Interp Works

This commit is contained in:
MegaMech
2025-05-16 19:06:17 -06:00
parent 09fb8d8421
commit 3ec0901718
8 changed files with 31 additions and 21 deletions
+8 -7
View File
@@ -11,10 +11,9 @@
* @param arg2
*/
void render_actor_mario_sign(Camera* arg0, UNUSED Mat4 arg1, struct Actor* arg2) {
Mat4 sp40;
Mat4 mtx;
f32 unk;
s16 temp = arg2->flags;
FrameInterpolation_RecordOpenChild(arg2, 0);
if (temp & 0x800) {
return;
}
@@ -24,14 +23,16 @@ void render_actor_mario_sign(Camera* arg0, UNUSED Mat4 arg1, struct Actor* arg2)
unk = MAX(unk, 0.0f);
}
if (!(unk < 0.0f)) {
FrameInterpolation_RecordMatrixPush(mtx);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
mtxf_pos_rotation_xyz(sp40, arg2->pos, arg2->rot);
if (render_set_position(sp40, 0) != 0) {
mtxf_pos_rotation_xyz(mtx, arg2->pos, arg2->rot);
if (render_set_position(mtx, 0) != 0) {
gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_sign);
}
FrameInterpolation_RecordMatrixPop(mtx);
}
FrameInterpolation_RecordCloseChild();
}
+2 -2
View File
@@ -11,10 +11,10 @@ void update_actor_mario_sign(struct Actor* arg0) {
arg0->pos[1] += 4.0f;
if (arg0->pos[1] > 800.0f) {
arg0->flags |= 0x800;
arg0->rot[1] += 4;
arg0->rot[1] += 1820;
}
} else {
arg0->rot[1] += 4;
arg0->rot[1] += 182;
}
}
}
+7
View File
@@ -51,6 +51,9 @@ void render_actor_yoshi_egg(Camera* arg0, Mat4 arg1, struct YoshiValleyEgg* egg,
sp5C[0] = 0;
sp5C[1] = egg->eggRot;
sp5C[2] = 0;
FrameInterpolation_RecordMatrixPush(sp60);
mtxf_pos_rotation_xyz(sp60, egg->pos, sp5C);
if (render_set_position(sp60, 0) == 0) {
return;
@@ -58,14 +61,18 @@ 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);
} else {
arg1[3][0] = egg->pos[0];
arg1[3][1] = egg->pos[1];
arg1[3][2] = egg->pos[2];
FrameInterpolation_RecordMatrixPush(arg1);
if (render_set_position(arg1, 0) != 0) {
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_egg_lod0);
}
FrameInterpolation_RecordMatrixPop(arg1);
}
}
+5 -1
View File
@@ -35,6 +35,9 @@ void convert_to_fixed_point_matrix_animation(Mtx* dest, Mat4 src) {
}
void mtxf_translate_rotate2(Mat4 dest, Vec3f pos, Vec3s angle) {
FrameInterpolation_RecordMatrixPosRotXYZ(&dest, pos, angle);
f32 sx = sins(angle[0]);
f32 cx = coss(angle[0]);
@@ -92,7 +95,7 @@ void render_limb_or_add_mtx(Armature* arg0, s16* arg1, AnimationLimbVector arg2,
}
angle[i] = arg1[arg2[i].indexCycle + some_offset];
}
FrameInterpolation_RecordMatrixPush(modelMatrix);
mtxf_translate_rotate2(modelMatrix, pos, angle);
//convert_to_fixed_point_matrix_animation(&gGfxPool->mtxHud[gMatrixHudCount], modelMatrix);
sMatrixStackSize += 1;
@@ -104,6 +107,7 @@ void render_limb_or_add_mtx(Armature* arg0, s16* arg1, AnimationLimbVector arg2,
model = (virtualModel);
gSPDisplayList(gDisplayListHead++, model);
}
FrameInterpolation_RecordMatrixPop(modelMatrix);
}
void render_armature(Armature* animation, Animation* arg1, s16 timeCycle) {
-3
View File
@@ -10,9 +10,6 @@ extern "C" {
}
void AddMatrix(std::vector<Mtx>& stack, Mat4 mtx, s32 flags) {
// Reserve space if needed to avoid reallocation overhead
stack.reserve(1000);
// Push a new matrix to the stack
stack.emplace_back();
+1
View File
@@ -379,6 +379,7 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) {
mtx_replacements.emplace_back();
}
}
// printf("mtxf size: %d\n", mtx_replacements.size());
time -= fps;
@@ -330,11 +330,11 @@ struct InterpolateCtx {
break;
case Op::MatrixPush:
// Matrix_Push(&gInterpolationMatrix);
Matrix_Push((Matrix**)&gInterpolationMatrix);
break;
case Op::MatrixPop:
// Matrix_Pop(&gInterpolationMatrix);
Matrix_Pop((Matrix**)&gInterpolationMatrix);
break;
// Unused on SF64
@@ -519,11 +519,11 @@ void FrameInterpolation_RecordActorPosRotMatrix(void) {
next_is_actor_pos_rot_matrix = true;
}
void FrameInterpolation_RecordMatrixPush(Mat4** matrix) {
void FrameInterpolation_RecordMatrixPush(Mat4* matrix) {
if (!is_recording)
return;
append(Op::MatrixPush).matrix_ptr = { matrix };
append(Op::MatrixPush).matrix_ptr = { (Mat4**)matrix };
}
void FrameInterpolation_RecordMarker(const char* file, int line) {
@@ -533,10 +533,10 @@ void FrameInterpolation_RecordMarker(const char* file, int line) {
// append(Op::Marker).marker = { file, line };
}
void FrameInterpolation_RecordMatrixPop(Mat4** matrix) {
void FrameInterpolation_RecordMatrixPop(Mat4* matrix) {
if (!is_recording)
return;
append(Op::MatrixPop).matrix_ptr = { matrix };
append(Op::MatrixPop).matrix_ptr = { (Mat4**)matrix };
}
void FrameInterpolation_RecordMatrixPut(MtxF* src) {
+2 -2
View File
@@ -35,9 +35,9 @@ void FrameInterpolation_RecordActorPosRotMatrix(void);
void FrameInterpolation_RecordMatrixPosRotXYZ(Mat4 out, Vec3f pos, Vec3s orientation);
//void FrameInterpolation_RecordMatrixPush(Matrix** mtx);
void FrameInterpolation_RecordMatrixPush(Mat4* mtx);
//void FrameInterpolation_RecordMatrixPop(Matrix** mtx);
void FrameInterpolation_RecordMatrixPop(Mat4* mtx);
//void FrameInterpolation_RecordMatrixMult(Matrix* matrix, MtxF* mf, u8 mode);