瀏覽代碼

prevent NaN values in .normalizeNormals

Mugen87 9 年之前
父節點
當前提交
8d5203fd2f
共有 1 個文件被更改,包括 7 次插入3 次删除
  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;
+
+			}
 
 		}