2 #include <msp/strings/format.h>
3 #include "animatedobject.h"
5 #include "programdata.h"
14 AnimatedObject::AnimatedObject(const Object &o):
18 if(const Technique *tech = object.get_technique())
19 if(tech->has_shaders())
20 shdata = new ProgramData;
23 AnimatedObject::~AnimatedObject()
28 void AnimatedObject::set_matrix(const Matrix &m)
33 void AnimatedObject::set_pose_matrix(unsigned link, const Matrix &m)
37 if(link*16>=pose_data.size())
38 pose_data.resize((link+1)*16);
39 copy(m.data(), m.data()+16, &pose_data[link*16]);
40 shdata->uniform_matrix4_array("pose[0]", pose_data.size()/16, &pose_data[0]);
44 void AnimatedObject::setup_render(Renderer &renderer, const Tag &) const
46 renderer.matrix_stack() *= matrix;
48 renderer.add_shader_data(*shdata);