]> git.tdb.fi Git - libs/gl.git/blob - source/animation/pose.h
Simplify Program by removing transient data
[libs/gl.git] / source / animation / pose.h
1 #ifndef MSP_GL_POSE_H_
2 #define MSP_GL_POSE_H_
3
4 #include <map>
5 #include <msp/datafile/objectloader.h>
6 #include "matrix.h"
7
8 namespace Msp {
9 namespace GL {
10
11 class Armature;
12
13 class Pose
14 {
15 public:
16         class Loader: public DataFile::CollectionObjectLoader<Pose>
17         {
18         public:
19                 Loader(Pose &, Collection &);
20         private:
21                 void armature(const std::string &);
22                 void link(const std::string &);
23         };
24
25 private:
26         struct Link
27         {
28                 Matrix matrix;
29                 Matrix local_matrix;
30         };
31
32         class LinkLoader: public DataFile::ObjectLoader<Pose>
33         {
34         private:
35                 unsigned link_index;
36
37         public:
38                 LinkLoader(Pose &, unsigned);
39         private:
40                 void rotation(float, float, float, float);
41         };
42
43         const Armature *armature = 0;
44         std::vector<Link> links;
45
46 public:
47         Pose() = default;
48         Pose(const Armature &);
49
50         void set_armature(const Armature &);
51         const Armature *get_armature() const { return armature; }
52         void rotate_link(unsigned, float, const Vector3 &);
53         const Matrix &get_link_matrix(unsigned) const;
54 };
55
56 } // namespace GL
57 } // namespace Msp
58
59 #endif