playcanvas
Version:
PlayCanvas WebGL game engine
41 lines (38 loc) • 1.22 kB
JavaScript
import { AnimCache } from './anim-cache.js';
/**
* @import { AnimTrack } from './anim-track.js'
*/ /**
* AnimSnapshot stores the state of an animation track at a particular time.
*
* @ignore
*/ class AnimSnapshot {
/**
* Create a new animation snapshot.
*
* @param {AnimTrack} animTrack - The source track.
*/ constructor(animTrack){
this._name = "" + animTrack.name + "Snapshot";
this._time = -1;
// per-curve input cache
this._cache = [];
// per-curve evaluation results
this._results = [];
// pre-allocate input caches
for(var i = 0; i < animTrack._inputs.length; ++i){
this._cache[i] = new AnimCache();
}
// pre-allocate storage for evaluation results
var curves = animTrack._curves;
var outputs = animTrack._outputs;
for(var i1 = 0; i1 < curves.length; ++i1){
var curve = curves[i1];
var output = outputs[curve._output];
var storage = [];
for(var j = 0; j < output._components; ++j){
storage[j] = 0;
}
this._results[i1] = storage;
}
}
}
export { AnimSnapshot };