未验证 提交 efd712ac 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #14715 from WestLangley/dev-cleanup_lookat

Examples: Avoid new when calling lookAt()
......@@ -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>
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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 ) );
......
......@@ -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 ) );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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
......
......@@ -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();
......
......@@ -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();
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册