Skip to content

Commit

Permalink
- properly render geometry that's fully shrouded in fog.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jun 1, 2021
1 parent 22364ff commit 3c5ef9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions source/core/rendering/scene/hw_flats.cpp
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
10 changes: 9 additions & 1 deletion source/core/rendering/scene/hw_walls.cpp
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3c5ef9c

Please sign in to comment.