From 3c5ef9c8e6213278af3f570cb3ae157fd58a992a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Jun 2021 21:48:39 +0200 Subject: [PATCH] - properly render geometry that's fully shrouded in fog. --- source/core/rendering/scene/hw_flats.cpp | 8 ++++++++ source/core/rendering/scene/hw_walls.cpp | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index c2236aa54fc..71572627b6c 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -182,6 +182,13 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) if (texture && !checkTranslucentReplacement(texture->GetID(), palette)) state.AlphaFunc(Alpha_GEqual, texture->alphaThreshold); else state.AlphaFunc(Alpha_GEqual, 0.f); } + else if (shade > numshades && (GlobalMapFog || (fade & 0xffffff))) + { + state.SetObjectColor(fade | 0xff000000); + state.EnableTexture(false); + } + + state.SetMaterial(texture, UF_Texture, 0, Sprite == nullptr? CLAMP_NONE : CLAMP_XY, TRANSLATION(Translation_Remap + curbasepal, palette), -1); state.SetLightIndex(dynlightindex); @@ -192,6 +199,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) state.EnableBrightmap(true); state.SetObjectColor(0xffffffff); + state.EnableTexture(true); //state.SetAddColor(0); //state.ApplyTextureManipulation(nullptr); } diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 4aacb3df7a3..9c9df27a97d 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -248,10 +248,17 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state) void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) { SetLightAndFog(state, fade, palette, shade, visibility, alpha); + state.SetMaterial(texture, UF_Texture, 0, (flags & (HWF_CLAMPX | HWF_CLAMPY)), TRANSLATION(Translation_Remap + curbasepal, palette), -1); if (Sprite == nullptr) { + if (shade > numshades && (GlobalMapFog || (fade & 0xffffff))) + { + state.SetObjectColor(fade | 0xff000000); + state.EnableTexture(false); + } + int h = (int)texture->GetDisplayHeight(); int h2 = 1 << sizeToBits(h); if (h2 < h) h2 *= 2; @@ -276,6 +283,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) state.SetNpotEmulation(0.f, 0.f); state.SetObjectColor(0xffffffff); + state.EnableTexture(true); /* none of these functions is in use. state.SetObjectColor2(0); state.SetAddColor(0); @@ -960,7 +968,7 @@ void HWWall::Process(HWDrawInfo* di, walltype* wal, sectortype* frontsector, sec #ifdef _DEBUG - if (wal - wall == 788) + if (wal - wall == 6468) { int a = 0; }