Browse Source

removed "position = _vector3" pattern per @WestLangley

Ben Houston 12 years ago
parent
commit
c589751dac
2 changed files with 20 additions and 25 deletions
  1. 9 11
      src/renderers/WebGLRenderer.js
  2. 11 14
      src/renderers/WebGLRenderer2.js

+ 9 - 11
src/renderers/WebGLRenderer.js

@@ -6035,12 +6035,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				position = _vector3;
-				position.getPositionFromMatrix( light.matrixWorld );
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
 
-				pointPositions[ pointOffset ]     = position.x;
-				pointPositions[ pointOffset + 1 ] = position.y;
-				pointPositions[ pointOffset + 2 ] = position.z;
+				pointPositions[ pointOffset ]     = _vector3.x;
+				pointPositions[ pointOffset + 1 ] = _vector3.y;
+				pointPositions[ pointOffset + 2 ] = _vector3.z;
 
 
 				pointDistances[ pointLength ] = distance;
 				pointDistances[ pointLength ] = distance;
 
 
@@ -6064,16 +6063,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				position = _vector3;
-				position.getPositionFromMatrix( light.matrixWorld );
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
 
-				spotPositions[ spotOffset ]     = position.x;
-				spotPositions[ spotOffset + 1 ] = position.y;
-				spotPositions[ spotOffset + 2 ] = position.z;
+				spotPositions[ spotOffset ]     = _vector3.x;
+				spotPositions[ spotOffset + 1 ] = _vector3.y;
+				spotPositions[ spotOffset + 2 ] = _vector3.z;
 
 
 				spotDistances[ spotLength ] = distance;
 				spotDistances[ spotLength ] = distance;
 
 
-				_direction.copy( position );
+				_direction.copy( _vector3 );
 				_vector3.getPositionFromMatrix( light.target.matrixWorld );
 				_vector3.getPositionFromMatrix( light.target.matrixWorld );
 				_direction.sub( _vector3 );
 				_direction.sub( _vector3 );
 				_direction.normalize();
 				_direction.normalize();

+ 11 - 14
src/renderers/WebGLRenderer2.js

@@ -2507,9 +2507,8 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
 
 
 				if ( p_uniforms.cameraPosition !== null ) {
 				if ( p_uniforms.cameraPosition !== null ) {
 
 
-					var position = _vector3;
-					position.getPositionFromMatrix( camera.matrixWorld );
-					renderer.uniform3f( p_uniforms.cameraPosition, position.x, position.y, position.z );
+					_vector3.getPositionFromMatrix( camera.matrixWorld );
+					renderer.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z );
 
 
 				}
 				}
 
 
@@ -3156,12 +3155,11 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
 
 
 				}
 				}
 
 
-				position = _vector3;
-				position.getPositionFromMatrix( light.matrixWorld );
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
 
-				pointPositions[ pointOffset ]     = position.x;
-				pointPositions[ pointOffset + 1 ] = position.y;
-				pointPositions[ pointOffset + 2 ] = position.z;
+				pointPositions[ pointOffset ]     = _vector3.x;
+				pointPositions[ pointOffset + 1 ] = _vector3.y;
+				pointPositions[ pointOffset + 2 ] = _vector3.z;
 
 
 				pointDistances[ pointLength ] = distance;
 				pointDistances[ pointLength ] = distance;
 
 
@@ -3185,16 +3183,15 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
 
 
 				}
 				}
 
 
-				position = _vector3;
-				position.getPositionFromMatrix( light.matrixWorld );
+				_vector3.getPositionFromMatrix( light.matrixWorld );
 
 
-				spotPositions[ spotOffset ]     = position.x;
-				spotPositions[ spotOffset + 1 ] = position.y;
-				spotPositions[ spotOffset + 2 ] = position.z;
+				spotPositions[ spotOffset ]     = _vector3.x;
+				spotPositions[ spotOffset + 1 ] = _vector3.y;
+				spotPositions[ spotOffset + 2 ] = _vector3.z;
 
 
 				spotDistances[ spotLength ] = distance;
 				spotDistances[ spotLength ] = distance;
 
 
-				_direction.copy( position );
+				_direction.copy( _vector3 );
 				_vector3.getPositionFromMatrix( light.target.matrixWorld );
 				_vector3.getPositionFromMatrix( light.target.matrixWorld );
 				_direction.sub( _vector3 );
 				_direction.sub( _vector3 );
 				_direction.normalize();
 				_direction.normalize();