]> git.tdb.fi Git - libs/gl.git/blob - source/keyframe.cpp
Allow setting keyframe matrix from the outside
[libs/gl.git] / source / keyframe.cpp
1 #include "keyframe.h"
2
3 namespace Msp {
4 namespace GL {
5
6 void KeyFrame::set_matrix(const Matrix &m)
7 {
8         matrix = m;
9 }
10
11 KeyFrame::Loader::Loader(KeyFrame &k):
12         DataFile::ObjectLoader<KeyFrame>(k)
13 {
14         add("position", &Loader::position);
15         add("rotation", &Loader::rotation);
16         add("scaling", &Loader::scaling_uniform);
17         add("scaling", &Loader::scaling);
18 }
19
20 void KeyFrame::Loader::position(float x, float y, float z)
21 {
22         obj.matrix.translate(x, y, z);
23 }
24
25 void KeyFrame::Loader::rotation(float a, float x, float y, float z)
26 {
27         obj.matrix.rotate_deg(a, x, y, z);
28 }
29
30 void KeyFrame::Loader::scaling_uniform(float s)
31 {
32         obj.matrix.scale(s);
33 }
34
35 void KeyFrame::Loader::scaling(float x, float y, float z)
36 {
37         obj.matrix.scale(x, y, z);
38 }
39
40 } // namespace GL
41 } // namespace Msp