+++ /dev/null
-#include "animatedobject.h"
-#include "animationplayer.h"
-#include "armature.h"
-
-using namespace std;
-
-namespace Msp {
-namespace GL {
-
-void AnimationPlayer::play(AnimatedObject &obj, const Animation &anim)
-{
- slots.push_back(Slot(obj, anim));
-}
-
-void AnimationPlayer::tick(const Time::TimeDelta &dt)
-{
- for(list<Slot>::iterator i=slots.begin(); i!=slots.end(); )
- {
- i->iterator += dt;
- i->object.set_matrix(i->iterator.get_matrix());
- if(const Armature *armature = i->animation.get_armature())
- {
- unsigned max_index = armature->get_max_link_index();
- for(unsigned j=0; j<=max_index; ++j)
- i->object.set_pose_matrix(j, i->iterator.get_pose_matrix(j));
- }
-
- if(i->iterator.is_end())
- slots.erase(i++);
- else
- ++i;
- }
-}
-
-
-AnimationPlayer::Slot::Slot(AnimatedObject &o, const Animation &a):
- object(o),
- animation(a),
- iterator(animation)
-{ }
-
-} // namespace GL
-} // namespace Msp