Browse Source

GLTFExporter: Add workaround for no-index geometry with multi-material

Takahiro 7 years ago
parent
commit
fe70963ad0
1 changed files with 11 additions and 1 deletions
  1. 11 1
      examples/js/exporters/GLTFExporter.js

+ 11 - 1
examples/js/exporters/GLTFExporter.js

@@ -1004,9 +1004,19 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
+			var forceIndices = options.forceIndices;
+
+			if ( ! forceIndices && Array.isArray( mesh.material ) ) {
+
+				// temporal workaround.
+				console.warn( 'THREE.GLTFExporter: Force index for a mesh with multi-material.', mesh );
+				forceIndices = true;
+
+			}
+
 			var forcedIndex = false;
 
-			if ( geometry.index === null && options.forceIndices ) {
+			if ( geometry.index === null && forceIndices ) {
 
 				var indices = new Uint32Array( geometry.attributes.position.count );