summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorMegaMech <7255464+MegaMech@users.noreply.github.com>2025-05-23 20:56:36 -0600
committerMegaMech <7255464+MegaMech@users.noreply.github.com>2025-05-23 20:56:36 -0600
commit5418951e1fcf9cd3c5bafce0ccf629b8e75467bf (patch)
treea1e3f2a84e2859189f9479d918a56954bb29b9f3 /src/port
parent96c8c80c9c832db3cd327728d36f5042b769647f (diff)
Interpolate guScale, guRotate, SetTextMatrix
Diffstat (limited to 'src/port')
-rw-r--r--src/port/interpolation/FrameInterpolation.cpp75
-rw-r--r--src/port/interpolation/FrameInterpolation.h6
2 files changed, 80 insertions, 1 deletions
diff --git a/src/port/interpolation/FrameInterpolation.cpp b/src/port/interpolation/FrameInterpolation.cpp
index 836e6c70c..c1f4a67b6 100644
--- a/src/port/interpolation/FrameInterpolation.cpp
+++ b/src/port/interpolation/FrameInterpolation.cpp
@@ -7,6 +7,7 @@
#include "port/Engine.h"
#include "FrameInterpolation.h"
#include "matrix.h"
+#include "src/engine/Matrix.h"
extern "C" {
#include "math_util.h"
@@ -81,7 +82,10 @@ enum class Op {
SkinMatrixMtxFToMtx,
SetTransformMatrix,
SetMatrixTransformation,
- SetTranslateRotate
+ SetTranslateRotate,
+ guRotate,
+ guScale,
+ SetTextMatrix,
};
typedef pair<const void*, uintptr_t> label;
@@ -117,6 +121,29 @@ union Data {
struct {
Mat4* matrix;
+ f32 a;
+ f32 x;
+ f32 y;
+ f32 z;
+ } matrix_gu_rotate;
+
+ struct {
+ Mat4* matrix;
+ f32 x;
+ f32 y;
+ f32 z;
+ } matrix_scale_xyz;
+
+ struct {
+ Mat4* matrix;
+ f32 x;
+ f32 y;
+ f32 arg3;
+ f32 arg4;
+ } matrix_text;
+
+ struct {
+ Mat4* matrix;
u32 coord;
s16 value;
} matrix_rotate_1_coord;
@@ -249,6 +276,7 @@ MtxF* Matrix_GetCurrent() {
struct InterpolateCtx {
float step;
float w;
+ float tmp_f;
unordered_map<Mtx*, MtxF> mtx_replacements;
MtxF tmp_mtxf, tmp_mtxf2;
Mat3 tmp_mat3;
@@ -533,6 +561,33 @@ struct InterpolateCtx {
mtxf_translate_rotate(*gInterpolationMatrix, tmp_vec3f, tmp_vec3s);
break;
}
+ case Op::guRotate: {
+ tmp_f = lerp(old_op.matrix_gu_rotate.a, new_op.matrix_gu_rotate.a);
+
+ tmp_vec3f[0] = lerp(old_op.matrix_gu_rotate.x, new_op.matrix_gu_rotate.x);
+ tmp_vec3f[1] = lerp(old_op.matrix_gu_rotate.y, new_op.matrix_gu_rotate.y);
+ tmp_vec3f[2] = lerp(old_op.matrix_gu_rotate.z, new_op.matrix_gu_rotate.z);
+
+ guRotateF(*gInterpolationMatrix, tmp_f, tmp_vec3f[0], tmp_vec3f[1], tmp_vec3f[2]);
+ break;
+ }
+ case Op::guScale: {
+ tmp_vec3f[0] = lerp(old_op.matrix_scale_xyz.x, new_op.matrix_scale_xyz.x);
+ tmp_vec3f[1] = lerp(old_op.matrix_scale_xyz.y, new_op.matrix_scale_xyz.y);
+ tmp_vec3f[2] = lerp(old_op.matrix_scale_xyz.z, new_op.matrix_scale_xyz.z);
+ guScaleF(*gInterpolationMatrix, tmp_vec3f[0], tmp_vec3f[1], tmp_vec3f[2]);
+ break;
+ }
+ case Op::SetTextMatrix: {
+
+ tmp_vec3f[0] = lerp(old_op.matrix_text.x, new_op.matrix_text.x);
+ tmp_vec3f[1] = lerp(old_op.matrix_text.y, new_op.matrix_text.y);
+ tmp_vec3f[2] = lerp(old_op.matrix_text.arg3, new_op.matrix_text.arg3);
+ tmp_f = lerp(old_op.matrix_text.arg4, new_op.matrix_text.arg4);
+
+ SetTextMatrix(*gInterpolationMatrix, tmp_vec3f[0], tmp_vec3f[1], tmp_vec3f[2], tmp_f);
+ break;
+ }
}
}
}
@@ -656,6 +711,24 @@ void FrameInterpolation_RecordMatrixScale(Mat4* matrix, f32 scale) {
append(Op::MatrixScale).matrix_scale = { matrix, scale };
}
+void FrameInterpolation_Record_guRotate(Mat4* matrix, f32 a, f32 x, f32 y, f32 z) {
+ if (!is_recording)
+ return;
+ append(Op::guRotate).matrix_gu_rotate = {matrix, a, x, y, z};
+}
+
+void FrameInterpolation_Record_guScale(Mat4* matrix, f32 x, f32 y, f32 z) {
+ if (!is_recording)
+ return;
+ append(Op::guScale).matrix_scale_xyz = {matrix, x, y, z};
+}
+
+void FrameInterpolation_Record_SetTextMatrix(Mat4* matrix, f32 x, f32 y, f32 arg3, f32 arg4) {
+ if (!is_recording)
+ return;
+ append(Op::SetTextMatrix).matrix_text = {matrix, x, y, arg3, arg4};
+}
+
void FrameInterpolation_RecordMatrixMultVec3fNoTranslate(Mat4* matrix, Vec3f src, Vec3f dest) {
if (!is_recording)
return;
diff --git a/src/port/interpolation/FrameInterpolation.h b/src/port/interpolation/FrameInterpolation.h
index c59743681..742dec470 100644
--- a/src/port/interpolation/FrameInterpolation.h
+++ b/src/port/interpolation/FrameInterpolation.h
@@ -51,6 +51,12 @@ void FrameInterpolation_RecordMatrixTranslate(Mat4* matrix, Vec3f b);
void FrameInterpolation_RecordMatrixScale(Mat4* matrix, f32 scale);
+void FrameInterpolation_Record_guRotate(Mat4* matrix, f32 a, f32 x, f32 y, f32 z);
+
+void FrameInterpolation_Record_guScale(Mat4* matrix, f32 x, f32 y, f32 z);
+
+void FrameInterpolation_Record_SetTextMatrix(Mat4* matrix, f32 x, f32 y, f32 arg3, f32 arg4);
+
void FrameInterpolation_RecordMatrixRotate1Coord(Mat4* matrix, u32 coord, s16 value);
void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest);