]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation.cpp
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / animation.cpp
index b1ae1157fac6eeb8bbc64c5431845eef04c4f5a0..a8d9e9698625b027997586745cd71b9c73c1d305 100644 (file)
@@ -267,6 +267,14 @@ void Animation::create_curve(CurveTarget target, int component, const T &extract
        while(n_control--)
                knots.pop_back();
 
+       if(knots.size()==1)
+       {
+               knots.push_back(knots.back());
+               knots.push_back(knots.back());
+               knots.back().x += 1;
+               knots.push_back(knots.back());
+       }
+
        curves.push_back(new ValueCurve<N>(target, component, knots));
 }
 
@@ -336,12 +344,18 @@ void Animation::ValueCurve<1>::apply(float x, Matrix &matrix) const
        float value = spline(x);
        if(target==POSITION || target==SCALE)
        {
-               Vector3 vec;
-               vec[component] = value;
                if(target==POSITION)
+               {
+                       Vector3 vec;
+                       vec[component] = value;
                        matrix.translate(vec);
+               }
                else
+               {
+                       Vector3 vec(1.0f, 1.0f, 1.0f);
+                       vec[component] = value;
                        matrix.scale(vec);
+               }
        }
        else if(target==EULER)
        {
@@ -377,7 +391,7 @@ void Animation::ValueCurve<N>::apply(float x, KeyFrame::AnimatedUniform &uni) co
        uni.size = N;
        typename Interpolate::Spline<double, 3, N>::Value value = spline(x);
        for(unsigned i=0; i<N; ++i)
-               uni.values[i] = Interpolate::SplineValue<float, N>::get(value, i);
+               uni.values[i] = Interpolate::SplineValue<double, N>::get(value, i);
 }