]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation/animation.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / animation / animation.cpp
index a9278e3de00836b3eb9e2ebe56ff908e2da207ed..a79e1f8d9860d9e31cdde6baf083cb3423b6c392 100644 (file)
@@ -16,11 +16,6 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Animation::Animation():
-       armature(0),
-       looping(false)
-{ }
-
 Animation::~Animation()
 {
        for(TimedKeyFrame &k: keyframes)
@@ -169,7 +164,7 @@ void Animation::add_keyframe(const Time::TimeDelta &t, const KeyFrame *kf, bool
        for(const auto &kvp: kf_uniforms)
        {
                if(find_member(uniforms, kvp.first, &UniformInfo::name)==uniforms.end())
-                       uniforms.push_back(UniformInfo(kvp.first, kvp.second.size));
+                       uniforms.emplace_back(kvp.first, kvp.second.size);
        }
 }
 
@@ -251,17 +246,17 @@ void Animation::create_curve(CurveTarget target, int component, const T &extract
                                {
                                        typename Knot::Value cv = knots.back().y;
                                        knots.back().y = (knots[knots.size()-2].y+cv*2.0)/3.0;
-                                       knots.push_back(Knot(x, (dvalue+cv*2.0)/3.0));
+                                       knots.emplace_back(x, (dvalue+cv*2.0/3.0));
                                }
                                else if(n_control==0 && !knots.empty())
                                {
                                        typename Knot::Value prev = knots.back().y;
-                                       knots.push_back(Knot(knots.back().x, (prev*2.0+dvalue)/3.0));
-                                       knots.push_back(Knot(x, (prev+dvalue*2.0)/3.0));
+                                       knots.emplace_back(knots.back().x, (prev*2.0+dvalue)/3.0);
+                                       knots.emplace_back(x, (prev+dvalue*2.0/3.0));
                                }
                                n_control = 0;
                        }
-                       knots.push_back(Knot(x, value));
+                       knots.emplace_back(x, value);
                }
        }
        
@@ -489,23 +484,12 @@ Matrix Animation::Iterator::get_pose_matrix(unsigned link) const
 }
 
 
-Animation::Loader::Loader(Animation &a):
-       DataFile::CollectionObjectLoader<Animation>(a, 0)
-{
-       init();
-}
-
-Animation::Loader::Loader(Animation &a, Collection &c):
-       DataFile::CollectionObjectLoader<Animation>(a, &c)
+Animation::Loader::Loader(Animation &a, Collection *c):
+       DataFile::CollectionObjectLoader<Animation>(a, c),
+       start_slope(1),
+       end_slope(1),
+       slopes_set(0)
 {
-       init();
-}
-
-void Animation::Loader::init()
-{
-       start_slope = 1;
-       end_slope = 1;
-       slopes_set = 0;
        add("armature", &Animation::armature);
        add("control_keyframe", &Loader::control_keyframe);
        add("control_keyframe", &Loader::control_keyframe_inline);