Browse Source

FBXLoader: Add warning about unsupported polygons. (#25030)

Michael Herzog 2 years ago
parent
commit
a3b3d826c7
1 changed files with 9 additions and 0 deletions
  1. 9 0
      examples/jsm/loaders/FBXLoader.js

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

@@ -1786,6 +1786,7 @@ class GeometryParser {
 
 
 		let polygonIndex = 0;
 		let polygonIndex = 0;
 		let faceLength = 0;
 		let faceLength = 0;
+		let polygonSides = 0;
 		let displayedWeightsWarning = false;
 		let displayedWeightsWarning = false;
 
 
 		// these will hold data for a single face
 		// these will hold data for a single face
@@ -1814,6 +1815,14 @@ class GeometryParser {
 				vertexIndex = vertexIndex ^ - 1; // equivalent to ( x * -1 ) - 1
 				vertexIndex = vertexIndex ^ - 1; // equivalent to ( x * -1 ) - 1
 				endOfFace = true;
 				endOfFace = true;
 
 
+				if ( polygonSides > 3 ) console.warn( 'THREE.FBXLoader: Polygons with more than three sides are not supported. Make sure to triangulate the geometry during export.' );
+
+				polygonSides = 0;
+
+			} else {
+
+				polygonSides ++;
+
 			}
 			}
 
 
 			let weightIndices = [];
 			let weightIndices = [];