]> git.tdb.fi Git - libs/gl.git/blobdiff - source/keyframe.cpp
Basic animation support
[libs/gl.git] / source / keyframe.cpp
diff --git a/source/keyframe.cpp b/source/keyframe.cpp
new file mode 100644 (file)
index 0000000..7310c23
--- /dev/null
@@ -0,0 +1,36 @@
+#include "keyframe.h"
+
+namespace Msp {
+namespace GL {
+
+KeyFrame::Loader::Loader(KeyFrame &k):
+       DataFile::ObjectLoader<KeyFrame>(k)
+{
+       add("position", &Loader::position);
+       add("rotation", &Loader::rotation);
+       add("scaling", &Loader::scaling_uniform);
+       add("scaling", &Loader::scaling);
+}
+
+void KeyFrame::Loader::position(float x, float y, float z)
+{
+       obj.matrix.translate(x, y, z);
+}
+
+void KeyFrame::Loader::rotation(float a, float x, float y, float z)
+{
+       obj.matrix.rotate_deg(a, x, y, z);
+}
+
+void KeyFrame::Loader::scaling_uniform(float s)
+{
+       obj.matrix.scale(s);
+}
+
+void KeyFrame::Loader::scaling(float x, float y, float z)
+{
+       obj.matrix.scale(x, y, z);
+}
+
+} // namespace GL
+} // namespace Msp