mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- fixed handling of SW's shadows.
An out of range shade will only work without fog.
This commit is contained in:
parent
88695ef554
commit
e1df17964e
4 changed files with 15 additions and 3 deletions
|
@ -114,6 +114,15 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
|
|||
bool foggy = (GlobalMapFog || (fade & 0xffffff));
|
||||
auto ShadeDiv = lookups.tables[palette].ShadeFactor;
|
||||
// Disable brightmaps if non-black fog is used.
|
||||
int shade = this->shade;
|
||||
PalEntry color(255, globalr, globalg, globalb);
|
||||
if (this->shade > numshades) // handling of SW's shadow hack using a shade of 127.
|
||||
{
|
||||
shade = sector[sprite->sectnum].floorshade;
|
||||
color = 0xff000000;
|
||||
}
|
||||
shade = clamp(shade, 0, numshades - 1);
|
||||
|
||||
if (ShadeDiv >= 1 / 1000.f && foggy && !foglayer)
|
||||
{
|
||||
state.EnableFog(1);
|
||||
|
@ -131,7 +140,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
|
|||
}
|
||||
|
||||
// The shade rgb from the tint is ignored here.
|
||||
state.SetColorAlpha(PalEntry(255, globalr, globalg, globalb), alpha);
|
||||
state.SetColorAlpha(color, alpha);
|
||||
|
||||
state.SetMaterial(texture, UF_Texture, 0, CLAMP_XY, TRANSLATION(Translation_Remap + curbasepal, palette), -1);
|
||||
|
||||
|
@ -320,7 +329,7 @@ void HWSprite::Process(HWDrawInfo* di, spritetype* spr, sectortype* sector, int
|
|||
|
||||
modelframe = 0;
|
||||
dynlightindex = -1;
|
||||
shade = clamp(spr->shade, 0, numshades-1);
|
||||
shade = spr->shade;
|
||||
palette = spr->pal;
|
||||
fade = lookups.getFade(sector->floorpal); // fog is per sector.
|
||||
visibility = sectorVisibility(sector);
|
||||
|
|
|
@ -206,7 +206,8 @@ bool PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
|
|||
state.SetMaterial(mMaterial.mTexture, mMaterial.uFlags, mMaterial.mScaleFlags, mMaterial.mClampMode, mMaterial.mTranslation, mMaterial.mOverrideShader);
|
||||
}
|
||||
|
||||
state.SetColor(Color[0], Color[1], Color[2], Color[3]);
|
||||
if (!drawblack) state.SetColor(Color[0], Color[1], Color[2], Color[3]);
|
||||
else state.SetColor(0, 0, 0, Color[3]);
|
||||
if (StateFlags != oldState.Flags)
|
||||
{
|
||||
state.EnableDepthTest(StateFlags & STF_DEPTHTEST);
|
||||
|
|
|
@ -138,6 +138,7 @@ public:
|
|||
|
||||
void SetShade(int32_t shade, int numshades)
|
||||
{
|
||||
renderState.drawblack = shade > numshades;
|
||||
renderState.Shade = std::min(shade, numshades-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ struct PolymostRenderState
|
|||
{
|
||||
int vindex, vcount, primtype;
|
||||
int Shade;
|
||||
int drawblack = false;
|
||||
float ShadeDiv = 62.f;
|
||||
float VisFactor = 128.f;
|
||||
int Flags = 0;
|
||||
|
|
Loading…
Reference in a new issue