Pārlūkot izejas kodu

FBXLoader: Handle invalid material indices. (#24436)

Michael Herzog 3 gadi atpakaļ
vecāks
revīzija
88c240dcda
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  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 ];
 				materialIndex = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material )[ 0 ];
 
 
+				if ( materialIndex < 0 ) {
+
+					console.warn( 'THREE.FBXLoader: Invalid material index:', materialIndex );
+					materialIndex = 0;
+
+				}
+
 			}
 			}
 
 
 			if ( geoInfo.uv ) {
 			if ( geoInfo.uv ) {