未验证 提交 c96f86ca 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #14286 from Mugen87/dev1

GLTFExporter: Fix multi material export
......@@ -566,8 +566,8 @@ THREE.GLTFExporter.prototype = {
var end = start + count;
var end2 = geometry.drawRange.count === Infinity
? attribute.count
: geometry.drawRange.start + geometry.drawRange.count;
? attribute.count
: geometry.drawRange.start + geometry.drawRange.count;
start = Math.max( start, geometry.drawRange.start );
count = Math.min( end, end2 ) - start;
......@@ -770,7 +770,7 @@ THREE.GLTFExporter.prototype = {
var gltfTexture = {
sampler: processSampler( map ),
source: processImage( map.image, map.format, map.flipY )
source: processImage( map.image, map.format, map.flipY )
};
......@@ -1206,7 +1206,7 @@ THREE.GLTFExporter.prototype = {
var forceIndices = options.forceIndices;
var isMultiMaterial = Array.isArray( mesh.material );
if ( isMultiMaterial && mesh.geometry.groups.length === 0 ) return null;
if ( isMultiMaterial && geometry.groups.length === 0 ) return null;
if ( ! forceIndices && geometry.index === null && isMultiMaterial ) {
......@@ -1235,7 +1235,7 @@ THREE.GLTFExporter.prototype = {
}
var materials = isMultiMaterial ? mesh.material : [ mesh.material ];
var groups = isMultiMaterial ? mesh.geometry.groups : [ { materialIndex: 0, start: undefined, count: undefined } ];
var groups = isMultiMaterial ? geometry.groups : [ { materialIndex: 0, start: undefined, count: undefined } ];
for ( var i = 0, il = groups.length; i < il; i ++ ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册