fix a matrix (#185)

* fix a matrix

* remove LOAD_ASSET
This commit is contained in:
coco875
2025-02-07 22:30:36 +01:00
committed by GitHub
parent 8e0e95d7d1
commit 6f8cbc0279
6 changed files with 18 additions and 8 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
#include "main.h"
#include "collision_viewer.h"
#include "math_util.h"
#include "assets/other_textures.h"
#include "assets/common_data.h"
@@ -25,7 +26,7 @@ void render_collision(void) {
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
// Set matrix
gSPMatrix(gDisplayListHead++, LOAD_ASSET(D_0D008E98), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
gSPMatrix(gDisplayListHead++, &gIdentityMatrix, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
for (size_t i = 0; i < gCollisionMeshCount; i++) {
// Load vertices for this tri
+3 -1
View File
@@ -4,6 +4,8 @@
#include <mk64.h>
#include <assets/common_data.h>
#include "math_util.h"
extern s16 D_800E43A8;
// rsp init
@@ -16,5 +18,5 @@ UNUSED void gfx_func_80040D00(void) {
guOrtho(&gGfxPool->mtxScreen, 0.0f, SCREEN_WIDTH, 0.0f, SCREEN_HEIGHT, -1.0f, 1.0f, 1.0f);
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(gGfxPool), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gIdentityMatrix), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
+3 -2
View File
@@ -3,6 +3,7 @@
#include "mk64.h"
#include <assets/common_data.h>
#include "port/Engine.h"
#include "math_util.h"
#include <stdio.h>
int gfx_create_framebuffer(uint32_t width, uint32_t height, uint32_t native_width, uint32_t native_height,
@@ -36,7 +37,7 @@ void FB_CreateFramebuffers(void) {
void FB_CopyToFramebuffer(Gfx** gfxP, s32 fb_src, s32 fb_dest, u8 oncePerFrame, u8* hasCopied) {
Gfx* gfx = *gfxP;
gSPMatrix(gfx++, LOAD_ASSET(D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gfx++, &gIdentityMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetOtherMode(gfx++,
G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE |
@@ -110,7 +111,7 @@ void FB_WriteFramebufferSliceToCPU(Gfx** gfxP, void* buffer, u8 byteSwap) {
void FB_DrawFromFramebuffer(Gfx** gfxP, s32 fb, u8 alpha) {
Gfx* gfx = *gfxP;
gSPMatrix(gfx++, LOAD_ASSET(D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gfx++, &gIdentityMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetEnvColor(gfx++, 255, 255, 255, alpha);
+4
View File
@@ -14,6 +14,10 @@
s32 D_802B91C0[2] = { 13, 13 };
Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f };
Mtx gIdentityMatrix = {
toFixedPointMatrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0),
};
// This functions looks similar to a segment of code from func_802A4A0C in skybox_and_splitscreen.c
UNUSED s32 func_802B4F60(UNUSED s32 arg0, Vec3f arg1, UNUSED s32 arg2, UNUSED f32 arg3, UNUSED f32 arg4) {
Mat4 sp30;
+1
View File
@@ -70,5 +70,6 @@ f32 is_within_render_distance(Vec3f, Vec3f, u16, f32, f32, f32);
extern s32 D_802B91C0[];
extern Vec3f D_802B91C8;
extern Mtx gIdentityMatrix;
#endif // MATH_UTIL_H
+5 -4
View File
@@ -20,6 +20,7 @@
#include "port/Engine.h"
#include "engine/courses/Course.h"
#include "port/Game.h"
#include "math_util.h"
Vp D_802B8880[] = {
{ { { 640, 480, 511, 0 }, { 640, 480, 511, 0 } } },
@@ -408,7 +409,7 @@ void func_802A487C(Vtx* arg0, UNUSED struct UnkStruct_800DC5EC* arg1, UNUSED s32
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxScreen),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, LOAD_ASSET(D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gDisplayListHead++, &gIdentityMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPVertex(gDisplayListHead++, &arg0[4], 4, 0);
gSP2Triangles(gDisplayListHead++, 0, 3, 1, 0, 1, 3, 2, 0);
}
@@ -444,8 +445,8 @@ void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, U
sp5C[0] = 0.0f;
sp5C[1] = 0.0f;
sp5C[2] = 30000.0f;
func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, CM_GetProps()->NearPersp,
CM_GetProps()->FarPersp, 1.0f);
func_802B5564(matrix1, &sp128, camera->unk_B4, gScreenAspect, CM_GetProps()->NearPersp, CM_GetProps()->FarPersp,
1.0f);
func_802B5794(matrix2, camera->pos, camera->lookAt);
mtxf_multiplication(matrix3, matrix1, matrix2);
@@ -475,7 +476,7 @@ void func_802A4A0C(Vtx* vtx, struct UnkStruct_800DC5EC* arg1, UNUSED s32 arg2, U
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxScreen),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, LOAD_ASSET(D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(gDisplayListHead++, &gIdentityMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPVertex(gDisplayListHead++, &vtx[0], 4, 0);
gSP2Triangles(gDisplayListHead++, 0, 3, 1, 0, 1, 3, 2, 0);
if (GetCourse() == GetRainbowRoad()) {