1 #ifndef MSP_GL_ANIMATIONPLAYER_H_
2 #define MSP_GL_ANIMATIONPLAYER_H_
4 #include <msp/time/timedelta.h>
14 The bridge between Animations and AnimatedObjects. A single AnimationPlayer
15 can handle an arbitrary number of animations simultaneously.
22 const Animation &animation;
23 Animation::Iterator iterator;
25 AnimationSlot(const Animation &);
28 typedef std::list<AnimationSlot> AnimationList;
32 AnimatedObject &object;
34 const Armature *armature;
35 AnimationList animations;
38 ObjectSlot(AnimatedObject &);
41 typedef std::map<const AnimatedObject *, ObjectSlot> ObjectMap;
46 ObjectSlot &get_slot(AnimatedObject &);
49 /// Plays an animation on an object. Any previous animations are replaced.
50 void play(AnimatedObject &, const Animation &);
52 /** Plays an animation, stacked with other animations. If no animations are
53 playing yet, the object's current matrix is used as the base. */
54 void play_stacked(AnimatedObject &, const Animation &);
56 /// Returns the number of animations currently affecting an object.
57 unsigned get_n_active_animations(const AnimatedObject &) const;
59 /// Stops all animations affecting an object.
60 void stop(AnimatedObject &);
62 /// Stops a single animation affecting an object.
63 void stop(AnimatedObject &, const Animation &);
65 /** Advances all playing animations. Should be called in a regular manner,
66 preferably just before rendering. */
67 void tick(const Time::TimeDelta &);
70 bool tick_single(ObjectSlot &, const Time::TimeDelta &);
71 bool tick_stacked(ObjectSlot &, const Time::TimeDelta &);