Polymost sky Z buffer hack from Nuke.YKT

git-svn-id: https://svn.eduke32.com/eduke32@7415 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-03-19 17:08:51 +00:00
parent 4522a8902b
commit 483fbe4cd6

View file

@ -2822,7 +2822,7 @@ void polymost_setupglowtexture(const int32_t texunits, const int32_t tex)
// +4 means it's a sprite, so wraparound isn't needed
// drawpoly's hack globals
static int32_t pow2xsplit = 0, skyclamphack = 0;
static int32_t pow2xsplit = 0, skyclamphack = 0, skyzbufferhack = 0;
static float drawpoly_alpha = 0.f;
static uint8_t drawpoly_blend = 0;
@ -3348,6 +3348,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
; /* do nothing */
}
static int32_t skyzbufferhack_pass = 0;
if (!waloff[globalpicnum])
{
glEnable(GL_BLEND);
@ -3409,6 +3411,9 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
globaltinting_apply(pc);
if (skyzbufferhack_pass)
pc[3] = 0.01f;
glColor4f(pc[0], pc[1], pc[2], pc[3]);
//POGOTODO: remove this, replace it with a shader implementation
@ -3681,6 +3686,16 @@ do
globalshade = shade;
fullbright_pass = 0;
}
if (skyzbufferhack && skyzbufferhack_pass == 0)
{
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
xtex = xtex2, ytex = ytex2, otex = otex2;
skyzbufferhack_pass++;
polymost_drawpoly(dpxy, n, DAMETH_MASK);
xtex = bxtex, ytex = bytex, otex = botex;
skyzbufferhack_pass--;
}
}
@ -5063,6 +5078,8 @@ static void polymost_drawalls(int32_t const bunch)
if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; }
skyzbufferhack = 1;
if (!usehightile || !hicfindskybox(globalpicnum, globalpal))
{
float const dd = fxdimen*.0000001f; //Adjust sky depth based on screen size!
@ -5353,6 +5370,7 @@ static void polymost_drawalls(int32_t const bunch)
}
skyclamphack = 0;
skyzbufferhack = 0;
if (!nofog)
polymost_setFogEnabled(true);
}
@ -5409,6 +5427,8 @@ static void polymost_drawalls(int32_t const bunch)
if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; }
skyzbufferhack = 1;
if (!usehightile || !hicfindskybox(globalpicnum, globalpal))
{
float const dd = fxdimen*.0000001f; //Adjust sky depth based on screen size!
@ -5699,6 +5719,7 @@ static void polymost_drawalls(int32_t const bunch)
}
skyclamphack = 0;
skyzbufferhack = 0;
if (!nofog)
polymost_setFogEnabled(true);
}