polymost.cpp: fix issue where GL_ALPHA_TEST could be enabled in certain instances when executing polymost_drawrooms() and better handle when we are drawing without a texture in polymost_drawpoly()

git-svn-id: https://svn.eduke32.com/eduke32@7682 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/polymost.cpp
This commit is contained in:
pogokeen 2019-05-25 14:59:14 +00:00 committed by Christoph Oelckers
parent 9b621c0ef2
commit f92ec7bb89

View file

@ -2264,12 +2264,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
if (!waloff[globalpicnum]) if (!waloff[globalpicnum])
{ {
tileLoad(globalpicnum); tileLoad(globalpicnum);
if (!waloff[globalpicnum])
{
tsiz.x = tsiz.y = 1;
method = DAMETH_MASK; //Hack to update Z-buffer for invalid mirror textures
}
} }
Bassert(n <= MAX_DRAWPOLY_VERTS); Bassert(n <= MAX_DRAWPOLY_VERTS);
@ -2335,6 +2329,12 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
return; return;
} }
if (!waloff[globalpicnum])
{
tsiz.x = tsiz.y = 1;
glColorMask(false, false, false, false); //Hack to update Z-buffer for invalid mirror textures
}
static int32_t fullbright_pass = 0; static int32_t fullbright_pass = 0;
if (pth->flags & PTH_HASFULLBRIGHT && r_fullbrights) if (pth->flags & PTH_HASFULLBRIGHT && r_fullbrights)
@ -2692,7 +2692,12 @@ do
} }
if (videoGetRenderMode() != REND_POLYMOST) if (videoGetRenderMode() != REND_POLYMOST)
{
if (!waloff[globalpicnum])
glColorMask(true, true, true, true);
return; return;
}
if (!(pth->flags & PTH_INDEXED)) if (!(pth->flags & PTH_INDEXED))
{ {
@ -2732,6 +2737,9 @@ do
xtex = bxtex, ytex = bytex, otex = botex; xtex = bxtex, ytex = bytex, otex = botex;
skyzbufferhack_pass--; skyzbufferhack_pass--;
} }
if (!waloff[globalpicnum])
glColorMask(true, true, true, true);
} }
@ -5442,6 +5450,7 @@ void polymost_drawrooms()
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS glDepthFunc(GL_ALWAYS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset // glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset
@ -5670,12 +5679,6 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
if ((uint32_t)globalpicnum >= MAXTILES) if ((uint32_t)globalpicnum >= MAXTILES)
globalpicnum = 0; globalpicnum = 0;
if (!waloff[globalpicnum])
{
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
}
globalorientation = (int32_t)wal->cstat; globalorientation = (int32_t)wal->cstat;
DO_TILE_ANIM(globalpicnum, (int16_t)thewall[z]+16384); DO_TILE_ANIM(globalpicnum, (int16_t)thewall[z]+16384);
@ -5866,19 +5869,6 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
polymost_updaterotmat(); polymost_updaterotmat();
polymost_drawpoly(dpxy, n, method); polymost_drawpoly(dpxy, n, method);
polymost_identityrotmat(); polymost_identityrotmat();
if (!waloff[globalpicnum])
{
// restore this to normal
if (polymost_maskWallHasTranslucency(wal))
{
glEnable(GL_ALPHA_TEST);
} else
{
glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
}
}
} }
typedef struct typedef struct