]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation/armature.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / animation / armature.h
diff --git a/source/animation/armature.h b/source/animation/armature.h
new file mode 100644 (file)
index 0000000..9dc2f50
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef MSP_GL_ARMATURE_H_
+#define MSP_GL_ARMATURE_H_
+
+#include <list>
+#include <string>
+#include <msp/datafile/objectloader.h>
+#include "pose.h"
+#include "vector.h"
+
+namespace Msp {
+namespace GL {
+
+class Armature
+{
+public:
+       class Loader: public DataFile::ObjectLoader<Armature>
+       {
+       public:
+               Loader(Armature &);
+       private:
+               void link(const std::string &);
+       };
+
+       class Link
+       {
+       public:
+               class Loader: public DataFile::ObjectLoader<Link>
+               {
+               private:
+                       const Armature &armature;
+
+               public:
+                       Loader(Link &, const Armature &);
+               private:
+                       void base(float, float, float);
+                       void parent(const std::string &);
+               };
+
+       private:
+               std::string name;
+               unsigned index;
+               const Link *parent;
+               Vector3 base;
+
+       public:
+               Link(const std::string &, unsigned);
+
+               void set_parent(const Link *);
+               void set_base(const Vector3 &);
+
+               const std::string &get_name() const { return name; }
+               unsigned get_index() const { return index; }
+               const Link *get_parent() const { return parent; }
+               const Vector3 &get_base() const { return base; }
+       };
+
+private:
+       std::vector<Link> links;
+
+public:
+       Link &add_link();
+
+       const Link &get_link(unsigned) const;
+       const Link &get_link(const std::string &) const;
+       unsigned get_max_link_index() const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif