Float precision rendering

This commit is contained in:
Sonic Dreamcaster 2025-02-18 20:12:11 -03:00
parent 608d078346
commit c76d6277a8
5 changed files with 24 additions and 9 deletions

View file

@ -17,7 +17,8 @@
"_LANGUAGE_C",
"__sgi",
"_MIPS_SZLONG=32",
"F3DEX_GBI"
"F3DEX_GBI",
"GBI_FLOATS"
],
"cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments
"cppStandard": "${default}"

View file

@ -85,6 +85,7 @@ add_compile_definitions(
NON_MATCHING=1
NON_EQUIVALENT=1
AVOID_UB=1
GBI_FLOATS=1
)
# Find necessary libraries

View file

@ -1249,6 +1249,7 @@ void AllRangeGround_Draw(void) {
Matrix_Push(&gGfxMatrix);
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild("360Ground", i);
Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i], MTXF_APPLY);
@ -1287,7 +1288,7 @@ void AllRangeGround_Draw(void) {
}
Matrix_Pop(&gGfxMatrix);
// @port: Tag the transform.
// @port: Pop the transform.
FrameInterpolation_RecordCloseChild();
}
}

View file

@ -12,8 +12,13 @@
#include <libultraship.h>
#ifdef GBI_FLOATS
#include <string.h>
#endif
#ifndef GBI_FLOATS
void guMtxF2L(float mf[4][4], Mtx* m) {
unsigned int r, c;
int r, c;
s32 tmp1;
s32 tmp2;
s32* m1 = &m->m[0][0];
@ -29,7 +34,7 @@ void guMtxF2L(float mf[4][4], Mtx* m) {
}
void guMtxL2F(float mf[4][4], Mtx* m) {
unsigned int r, c;
int r, c;
u32 tmp1;
u32 tmp2;
u32* m1;
@ -48,9 +53,14 @@ void guMtxL2F(float mf[4][4], Mtx* m) {
}
}
}
#else
void guMtxF2L(float mf[4][4], Mtx* m) {
memcpy(m, mf, sizeof(Mtx));
}
#endif
void guMtxIdentF(f32 mf[4][4]) {
unsigned int r, c;
void guMtxIdentF(float mf[4][4]) {
int r, c;
for (r = 0; r < 4; r++) {
for (c = 0; c < 4; c++) {
if (r == c) {
@ -63,9 +73,11 @@ void guMtxIdentF(f32 mf[4][4]) {
}
void guMtxIdent(Mtx* m) {
#ifndef GBI_FLOATS
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
#else
guMtxIdentF(m->mf);
#endif
}

View file

@ -493,7 +493,7 @@ void Matrix_ToMtx(Mtx* dest) {
// Converts the Mtx src to a Matrix, putting the result in dest
void Matrix_FromMtx(Mtx* src, Matrix* dest) {
FrameInterpolation_RecordMatrixMtxFToMtx(src, dest);
guMtxF2L(src->m, dest->m);
guMtxF2L(src->mf, dest->m);
}
// Applies the transform matrix mtx to the vector src, putting the result in dest