try to fix skywalls zfighting

just apply a small polygonoffset to them
lets hope this is small enough so they dont end up rendering infront of actual textures and such
This commit is contained in:
Alug committed 2025-04-23 01:04:04 +02:00
1 parent b43ca1f3c7
commit 60e0e50141
3 files changed
+19 -4

No files matched your search

+2 -1
View File
@@ -255,7 +255,8 @@ enum EPolyFlags
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
PF_ForceWrapY = 0x00040000, // Forces repeat texture on Y
PF_Ripple = 0x00100000 // Water ripple effect. The current backend doesn't use it for anything.
PF_Ripple = 0x00100000, // Water ripple effect. The current backend doesn't use it for anything.
PF_Skydecal = 0x20000000 // Enables smaller polygon offset, to be used for skywalls only
// 0x20000000
// 0x40000000
// 0x80000000
+2 -2
View File
@@ -1211,7 +1211,7 @@ static void HWR_DrawSkyWallList(void)
GL_UnSetShader();
for (i = 0; i < skyWallVertexArraySize; i++)
{
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture|PF_Skydecal);
}
}
@@ -1233,7 +1233,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf)
else
{
HWR_SetCurrentTexture(NULL);
HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture, 255, NULL);
HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture|PF_Skydecal, 255, NULL);
}
// PF_Invisible so it's not drawn into the colour buffer
// PF_NoTexture for no texture
+15 -1
View File
@@ -1529,7 +1529,7 @@ void GL_SetBlend(FBITFIELD PolyFlags)
{
const FBITFIELD Xor = CurrentPolyFlags^PolyFlags;;
if (Xor & (PF_Blending|PF_RemoveYWrap|PF_ForceWrapX|PF_ForceWrapY|PF_Occlude|PF_NoTexture|PF_Modulated|PF_NoDepthTest|PF_Decal|PF_Invisible))
if (Xor & (PF_Blending|PF_RemoveYWrap|PF_ForceWrapX|PF_ForceWrapY|PF_Occlude|PF_NoTexture|PF_Modulated|PF_NoDepthTest|PF_Decal|PF_Skydecal|PF_Invisible))
{
if (Xor & PF_Blending) // if blending mode must be changed
GL_SetBlendMode(PolyFlags & PF_Blending);
@@ -1545,7 +1545,21 @@ void GL_SetBlend(FBITFIELD PolyFlags)
if (Xor & PF_Decal)
{
if (PolyFlags & PF_Decal)
{
pglPolygonOffset(-1.0f, -1.0f);
pglEnable(GL_POLYGON_OFFSET_FILL);
}
else
pglDisable(GL_POLYGON_OFFSET_FILL);
}
if (Xor & PF_Skydecal)
{
if (PolyFlags & PF_Skydecal)
{
pglPolygonOffset(-0.45f, -0.45f); // dont let skywalls draw over actual walls tho
pglEnable(GL_POLYGON_OFFSET_FILL);
}
else
pglDisable(GL_POLYGON_OFFSET_FILL);
}