DS: Use smaller quads for water outside map

This commit is contained in:
UnknownShadow200 2025-01-18 07:11:50 +11:00
parent 69f0cda9c7
commit c03dffbf5f
2 changed files with 25 additions and 20 deletions

View file

@ -17,7 +17,8 @@ void Gfx_Create(void) {
Gfx.MaxTexWidth = 256; Gfx.MaxTexWidth = 256;
Gfx.MaxTexHeight = 256; Gfx.MaxTexHeight = 256;
//Gfx.MaxTexSize = 256 * 256; //Gfx.MaxTexSize = 256 * 256;
Gfx.Created = true; Gfx.Created = true;
Gfx.Limitations = GFX_LIMIT_VERTEX_ONLY_FOG;
glInit(); glInit();
glClearColor(0, 15, 10, 31); glClearColor(0, 15, 10, 31);
@ -445,25 +446,25 @@ void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); }
*-----------------------------------------------------State management----------------------------------------------------* *-----------------------------------------------------State management----------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static cc_bool skipRendering; static cc_bool skipRendering;
static cc_bool backfaceCull;
static cc_bool backfaceCullEnabled;
static cc_bool fogEnabled; static cc_bool fogEnabled;
static FogFunc fogMode; static FogFunc fogMode;
static float fogDensityEnd; static float fogDensityEnd;
static void SetPolygonMode() { static void SetPolygonMode() {
glPolyFmt( u32 fmt =
POLY_ALPHA(31) | POLY_ALPHA(31) |
(backfaceCullEnabled ? POLY_CULL_BACK : POLY_CULL_NONE) | (backfaceCull ? POLY_CULL_BACK : POLY_CULL_NONE) |
(fogEnabled ? POLY_FOG : 0) | (fogEnabled ? POLY_FOG : 0) |
POLY_RENDER_FAR_POLYS | POLY_RENDER_FAR_POLYS |
POLY_RENDER_1DOT_POLYS POLY_RENDER_1DOT_POLYS;
);
GFX_POLY_FORMAT = fmt;
} }
void Gfx_SetFaceCulling(cc_bool enabled) { void Gfx_SetFaceCulling(cc_bool enabled) {
backfaceCullEnabled = enabled; backfaceCull = enabled;
SetPolygonMode(); SetPolygonMode();
} }
@ -495,17 +496,17 @@ static void RecalculateFog() {
} }
glFogShift(shift); glFogShift(shift);
glFogOffset(0); GFX_FOG_OFFSET = 0;
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
int distance = (i * 512 + 256) * (0x400 >> shift); int distance = (i * 512 + 256) * (0x400 >> shift);
int intensity = distance * 127 / fogEnd; int intensity = distance * 127 / fogEnd;
if(intensity > 127) intensity = 127; if(intensity > 127) intensity = 127;
glFogDensity(i, intensity); GFX_FOG_TABLE[i] = intensity;
} }
glFogDensity(31, 127); GFX_FOG_TABLE[31] = 127;
} else { } else {
// TODO? // TODO?
} }
@ -517,11 +518,12 @@ void Gfx_SetFog(cc_bool enabled) {
} }
void Gfx_SetFogCol(PackedCol color) { void Gfx_SetFogCol(PackedCol color) {
int r = PackedCol_R(color); int r = PackedCol_R(color) >> 3;
int g = PackedCol_G(color); int g = PackedCol_G(color) >> 3;
int b = PackedCol_B(color); int b = PackedCol_B(color) >> 3;
int a = 31;
glFogColor(r >> 3, g >> 3, b >> 3, 31); GFX_FOG_COLOR = RGB15(r, g, b) | (a << 16);
} }
void Gfx_SetFogDensity(float value) { void Gfx_SetFogDensity(float value) {
@ -560,7 +562,7 @@ static int lastMatrix;
void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) { void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
if (type != lastMatrix) { if (type != lastMatrix) {
lastMatrix = type; lastMatrix = type;
MATRIX_CONTROL = matrix_modes[type]; MATRIX_CONTROL = matrix_modes[type];
} }
@ -582,8 +584,11 @@ void Gfx_LoadMatrix(MatrixType type, const struct Matrix* matrix) {
// aka only from -8.0 to 8.0 // aka only from -8.0 to 8.0
// That's way too small to be useful, so counteract that by scaling down // That's way too small to be useful, so counteract that by scaling down
// vertices and then scaling up the matrix multiplication // vertices and then scaling up the matrix multiplication
if (type == MATRIX_VIEW) if (type == MATRIX_VIEW) {
glScalef32(floattof32(64.0f), floattof32(64.0f), floattof32(64.0f)); MATRIX_SCALE = floattof32(64.0f); // X scale
MATRIX_SCALE = floattof32(64.0f); // Y scale
MATRIX_SCALE = floattof32(64.0f); // Z scale
}
} }
void Gfx_LoadMVP(const struct Matrix* view, const struct Matrix* proj, struct Matrix* mvp) { void Gfx_LoadMVP(const struct Matrix* view, const struct Matrix* proj, struct Matrix* mvp) {