X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimation%2Fanimation.cpp;h=a79e1f8d9860d9e31cdde6baf083cb3423b6c392;hp=a9278e3de00836b3eb9e2ebe56ff908e2da207ed;hb=HEAD;hpb=e9a898f315b5d1396f196d785913a283c30940f2 diff --git a/source/animation/animation.cpp b/source/animation/animation.cpp index a9278e3d..a79e1f8d 100644 --- a/source/animation/animation.cpp +++ b/source/animation/animation.cpp @@ -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(a, 0) -{ - init(); -} - -Animation::Loader::Loader(Animation &a, Collection &c): - DataFile::CollectionObjectLoader(a, &c) +Animation::Loader::Loader(Animation &a, Collection *c): + DataFile::CollectionObjectLoader(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);