1 #ifndef MSP_GL_ANIMATIONPLAYER_H_
2 #define MSP_GL_ANIMATIONPLAYER_H_
4 #include <msp/time/timedelta.h>
13 The bridge between Animations and AnimatedObjects. A single AnimationPlayer
14 can handle an arbitrary number of animations simultaneously.
21 const Animation &animation;
22 Animation::Iterator iterator;
24 AnimationSlot(const Animation &);
27 typedef std::list<AnimationSlot> AnimationList;
31 AnimatedObject &object;
33 const Armature *armature;
34 AnimationList animations;
37 ObjectSlot(AnimatedObject &);
40 typedef std::map<AnimatedObject *, ObjectSlot> ObjectMap;
45 ObjectSlot &get_slot(AnimatedObject &);
48 /// Plays an animation on an object. Any previous animations are replaced.
49 void play(AnimatedObject &, const Animation &);
51 /** Plays an animation, stacked with other animations. If no animations are
52 playing yet, the object's current matrix is used as the base. */
53 void play_stacked(AnimatedObject &, const Animation &);
55 /// Stops any animations affecting an object.
56 void stop(AnimatedObject &);
58 /** Advances all playing animations. Should be called in a regular manner,
59 preferably just before rendering. */
60 void tick(const Time::TimeDelta &);
63 bool tick_single(ObjectSlot &, const Time::TimeDelta &);
64 bool tick_stacked(ObjectSlot &, const Time::TimeDelta &);