Browse Source

Changed console error to return null and updated WebGLRenderer to handle null value. A valid matrix with no rotation and 0 scale will have a 0 determinant and does not need a normal matrix.

Work By: Erik Kitson
John Pywtorak 13 years ago
parent
commit
1db29f1893
2 changed files with 8 additions and 2 deletions
  1. 1 1
      src/core/Matrix4.js
  2. 7 1
      src/renderers/WebGLRenderer.js

+ 1 - 1
src/core/Matrix4.js

@@ -794,7 +794,7 @@ THREE.Matrix4.makeInvert3x3 = function ( m1 ) {
 
 
 	if ( det === 0 ) {
 	if ( det === 0 ) {
 
 
-		console.error( 'THREE.Matrix4.makeInvert3x3: Matrix not invertible.' );
+		return null;
 
 
 	}
 	}
 
 

+ 7 - 1
src/renderers/WebGLRenderer.js

@@ -4815,7 +4815,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		if ( computeNormalMatrix ) {
 		if ( computeNormalMatrix ) {
 
 
-			THREE.Matrix4.makeInvert3x3( object._modelViewMatrix ).transposeIntoArray( object._normalMatrixArray );
+			var inv = THREE.Matrix4.makeInvert3x3( object._modelViewMatrix );
+
+			if ( inv ) {
+
+				inv.transposeIntoArray( object._normalMatrixArray );
+
+			}
 
 
 		}
 		}