~AnimatedObject();
void set_pose_matrix(unsigned, const Matrix &);
+ ProgramData &get_shader_data();
+
+ // Deprecated
void set_uniform(const std::string &, const KeyFrame::AnimatedUniform &);
virtual const Matrix *get_matrix() const { return &matrix; }
#include "animatedobject.h"
#include "animationplayer.h"
#include "armature.h"
+#include "programdata.h"
using namespace std;
unsigned n_uniforms = anim.animation.get_n_uniforms();
for(unsigned i=0; i<n_uniforms; ++i)
- obj.set_uniform(anim.animation.get_uniform_name(i), anim.iterator.get_uniform(i));
+ set_object_uniform(obj, anim.animation.get_uniform_name(i), anim.iterator.get_uniform(i));
if(slot.armature)
{
unsigned n_uniforms = i->animation.get_n_uniforms();
for(unsigned j=0; j<n_uniforms; ++j)
- slot.object.set_uniform(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);
return !slot.animations.empty();
}
+void AnimationPlayer::set_object_uniform(AnimatedObject &obj, const string &name, const KeyFrame::AnimatedUniform &uni)
+{
+ ProgramData &shdata = obj.get_shader_data();
+
+ if(uni.size==1)
+ shdata.uniform(name, uni.values[0]);
+ else if(uni.size==2)
+ shdata.uniform2(name, uni.values);
+ else if(uni.size==2)
+ shdata.uniform3(name, uni.values);
+ else if(uni.size==4)
+ shdata.uniform4(name, uni.values);
+}
+
AnimationPlayer::ObjectSlot::ObjectSlot(AnimatedObject &o):
object(o),
private:
bool tick_single(ObjectSlot &, const Time::TimeDelta &);
bool tick_stacked(ObjectSlot &, const Time::TimeDelta &);
+ static void set_object_uniform(AnimatedObject &, const std::string &, const KeyFrame::AnimatedUniform &);
};
} // namespace GL