mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- always use glPolygonOffset to render translucent geometry.
This commit is contained in:
parent
92dcf2e5ef
commit
43e2d704a3
2 changed files with 21 additions and 19 deletions
|
@ -100,19 +100,20 @@ void FLightBuffer::Clear()
|
|||
|
||||
int FLightBuffer::UploadLights(FDynLightData &data)
|
||||
{
|
||||
unsigned int size0 = data.arrays[0].Size()/4;
|
||||
unsigned int size1 = data.arrays[1].Size()/4;
|
||||
unsigned int size2 = data.arrays[2].Size()/4;
|
||||
unsigned int totalsize = size0 + size1 + size2 + 1;
|
||||
int size0 = data.arrays[0].Size()/4;
|
||||
int size1 = data.arrays[1].Size()/4;
|
||||
int size2 = data.arrays[2].Size()/4;
|
||||
int totalsize = size0 + size1 + size2 + 1;
|
||||
|
||||
if (mBlockAlign > 0 && totalsize + (mIndex % mBlockAlign) > mBlockSize)
|
||||
// pointless type casting because some compilers can't print enough warnings.
|
||||
if (mBlockAlign > 0 && (unsigned int)totalsize + (mIndex % mBlockAlign) > mBlockSize)
|
||||
{
|
||||
mIndex = ((mIndex + mBlockAlign) / mBlockAlign) * mBlockAlign;
|
||||
|
||||
// can't be rendered all at once.
|
||||
if (totalsize > mBlockSize)
|
||||
if ((unsigned int)totalsize > mBlockSize)
|
||||
{
|
||||
int diff = totalsize - mBlockSize;
|
||||
int diff = totalsize - (int)mBlockSize;
|
||||
|
||||
size2 -= diff;
|
||||
if (size2 < 0)
|
||||
|
|
|
@ -238,7 +238,11 @@ void GLWall::RenderFogBoundary()
|
|||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
gl_RenderState.SetEffect(EFF_FOGBOUNDARY);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -128.0f);
|
||||
RenderWall(RWF_BLANK);
|
||||
glPolygonOffset(0.0f, 0.0f);
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
gl_RenderState.SetEffect(EFF_NONE);
|
||||
}
|
||||
}
|
||||
|
@ -368,12 +372,6 @@ void GLWall::Draw(int pass)
|
|||
#endif
|
||||
|
||||
|
||||
if (type == RENDERWALL_COLORLAYER && pass != GLPASS_LIGHTSONLY)
|
||||
{
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -128.0f);
|
||||
}
|
||||
|
||||
switch (pass)
|
||||
{
|
||||
case GLPASS_LIGHTSONLY:
|
||||
|
@ -396,6 +394,8 @@ void GLWall::Draw(int pass)
|
|||
break;
|
||||
|
||||
case GLPASS_TRANSLUCENT:
|
||||
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case RENDERWALL_MIRRORSURFACE:
|
||||
|
@ -406,15 +406,16 @@ void GLWall::Draw(int pass)
|
|||
RenderFogBoundary();
|
||||
break;
|
||||
|
||||
case RENDERWALL_COLORLAYER:
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -128.0f);
|
||||
RenderTranslucentWall();
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(0, 0);
|
||||
|
||||
default:
|
||||
RenderTranslucentWall();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == RENDERWALL_COLORLAYER && pass != GLPASS_LIGHTSONLY)
|
||||
{
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(0, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue