summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMegaMech <inkstudios1@hotmail.com>2025-05-17 18:15:50 -0600
committerMegaMech <inkstudios1@hotmail.com>2025-05-17 18:15:50 -0600
commitaaa232238dbafbc98c6cdafa5c7e7488350e34c4 (patch)
treec48e0158d6bbf383dfa84b97f6ff5ecf16fe39d6
parent08ec787e79199d255f1886c7f2a69d66041015f1 (diff)
Add more interps
-rw-r--r--src/port/interpolation/FrameInterpolation.cpp26
-rw-r--r--src/port/interpolation/FrameInterpolation.h6
-rw-r--r--src/render_player.c6
-rw-r--r--src/render_player.h6
4 files changed, 33 insertions, 11 deletions
diff --git a/src/port/interpolation/FrameInterpolation.cpp b/src/port/interpolation/FrameInterpolation.cpp
index 268d323dc..c1d787119 100644
--- a/src/port/interpolation/FrameInterpolation.cpp
+++ b/src/port/interpolation/FrameInterpolation.cpp
@@ -11,6 +11,7 @@
extern "C" {
#include "math_util.h"
#include "math_util_2.h"
+#include "render_player.h"
}
/*
Frame interpolation.
@@ -72,7 +73,7 @@ enum class Op {
SkinMatrixMtxFToMtx,
SetTransformMatrix,
SetMatrixTransformation,
- CalculateOrientationMatrix
+ SetTranslateRotate
};
typedef pair<const void*, int> label;
@@ -186,6 +187,12 @@ union Data {
} set_matrix_transformation_data;
struct {
+ Mat4* dest;
+ Vec3f location;
+ Vec3s rotation;
+ } set_translate_rotate_data;
+
+ struct {
Mat3* dest;
f32 arg1;
f32 arg2;
@@ -384,7 +391,7 @@ struct InterpolateCtx {
// break;
case Op::MatrixMult:
- interpolate_mtxf(&tmp_mtxf, &old_op.matrix_mult.mf, &new_op.matrix_mult.mf);
+ //interpolate_mtxf(&tmp_mtxf, &old_op.matrix_mult.mf, &new_op.matrix_mult.mf);
// Matrix_Mult(gInterpolationMatrix, (Matrix*) &tmp_mtxf, new_op.matrix_mult.mode);
break;
@@ -512,10 +519,14 @@ struct InterpolateCtx {
break;
}
- case Op::CalculateOrientationMatrix: {
+ case Op::SetTranslateRotate: {
+ lerp_vec3f(&tmp_vec3f, &old_op.set_translate_rotate_data.location,
+ &new_op.set_translate_rotate_data.location);
+ lerp_vec3s(&tmp_vec3s, old_op.set_translate_rotate_data.rotation,
+ new_op.set_translate_rotate_data.rotation);
- calculate_orientation_matrix(* tmp_mat3);
+ mtxf_translate_rotate(*gInterpolationMatrix, tmp_vec3f, tmp_vec3s);
break;
}
}
@@ -654,6 +665,11 @@ void FrameInterpolation_RecordSetTransformMatrix(Mat4* dest, Vec3f orientationVe
append(Op::SetTransformMatrix).set_transform_matrix_data = { dest, {orientationVector[0], orientationVector[1], orientationVector[2]}, { positionVector[0], positionVector[1], positionVector[2] }, rotationAngle, scaleFactor};
}
+void FrameInterpolation_RecordTranslateRotate(Mat4* dest, Vec3f pos, Vec3s rotation) {
+ if (!is_recording) { return; }
+
+ append(Op::SetTranslateRotate).set_translate_rotate_data = { dest, {pos[0], pos[1], pos[2]}, { rotation[0], rotation[1], rotation[2] }};
+}
void FrameInterpolation_RecordSetMatrixTransformation(Mat4* dest, Vec3f location, Vec3su rotation, f32 scale) {
if (!is_recording)
@@ -664,7 +680,7 @@ void FrameInterpolation_RecordSetMatrixTransformation(Mat4* dest, Vec3f location
void FrameInterpolation_RecordCalculateOrientationMatrix(Mat3* dest, f32 x, f32 y, f32 z, s16 rot) {
if (!is_recording) return;
- append(Op::SetMatrixTransformation).set_calculate_orientation_matrix_data = { dest, x, y, z, rot};
+ // append(Op::SetMatrixTransformation).set_calculate_orientation_matrix_data = { dest, x, y, z, rot};
}
// Make a template for deref
diff --git a/src/port/interpolation/FrameInterpolation.h b/src/port/interpolation/FrameInterpolation.h
index bd544f621..612db4160 100644
--- a/src/port/interpolation/FrameInterpolation.h
+++ b/src/port/interpolation/FrameInterpolation.h
@@ -74,8 +74,12 @@ void FrameInterpolation_RecordSetMatrixTransformation(Mat4* dest, Vec3f location
void FrameInterpolation_RecordCalculateOrientationMatrix(Mat3*, f32, f32, f32, s16);
+void FrameInterpolation_RecordTranslateRotate(Mat4* dest, Vec3f pos, Vec3s rotation);
+
+//void FrameInterpolation_func_80062B18(f32* arg0, f32* arg1, f32* arg2, arg3, arg4, arg5, arg6, arg7);
+
#ifdef __cplusplus
}
#endif
-#endif // __FRAME_INTERPOLATION_H \ No newline at end of file
+#endif // __FRAME_INTERPOLATION_H
diff --git a/src/render_player.c b/src/render_player.c
index ff33db379..d16c4380c 100644
--- a/src/render_player.c
+++ b/src/render_player.c
@@ -903,6 +903,8 @@ void mtxf_translate_rotate(Mat4 dest, Vec3f pos, Vec3s orientation) {
f32 sinZ = sins(orientation[2]);
f32 cosZ = coss(orientation[2]);
+ FrameInterpolation_RecordTranslateRotate(dest, pos, orientation);
+
dest[0][0] = (cosY * cosZ) + ((sinX * sinY) * sinZ);
dest[1][0] = (-cosY * sinZ) + ((sinX * sinY) * cosZ);
dest[2][0] = cosX * sinY;
@@ -1609,7 +1611,8 @@ void render_kart(Player* player, s8 playerId, s8 screenId, s8 arg3) {
f32 sp140;
s16 temp_v1;
s16 thing;
-
+
+ FrameInterpolation_RecordOpenChild("Player", playerId | screenId << 8);
if (player->unk_044 & 0x2000) {
sp14C[0] = 0;
sp14C[1] = player->unk_048[screenId];
@@ -1666,7 +1669,6 @@ void render_kart(Player* player, s8 playerId, s8 screenId, s8 arg3) {
// convert_to_fixed_point_matrix(&gGfxPool->mtxKart[playerId + (screenId * 8)], mtx);
// @port: Tag the transform.
- FrameInterpolation_RecordOpenChild("Player", playerId | screenId << 8);
if ((player->effects & BOO_EFFECT) == BOO_EFFECT) {
if (screenId == playerId) {
diff --git a/src/render_player.h b/src/render_player.h
index e11c7c3eb..3f9d06406 100644
--- a/src/render_player.h
+++ b/src/render_player.h
@@ -1,5 +1,5 @@
-#ifndef CODE_8001F980_H
-#define CODE_8001F980_H
+#ifndef RENDER_PLAYER_H
+#define RENDER_PLAYER_H
#include <common_structs.h>
#include "buffers.h"
@@ -278,4 +278,4 @@ extern s16 D_80165150[4][8];
extern s16 D_80165190[4][8];
extern s16 D_801651D0[4][8];
-#endif
+#endif // RENDER_PLAYER_H