Browse Source

created _m33 class member (moved out of Matrix4) and modified THREE.Matrix4.makeInvert3x3() call accordingly

astrodud 14 years ago
parent
commit
2319f227f3
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/renderers/WebGLRenderer.js

+ 3 - 1
src/renderers/WebGLRenderer.js

@@ -1166,6 +1166,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	this._m33 = new THREE.Matrix3();
+
 	this.setupMatrices = function ( object, camera ) {
 
 		object.autoUpdateMatrix && object.updateMatrix();
@@ -1173,7 +1175,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		_modelViewMatrix.multiply( camera.matrix, object.matrix );
 		_modelViewMatrixArray.set( _modelViewMatrix.flatten() );
 
-		_normalMatrix = THREE.Matrix4.makeInvert3x3( _modelViewMatrix ).transpose();
+		_normalMatrix = THREE.Matrix4.makeInvert3x3( _modelViewMatrix, this._m33 ).transpose();
 		_normalMatrixArray.set( _normalMatrix.m );
 
 		_objectMatrixArray.set( object.matrix.flatten() );