mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
NDS: Implement water translucency partially
This commit is contained in:
parent
eb84b2e607
commit
fe086a089d
@ -101,7 +101,7 @@ void ResetGPU(void) {
|
|||||||
|
|
||||||
GFX_ALPHA_TEST = 7; // Alpha threshold ranges from 0 to 15
|
GFX_ALPHA_TEST = 7; // Alpha threshold ranges from 0 to 15
|
||||||
|
|
||||||
GFX_CONTROL = GL_ANTIALIAS | GL_TEXTURE_2D | GL_FOG;
|
GFX_CONTROL = GL_ANTIALIAS | GL_TEXTURE_2D | GL_FOG | GL_BLEND;
|
||||||
|
|
||||||
GFX_CLEAR_DEPTH = GL_MAX_DEPTH;
|
GFX_CLEAR_DEPTH = GL_MAX_DEPTH;
|
||||||
GFX_TEX_FORMAT = 0;
|
GFX_TEX_FORMAT = 0;
|
||||||
@ -703,14 +703,16 @@ void Gfx_DeleteDynamicVb(GfxResourceID* vb) { Gfx_DeleteVb(vb); }
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static cc_bool skipRendering;
|
static cc_bool skipRendering;
|
||||||
static cc_bool backfaceCull;
|
static cc_bool backfaceCull;
|
||||||
|
static cc_bool alphaBlend;
|
||||||
|
|
||||||
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() {
|
||||||
|
int blend = !gfx_rendering2D && alphaBlend;
|
||||||
u32 fmt =
|
u32 fmt =
|
||||||
POLY_ALPHA(31) |
|
POLY_ALPHA(blend ? 14 : 31) |
|
||||||
(backfaceCull ? 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 |
|
||||||
@ -725,11 +727,8 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void SetAlphaBlend(cc_bool enabled) {
|
static void SetAlphaBlend(cc_bool enabled) {
|
||||||
/*if (enabled) {
|
alphaBlend = enabled;
|
||||||
glEnable(GL_BLEND);
|
SetPolygonMode();
|
||||||
} else {
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaArgBlend(cc_bool enabled) { }
|
void Gfx_SetAlphaArgBlend(cc_bool enabled) { }
|
||||||
|
@ -243,6 +243,7 @@ void Gfx_Make2DQuad(const struct Texture* tex, PackedCol color, struct VertexTex
|
|||||||
static cc_bool gfx_hadFog;
|
static cc_bool gfx_hadFog;
|
||||||
|
|
||||||
void Gfx_Begin2D(int width, int height) {
|
void Gfx_Begin2D(int width, int height) {
|
||||||
|
gfx_rendering2D = true;
|
||||||
struct Matrix ortho;
|
struct Matrix ortho;
|
||||||
/* intentionally biased more towards positive Z to reduce 2D clipping issues on the DS */
|
/* intentionally biased more towards positive Z to reduce 2D clipping issues on the DS */
|
||||||
Gfx_CalcOrthoMatrix(&ortho, (float)width, (float)height, -100.0f, 1000.0f);
|
Gfx_CalcOrthoMatrix(&ortho, (float)width, (float)height, -100.0f, 1000.0f);
|
||||||
@ -255,16 +256,15 @@ void Gfx_Begin2D(int width, int height) {
|
|||||||
|
|
||||||
gfx_hadFog = Gfx_GetFog();
|
gfx_hadFog = Gfx_GetFog();
|
||||||
if (gfx_hadFog) Gfx_SetFog(false);
|
if (gfx_hadFog) Gfx_SetFog(false);
|
||||||
gfx_rendering2D = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_End2D(void) {
|
void Gfx_End2D(void) {
|
||||||
|
gfx_rendering2D = false;
|
||||||
Gfx_SetDepthTest(true);
|
Gfx_SetDepthTest(true);
|
||||||
Gfx_SetDepthWrite(true);
|
Gfx_SetDepthWrite(true);
|
||||||
Gfx_SetAlphaBlending(false);
|
Gfx_SetAlphaBlending(false);
|
||||||
|
|
||||||
if (gfx_hadFog) Gfx_SetFog(true);
|
if (gfx_hadFog) Gfx_SetFog(true);
|
||||||
gfx_rendering2D = false;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user