- make sure that all objects rendered as shadow reset the object color after the draw call.

This commit is contained in:
Christoph Oelckers 2021-05-15 10:40:25 +02:00
parent b520d38bc0
commit 845ce63348
4 changed files with 9 additions and 9 deletions

View file

@ -401,15 +401,12 @@ inline void SetSpriteTranslucency(const spritetype* sprite, float& alpha, FRende
extern PalEntry GlobalMapFog; extern PalEntry GlobalMapFog;
extern float GlobalFogDensity; extern float GlobalFogDensity;
__forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int shade, float visibility, float alpha, bool setcolor = true) __forceinline void SetLightAndFog(FRenderState& state, PalEntry fade, int palette, int shade, float visibility, float alpha)
{ {
// Fog must be done before the texture so that the texture selector can override it. // Fog must be done before the texture so that the texture selector can override it.
bool foggy = (GlobalMapFog || (fade & 0xffffff)); bool foggy = (GlobalMapFog || (fade & 0xffffff));
auto ShadeDiv = lookups.tables[palette].ShadeFactor; auto ShadeDiv = lookups.tables[palette].ShadeFactor;
bool shadow = shade >= numshades; if (shade == 127) state.SetObjectColor(0xff000000); // 127 is generally used for shadow objects that must be black, even in foggy areas.
if (shadow) state.SetObjectColor(0xff000000); // make sure that nothing lights this up again.
else state.SetObjectColor(0xffffffff);
// Disable brightmaps if non-black fog is used. // Disable brightmaps if non-black fog is used.
if (ShadeDiv >= 1 / 1000.f && foggy) if (ShadeDiv >= 1 / 1000.f && foggy)

View file

@ -191,7 +191,7 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
if (translucent) state.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]); if (translucent) state.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]);
state.EnableBrightmap(true); state.EnableBrightmap(true);
//state.SetObjectColor(0xffffffff); state.SetObjectColor(0xffffffff);
//state.SetAddColor(0); //state.SetAddColor(0);
//state.ApplyTextureManipulation(nullptr); //state.ApplyTextureManipulation(nullptr);
} }

View file

@ -109,7 +109,10 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work. else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work.
} }
SetLightAndFog(state, fade, palette, shade, visibility, alpha, this->shade <= numshades); SetLightAndFog(state, fade, palette, shade, visibility, alpha);
if (shade >= numshades) state.SetObjectColor(0xff000000); // make sure that nothing lights this up again.
if (modelframe == 0) if (modelframe == 0)
{ {

View file

@ -128,7 +128,7 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state)
// Use sphere mapping for this // Use sphere mapping for this
state.SetEffect(EFF_SPHEREMAP); state.SetEffect(EFF_SPHEREMAP);
SetLightAndFog(state, fade, palette, shade, visibility, alpha, false); SetLightAndFog(state, fade, palette, min<int>(shade, numshades), visibility, alpha);
state.SetColor(PalEntry(25, globalr >> 1, globalg >> 1, globalb >> 1)); state.SetColor(PalEntry(25, globalr >> 1, globalg >> 1, globalb >> 1));
state.SetRenderStyle(STYLE_Add); state.SetRenderStyle(STYLE_Add);
@ -173,8 +173,8 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags)
RenderWall(di, state, rflags); RenderWall(di, state, rflags);
state.SetNpotEmulation(0.f, 0.f); state.SetNpotEmulation(0.f, 0.f);
/* none of these functions is in use.
state.SetObjectColor(0xffffffff); state.SetObjectColor(0xffffffff);
/* none of these functions is in use.
state.SetObjectColor2(0); state.SetObjectColor2(0);
state.SetAddColor(0); state.SetAddColor(0);
state.SetTextureMode(tmode); state.SetTextureMode(tmode);