Explorar el Código

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

astrodud hace 14 años
padre
commit
2319f227f3
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  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() );