if(i==objects.end())
return;
- for(AnimationList::iterator j=i->second.animations.begin(); j!=i->second.animations.end(); ++j)
- if(&j->animation==&anim)
+ for(vector<AnimationSlot>::iterator j=i->second.animations.begin(); j!=i->second.animations.end(); ++j)
+ if(j->animation==&anim)
{
i->second.animations.erase(j);
break;
anim.iterator += dt;
slot.object.set_matrix(anim.iterator.get_matrix());
- unsigned n_uniforms = anim.animation.get_n_uniforms();
+ unsigned n_uniforms = anim.animation->get_n_uniforms();
for(unsigned i=0; i<n_uniforms; ++i)
- set_object_uniform(slot.object, anim.animation.get_uniform_name(i), anim.iterator.get_uniform(i));
+ set_object_uniform(slot.object, anim.animation->get_uniform_name(i), anim.iterator.get_uniform(i));
if(slot.armature)
{
bool AnimationPlayer::tick_stacked(ObjectSlot &slot, const Time::TimeDelta &dt)
{
Matrix matrix = slot.base_matrix;
- for(AnimationList::iterator i=slot.animations.begin(); i!=slot.animations.end(); ++i)
+ for(vector<AnimationSlot>::iterator i=slot.animations.begin(); i!=slot.animations.end(); ++i)
{
i->iterator += dt;
matrix *= i->iterator.get_matrix();
- unsigned n_uniforms = i->animation.get_n_uniforms();
+ unsigned n_uniforms = i->animation->get_n_uniforms();
for(unsigned j=0; j<n_uniforms; ++j)
- set_object_uniform(slot.object, i->animation.get_uniform_name(j), i->iterator.get_uniform(j));
+ set_object_uniform(slot.object, i->animation->get_uniform_name(j), i->iterator.get_uniform(j));
}
slot.object.set_matrix(matrix);
matrix = Matrix();
/* XXX This is in all likelihood incorrect. The stacking should be
performed on local matrices. */
- for(AnimationList::iterator j=slot.animations.begin(); j!=slot.animations.end(); ++j)
- if(j->animation.get_armature())
+ for(vector<AnimationSlot>::iterator j=slot.animations.begin(); j!=slot.animations.end(); ++j)
+ if(j->animation->get_armature())
matrix *= j->iterator.get_pose_matrix(i);
slot.object.set_pose_matrix(i, matrix);
}
}
- for(AnimationList::iterator i=slot.animations.begin(); i!=slot.animations.end(); )
+ for(vector<AnimationSlot>::iterator i=slot.animations.begin(); i!=slot.animations.end(); )
{
if(i->iterator.is_end())
- slot.animations.erase(i++);
+ i = slot.animations.erase(i);
else
++i;
}
AnimationPlayer::AnimationSlot::AnimationSlot(const Animation &a):
- animation(a),
- iterator(animation)
+ animation(&a),
+ iterator(*animation)
{ }
} // namespace GL