X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimation.h;h=7b86eca9b162a56cd38e29ae1c17f05a326bce3b;hp=83b369bfca1f1e975df889de113d9655ca77db80;hb=29ee3d841a610d24ccfa3e16e492e278f81f64bd;hpb=025016d7628be9c43b20999325dcbaae5cb3c3b8 diff --git a/source/animation.h b/source/animation.h index 83b369bf..7b86eca9 100644 --- a/source/animation.h +++ b/source/animation.h @@ -36,6 +36,11 @@ public: void init(); virtual void finish(); + void load_kf(const std::string &, bool); + void load_kf_inline(bool); + + void control_keyframe(const std::string &); + void control_keyframe_inline(); void event(const std::string &); void event1i(const std::string &, int); void event1f(const std::string &, float); @@ -77,7 +82,7 @@ private: typedef typename Interpolate::SplineKnot Knot; private: - Interpolate::Spline spline; + Interpolate::Spline spline; public: ValueCurve(CurveTarget, const std::vector &); @@ -86,12 +91,21 @@ private: virtual void apply(float, KeyFrame::AnimatedUniform &) const; }; + template + struct ExtractUniform + { + const std::string &name; + + ExtractUniform(const std::string &n): name(n) { } + + bool operator()(const KeyFrame &, typename Interpolate::SplineValue::Type &) const; + }; + struct TimedKeyFrame { Time::TimeDelta time; - float start_slope; - float end_slope; RefPtr keyframe; + bool control; }; struct Event @@ -152,12 +166,16 @@ public: void add_keyframe(const Time::TimeDelta &, const KeyFrame &); void add_keyframe(const Time::TimeDelta &, const KeyFrame &, float); void add_keyframe(const Time::TimeDelta &, const KeyFrame &, float, float); + void add_control_keyframe(const KeyFrame &); private: - void add_keyframe(const Time::TimeDelta &, const RefPtr &, float, float); + void add_keyframe(const Time::TimeDelta &, const KeyFrame *, bool, bool); void prepare_keyframe(TimedKeyFrame &); void create_curves(); - template - void create_uniform_curve(const std::string &); + template + void create_curve(CurveTarget target, const T &); + static bool extract_position(const KeyFrame &, Vector3 &); + static bool extract_euler(const KeyFrame &, Vector3 &); + static bool extract_scale(const KeyFrame &, Vector3 &); public: void add_event(const Time::TimeDelta &, const std::string &, const Variant & = Variant());