From 1a810d74cc8531ce486bcb1c399cc6798fa1b51d Mon Sep 17 00:00:00 2001 From: MegaMech Date: Fri, 16 May 2025 21:43:05 -0600 Subject: [PATCH] test --- src/actors/item_box/render.inc.c | 6 ++++++ src/actors/mario_sign/render.inc.c | 2 +- src/actors/yoshi_egg/render.inc.c | 4 ++-- src/animation.c | 2 +- src/engine/Matrix.cpp | 4 +++- src/port/interpolation/FrameInterpolation.cpp | 4 ++++ src/port/interpolation/FrameInterpolation.h | 2 +- src/racing/math_util.c | 2 ++ 8 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/actors/item_box/render.inc.c b/src/actors/item_box/render.inc.c index d4a96a0e3..fe793ba9a 100644 --- a/src/actors/item_box/render.inc.c +++ b/src/actors/item_box/render.inc.c @@ -1,6 +1,7 @@ #include #include #include +#include "port/interpolation/FrameInterpolation.h" /** * @brief Renders the item box actor. @@ -28,6 +29,11 @@ void render_actor_item_box(Camera* camera, struct ItemBox* item_box) { temp_f0 = is_within_render_distance(camera->pos, item_box->pos, camera->rot[1], 0.0f, gCameraZoom[camera - camera1], 4000000.0f); + + FrameInterpolation_RecordMatrixPush(someMatrix1); + FrameInterpolation_RecordMatrixPush(someMatrix2); + + if (CVarGetInteger("gNoCulling", 0) == 1) { temp_f0 = CLAMP(temp_f0, 0.0f, 600000.0f); } diff --git a/src/actors/mario_sign/render.inc.c b/src/actors/mario_sign/render.inc.c index 0bf10bf88..559f3ec0b 100644 --- a/src/actors/mario_sign/render.inc.c +++ b/src/actors/mario_sign/render.inc.c @@ -33,7 +33,7 @@ void render_actor_mario_sign(Camera* arg0, UNUSED Mat4 arg1, struct Actor* arg2) if (render_set_position(mtx, 0) != 0) { gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_sign); } - FrameInterpolation_RecordMatrixPop(mtx); + //FrameInterpolation_RecordMatrixPop(mtx); } } diff --git a/src/actors/yoshi_egg/render.inc.c b/src/actors/yoshi_egg/render.inc.c index f39524aa3..e0e5aa89a 100644 --- a/src/actors/yoshi_egg/render.inc.c +++ b/src/actors/yoshi_egg/render.inc.c @@ -62,7 +62,7 @@ void render_actor_yoshi_egg(Camera* arg0, Mat4 arg1, struct YoshiValleyEgg* egg, gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING); gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_16D70); - FrameInterpolation_RecordMatrixPop(sp60); + // FrameInterpolation_RecordMatrixPop(sp60); } else { arg1[3][0] = egg->pos[0]; arg1[3][1] = egg->pos[1]; @@ -74,6 +74,6 @@ void render_actor_yoshi_egg(Camera* arg0, Mat4 arg1, struct YoshiValleyEgg* egg, gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_egg_lod0); } - FrameInterpolation_RecordMatrixPop(arg1); + //FrameInterpolation_RecordMatrixPop(arg1); } } diff --git a/src/animation.c b/src/animation.c index ed290ef7a..d2f33301c 100644 --- a/src/animation.c +++ b/src/animation.c @@ -108,7 +108,7 @@ void render_limb_or_add_mtx(Armature* arg0, s16* arg1, AnimationLimbVector arg2, model = (virtualModel); gSPDisplayList(gDisplayListHead++, model); } - FrameInterpolation_RecordMatrixPop(modelMatrix); + //FrameInterpolation_RecordMatrixPop(modelMatrix); } void render_armature(Armature* animation, Animation* arg1, s16 timeCycle) { diff --git a/src/engine/Matrix.cpp b/src/engine/Matrix.cpp index e46804ad5..f79bc27bf 100644 --- a/src/engine/Matrix.cpp +++ b/src/engine/Matrix.cpp @@ -11,10 +11,12 @@ extern "C" { void AddMatrix(std::vector& stack, Mat4 mtx, s32 flags) { // Push a new matrix to the stack + +//FrameInterpolation_RecordMatrixPush((Mat4*) &mtx); + stack.emplace_back(); // Convert to a fixed-point matrix - FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mtx, &stack.back()); guMtxF2L(mtx, &stack.back()); // Load the matrix diff --git a/src/port/interpolation/FrameInterpolation.cpp b/src/port/interpolation/FrameInterpolation.cpp index a674c1ff2..1ae649e0a 100644 --- a/src/port/interpolation/FrameInterpolation.cpp +++ b/src/port/interpolation/FrameInterpolation.cpp @@ -520,6 +520,10 @@ void FrameInterpolation_RecordActorPosRotMatrix(void) { } void FrameInterpolation_RecordMatrixPush(Mat4* matrix) { + if (is_recording) { + append(Op::MatrixPop).matrix_ptr = { (Mat4**)matrix }; + } + if (!is_recording) return; diff --git a/src/port/interpolation/FrameInterpolation.h b/src/port/interpolation/FrameInterpolation.h index 93f4dd0a9..533178780 100644 --- a/src/port/interpolation/FrameInterpolation.h +++ b/src/port/interpolation/FrameInterpolation.h @@ -35,7 +35,7 @@ void FrameInterpolation_RecordActorPosRotMatrix(void); void FrameInterpolation_RecordMatrixPosRotXYZ(Mat4 out, Vec3f pos, Vec3s orientation); -void FrameInterpolation_RecordMatrixPush(Mat4* mtx); +void FrameInterpolation_RecordMatrixPush(Mat4* matrix); void FrameInterpolation_RecordMatrixPop(Mat4* mtx); diff --git a/src/racing/math_util.c b/src/racing/math_util.c index f1dd6bf5d..0f96c3117 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -190,6 +190,8 @@ void mtxf_identity(Mat4 mtx) { // Add a translation vector to a matrix, mat is the matrix to add, dest is the destination matrix, pos is the // translation vector void add_translate_mat4_vec3f(Mat4 mat, Mat4 dest, Vec3f pos) { + FrameInterpolation_RecordMatrixTranslate(dest, pos); + dest[3][0] = mat[3][0] + pos[0]; dest[3][1] = mat[3][1] + pos[1]; dest[3][2] = mat[3][2] + pos[2];