From c9483353ff4058ecd7e68b84921c663aee1322d9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Apr 2021 19:56:18 +0200 Subject: [PATCH] - some more translucency checks. --- source/core/rendering/scene/hw_flats.cpp | 3 ++- source/core/rendering/scene/hw_sprites.cpp | 2 +- source/core/rendering/scene/hw_walls.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index a99d9b13e..1f08a86e2 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -202,7 +202,8 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent) state.SetRenderStyle(RenderStyle); state.SetTextureMode(RenderStyle); - if (!texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_threshold); + + if (!texture || !checkTranslucentReplacement(texture->GetID(), palette)) state.AlphaFunc(Alpha_GEqual, texture->alphaThreshold); else state.AlphaFunc(Alpha_GEqual, 0.f); } state.SetMaterial(texture, UF_Texture, 0, sprite == nullptr? CLAMP_NONE : CLAMP_XY, TRANSLATION(Translation_Remap + curbasepal, palette), -1); diff --git a/source/core/rendering/scene/hw_sprites.cpp b/source/core/rendering/scene/hw_sprites.cpp index 66f96865f..d32bf3514 100644 --- a/source/core/rendering/scene/hw_sprites.cpp +++ b/source/core/rendering/scene/hw_sprites.cpp @@ -75,7 +75,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent) state.SetRenderStyle(RenderStyle); state.SetTextureMode(RenderStyle); - if (!texture || !texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold); + if (!texture || !checkTranslucentReplacement(texture->GetID(), palette)) state.AlphaFunc(Alpha_GEqual, texture->alphaThreshold); else state.AlphaFunc(Alpha_Greater, 0.f); if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 466979155..a1826af63 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -176,7 +176,7 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state) state.EnableTextureMatrix(false); state.SetEffect(EFF_NONE); - state.AlphaFunc(Alpha_GEqual, gl_mask_sprite_threshold); + state.AlphaFunc(Alpha_GEqual, 0.5f); state.SetDepthFunc(DF_Less); state.SetRenderStyle(STYLE_Translucent); @@ -235,7 +235,7 @@ void HWWall::RenderTranslucentWall(HWDrawInfo *di, FRenderState &state) state.SetRenderStyle(RenderStyle); state.SetTextureMode(RenderStyle); - if (!texture->GetTranslucency()) state.AlphaFunc(Alpha_GEqual, gl_mask_threshold); + if (!texture || !checkTranslucentReplacement(texture->GetID(), palette)) state.AlphaFunc(Alpha_GEqual, texture->alphaThreshold); else state.AlphaFunc(Alpha_GEqual, 0.f); RenderTexturedWall(di, state, HWWall::RWF_TEXTURED); state.SetRenderStyle(STYLE_Translucent);