void AnimExportUtil::addPositionKey( KeyFrameContainer& anim, const Matrix4x4& tm, float time ) { KeyFrame key; key.time = time; key.interpolation = INTERP_TYPE; key.setChannel( 0, tm(0,3) ); key.setChannel( 1, tm(1,3) ); key.setChannel( 2, tm(2,3) ); anim.insertKey( key ); }
void AnimExportUtil::addRotationKey( KeyFrameContainer& anim, const Matrix4x4& tm, float time ) { Matrix3x3 rotm = tm.rotation().orthonormalize(); Quaternion q( rotm ); KeyFrame key; key.time = time; key.interpolation = INTERP_TYPE; key.setChannel( 0, q.x ); key.setChannel( 1, q.y ); key.setChannel( 2, q.z ); key.setChannel( 3, q.w ); anim.insertKey( key ); }
void AnimExportUtil::addScaleKey( KeyFrameContainer& anim, const Matrix4x4& tm, float time ) { KeyFrame key; key.time = time; key.interpolation = INTERP_TYPE; for ( int i = 0 ; i < 3 ; ++i ) { Vector3 axis = getAxis( tm, i ); float s = axis.dot( normalize0(axis) ); key.setChannel( i, s ); } anim.insertKey( key ); }