|
@@ -40,12 +40,8 @@
|
|
|
|
|
|
var count = 0, cubeCamera1, cubeCamera2;
|
|
|
|
|
|
- var fov = 60,
|
|
|
- isUserInteracting = false,
|
|
|
- onMouseDownMouseX = 0, onMouseDownMouseY = 0,
|
|
|
- lon = 0, onMouseDownLon = 0,
|
|
|
- lat = 0, onMouseDownLat = 0,
|
|
|
- phi = 0, theta = 0;
|
|
|
+ var lon = 0, lat = 0;
|
|
|
+ var phi = 0, theta = 0;
|
|
|
|
|
|
var textureLoader = new THREE.TextureLoader();
|
|
|
|
|
@@ -60,11 +56,11 @@
|
|
|
|
|
|
function init( texture ) {
|
|
|
|
|
|
- camera = new THREE.PerspectiveCamera( fov, window.innerWidth / window.innerHeight, 1, 1000 );
|
|
|
+ camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
|
|
|
|
|
|
scene = new THREE.Scene();
|
|
|
|
|
|
- var mesh = new THREE.Mesh( new THREE.SphereGeometry( 500, 32, 16 ), new THREE.MeshBasicMaterial( { map: texture } ) );
|
|
|
+ var mesh = new THREE.Mesh( new THREE.SphereBufferGeometry( 500, 32, 16 ), new THREE.MeshBasicMaterial( { map: texture } ) );
|
|
|
mesh.scale.x = -1;
|
|
|
scene.add( mesh );
|
|
|
|
|
@@ -88,13 +84,13 @@
|
|
|
envMap: cubeCamera2.renderTarget.texture
|
|
|
} );
|
|
|
|
|
|
- sphere = new THREE.Mesh( new THREE.IcosahedronGeometry( 20, 3 ), material );
|
|
|
+ sphere = new THREE.Mesh( new THREE.IcosahedronBufferGeometry( 20, 3 ), material );
|
|
|
scene.add( sphere );
|
|
|
|
|
|
- cube = new THREE.Mesh( new THREE.BoxGeometry( 20, 20, 20 ), material );
|
|
|
+ cube = new THREE.Mesh( new THREE.BoxBufferGeometry( 20, 20, 20 ), material );
|
|
|
scene.add( cube );
|
|
|
|
|
|
- torus = new THREE.Mesh( new THREE.TorusKnotGeometry( 10, 5, 100, 25 ), material );
|
|
|
+ torus = new THREE.Mesh( new THREE.TorusKnotBufferGeometry( 10, 5, 100, 25 ), material );
|
|
|
scene.add( torus );
|
|
|
|
|
|
//
|
|
@@ -104,14 +100,15 @@
|
|
|
|
|
|
window.addEventListener( 'resize', onWindowResized, false );
|
|
|
|
|
|
- onWindowResized( null );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function onWindowResized( event ) {
|
|
|
|
|
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
|
|
- camera.projectionMatrix.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
|
|
|
+
|
|
|
+ camera.aspect = window.innerWidth / window.innerHeight;
|
|
|
+ camera.updateProjectionMatrix();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function onDocumentMouseDown( event ) {
|
|
@@ -145,9 +142,8 @@
|
|
|
|
|
|
function onDocumentMouseWheel( event ) {
|
|
|
|
|
|
- fov += event.deltaY * 0.05;
|
|
|
-
|
|
|
- camera.projectionMatrix.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
|
|
|
+ camera.fov += ( event.deltaY * 0.05 );
|
|
|
+ camera.updateProjectionMatrix();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -188,7 +184,7 @@
|
|
|
|
|
|
camera.lookAt( scene.position );
|
|
|
|
|
|
- sphere.visible = false; // *cough*
|
|
|
+ sphere.visible = false;
|
|
|
|
|
|
// pingpong
|
|
|
|
|
@@ -206,7 +202,7 @@
|
|
|
|
|
|
count ++;
|
|
|
|
|
|
- sphere.visible = true; // *cough*
|
|
|
+ sphere.visible = true;
|
|
|
|
|
|
renderer.render( scene, camera );
|
|
|
|