mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
Reduce state changes and fix translucent maskwall depth buffer issue
git-svn-id: https://svn.eduke32.com/eduke32@7619 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymost.cpp
This commit is contained in:
parent
be86eb779b
commit
d2ebc8a29c
2 changed files with 28 additions and 24 deletions
|
@ -5833,9 +5833,6 @@ static void renderDrawSprite(int32_t snum)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
case REND_POLYMOST:
|
case REND_POLYMOST:
|
||||||
polymost_drawsprite(snum);
|
polymost_drawsprite(snum);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
|
|
||||||
// glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset
|
|
||||||
return;
|
return;
|
||||||
# ifdef POLYMER
|
# ifdef POLYMER
|
||||||
case REND_POLYMER:
|
case REND_POLYMER:
|
||||||
|
@ -8558,6 +8555,9 @@ killsprite:
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (videoGetRenderMode() == REND_POLYMOST)
|
if (videoGetRenderMode() == REND_POLYMOST)
|
||||||
{
|
{
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
for (i = spritesortcnt; i < numSprites; ++i)
|
for (i = spritesortcnt; i < numSprites; ++i)
|
||||||
{
|
{
|
||||||
if (tspriteptr[i] != NULL)
|
if (tspriteptr[i] != NULL)
|
||||||
|
@ -8581,6 +8581,10 @@ killsprite:
|
||||||
else
|
else
|
||||||
renderDrawMaskedWall(--maskwallcnt);
|
renderDrawMaskedWall(--maskwallcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glDepthMask(GL_FALSE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8716,10 +8720,6 @@ killsprite:
|
||||||
renderDrawMaskedWall(maskwallcnt);
|
renderDrawMaskedWall(maskwallcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
if (videoGetRenderMode() == REND_POLYMOST)
|
|
||||||
glDepthMask(GL_FALSE);
|
|
||||||
#endif
|
|
||||||
while (spritesortcnt)
|
while (spritesortcnt)
|
||||||
{
|
{
|
||||||
--spritesortcnt;
|
--spritesortcnt;
|
||||||
|
|
|
@ -2398,26 +2398,13 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
|
|
||||||
static int32_t skyzbufferhack_pass = 0;
|
static int32_t skyzbufferhack_pass = 0;
|
||||||
|
|
||||||
if (!waloff[globalpicnum])
|
if (method & DAMETH_MASKPROPS || fullbright_pass == 2)
|
||||||
{
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
}
|
|
||||||
else if (!(method & DAMETH_MASKPROPS) && fullbright_pass < 2)
|
|
||||||
{
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
float const al = alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f) :
|
float const al = alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f) :
|
||||||
(pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f);
|
(pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f);
|
||||||
|
|
||||||
glAlphaFunc(GL_GREATER, al);
|
glAlphaFunc(GL_GREATER, al);
|
||||||
handle_blend((method & DAMETH_MASKPROPS) > DAMETH_MASK, drawpoly_blend, (method & DAMETH_MASKPROPS) == DAMETH_TRANS2);
|
handle_blend((method & DAMETH_MASKPROPS) > DAMETH_MASK, drawpoly_blend, (method & DAMETH_MASKPROPS) == DAMETH_TRANS2);
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float pc[4];
|
float pc[4];
|
||||||
|
@ -2633,8 +2620,6 @@ do
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
if (videoGetRenderMode() != REND_POLYMOST)
|
if (videoGetRenderMode() != REND_POLYMOST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2670,7 +2655,9 @@ do
|
||||||
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
||||||
xtex = xtex2, ytex = ytex2, otex = otex2;
|
xtex = xtex2, ytex = ytex2, otex = otex2;
|
||||||
skyzbufferhack_pass++;
|
skyzbufferhack_pass++;
|
||||||
|
glColorMask(false, false, false, false);
|
||||||
polymost_drawpoly(dpxy, n, DAMETH_MASK);
|
polymost_drawpoly(dpxy, n, DAMETH_MASK);
|
||||||
|
glColorMask(true, true, true, true);
|
||||||
xtex = bxtex, ytex = bytex, otex = botex;
|
xtex = bxtex, ytex = bytex, otex = botex;
|
||||||
skyzbufferhack_pass--;
|
skyzbufferhack_pass--;
|
||||||
}
|
}
|
||||||
|
@ -5540,6 +5527,12 @@ 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);
|
||||||
|
|
||||||
|
@ -5730,6 +5723,13 @@ 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
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -6745,7 +6745,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
#if defined(POLYMER)
|
#if defined(POLYMER)
|
||||||
# ifdef USE_GLEXT
|
# ifdef USE_GLEXT
|
||||||
|
@ -6904,6 +6905,9 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
||||||
if (!nofog) polymost_setFogEnabled(true);
|
if (!nofog) polymost_setFogEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
if (videoGetRenderMode() == REND_POLYMER)
|
if (videoGetRenderMode() == REND_POLYMER)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue