]> git.tdb.fi Git - libs/gl.git/blob - source/pose.h
Add classes for armature-based deformation
[libs/gl.git] / source / 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 link(const std::string &);
22         };
23
24 private:
25         struct Link
26         {
27                 Matrix matrix;
28                 Matrix local_matrix;
29         };
30
31         class LinkLoader: public DataFile::ObjectLoader<Pose>
32         {
33         private:
34                 unsigned link_index;
35
36         public:
37                 LinkLoader(Pose &, unsigned);
38         private:
39                 void rotation(float, float, float, float);
40         };
41
42         const Armature *armature;
43         std::vector<Link> links;
44
45 public:
46         Pose();
47         Pose(const Armature &);
48
49         void set_armature(const Armature &);
50         void rotate_link(unsigned, float, const Vector3 &);
51         const Matrix &get_link_matrix(unsigned) const;
52 };
53
54 } // namespace GL
55 } // namespace Msp
56
57 #endif