Render the world surfaces always in DF_LEqual mode instead of sometimes using DF_Less.

This commit is contained in:
dpjudas 2025-04-07 01:08:49 +02:00
commit 00a9c964b8
4 changed files with 4 additions and 13 deletions

View file

@ -56,7 +56,6 @@ VSMatrix FHWModelRenderer::GetViewToWorldMatrix()
void FHWModelRenderer::BeginDrawModel(FRenderStyle style, int smf_flags, const VSMatrix &objectToWorldMatrix, bool mirrored)
{
state.SetDepthFunc(DF_LEqual);
state.EnableTexture(true);
if (!gl_texture)
@ -83,14 +82,12 @@ void FHWModelRenderer::EndDrawModel(FRenderStyle style, int smf_flags)
{
state.SetBoneIndexBase(-1);
state.SetModelMatrix(VSMatrix::identity(), VSMatrix::identity());
state.SetDepthFunc(DF_Less);
if ((smf_flags & MDL_FORCECULLBACKFACES) || (!(style == DefaultRenderStyle()) && !(smf_flags & MDL_DONTCULLBACKFACES)))
state.SetCulling(Cull_None);
}
void FHWModelRenderer::BeginDrawHUDModel(FRenderStyle style, const VSMatrix &objectToWorldMatrix, bool mirrored, int smf_flags)
{
state.SetDepthFunc(DF_LEqual);
state.SetDepthClamp(true);
state.EnableTexture(true);
@ -119,7 +116,6 @@ void FHWModelRenderer::EndDrawHUDModel(FRenderStyle style, int smf_flags)
state.SetBoneIndexBase(-1);
state.SetModelMatrix(VSMatrix::identity(), VSMatrix::identity());
state.SetDepthFunc(DF_Less);
if (!(style == DefaultRenderStyle()) || (smf_flags & MDL_FORCECULLBACKFACES))
state.SetCulling(Cull_None);
}

View file

@ -754,7 +754,7 @@ void HWDrawInfo::RenderScene(FRenderState &state)
}
// Part 1: solid geometry. This is set up so that there are no transparent parts
state.SetDepthFunc(DF_Less);
state.SetDepthFunc(DF_LEqual);
state.AlphaFunc(Alpha_GEqual, 0.f);
state.ClearDepthBias();

View file

@ -284,7 +284,7 @@ void HWPortal::SetupStencil(HWDrawInfo *di, FRenderState &state, bool usestencil
// set normal drawing mode
state.EnableTexture(true);
state.SetDepthRange(0, 1);
state.SetDepthFunc(DF_Less);
state.SetDepthFunc(DF_LEqual);
state.SetColorMask(true);
state.SetEffect(EFF_NONE);
}
@ -298,6 +298,7 @@ void HWPortal::SetupStencil(HWDrawInfo *di, FRenderState &state, bool usestencil
state.SetStencil(1, SOP_Keep); // draw sky into stencil. This stage doesn't modify the stencil.
state.EnableTexture(true);
state.SetColorMask(true);
state.SetDepthFunc(DF_LEqual);
state.SetEffect(EFF_NONE);
state.EnableDepthTest(false);
state.SetDepthMask(false); // don't write to Z-buffer!
@ -359,9 +360,8 @@ void HWPortal::RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestenci
state.SetDepthRange(0, 1);
state.SetStencil(0, SOP_Decrement);
DrawPortalStencil(state, STP_DepthRestore);
state.SetDepthFunc(DF_Less);
state.SetDepthFunc(DF_LEqual);
state.EnableTexture(true);
state.SetEffect(EFF_NONE);
state.SetColorMask(true);
@ -396,7 +396,6 @@ void HWPortal::RemoveStencil(HWDrawInfo *di, FRenderState &state, bool usestenci
state.SetEffect(EFF_NONE);
state.EnableTexture(true);
state.SetColorMask(true);
state.SetDepthFunc(DF_Less);
}
}

View file

@ -146,8 +146,6 @@ void HWWall::RenderMirrorSurface(HWWallDispatcher*di, FRenderState &state)
{
if (!TexMan.mirrorTexture.isValid()) return;
state.SetDepthFunc(DF_LEqual);
// Use sphere mapping for this
state.SetEffect(EFF_SPHEREMAP);
SetColor(state, di->Level, di->lightmode, lightlevel, 0, di->isFullbrightScene(), Colormap, 0.1f);
@ -165,8 +163,6 @@ void HWWall::RenderMirrorSurface(HWWallDispatcher*di, FRenderState &state)
state.SetEffect(EFF_NONE);
state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold);
state.SetDepthFunc(DF_Less);
// This is drawn in the translucent pass which is done after the decal pass
// As a result the decals have to be drawn here, right after the wall they are on,
// because the depth buffer won't get set by translucent items.