Selaa lähdekoodia

FBXLoader: Handle invalid material indices. (#24436)

Michael Herzog 3 vuotta sitten
vanhempi
commit
88c240dcda
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      examples/jsm/loaders/FBXLoader.js

+ 7 - 0
examples/jsm/loaders/FBXLoader.js

@@ -1897,6 +1897,13 @@ class GeometryParser {
 
 				materialIndex = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material )[ 0 ];
 
+				if ( materialIndex < 0 ) {
+
+					console.warn( 'THREE.FBXLoader: Invalid material index:', materialIndex );
+					materialIndex = 0;
+
+				}
+
 			}
 
 			if ( geoInfo.uv ) {