Browse Source

GLTFExporter: Use BufferGeometry.setIndex()

Takahiro 7 years ago
parent
commit
2d1a89771e
1 changed files with 4 additions and 4 deletions
  1. 4 4
      examples/js/exporters/GLTFExporter.js

+ 4 - 4
examples/js/exporters/GLTFExporter.js

@@ -1019,15 +1019,15 @@ THREE.GLTFExporter.prototype = {
 
 			if ( geometry.index === null && forceIndices ) {
 
-				var indices = new Uint32Array( geometry.attributes.position.count );
+				var indices = [];
 
-				for ( var i = 0, il = indices.length; i < il; i ++ ) {
+				for ( var i = 0, il = geometry.attributes.position.count; i < il; i ++ ) {
 
 					indices[ i ] = i;
 
 				}
 
-				geometry.index = new THREE.Uint32BufferAttribute( indices, 1 );
+				geometry.setIndex( indices );
 
 				didForceIndices = true;
 
@@ -1065,7 +1065,7 @@ THREE.GLTFExporter.prototype = {
 
 			if ( didForceIndices ) {
 
-				geometry.index = null;
+				geometry.setIndex( null );
 
 			}