X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimation.h;h=c190bdbfd1cb11048020ad7ba06a44fff81d1a24;hp=dd3cc688c41290316450858a7d540a79e93dcfb8;hb=19555043d70f972feedb89786fc24a2b83b4f7e9;hpb=89a1ada18430079896cfb28862e61bb32d66b8a0 diff --git a/source/animation.h b/source/animation.h index dd3cc688..c190bdbf 100644 --- a/source/animation.h +++ b/source/animation.h @@ -9,6 +9,7 @@ namespace Msp { namespace GL { +class AnimationEventObserver; class Armature; class Matrix; class Pose; @@ -31,6 +32,12 @@ public: private: void init(); + void event(const std::string &); + void event1i(const std::string &, int); + void event1f(const std::string &, float); + void event2f(const std::string &, float, float); + void event3f(const std::string &, float, float, float); + void event4f(const std::string &, float, float, float, float); void keyframe(const std::string &); void keyframe_inline(); void interval(float); @@ -72,6 +79,13 @@ private: void prepare(const Animation &); }; + struct Event + { + Time::TimeDelta time; + std::string name; + Variant value; + }; + struct UniformInfo { std::string name; @@ -86,6 +100,7 @@ public: private: const Animation *animation; std::vector::const_iterator iter; + std::vector::const_iterator event_iter; Time::TimeDelta time_since_keyframe; bool end; @@ -93,6 +108,7 @@ public: Iterator(const Animation &); Iterator &operator+=(const Time::TimeDelta &); + void dispatch_events(AnimationEventObserver &); bool is_end() const { return end; } Matrix get_matrix() const; @@ -103,6 +119,7 @@ public: private: const Armature *armature; std::vector keyframes; + std::vector events; bool looping; std::vector uniforms; @@ -121,8 +138,9 @@ public: private: void add_keyframe(const Time::TimeDelta &, const RefPtr &); void prepare_keyframe(TimedKeyFrame &); - public: + void add_event(const Time::TimeDelta &, const std::string &, const Variant & = Variant()); + void set_looping(bool); };