From ac3546bdaa872f88bb2478d0ef9ae1f1e8cecf81 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 3 Jan 2022 21:10:04 +0100 Subject: [PATCH] - fixed depth buffer use of slope sprites. They cannot be treated like perfectly horizontal floor sprites and need to write to the depth buffer in the same pass as the regular pixels. --- source/core/rendering/scene/hw_drawinfo.cpp | 1 + source/core/rendering/scene/hw_drawinfo.h | 1 + source/core/rendering/scene/hw_drawlistadd.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index c7e7744c0..7b245b125 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -540,6 +540,7 @@ void HWDrawInfo::RenderScene(FRenderState &state) state.SetColorMask(true); state.SetDepthBias(-1, -128); + drawlists[GLDL_MASKEDSLOPEFLATS].DrawFlats(this, state, false); state.SetDepthMask(false); drawlists[GLDL_MASKEDFLATS].DrawFlats(this, state, false); state.SetDepthMask(true); diff --git a/source/core/rendering/scene/hw_drawinfo.h b/source/core/rendering/scene/hw_drawinfo.h index 503291694..70dde41b9 100644 --- a/source/core/rendering/scene/hw_drawinfo.h +++ b/source/core/rendering/scene/hw_drawinfo.h @@ -77,6 +77,7 @@ enum DrawListType GLDL_MASKEDWALLSV, // vertical wall sprites GLDL_MASKEDWALLSH, // horizontal wall sprites. These two lists merely exist for easier sorting. GLDL_MASKEDFLATS, + GLDL_MASKEDSLOPEFLATS, GLDL_MODELS, GLDL_TRANSLUCENT, diff --git a/source/core/rendering/scene/hw_drawlistadd.cpp b/source/core/rendering/scene/hw_drawlistadd.cpp index 9c9ee3f2a..cee0ff943 100644 --- a/source/core/rendering/scene/hw_drawlistadd.cpp +++ b/source/core/rendering/scene/hw_drawlistadd.cpp @@ -104,7 +104,7 @@ void HWDrawInfo::AddFlat(HWFlat *flat) } else { - list = flat->Sprite ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; + list = flat->Sprite ? ((flat->Sprite->clipdist & TSPR_SLOPESPRITE)? GLDL_MASKEDSLOPEFLATS : GLDL_MASKEDFLATS) : GLDL_PLAINFLATS; } auto newflat = drawlists[list].NewFlat(slopespr); *newflat = *flat;