From d71ebace9780fbc3d92f2bb3ccf9db415bef9c21 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 3 Apr 2021 22:51:31 +0200 Subject: [PATCH] - fixed fog density of the new renderer. The actual value needs to be a lot lower than for Polymost due to the different projection. --- source/core/rendering/hw_entrypoint.cpp | 2 +- source/core/rendering/scene/hw_drawstructs.h | 1 + source/core/rendering/scene/hw_flats.cpp | 2 +- source/core/rendering/scene/hw_sprites.cpp | 4 ++-- source/core/rendering/scene/hw_walls.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/core/rendering/hw_entrypoint.cpp b/source/core/rendering/hw_entrypoint.cpp index 08c0248ea..18269e365 100644 --- a/source/core/rendering/hw_entrypoint.cpp +++ b/source/core/rendering/hw_entrypoint.cpp @@ -54,7 +54,7 @@ EXTERN_CVAR(Bool, cl_capfps) PalEntry GlobalMapFog; -float GlobalFogDensity; +float GlobalFogDensity = 350.f; TArray allPortals; diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index 4d4d75277..06892c6cc 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -355,3 +355,4 @@ inline float sectorVisibility(sectortype* sec) return v ? ((uint8_t)(v + 16)) / 16.f : 1.f; } +inline const float hw_density = 0.35f; diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index 525cfd8e1..a964e9aaa 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -178,7 +178,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) { state.EnableFog(1); float density = GlobalMapFog ? GlobalFogDensity : 350.f - Scale(numshades - shade, 150, numshades); - state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density); + state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density * hw_density); state.SetSoftLightLevel(255); state.SetLightParms(128.f, 1 / 1000.f); } diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index 4aa754b10..27b1f2b35 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -129,7 +129,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent) { state.EnableFog(1); float density = GlobalMapFog ? GlobalFogDensity : 350.f - Scale(numshades - shade, 150, numshades); - state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density); + state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density * hw_density); state.SetSoftLightLevel(255); state.SetLightParms(128.f, 1 / 1000.f); } @@ -161,7 +161,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent) { // If we get here we know that we have colored fog and no fixed colormap. float density = GlobalMapFog ? GlobalFogDensity : 350.f - Scale(numshades - shade, 150, numshades); - state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density); + state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density * hw_density); state.SetTextureMode(TM_FOGLAYER); state.SetRenderStyle(STYLE_Translucent); state.Draw(DT_TriangleStrip, vertexindex, 4); diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 7b0805410..29ebc9efd 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -131,7 +131,7 @@ void HWWall::SetLightAndFog(FRenderState& state) { state.EnableFog(1); float density = GlobalMapFog ? GlobalFogDensity : 350.f - Scale(numshades - shade, 150, numshades); - state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density); + state.SetFog((GlobalMapFog) ? GlobalMapFog : fade, density * hw_density); state.SetSoftLightLevel(255); state.SetLightParms(128.f, 1 / 1000.f); }