Răsfoiți Sursa

Merge pull request #14715 from WestLangley/dev-cleanup_lookat

Examples: Avoid new when calling lookAt()
Mr.doob 7 ani în urmă
părinte
comite
efd712ac14

+ 1 - 1
docs/manual/introduction/Drawing-lines.html

@@ -23,7 +23,7 @@ document.body.appendChild( renderer.domElement );
 
 var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 500 );
 camera.position.set( 0, 0, 100 );
-camera.lookAt( new THREE.Vector3( 0, 0, 0 ) );
+camera.lookAt( 0, 0, 0 );
 
 var scene = new THREE.Scene();
 			</code>

+ 1 - 1
examples/canvas_interactive_voxelpainter.html

@@ -51,7 +51,7 @@
 
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.set( 500, 800, 1300 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0xf0f0f0 );

+ 1 - 1
examples/css3d_sprites.html

@@ -59,7 +59,7 @@
 
 				camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 5000 );
 				camera.position.set( 600, 400, 1500 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				scene = new THREE.Scene();
 

+ 1 - 1
examples/misc_animation_authoring.html

@@ -53,7 +53,7 @@
 
 				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.set( 1000, 500, 1000 );
-				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
+				camera.lookAt( 0, 200, 0 );
 
 				scene = new THREE.Scene();
 				scene.add( new THREE.GridHelper( 1000, 10 ) );

+ 1 - 1
examples/misc_controls_transform.html

@@ -51,7 +51,7 @@
 
 				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
 				camera.position.set( 1000, 500, 1000 );
-				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
+				camera.lookAt( 0, 200, 0 );
 
 				scene = new THREE.Scene();
 				scene.add( new THREE.GridHelper( 1000, 10 ) );

+ 1 - 1
examples/webgl_camera_array.html

@@ -42,7 +42,7 @@
 						subcamera.position.y = 0.5 - ( y / AMOUNT );
 						subcamera.position.z = 1.5;
 						subcamera.position.multiplyScalar( 2 );
-						subcamera.lookAt( new THREE.Vector3() );
+						subcamera.lookAt( 0, 0, 0 );
 						subcamera.updateMatrixWorld();
 						cameras.push( subcamera );
 

+ 1 - 1
examples/webgl_interactive_voxelpainter.html

@@ -59,7 +59,7 @@
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.set( 500, 800, 1300 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0xf0f0f0 );

+ 1 - 1
examples/webgl_lights_pointlights2.html

@@ -67,7 +67,7 @@
 
 				camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 300 );
 				camera.position.set( 0, 15, 150 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				// SCENE
 

+ 1 - 1
examples/webgl_loader_assimp.html

@@ -70,7 +70,7 @@
 			camera = new THREE.PerspectiveCamera( 25, window.innerWidth / window.innerHeight, 1, 10000 );
 			camera.position.set( 600, 1150, 5 );
 			camera.up.set( 0, 0, 1 );
-			camera.lookAt( new THREE.Vector3( -100, 0, 0 ) );
+			camera.lookAt( - 100, 0, 0 );
 
 			scene = new THREE.Scene();
 

+ 1 - 1
examples/webgl_loader_collada.html

@@ -58,7 +58,7 @@
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 2000 );
 				camera.position.set( 8, 10, 8 );
-				camera.lookAt( new THREE.Vector3( 0, 3, 0 ) );
+				camera.lookAt( 0, 3, 0 );
 
 				scene = new THREE.Scene();
 

+ 1 - 1
examples/webgl_loader_collada_kinematics.html

@@ -212,7 +212,7 @@
 				camera.position.y = 10;
 				camera.position.z = Math.sin( timer ) * 20;
 
-				camera.lookAt( new THREE.Vector3( 0, 5, 0 ) );
+				camera.lookAt( 0, 5, 0 );
 
 				particleLight.position.x = Math.sin( timer * 4 ) * 3009;
 				particleLight.position.y = Math.cos( timer * 5 ) * 4000;

+ 1 - 1
examples/webgl_loader_draco.html

@@ -130,7 +130,7 @@
 
 			camera.position.x = Math.sin( timer ) * 0.5;
 			camera.position.z = Math.cos( timer ) * 0.5;
-			camera.lookAt( new THREE.Vector3( 0, 0.1, 0 ) );
+			camera.lookAt( 0, 0.1, 0 );
 
 			renderer.render( scene, camera );
 

+ 1 - 1
examples/webgl_loader_imagebitmap.html

@@ -103,7 +103,7 @@
 
 				camera = new THREE.PerspectiveCamera( 30, window.innerWidth / window.innerHeight, 1, 1500 );
 				camera.position.set( 0, 4, 7 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				// SCENE
 

+ 1 - 1
examples/webgl_loader_sea3d.html

@@ -110,7 +110,7 @@
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.set( 1000, 1000, 1000 );
-				camera.lookAt( new THREE.Vector3() );
+				camera.lookAt( 0, 0, 0 );
 
 				controls = new THREE.OrbitControls( camera );
 

+ 1 - 1
examples/webgl_physics_terrain.html

@@ -124,7 +124,7 @@
 						camera.position.y = heightData[ terrainHalfWidth + terrainHalfDepth * terrainWidth ] * ( terrainMaxHeight - terrainMinHeight ) + 5;
 
 						camera.position.z = terrainDepthExtents / 2;
-						camera.lookAt( new THREE.Vector3( 0, 0, 0 ) );
+						camera.lookAt( 0, 0, 0 );
 
 						controls = new THREE.OrbitControls( camera );
 

+ 1 - 1
examples/webgl_postprocessing_unreal_bloom.html

@@ -93,7 +93,7 @@
 
 			camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 100 );
 			camera.position.set( - 5, 2.5, -3.5 );
-			camera.lookAt( new THREE.Vector3( 0, 0, 0 ) );
+			camera.lookAt( 0, 0, 0 );
 
 			controls = new THREE.OrbitControls( camera, renderer.domElement );
 			controls.maxPolarAngle = Math.PI * 0.5;

+ 1 - 1
examples/webgl_shaders_ocean2.html

@@ -80,7 +80,7 @@
 
 					this.ms_Camera = new THREE.PerspectiveCamera(55.0, window.innerWidth / window.innerHeight, 0.5, 300000);
 					this.ms_Camera.position.set(450, 350, 450);
-					this.ms_Camera.lookAt(new THREE.Vector3());
+					this.ms_Camera.lookAt( 0, 0, 0 );
 
 					// Initialize Orbit control
 					this.ms_Controls = new THREE.OrbitControls(this.ms_Camera, this.ms_Renderer.domElement);