浏览代码

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

Michael Herzog 2 年之前
父节点
当前提交
a3b3d826c7
共有 1 个文件被更改,包括 9 次插入0 次删除
  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 faceLength = 0;
+		let polygonSides = 0;
 		let displayedWeightsWarning = false;
 
 		// these will hold data for a single face
@@ -1814,6 +1815,14 @@ class GeometryParser {
 				vertexIndex = vertexIndex ^ - 1; // equivalent to ( x * -1 ) - 1
 				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 = [];