|
@@ -66,13 +66,13 @@
|
|
// controls
|
|
// controls
|
|
|
|
|
|
controls = new OrbitControls( camera, renderer.domElement );
|
|
controls = new OrbitControls( camera, renderer.domElement );
|
|
|
|
+ controls.addEventListener( 'change', render ); // use if there is no animation loop
|
|
controls.minDistance = 4;
|
|
controls.minDistance = 4;
|
|
controls.maxDistance = 20;
|
|
controls.maxDistance = 20;
|
|
- controls.update();
|
|
|
|
|
|
|
|
// light
|
|
// light
|
|
|
|
|
|
- var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
|
|
|
|
|
|
+ var directionalLight = new THREE.DirectionalLight( 0xffffff, 0 ); // set intensity to 0 to start
|
|
var x = 597;
|
|
var x = 597;
|
|
var y = 213;
|
|
var y = 213;
|
|
var theta = ( x + 0.5 ) * Math.PI / 512;
|
|
var theta = ( x + 0.5 ) * Math.PI / 512;
|
|
@@ -101,6 +101,8 @@
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
+ render();
|
|
|
|
+
|
|
} );
|
|
} );
|
|
|
|
|
|
document.body.addEventListener( 'mouseout', function () {
|
|
document.body.addEventListener( 'mouseout', function () {
|
|
@@ -116,6 +118,8 @@
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
+ render();
|
|
|
|
+
|
|
} );
|
|
} );
|
|
|
|
|
|
}
|
|
}
|
|
@@ -158,6 +162,8 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ render();
|
|
|
|
+
|
|
} );
|
|
} );
|
|
|
|
|
|
}
|
|
}
|
|
@@ -172,6 +178,8 @@
|
|
|
|
|
|
renderer.setSize( width, height );
|
|
renderer.setSize( width, height );
|
|
|
|
|
|
|
|
+ render();
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
function updateCamera() {
|
|
function updateCamera() {
|
|
@@ -183,12 +191,6 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- function animate() {
|
|
|
|
-
|
|
|
|
- renderer.setAnimationLoop( render );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
function render() {
|
|
function render() {
|
|
|
|
|
|
renderer.render( scene, camera );
|
|
renderer.render( scene, camera );
|
|
@@ -198,7 +200,7 @@
|
|
Promise.resolve()
|
|
Promise.resolve()
|
|
.then( init )
|
|
.then( init )
|
|
.then( createObjects )
|
|
.then( createObjects )
|
|
- .then( animate );
|
|
|
|
|
|
+ .then( render );
|
|
|
|
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|