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

Merge pull request #14111 from takahirox/GLTFLoaderLessMeshClone

GLTFLoader: No mesh clone if it is referenced only once
......@@ -2903,36 +2903,26 @@ THREE.GLTFLoader = ( function () {
var mesh = dependencies.meshes[ nodeDef.mesh ];
node = mesh.clone();
// for Specular-Glossiness
if ( mesh.isGroup === true ) {
if ( meshReferences[ nodeDef.mesh ] > 1 ) {
for ( var i = 0, il = mesh.children.length; i < il; i ++ ) {
var instanceNum = meshUses[ nodeDef.mesh ] ++;
var child = mesh.children[ i ];
node = mesh.clone();
node.name += '_instance_' + instanceNum;
if ( child.material && child.material.isGLTFSpecularGlossinessMaterial === true ) {
// onBeforeRender copy for Specular-Glossiness
node.onBeforeRender = mesh.onBeforeRender;
node.children[ i ].onBeforeRender = child.onBeforeRender;
for ( var i = 0, il = node.children.length; i < il; i ++ ) {
}
node.children[ i ].name += '_instance_' + instanceNum;
node.children[ i ].onBeforeRender = mesh.children[ i ].onBeforeRender;
}
} else {
if ( mesh.material && mesh.material.isGLTFSpecularGlossinessMaterial === true ) {
node.onBeforeRender = mesh.onBeforeRender;
}
}
if ( meshReferences[ nodeDef.mesh ] > 1 ) {
node.name += '_instance_' + meshUses[ nodeDef.mesh ] ++;
node = mesh;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册