瀏覽代碼

GLTFExporter: Use BufferGeometry.setIndex()

Takahiro 7 年之前
父節點
當前提交
2d1a89771e
共有 1 個文件被更改,包括 4 次插入4 次删除
  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 );
 
 			}