]> git.tdb.fi Git - libs/gl.git/blob - source/animatedobject.h
Add a new Placeable base class
[libs/gl.git] / source / animatedobject.h
1 #ifndef MSP_GL_ANIMATEDOBJECT_H_
2 #define MSP_GL_ANIMATEDOBJECT_H_
3
4 #include <vector>
5 #include <msp/datafile/objectloader.h>
6 #include "keyframe.h"
7 #include "matrix.h"
8 #include "objectinstance.h"
9
10 namespace Msp {
11 namespace GL {
12
13 /**
14 An object instance that can be animated by an AnimationPlayer.
15 */
16 class AnimatedObject: public ObjectInstance
17 {
18 public:
19         class Loader: public DataFile::ObjectLoader<AnimatedObject>
20         {
21         public:
22                 Loader(AnimatedObject &);
23
24         private:
25                 void position(float, float, float);
26                 void rotation(float, float, float, float);
27                 void scale(float, float, float);
28                 void scale_uniform(float);
29         };
30
31 private:
32         std::vector<float> pose_data;
33         ProgramData *shdata;
34
35 public:
36         AnimatedObject(const Object &);
37         ~AnimatedObject();
38
39         void set_pose_matrix(unsigned, const Matrix &);
40         void set_uniform(const std::string &, const KeyFrame::AnimatedUniform &);
41
42         virtual const Matrix *get_matrix() const { return &matrix; }
43
44         virtual void setup_render(Renderer &, const Tag &) const;
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif