Răsfoiți Sursa

Fix OBJLoader not generating normals when the file does not describe any.

Garrett Johnson 4 ani în urmă
părinte
comite
3bf981803a
2 a modificat fișierele cu 2 adăugiri și 16 ștergeri
  1. 1 8
      examples/js/loaders/OBJLoader.js
  2. 1 8
      examples/jsm/loaders/OBJLoader.js

+ 1 - 8
examples/js/loaders/OBJLoader.js

@@ -61,7 +61,6 @@ THREE.OBJLoader = ( function () {
 						normals: [],
 						colors: [],
 						uvs: [],
-						hasNormalIndices: false,
 						hasUVIndices: false
 					},
 					materials: [],
@@ -340,8 +339,6 @@ THREE.OBJLoader = ( function () {
 
 					this.addNormal( ia, ib, ic );
 
-					this.object.geometry.hasNormalIndices = true;
-
 				} else {
 
 					this.addFaceNormal( ia, ib, ic );
@@ -729,11 +726,7 @@ THREE.OBJLoader = ( function () {
 
 				buffergeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( geometry.vertices, 3 ) );
 
-				if ( geometry.hasNormalIndices === true ) {
-
-					buffergeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
-
-				}
+				buffergeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
 
 				if ( geometry.colors.length > 0 ) {
 

+ 1 - 8
examples/jsm/loaders/OBJLoader.js

@@ -75,7 +75,6 @@ var OBJLoader = ( function () {
 						normals: [],
 						colors: [],
 						uvs: [],
-						hasNormalIndices: false,
 						hasUVIndices: false
 					},
 					materials: [],
@@ -354,8 +353,6 @@ var OBJLoader = ( function () {
 
 					this.addNormal( ia, ib, ic );
 
-					this.object.geometry.hasNormalIndices = true;
-
 				} else {
 
 					this.addFaceNormal( ia, ib, ic );
@@ -743,11 +740,7 @@ var OBJLoader = ( function () {
 
 				buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) );
 
-				if ( geometry.hasNormalIndices === true ) {
-
-					buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
-
-				}
+				buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
 
 				if ( geometry.colors.length > 0 ) {