]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation/animatedobject.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / animation / animatedobject.h
diff --git a/source/animation/animatedobject.h b/source/animation/animatedobject.h
new file mode 100644 (file)
index 0000000..f9b8824
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef MSP_GL_ANIMATEDOBJECT_H_
+#define MSP_GL_ANIMATEDOBJECT_H_
+
+#include <vector>
+#include <msp/core/attributes.h>
+#include <msp/datafile/objectloader.h>
+#include "keyframe.h"
+#include "matrix.h"
+#include "objectinstance.h"
+
+namespace Msp {
+namespace GL {
+
+/**
+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:
+       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 &);
+
+       virtual const Matrix *get_matrix() const { return &matrix; }
+
+       virtual void setup_render(Renderer &, const Tag &) const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif