Skip to content

Commit

Permalink
Model.update optimization. Dropped 1% from Washington DC profile sinc…
Browse files Browse the repository at this point in the history
…e it no longer sets the array length to zero
  • Loading branch information
pjcozzi committed Jul 1, 2015
1 parent 7636cbd commit 6a29eba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Scene/ModelAnimationCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,15 @@ define([
* @private
*/
ModelAnimationCollection.prototype.update = function(frameState) {
var scheduledAnimations = this._scheduledAnimations;
var length = scheduledAnimations.length;

if (length === 0) {
// No animations - quick return for performance
this._previousTime = undefined;
return false;
}

if (JulianDate.equals(frameState.time, this._previousTime)) {
// Animations are currently only time-dependent so do not animate when paused or picking
return false;
Expand All @@ -338,10 +347,7 @@ define([

var animationOccured = false;
var sceneTime = frameState.time;

var model = this._model;
var scheduledAnimations = this._scheduledAnimations;
var length = scheduledAnimations.length;

for (var i = 0; i < length; ++i) {
var scheduledAnimation = scheduledAnimations[i];
Expand Down

0 comments on commit 6a29eba

Please sign in to comment.