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>
24 Loader(KeyFrame &, Collection &);
28 void pose(const std::string &);
30 void position(float, float, float);
31 void rotation(float, float, float, float);
32 void scaling_uniform(float);
33 void scaling(float, float, float);
38 class UniformsLoader: public DataFile::ObjectLoader<KeyFrame>
41 UniformsLoader(KeyFrame &);
44 void uniform1f(const std::string &, float);
45 void uniform2f(const std::string &, float, float);
46 void uniform3f(const std::string &, float, float, float);
47 void uniform4f(const std::string &, float, float, float, float);
50 struct AnimatedUniform
55 AnimatedUniform(unsigned, float, float = 0.0f, float = 0.0f, float = 0.0f);
58 typedef std::map<std::string, AnimatedUniform> UniformMap;
63 RefPtr<const Pose> pose;
69 void set_transform(const Transform &);
70 void set_matrix(const Matrix &);
71 void set_uniform(const std::string &, const AnimatedUniform &);
72 void set_pose(const Pose &);
73 const Transform &get_transform() const { return transform; }
74 Matrix get_matrix() const { return transform.to_matrix(); }
75 const UniformMap &get_uniforms() const { return uniforms; }
76 const Pose *get_pose() const { return pose.get(); }