|
|
|
@ -15,11 +15,6 @@ const renderer = new THREE.WebGLRenderer({antialias: true});
|
|
|
|
|
document.body.appendChild(renderer.domElement);
|
|
|
|
|
//renderer.setPixelRatio( window.devicePixelRatio );
|
|
|
|
|
|
|
|
|
|
function log(s) {
|
|
|
|
|
document.getElementById("text").innerHTML = s;
|
|
|
|
|
document.getElementById("popup").style.display = "block";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WindSimulation {
|
|
|
|
|
constructor(width, height, mills) {
|
|
|
|
|
this.width = width;
|
|
|
|
@ -38,8 +33,10 @@ class WindSimulation {
|
|
|
|
|
|
|
|
|
|
const loader = new STLLoader();
|
|
|
|
|
loader.load('assets/MonumentoBandera.stl', (geometry) => {
|
|
|
|
|
var material = new THREE.MeshBasicMaterial({color: 0xffffff});
|
|
|
|
|
var material = new THREE.MeshStandardMaterial({color: 0xffffff});
|
|
|
|
|
var mesh = new THREE.Mesh(geometry, material);
|
|
|
|
|
mesh.castShadow = true;
|
|
|
|
|
mesh.receiveShadow = true;
|
|
|
|
|
var scale = 0.0093;
|
|
|
|
|
mesh.scale.setScalar(scale);
|
|
|
|
|
mesh.rotation.z = -Math.PI / 2;
|
|
|
|
@ -179,6 +176,34 @@ var screen = new Screen(camera, renderer, new THREE.Vector3(width / 2 + 0.5, hei
|
|
|
|
|
screen.setMoveCallBack((pos, end) => { ws.move(pos, end); });
|
|
|
|
|
screen.onResize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*const light = new THREE.DirectionalLight("#FFFFFF");
|
|
|
|
|
light.position.set(5,5,100);
|
|
|
|
|
//scene.add(light);*/
|
|
|
|
|
const ambientLight = new THREE.AmbientLight("#999999", 0.6);
|
|
|
|
|
scene.add(ambientLight);
|
|
|
|
|
const light = new THREE.DirectionalLight( 0xfff8ee, 1 );
|
|
|
|
|
light.position.set(6, -10, 10); //default; light shining from top
|
|
|
|
|
//light.target.position.set(5, 5, 0);
|
|
|
|
|
light.castShadow = true; // default false
|
|
|
|
|
scene.add( light );
|
|
|
|
|
light.shadow.mapSize.width = 1024; // default 512
|
|
|
|
|
light.shadow.mapSize.height = 1024; // default 512
|
|
|
|
|
light.shadow.camera.near = 5;
|
|
|
|
|
light.shadow.camera.far = 25;
|
|
|
|
|
light.shadow.camera.right = 3.5 + 5;
|
|
|
|
|
light.shadow.camera.left = 3.5 - 5;
|
|
|
|
|
light.shadow.camera.top = 6 + 6;
|
|
|
|
|
light.shadow.camera.bottom = 6 - 6;
|
|
|
|
|
|
|
|
|
|
renderer.shadowMap.enabled = true;
|
|
|
|
|
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
|
|
|
|
window.light = light;
|
|
|
|
|
|
|
|
|
|
//const helper = new THREE.CameraHelper( light.shadow.camera );
|
|
|
|
|
//scene.add( helper);
|
|
|
|
|
//window.helper = helper;
|
|
|
|
|
|
|
|
|
|
window.ws = ws;
|
|
|
|
|
window.screen = screen;
|
|
|
|
|
window.scene = scene;
|
|
|
|
|