KeyFrame - Fish-In-A-Suit/Conquest GitHub Wiki
public class KeyFrame {
private final float timeStamp;
private final Map<String, JointTransform> pose;
public KeyFrame(float timeStamp, Map<String, JointTransform> jointKeyFrames) {
this.timeStamp = timeStamp;
this.pose = jointKeyFrames;
}
protected float getTimeStamp() {
return timeStamp;
}
protected Map<String, JointTransform> getJointKeyFrames() {
return pose;
}
}
This class represents one keyframe of an animation. This contains the timestamp of the keyframe (timeStamp), which is the time (in seconds) from the start of the animation when this keyframe occurs. It also contains the desired bone-space (in relation to parent joint) transforms of all of the joints in the animation (pose) (ie it contains all the joint transforms for the pose at this time of the animation). The joint transforms are stored in a map, indexed by the name of the joint that they should be applied to.
Note: In this code, all of the joints have keyframes at the same time (each KeyFrame has the JointTransform for every joint in the model). In more complex systems, you might need individual joints to have keyframes at different times to other joints. The Animation data structure would be in this case different. It would have an array of JointAnimations (one for each joint in the model), and each JointAnimation would have an array of KeyFrames for that particular joint only, which would allow different joints to have keyframes at different times during the animation: