|
@@ -34,10 +34,10 @@ function KeyframeTrack( name, times, values, interpolation ) {
|
|
this.times = AnimationUtils.convertArray( times, this.TimeBufferType );
|
|
this.times = AnimationUtils.convertArray( times, this.TimeBufferType );
|
|
this.values = AnimationUtils.convertArray( values, this.ValueBufferType );
|
|
this.values = AnimationUtils.convertArray( values, this.ValueBufferType );
|
|
|
|
|
|
- this.setInterpolation( interpolation || this.DefaultInterpolation );
|
|
|
|
|
|
+ this.isValidated = false;
|
|
|
|
+ this.isOptimized = false;
|
|
|
|
|
|
- this.validate();
|
|
|
|
- this.optimize();
|
|
|
|
|
|
+ this.setInterpolation( interpolation || this.DefaultInterpolation );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -353,6 +353,8 @@ Object.assign( KeyframeTrack.prototype, {
|
|
// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
|
|
// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
|
|
validate: function () {
|
|
validate: function () {
|
|
|
|
|
|
|
|
+ if ( this.isValidated ) return true;
|
|
|
|
+
|
|
var valid = true;
|
|
var valid = true;
|
|
|
|
|
|
var valueSize = this.getValueSize();
|
|
var valueSize = this.getValueSize();
|
|
@@ -423,6 +425,8 @@ Object.assign( KeyframeTrack.prototype, {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this.isValidated = valid;
|
|
|
|
+
|
|
return valid;
|
|
return valid;
|
|
|
|
|
|
},
|
|
},
|
|
@@ -431,6 +435,8 @@ Object.assign( KeyframeTrack.prototype, {
|
|
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
|
|
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
|
|
optimize: function () {
|
|
optimize: function () {
|
|
|
|
|
|
|
|
+ if ( this.isOptimized ) return this;
|
|
|
|
+
|
|
var times = this.times,
|
|
var times = this.times,
|
|
values = this.values,
|
|
values = this.values,
|
|
stride = this.getValueSize(),
|
|
stride = this.getValueSize(),
|
|
@@ -529,6 +535,8 @@ Object.assign( KeyframeTrack.prototype, {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this.isOptimized = true;
|
|
|
|
+
|
|
return this;
|
|
return this;
|
|
|
|
|
|
}
|
|
}
|