X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimatedobject.cpp;h=3a78110009bc2c47b8cf26e9ab7ee59013444b40;hp=d2157fd1bc128ebc6dd676ef0cc10c54b9204e5c;hb=9e384cddaf641f25ce6714327e1b4fadfea4632d;hpb=00d926c3fe134820139a925cfac28cd64729db93 diff --git a/source/animatedobject.cpp b/source/animatedobject.cpp index d2157fd1..3a781100 100644 --- a/source/animatedobject.cpp +++ b/source/animatedobject.cpp @@ -6,6 +6,7 @@ #include "programdata.h" #include "renderer.h" #include "technique.h" +#include "transform.h" using namespace std; @@ -37,6 +38,20 @@ void AnimatedObject::set_pose_matrix(unsigned link, const Matrix &m) } } +ProgramData &AnimatedObject::get_shader_data() +{ + if(!shdata) + throw invalid_operation("AnimatedObject::get_shader_data"); + return *shdata; +} + +const ProgramData &AnimatedObject::get_shader_data() const +{ + if(!shdata) + throw invalid_operation("AnimatedObject::get_shader_data"); + return *shdata; +} + void AnimatedObject::set_uniform(const string &name, const KeyFrame::AnimatedUniform &uni) { if(!shdata) @@ -65,6 +80,9 @@ void AnimatedObject::setup_render(Renderer &renderer, const Tag &) const AnimatedObject::Loader::Loader(AnimatedObject &o): DataFile::ObjectLoader(o) { + add("transform", &Loader::transform); + + // Deprecated; Use the transform statement instead add("position", &Loader::position); add("rotation", &Loader::rotation); add("scale", &Loader::scale); @@ -91,5 +109,12 @@ void AnimatedObject::Loader::scale_uniform(float s) obj.matrix.scale(s); } +void AnimatedObject::Loader::transform() +{ + Transform trn; + load_sub(trn); + obj.matrix = trn.to_matrix(); +} + } // namespace GL } // namespace Msp