X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimatedobject.cpp;h=4be198a87fec6739957642e485db91baee036263;hp=63a25112a769428374e37dd0634251b4f2c2c8b7;hb=de5d710b87879d6a0b06407da096ec505f8b7679;hpb=7533ecca549e09eab5ef229292de8908370c395c diff --git a/source/animatedobject.cpp b/source/animatedobject.cpp index 63a25112..4be198a8 100644 --- a/source/animatedobject.cpp +++ b/source/animatedobject.cpp @@ -48,5 +48,35 @@ void AnimatedObject::setup_render(Renderer &renderer, const Tag &) const renderer.add_shader_data(*shdata); } + +AnimatedObject::Loader::Loader(AnimatedObject &o): + DataFile::ObjectLoader(o) +{ + add("position", &Loader::position); + add("rotation", &Loader::rotation); + add("scale", &Loader::scale); + add("scale", &Loader::scale_uniform); +} + +void AnimatedObject::Loader::position(float x, float y, float z) +{ + obj.matrix.translate(x, y, z); +} + +void AnimatedObject::Loader::rotation(float a, float x, float y, float z) +{ + obj.matrix.rotate_deg(a, x, y, z); +} + +void AnimatedObject::Loader::scale(float x, float y, float z) +{ + obj.matrix.scale(x, y, z); +} + +void AnimatedObject::Loader::scale_uniform(float s) +{ + obj.matrix.scale(s); +} + } // namespace GL } // namespace Msp