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

Merge pull request #13562 from takahirox/GLTFExporterNodeMap

GLTFExporter: Use Map for nodeMap.
......@@ -98,7 +98,7 @@ THREE.GLTFExporter.prototype = {
var byteOffset = 0;
var buffers = [];
var pending = [];
var nodeMap = {};
var nodeMap = new Map();
var skins = [];
var extensionsUsed = {};
var cachedData = {
......@@ -1245,7 +1245,7 @@ THREE.GLTFExporter.prototype = {
sampler: samplers.length - 1,
target: {
node: nodeMap[ trackNode.uuid ],
node: nodeMap.get( trackNode ),
path: trackProperty
}
......@@ -1267,7 +1267,7 @@ THREE.GLTFExporter.prototype = {
function processSkin( object ) {
var node = outputJSON.nodes[ nodeMap[ object.uuid ] ];
var node = outputJSON.nodes[ nodeMap.get( object ) ];
var skeleton = object.skeleton;
var rootJoint = object.skeleton.bones[ 0 ];
......@@ -1279,7 +1279,7 @@ THREE.GLTFExporter.prototype = {
for ( var i = 0; i < skeleton.bones.length; ++ i ) {
joints.push( nodeMap[ skeleton.bones[ i ].uuid ] );
joints.push( nodeMap.get( skeleton.bones[ i ] ) );
skeleton.boneInverses[ i ].toArray( inverseBindMatrices, i * 16 );
......@@ -1295,7 +1295,7 @@ THREE.GLTFExporter.prototype = {
inverseBindMatrices: processAccessor( new THREE.BufferAttribute( inverseBindMatrices, 16 ) ),
joints: joints,
skeleton: nodeMap[ rootJoint.uuid ]
skeleton: nodeMap.get( rootJoint )
} );
......@@ -1432,7 +1432,8 @@ THREE.GLTFExporter.prototype = {
outputJSON.nodes.push( gltfNode );
var nodeIndex = nodeMap[ object.uuid ] = outputJSON.nodes.length - 1;
var nodeIndex = outputJSON.nodes.length - 1;
nodeMap.set( object, nodeIndex );
return nodeIndex;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册