]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation.h
Use bezier splines in Animation
[libs/gl.git] / source / animation.h
index 92c177b685fead92aa15ee34c8721af1e16e4924..43cfc2894013016ec9018244e60c5bff0b2a7f26 100644 (file)
@@ -36,6 +36,11 @@ public:
                void init();
                virtual void finish();
 
                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);
                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<float, N> Knot;
 
        private:
                typedef typename Interpolate::SplineKnot<float, N> Knot;
 
        private:
-               Interpolate::Spline<float, 1, N> spline;
+               Interpolate::Spline<float, 3, N> spline;
 
        public:
                ValueCurve(CurveTarget, const std::vector<Knot> &);
 
        public:
                ValueCurve(CurveTarget, const std::vector<Knot> &);
@@ -99,9 +104,8 @@ private:
        struct TimedKeyFrame
        {
                Time::TimeDelta time;
        struct TimedKeyFrame
        {
                Time::TimeDelta time;
-               float start_slope;
-               float end_slope;
                RefPtr<const KeyFrame> keyframe;
                RefPtr<const KeyFrame> keyframe;
+               bool control;
        };
 
        struct Event
        };
 
        struct Event
@@ -162,8 +166,9 @@ 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_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:
 private:
-       void add_keyframe(const Time::TimeDelta &, const RefPtr<const KeyFrame> &, float, float);
+       void add_keyframe(const Time::TimeDelta &, const RefPtr<const KeyFrame> &, bool);
        void prepare_keyframe(TimedKeyFrame &);
        void create_curves();
        template<unsigned N, typename T>
        void prepare_keyframe(TimedKeyFrame &);
        void create_curves();
        template<unsigned N, typename T>