提交 8da58ca3 编写于 作者: B Ben Houston

get rid of another map used in a tight inner loop.

上级 a3352477
......@@ -17,6 +17,8 @@ THREE.AnimationAction = function ( clip, startTime, timeScale, weight, loop ) {
this.enabled = true; // allow for easy disabling of the action.
this.clipTime = 0;
this.propertyBindingIndices = [];
};
THREE.AnimationAction.prototype = {
......
......@@ -48,6 +48,32 @@ THREE.AnimationMixer.prototype = {
}
this.updatePropertyBindingIndices();
},
updatePropertyBindingIndices: function() {
for( var i = 0; i < this.actions.length; i++ ) {
var action = this.actions[i];
var propertyBindingIndices = [];
for( var j = 0; j < action.clip.tracks.length; j ++ ) {
var trackName = action.clip.tracks[j].name;
for( var k = 0; k < this.propertyBindingsArray.length; k ++ ) {
if( this.propertyBindingsArray[k].trackName === trackName ) {
propertyBindingIndices.push( k );
break;
}
}
}
action.propertyBindingIndices = propertyBindingIndices;
}
},
removeAllActions: function() {
......@@ -102,6 +128,8 @@ THREE.AnimationMixer.prototype = {
}
}
this.updatePropertyBindingIndices();
},
play: function( action, optionalFadeInDuration ) {
......@@ -182,7 +210,7 @@ THREE.AnimationMixer.prototype = {
var name = action.clip.tracks[j].name;
this.propertyBindings[name].accumulate( actionResults[j], weight );
this.propertyBindingsArray[ action.propertyBindingIndices[ j ] ].accumulate( actionResults[j], weight );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册