提交 4392cf14 编写于 作者: F Fernando Serrano 提交者: Mr.doob

GLTFExporter: Add forceIndices

上级 e5367bef
......@@ -68,7 +68,8 @@ THREE.GLTFExporter.prototype = {
onlyVisible: true,
truncateDrawRange: true,
embedImages: true,
animations: []
animations: [],
forceIndices: false
};
options = Object.assign( {}, DEFAULT_OPTIONS, options );
......@@ -809,6 +810,18 @@ THREE.GLTFExporter.prototype = {
gltfMesh.primitives[ 0 ].indices = processAccessor( geometry.index, geometry );
} else if ( options.forceIndices ) {
var numFaces = geometry.attributes.position.count;
var indices = new Uint32Array( numFaces );
for ( var i = 0; i < numFaces; i ++ ) {
indices[ i ] = i;
}
gltfMesh.primitives[ 0 ].indices = processAccessor( new THREE.Uint32BufferAttribute( indices, 1 ), geometry );
}
// We've just one primitive per mesh
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册