]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation.cpp
Use libmspmath to provide vector and matrix operations
[libs/gl.git] / source / animation.cpp
index 8135cb5995a406e5f9b722f5ca242b3c60eecb96..c0b508180b0da9f8676cd12e6f5c74a4a77cede1 100644 (file)
@@ -17,6 +17,10 @@ Animation::Animation():
        looping(false)
 { }
 
+// Avoid synthesizing ~RefPtr in files including animation.h
+Animation::~Animation()
+{ }
+
 void Animation::set_armature(const Armature &a)
 {
        armature = &a;
@@ -219,10 +223,11 @@ Matrix Animation::Iterator::get_pose_matrix(unsigned link) const
        }
 
        // We must redo the base point correction since interpolation throws if off
+       // XXX This should probably be done on local matrices
        Matrix result = iter->pose_matrices[link].get(time_since_keyframe/iter->delta_t);
        const Vector3 &base = animation.armature->get_link(link).get_base();
        Vector3 new_base = result*base;
-       result = Matrix::translation(base.x-new_base.x, base.y-new_base.y, base.z-new_base.z)*result;
+       result = Matrix::translation(base-new_base)*result;
        return result;
 }