1 #ifndef MSP_GL_KEYFRAME_H_
2 #define MSP_GL_KEYFRAME_H_
4 #include <msp/core/refptr.h>
5 #include <msp/datafile/objectloader.h>
15 Keyframes are used to encapsulate object state for animation.
20 class Loader: public DataFile::CollectionObjectLoader<KeyFrame>
23 std::string inline_base_name;
26 Loader(KeyFrame &k): Loader(k, 0) { }
27 Loader(KeyFrame &k, Collection &c): Loader(k, &c) { }
29 Loader(KeyFrame &, Collection *);
32 void set_inline_base_name(const std::string &);
35 void pose(const std::string &);
37 void position(float, float, float);
38 void rotation(float, float, float, float);
39 void scaling_uniform(float);
40 void scaling(float, float, float);
45 class UniformsLoader: public DataFile::ObjectLoader<KeyFrame>
48 UniformsLoader(KeyFrame &);
51 void uniform1f(const std::string &, float);
52 void uniform2f(const std::string &, float, float);
53 void uniform3f(const std::string &, float, float, float);
54 void uniform4f(const std::string &, float, float, float, float);
57 struct AnimatedUniform
62 AnimatedUniform(unsigned, float, float = 0.0f, float = 0.0f, float = 0.0f);
65 typedef std::map<std::string, AnimatedUniform> UniformMap;
73 void set_transform(const Transform &);
74 void set_matrix(const Matrix &);
75 void set_uniform(const std::string &, const AnimatedUniform &);
76 void set_pose(const Pose &);
77 const Transform &get_transform() const { return transform; }
78 Matrix get_matrix() const { return transform.to_matrix(); }
79 const UniformMap &get_uniforms() const { return uniforms; }
80 const Pose *get_pose() const { return pose; }