diff --git a/src/math_util_2.c b/src/math_util_2.c index 091bf9215..174d9095e 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -919,6 +919,8 @@ void set_transform_matrix(Mat4 dest, Vec3f orientationVector, Vec3f positionVect Vec3f sp38; Vec3f sp2C; + FrameInterpolation_Record_set_transform_matrix(dest, orientationVector, positionVector, rotationAngle, scaleFactor); + vec3f_set_xyz(sp44, sins(rotationAngle), 0.0f, coss(rotationAngle)); vec3f_normalize(orientationVector); vec3f_cross_product(sp38, orientationVector, sp44); diff --git a/src/port/interpolation/FrameInterpolation.cpp b/src/port/interpolation/FrameInterpolation.cpp index 70a7ccf01..65de693a4 100644 --- a/src/port/interpolation/FrameInterpolation.cpp +++ b/src/port/interpolation/FrameInterpolation.cpp @@ -5,11 +5,13 @@ #include #include #include "port/Engine.h" -#include -#include "math_util_2.h" #include "FrameInterpolation.h" #include "matrix.h" +extern "C" { +#include "math_util.h" +#include "math_util_2.h" +} /* Frame interpolation. @@ -162,7 +164,7 @@ union Data { } matrix_rotate_axis; struct { - Mat4 dest; + Mat4* dest; Vec3f orientationVector; Vec3f positionVector; u16 rotationAngle; @@ -606,11 +608,11 @@ void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Mat4* matrix, Vec3f src // append(Op::MatrixMultVec3fNoTranslate).matrix_vec_no_translate = { matrix, src, dest }; } -void FrameInterpolation_Record_set_transform_matrix(Mat4 dest, Vec3f orientationVector, Vec3f positionVector, u16 rotationAngle, +void FrameInterpolation_Record_set_transform_matrix(Mat4* dest, Vec3f orientationVector, Vec3f positionVector, u16 rotationAngle, f32 scaleFactor) { if (!is_recording) return; - append(Op::SetTransformMatrix).set_transform_matrix_data = { dest[0][0], orientationVector[0], positionVector[0], rotationAngle, scaleFactor}; + append(Op::SetTransformMatrix).set_transform_matrix_data = { dest, orientationVector[0], positionVector[0], (f32)rotationAngle, scaleFactor}; } // Make a template for deref diff --git a/src/port/interpolation/FrameInterpolation.h b/src/port/interpolation/FrameInterpolation.h index d2a9a5fe3..a70f3e7b0 100644 --- a/src/port/interpolation/FrameInterpolation.h +++ b/src/port/interpolation/FrameInterpolation.h @@ -67,6 +67,9 @@ void FrameInterpolation_RecordSkinMatrixMtxFToMtx(MtxF* src, Mtx* dest); //void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Matrix* matrix, Vec3f src, Vec3f dest); +void FrameInterpolation_Record_set_transform_matrix(Mat4* dest, Vec3f orientationVector, Vec3f positionVector, u16 rotationAngle, + f32 scaleFactor); + #ifdef __cplusplus } #endif