]> git.tdb.fi Git - libs/gl.git/blob - source/animation/armature.h
Refactor adding types in SL::Parser
[libs/gl.git] / source / animation / armature.h
1 #ifndef MSP_GL_ARMATURE_H_
2 #define MSP_GL_ARMATURE_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/datafile/objectloader.h>
7 #include "pose.h"
8 #include "vector.h"
9
10 namespace Msp {
11 namespace GL {
12
13 class Armature
14 {
15 public:
16         class Loader: public DataFile::ObjectLoader<Armature>
17         {
18         public:
19                 Loader(Armature &);
20         private:
21                 void link(const std::string &);
22         };
23
24         class Link
25         {
26         public:
27                 class Loader: public DataFile::ObjectLoader<Link>
28                 {
29                 private:
30                         const Armature &armature;
31
32                 public:
33                         Loader(Link &, const Armature &);
34                 private:
35                         void base(float, float, float);
36                         void parent(const std::string &);
37                 };
38
39         private:
40                 std::string name;
41                 unsigned index;
42                 const Link *parent;
43                 Vector3 base;
44
45         public:
46                 Link(const std::string &, unsigned);
47
48                 void set_parent(const Link *);
49                 void set_base(const Vector3 &);
50
51                 const std::string &get_name() const { return name; }
52                 unsigned get_index() const { return index; }
53                 const Link *get_parent() const { return parent; }
54                 const Vector3 &get_base() const { return base; }
55         };
56
57 private:
58         std::vector<Link> links;
59
60 public:
61         Link &add_link();
62
63         const Link &get_link(unsigned) const;
64         const Link &get_link(const std::string &) const;
65         unsigned get_max_link_index() const;
66 };
67
68 } // namespace GL
69 } // namespace Msp
70
71 #endif