]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation/pose.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / animation / pose.h
diff --git a/source/animation/pose.h b/source/animation/pose.h
new file mode 100644 (file)
index 0000000..cbd8137
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef MSP_GL_POSE_H_
+#define MSP_GL_POSE_H_
+
+#include <map>
+#include <msp/datafile/objectloader.h>
+#include "matrix.h"
+
+namespace Msp {
+namespace GL {
+
+class Armature;
+
+class Pose
+{
+public:
+       class Loader: public DataFile::CollectionObjectLoader<Pose>
+       {
+       public:
+               Loader(Pose &, Collection &);
+       private:
+               void armature(const std::string &);
+               void link(const std::string &);
+       };
+
+private:
+       struct Link
+       {
+               Matrix matrix;
+               Matrix local_matrix;
+       };
+
+       class LinkLoader: public DataFile::ObjectLoader<Pose>
+       {
+       private:
+               unsigned link_index;
+
+       public:
+               LinkLoader(Pose &, unsigned);
+       private:
+               void rotation(float, float, float, float);
+       };
+
+       const Armature *armature;
+       std::vector<Link> links;
+
+public:
+       Pose();
+       Pose(const Armature &);
+
+       void set_armature(const Armature &);
+       const Armature *get_armature() const { return armature; }
+       void rotate_link(unsigned, float, const Vector3 &);
+       const Matrix &get_link_matrix(unsigned) const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif