Răsfoiți Sursa

prevent NaN values in .normalizeNormals

Mugen87 9 ani în urmă
părinte
comite
8d5203fd2f
1 a modificat fișierele cu 7 adăugiri și 3 ștergeri
  1. 7 3
      src/core/BufferGeometry.js

+ 7 - 3
src/core/BufferGeometry.js

@@ -818,9 +818,13 @@ THREE.BufferGeometry.prototype = {
 
 			n = 1.0 / Math.sqrt( x * x + y * y + z * z );
 
-			normals[ i ] *= n;
-			normals[ i + 1 ] *= n;
-			normals[ i + 2 ] *= n;
+			if( isFinite( n ) ) {
+
+				normals[ i ] *= n;
+				normals[ i + 1 ] *= n;
+				normals[ i + 2 ] *= n;
+
+			}
 
 		}