]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation.h
Refactor the Animation reference out of TimedKeyFrame
[libs/gl.git] / source / animation.h
index 32a06075ec18269450a9ab329317e1e7551b8994..dd3cc688c41290316450858a7d540a79e93dcfb8 100644 (file)
@@ -60,7 +60,6 @@ private:
 
        struct TimedKeyFrame
        {
-               const Animation &animation;
                const TimedKeyFrame *prev;
                Time::TimeDelta time;
                Time::TimeDelta delta_t;
@@ -69,12 +68,10 @@ private:
                std::vector<KeyFrame::AnimatedUniform> uniforms;
                std::vector<MatrixInterpolation> pose_matrices;
 
-               TimedKeyFrame(const Animation &);
-               void prepare();
+               TimedKeyFrame();
+               void prepare(const Animation &);
        };
 
-       typedef std::list<TimedKeyFrame> KeyFrameList;
-
        struct UniformInfo
        {
                std::string name;
@@ -88,7 +85,7 @@ public:
        {
        private:
                const Animation *animation;
-               KeyFrameList::const_iterator iter;
+               std::vector<TimedKeyFrame>::const_iterator iter;
                Time::TimeDelta time_since_keyframe;
                bool end;
 
@@ -105,7 +102,7 @@ public:
 
 private:
        const Armature *armature;
-       KeyFrameList keyframes;
+       std::vector<TimedKeyFrame> keyframes;
        bool looping;
        std::vector<UniformInfo> uniforms;
 
@@ -122,6 +119,7 @@ public:
 
        void add_keyframe(const Time::TimeDelta &, const KeyFrame &);
 private:
+       void add_keyframe(const Time::TimeDelta &, const RefPtr<const KeyFrame> &);
        void prepare_keyframe(TimedKeyFrame &);
 
 public: