]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animatedobject.h
Make animation curve creation more generic
[libs/gl.git] / source / animatedobject.h
index 4f6085ff84ce146974bcfa2e64f84b23fa672c64..2b640b763fa1859807f5a2a0736b44c57ca7aa87 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef MSP_GL_ANIMATEDOBJECT_H_
 #define MSP_GL_ANIMATEDOBJECT_H_
 
+#include <vector>
+#include <msp/datafile/objectloader.h>
+#include "keyframe.h"
 #include "matrix.h"
 #include "objectinstance.h"
 
@@ -8,18 +11,39 @@ namespace Msp {
 namespace GL {
 
 /**
-An object instance that can be animated.  Despite the name, this can also be
-useful for displaying objects at a static position.
+An object instance that can be animated by an AnimationPlayer.
 */
 class AnimatedObject: public ObjectInstance
 {
+public:
+       class Loader: public DataFile::DerivedObjectLoader<AnimatedObject, ObjectInstance::Loader>
+       {
+       public:
+               Loader(AnimatedObject &);
+
+       private:
+               void position(float, float, float);
+               void rotation(float, float, float, float);
+               void scale(float, float, float);
+               void scale_uniform(float);
+       };
+
 private:
-       Matrix matrix;
+       std::vector<float> pose_data;
+       ProgramData *shdata;
 
 public:
        AnimatedObject(const Object &);
+       ~AnimatedObject();
+
+       void set_pose_matrix(unsigned, const Matrix &);
+       ProgramData &get_shader_data();
+       const ProgramData &get_shader_data() const;
+
+       // Deprecated
+       void set_uniform(const std::string &, const KeyFrame::AnimatedUniform &);
 
-       void set_matrix(const Matrix &);
+       virtual const Matrix *get_matrix() const { return &matrix; }
 
        virtual void setup_render(Renderer &, const Tag &) const;
 };