1 #ifndef MSP_GL_ANIMATION_H_
2 #define MSP_GL_ANIMATION_H_
4 #include <msp/core/refptr.h>
5 #include <msp/datafile/objectloader.h>
6 #include <msp/time/timedelta.h>
15 An Animation is a sequence of KeyFrames combined with timing information. The
16 state at any point in the animation can be interpolated from the keyframes.
21 class Loader: public DataFile::CollectionObjectLoader<Animation>
24 Time::TimeDelta current_time;
28 Loader(Animation &, Collection &);
32 void keyframe(const std::string &);
33 void keyframe_inline();
38 struct AxisInterpolation
48 const TimedKeyFrame *prev;
50 Time::TimeDelta delta_t;
51 RefPtr<const KeyFrame> keyframe;
52 AxisInterpolation axes[3];
55 typedef std::list<TimedKeyFrame> KeyFrameList;
61 const Animation &animation;
62 KeyFrameList::const_iterator iter;
63 Time::TimeDelta time_since_keyframe;
67 Iterator(const Animation &);
69 Iterator &operator+=(const Time::TimeDelta &);
71 bool is_end() const { return end; }
72 Matrix get_matrix() const;
76 KeyFrameList keyframes;
82 void add_keyframe(const Time::TimeDelta &, const KeyFrame &);
83 void set_looping(bool);
85 void prepare_keyframe(TimedKeyFrame &);
87 Matrix compute_matrix(const TimedKeyFrame &, const Time::TimeDelta &) const;