mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-04-28 12:27:59 +03:00
Float precision rendering
This commit is contained in:
parent
608d078346
commit
c76d6277a8
5 changed files with 24 additions and 9 deletions
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
|
@ -17,7 +17,8 @@
|
||||||
"_LANGUAGE_C",
|
"_LANGUAGE_C",
|
||||||
"__sgi",
|
"__sgi",
|
||||||
"_MIPS_SZLONG=32",
|
"_MIPS_SZLONG=32",
|
||||||
"F3DEX_GBI"
|
"F3DEX_GBI",
|
||||||
|
"GBI_FLOATS"
|
||||||
],
|
],
|
||||||
"cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments
|
"cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments
|
||||||
"cppStandard": "${default}"
|
"cppStandard": "${default}"
|
||||||
|
|
|
@ -85,6 +85,7 @@ add_compile_definitions(
|
||||||
NON_MATCHING=1
|
NON_MATCHING=1
|
||||||
NON_EQUIVALENT=1
|
NON_EQUIVALENT=1
|
||||||
AVOID_UB=1
|
AVOID_UB=1
|
||||||
|
GBI_FLOATS=1
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find necessary libraries
|
# Find necessary libraries
|
||||||
|
|
|
@ -1249,6 +1249,7 @@ void AllRangeGround_Draw(void) {
|
||||||
|
|
||||||
Matrix_Push(&gGfxMatrix);
|
Matrix_Push(&gGfxMatrix);
|
||||||
|
|
||||||
|
// @port: Tag the transform.
|
||||||
FrameInterpolation_RecordOpenChild("360Ground", i);
|
FrameInterpolation_RecordOpenChild("360Ground", i);
|
||||||
|
|
||||||
Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i], MTXF_APPLY);
|
Matrix_Translate(gGfxMatrix, sGroundPositions360x_FIX[i], 0.0f, sGroundPositions360z_FIX[i], MTXF_APPLY);
|
||||||
|
@ -1287,7 +1288,7 @@ void AllRangeGround_Draw(void) {
|
||||||
}
|
}
|
||||||
Matrix_Pop(&gGfxMatrix);
|
Matrix_Pop(&gGfxMatrix);
|
||||||
|
|
||||||
// @port: Tag the transform.
|
// @port: Pop the transform.
|
||||||
FrameInterpolation_RecordCloseChild();
|
FrameInterpolation_RecordCloseChild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,13 @@
|
||||||
|
|
||||||
#include <libultraship.h>
|
#include <libultraship.h>
|
||||||
|
|
||||||
|
#ifdef GBI_FLOATS
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef GBI_FLOATS
|
||||||
void guMtxF2L(float mf[4][4], Mtx* m) {
|
void guMtxF2L(float mf[4][4], Mtx* m) {
|
||||||
unsigned int r, c;
|
int r, c;
|
||||||
s32 tmp1;
|
s32 tmp1;
|
||||||
s32 tmp2;
|
s32 tmp2;
|
||||||
s32* m1 = &m->m[0][0];
|
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) {
|
void guMtxL2F(float mf[4][4], Mtx* m) {
|
||||||
unsigned int r, c;
|
int r, c;
|
||||||
u32 tmp1;
|
u32 tmp1;
|
||||||
u32 tmp2;
|
u32 tmp2;
|
||||||
u32* m1;
|
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]) {
|
void guMtxIdentF(float mf[4][4]) {
|
||||||
unsigned int r, c;
|
int r, c;
|
||||||
for (r = 0; r < 4; r++) {
|
for (r = 0; r < 4; r++) {
|
||||||
for (c = 0; c < 4; c++) {
|
for (c = 0; c < 4; c++) {
|
||||||
if (r == c) {
|
if (r == c) {
|
||||||
|
@ -63,9 +73,11 @@ void guMtxIdentF(f32 mf[4][4]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void guMtxIdent(Mtx* m) {
|
void guMtxIdent(Mtx* m) {
|
||||||
|
#ifndef GBI_FLOATS
|
||||||
float mf[4][4];
|
float mf[4][4];
|
||||||
|
|
||||||
guMtxIdentF(mf);
|
guMtxIdentF(mf);
|
||||||
|
|
||||||
guMtxF2L(mf, m);
|
guMtxF2L(mf, m);
|
||||||
|
#else
|
||||||
|
guMtxIdentF(m->mf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,7 +493,7 @@ void Matrix_ToMtx(Mtx* dest) {
|
||||||
// Converts the Mtx src to a Matrix, putting the result in dest
|
// Converts the Mtx src to a Matrix, putting the result in dest
|
||||||
void Matrix_FromMtx(Mtx* src, Matrix* dest) {
|
void Matrix_FromMtx(Mtx* src, Matrix* dest) {
|
||||||
FrameInterpolation_RecordMatrixMtxFToMtx(src, 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
|
// Applies the transform matrix mtx to the vector src, putting the result in dest
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue