mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
took several functions out of HWDrawInfo.
The only thing they needed from that class is the Level pointer and the light mode, this is better passed in as function argument.
This commit is contained in:
parent
28400a12f1
commit
1f5df23818
10 changed files with 80 additions and 79 deletions
|
@ -84,7 +84,7 @@ void HWDecal::DrawDecal(HWDrawInfo *di, FRenderState &state)
|
|||
else state.AlphaFunc(Alpha_Greater, 0.f);
|
||||
|
||||
|
||||
di->SetColor(state, lightlevel, rellight, di->isFullbrightScene(), Colormap, alpha);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, rellight, di->isFullbrightScene(), Colormap, alpha);
|
||||
// for additively drawn decals we must temporarily set the fog color to black.
|
||||
PalEntry fc = state.GetFogColor();
|
||||
if (decal->RenderStyle.BlendOp == STYLEOP_Add && decal->RenderStyle.DestAlpha == STYLEALPHA_One)
|
||||
|
@ -115,9 +115,9 @@ void HWDecal::DrawDecal(HWDrawInfo *di, FRenderState &state)
|
|||
FColormap thiscm;
|
||||
thiscm.FadeColor = Colormap.FadeColor;
|
||||
CopyFrom3DLight(thiscm, &lightlist[k]);
|
||||
di->SetColor(state, thisll, rellight, di->isFullbrightScene(), thiscm, alpha);
|
||||
SetColor(state, di->Level, di->lightmode, thisll, rellight, di->isFullbrightScene(), thiscm, alpha);
|
||||
if (di->Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING) thiscm.Decolorize();
|
||||
di->SetFog(state, thisll, rellight, di->isFullbrightScene(), &thiscm, false);
|
||||
SetFog(state, di->Level, di->lightmode, thisll, rellight, di->isFullbrightScene(), &thiscm, false);
|
||||
SetSplitPlanes(state, lightlist[k].plane, lowplane);
|
||||
|
||||
state.Draw(DT_TriangleStrip, vertindex, 4);
|
||||
|
@ -156,7 +156,7 @@ void HWDrawInfo::DrawDecals(FRenderState &state, TArray<HWDecal *> &decals)
|
|||
else
|
||||
{
|
||||
state.EnableSplit(false);
|
||||
SetFog(state, gldecal->lightlevel, gldecal->rellight, isFullbrightScene(), &gldecal->Colormap, false);
|
||||
SetFog(state, Level, lightmode, gldecal->lightlevel, gldecal->rellight, isFullbrightScene(), &gldecal->Colormap, false);
|
||||
}
|
||||
}
|
||||
gldecal->DrawDecal(this, state);
|
||||
|
@ -178,7 +178,7 @@ void HWWall::DrawDecalsForMirror(HWDrawInfo *di, FRenderState &state, TArray<HWD
|
|||
{
|
||||
state.SetDepthMask(false);
|
||||
state.SetDepthBias(-1, -128);
|
||||
di->SetFog(state, lightlevel, rellight + getExtraLight(), di->isFullbrightScene(), &Colormap, false);
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, rellight + getExtraLight(), di->isFullbrightScene(), &Colormap, false);
|
||||
for (auto gldecal : decals)
|
||||
{
|
||||
if (gldecal->decal->Side == seg->sidedef)
|
||||
|
|
|
@ -208,12 +208,6 @@ private:
|
|||
int SetupLightsForOtherPlane(subsector_t * sub, FDynLightData &lightdata, const secplane_t *plane);
|
||||
int CreateOtherPlaneVertices(subsector_t *sub, const secplane_t *plane);
|
||||
void DrawPSprite(HUDSprite *huds, FRenderState &state);
|
||||
void SetColor(FRenderState &state, int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon = false);
|
||||
void SetFog(FRenderState &state, int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive);
|
||||
void SetShaderLight(FRenderState &state, float level, float olight);
|
||||
int CalcLightLevel(int lightlevel, int rellight, bool weapon, int blendfactor);
|
||||
PalEntry CalcLightColor(int light, PalEntry pe, int blendfactor);
|
||||
float GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity, int blendfactor);
|
||||
WeaponLighting GetWeaponLighting(sector_t *viewsector, const DVector3 &pos, int cm, area_t in_area, const DVector3 &playerpos);
|
||||
|
||||
void PreparePlayerSprites2D(sector_t * viewsector, area_t in_area);
|
||||
|
@ -319,26 +313,6 @@ public:
|
|||
|
||||
HWDecal *AddDecal(bool onmirror);
|
||||
|
||||
bool isSoftwareLighting() const
|
||||
{
|
||||
return lightmode == ELightMode::ZDoomSoftware || lightmode == ELightMode::DoomSoftware || lightmode == ELightMode::Build;
|
||||
}
|
||||
|
||||
bool isBuildSoftwareLighting() const
|
||||
{
|
||||
return lightmode == ELightMode::Build;
|
||||
}
|
||||
|
||||
bool isDoomSoftwareLighting() const
|
||||
{
|
||||
return lightmode == ELightMode::ZDoomSoftware || lightmode == ELightMode::DoomSoftware;
|
||||
}
|
||||
|
||||
bool isDarkLightMode() const
|
||||
{
|
||||
return lightmode == ELightMode::Doom || lightmode == ELightMode::DoomDark;
|
||||
}
|
||||
|
||||
void SetFallbackLightMode()
|
||||
{
|
||||
lightmode = ELightMode::Doom;
|
||||
|
@ -352,3 +326,30 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height);
|
|||
sector_t* RenderView(player_t* player);
|
||||
|
||||
|
||||
inline bool isSoftwareLighting(ELightMode lightmode)
|
||||
{
|
||||
return lightmode == ELightMode::ZDoomSoftware || lightmode == ELightMode::DoomSoftware || lightmode == ELightMode::Build;
|
||||
}
|
||||
|
||||
inline bool isBuildSoftwareLighting(ELightMode lightmode)
|
||||
{
|
||||
return lightmode == ELightMode::Build;
|
||||
}
|
||||
|
||||
inline bool isDoomSoftwareLighting(ELightMode lightmode)
|
||||
{
|
||||
return lightmode == ELightMode::ZDoomSoftware || lightmode == ELightMode::DoomSoftware;
|
||||
}
|
||||
|
||||
inline bool isDarkLightMode(ELightMode lightmode)
|
||||
{
|
||||
return lightmode == ELightMode::Doom || lightmode == ELightMode::DoomDark;
|
||||
}
|
||||
|
||||
int CalcLightLevel(ELightMode lightmode, int lightlevel, int rellight, bool weapon, int blendfactor);
|
||||
PalEntry CalcLightColor(ELightMode lightmode, int light, PalEntry pe, int blendfactor);
|
||||
float GetFogDensity(FLevelLocals* Level, ELightMode lightmode, int lightlevel, PalEntry fogcolor, int sectorfogdensity, int blendfactor);
|
||||
bool CheckFog(FLevelLocals* Level, sector_t* frontsector, sector_t* backsector, ELightMode lightmode);
|
||||
void SetColor(FRenderState& state, FLevelLocals* Level, ELightMode lightmode, int sectorlightlevel, int rellight, bool fullbright, const FColormap& cm, float alpha, bool weapon = false);
|
||||
void SetShaderLight(FRenderState& state, FLevelLocals* Level, float level, float olight);
|
||||
void SetFog(FRenderState& state, FLevelLocals* Level, ELightMode lightmode, int lightlevel, int rellight, bool fullbright, const FColormap* cmap, bool isadditive);
|
||||
|
|
|
@ -315,8 +315,8 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
|
||||
state.SetNormal(plane.plane.Normal().X, plane.plane.Normal().Z, plane.plane.Normal().Y);
|
||||
|
||||
di->SetColor(state, lightlevel, rel, di->isFullbrightScene(), Colormap, alpha);
|
||||
di->SetFog(state, lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), Colormap, alpha);
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), &Colormap, false);
|
||||
state.SetObjectColor(FlatColor | 0xff000000);
|
||||
state.SetAddColor(AddColor | 0xff000000);
|
||||
state.ApplyTextureManipulation(TextureFx);
|
||||
|
|
|
@ -76,13 +76,13 @@ CUSTOM_CVAR(Int, gl_distfog, 70, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int HWDrawInfo::CalcLightLevel(int lightlevel, int rellight, bool weapon, int blendfactor)
|
||||
int CalcLightLevel(ELightMode lightmode, int lightlevel, int rellight, bool weapon, int blendfactor)
|
||||
{
|
||||
int light;
|
||||
|
||||
if (lightlevel <= 0) return 0;
|
||||
|
||||
bool darklightmode = (isDarkLightMode()) || (isSoftwareLighting() && blendfactor > 0);
|
||||
bool darklightmode = (isDarkLightMode(lightmode)) || (isSoftwareLighting(lightmode) && blendfactor > 0);
|
||||
|
||||
if (darklightmode && lightlevel < 192 && !weapon)
|
||||
{
|
||||
|
@ -119,13 +119,13 @@ int HWDrawInfo::CalcLightLevel(int lightlevel, int rellight, bool weapon, int bl
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
PalEntry HWDrawInfo::CalcLightColor(int light, PalEntry pe, int blendfactor)
|
||||
PalEntry CalcLightColor(ELightMode lightmode, int light, PalEntry pe, int blendfactor)
|
||||
{
|
||||
int r,g,b;
|
||||
|
||||
if (blendfactor == 0)
|
||||
{
|
||||
if (isSoftwareLighting())
|
||||
if (isSoftwareLighting(lightmode))
|
||||
{
|
||||
return pe;
|
||||
}
|
||||
|
@ -165,12 +165,12 @@ PalEntry HWDrawInfo::CalcLightColor(int light, PalEntry pe, int blendfactor)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
float HWDrawInfo::GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity, int blendfactor)
|
||||
float GetFogDensity(FLevelLocals* Level, ELightMode lightmode, int lightlevel, PalEntry fogcolor, int sectorfogdensity, int blendfactor)
|
||||
{
|
||||
float density;
|
||||
|
||||
auto oldlightmode = lightmode;
|
||||
if (isSoftwareLighting() && blendfactor > 0) lightmode = ELightMode::Doom; // The blendfactor feature does not work with software-style lighting.
|
||||
if (isSoftwareLighting(lightmode) && blendfactor > 0) lightmode = ELightMode::Doom; // The blendfactor feature does not work with software-style lighting.
|
||||
|
||||
if (lightmode == ELightMode::DoomLegacy)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ float HWDrawInfo::GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfog
|
|||
else if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
// case 2: black fog
|
||||
if ((!isDoomSoftwareLighting() || blendfactor > 0) && !(Level->flags3 & LEVEL3_NOLIGHTFADE))
|
||||
if ((!isDoomSoftwareLighting(lightmode) || blendfactor > 0) && !(Level->flags3 & LEVEL3_NOLIGHTFADE))
|
||||
{
|
||||
density = distfogtable[lightmode != ELightMode::LinearStandard][hw_ClampLight(lightlevel)];
|
||||
}
|
||||
|
|
|
@ -972,14 +972,14 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
if (texture->isFullbright())
|
||||
{
|
||||
// glowing textures are always drawn full bright without color
|
||||
di->SetColor(state, 255, 0, false, origin->colormap, 1.f);
|
||||
di->SetFog(state, 255, 0, false, &origin->colormap, false);
|
||||
SetColor(state, di->Level, di->lightmode, 255, 0, false, origin->colormap, 1.f);
|
||||
SetFog(state, di->Level, di->lightmode, 255, 0, false, &origin->colormap, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
int rel = getExtraLight();
|
||||
di->SetColor(state, origin->lightlevel, rel, di->isFullbrightScene(), origin->colormap, 1.0f);
|
||||
di->SetFog(state, origin->lightlevel, rel, di->isFullbrightScene(), &origin->colormap, false);
|
||||
SetColor(state, di->Level, di->lightmode, origin->lightlevel, rel, di->isFullbrightScene(), origin->colormap, 1.0f);
|
||||
SetFog(state, di->Level, di->lightmode, origin->lightlevel, rel, di->isFullbrightScene(), &origin->colormap, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,20 +38,20 @@
|
|||
// set current light color
|
||||
//
|
||||
//==========================================================================
|
||||
void HWDrawInfo::SetColor(FRenderState &state, int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon)
|
||||
void SetColor(FRenderState &state, FLevelLocals* Level, ELightMode lightmode, int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon)
|
||||
{
|
||||
if (fullbright)
|
||||
{
|
||||
state.SetColorAlpha(0xffffff, alpha, 0);
|
||||
if (isSoftwareLighting()) state.SetSoftLightLevel(255);
|
||||
if (isSoftwareLighting(lightmode)) state.SetSoftLightLevel(255);
|
||||
else state.SetNoSoftLightLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
int hwlightlevel = CalcLightLevel(sectorlightlevel, rellight, weapon, cm.BlendFactor);
|
||||
PalEntry pe = CalcLightColor(hwlightlevel, cm.LightColor, cm.BlendFactor);
|
||||
int hwlightlevel = CalcLightLevel(lightmode, sectorlightlevel, rellight, weapon, cm.BlendFactor);
|
||||
PalEntry pe = CalcLightColor(lightmode, hwlightlevel, cm.LightColor, cm.BlendFactor);
|
||||
state.SetColorAlpha(pe, alpha, cm.Desaturation);
|
||||
if (isSoftwareLighting()) state.SetSoftLightLevel(hw_ClampLight(sectorlightlevel + rellight), cm.BlendFactor);
|
||||
if (isSoftwareLighting(lightmode)) state.SetSoftLightLevel(hw_ClampLight(sectorlightlevel + rellight), cm.BlendFactor);
|
||||
else state.SetNoSoftLightLevel();
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void HWDrawInfo::SetColor(FRenderState &state, int sectorlightlevel, int relligh
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::SetShaderLight(FRenderState &state, float level, float olight)
|
||||
void SetShaderLight(FRenderState &state, FLevelLocals* Level, float level, float olight)
|
||||
{
|
||||
const float MAXDIST = 256.f;
|
||||
const float THRESHOLD = 96.f;
|
||||
|
@ -96,7 +96,7 @@ void HWDrawInfo::SetShaderLight(FRenderState &state, float level, float olight)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive)
|
||||
void SetFog(FRenderState &state, FLevelLocals* Level, ELightMode lightmode, int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive)
|
||||
{
|
||||
PalEntry fogcolor;
|
||||
float fogdensity;
|
||||
|
@ -109,7 +109,7 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool
|
|||
else if (cmap != nullptr && !fullbright)
|
||||
{
|
||||
fogcolor = cmap->FadeColor;
|
||||
fogdensity = GetFogDensity(lightlevel, fogcolor, cmap->FogDensity, cmap->BlendFactor);
|
||||
fogdensity = GetFogDensity(Level, lightmode, lightlevel, fogcolor, cmap->FogDensity, cmap->BlendFactor);
|
||||
fogcolor.a = 0;
|
||||
}
|
||||
else
|
||||
|
@ -130,10 +130,10 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((lightmode == ELightMode::Doom || (isSoftwareLighting() && cmap && cmap->BlendFactor > 0)) && fogcolor == 0)
|
||||
if ((lightmode == ELightMode::Doom || (isSoftwareLighting(lightmode) && cmap && cmap->BlendFactor > 0)) && fogcolor == 0)
|
||||
{
|
||||
float light = (float)CalcLightLevel(lightlevel, rellight, false, cmap->BlendFactor);
|
||||
SetShaderLight(state, light, lightlevel);
|
||||
float light = (float)CalcLightLevel(lightmode, lightlevel, rellight, false, cmap->BlendFactor);
|
||||
SetShaderLight(state, Level, light, lightlevel);
|
||||
}
|
||||
else if (lightmode == ELightMode::Build)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool
|
|||
state.SetFog(fogcolor, fogdensity);
|
||||
|
||||
// Korshun: fullbright fog like in software renderer.
|
||||
if (isSoftwareLighting() && cmap && cmap->BlendFactor == 0 && Level->brightfog && fogdensity != 0 && fogcolor != 0)
|
||||
if (isSoftwareLighting(lightmode) && cmap && cmap->BlendFactor == 0 && Level->brightfog && fogdensity != 0 && fogcolor != 0)
|
||||
{
|
||||
state.SetSoftLightLevel(255);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
|
||||
// We have no use for Doom lighting special handling here, so disable it for this function.
|
||||
auto oldlightmode = di->lightmode;
|
||||
if (di->isSoftwareLighting())
|
||||
if (isSoftwareLighting(oldlightmode))
|
||||
{
|
||||
di->SetFallbackLightMode();
|
||||
state.SetNoSoftLightLevel();
|
||||
|
|
|
@ -142,7 +142,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
if (!Colormap.FadeColor.isBlack())
|
||||
{
|
||||
float dist = Dist2(vp.Pos.X, vp.Pos.Y, x, y);
|
||||
int fogd = di->GetFogDensity(lightlevel, Colormap.FadeColor, Colormap.FogDensity, Colormap.BlendFactor);
|
||||
int fogd = GetFogDensity(di->Level, di->lightmode, lightlevel, Colormap.FadeColor, Colormap.FogDensity, Colormap.BlendFactor);
|
||||
|
||||
// this value was determined by trial and error and is scale dependent!
|
||||
float factor = 0.05f + exp(-fogd * dist / 62500.f);
|
||||
|
@ -187,7 +187,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
state.SetObjectColor(finalcol);
|
||||
state.SetAddColor(cursec->AdditiveColors[sector_t::sprites] | 0xff000000);
|
||||
}
|
||||
di->SetColor(state, lightlevel, rel, di->isFullbrightScene(), Colormap, trans);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), Colormap, trans);
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work.
|
||||
}
|
||||
|
||||
if (!foglayer) di->SetFog(state, foglevel, rel, di->isFullbrightScene(), &Colormap, additivefog);
|
||||
if (!foglayer) SetFog(state, di->Level, di->lightmode, foglevel, rel, di->isFullbrightScene(), &Colormap, additivefog);
|
||||
else
|
||||
{
|
||||
state.EnableFog(false);
|
||||
|
@ -255,10 +255,10 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
thiscm.Decolorize();
|
||||
}
|
||||
|
||||
di->SetColor(state, thisll, rel, di->isFullbrightScene(), thiscm, trans);
|
||||
SetColor(state, di->Level, di->lightmode, thisll, rel, di->isFullbrightScene(), thiscm, trans);
|
||||
if (!foglayer)
|
||||
{
|
||||
di->SetFog(state, thislight, rel, di->isFullbrightScene(), &thiscm, additivefog);
|
||||
SetFog(state, di->Level, di->lightmode, thislight, rel, di->isFullbrightScene(), &thiscm, additivefog);
|
||||
}
|
||||
SetSplitPlanes(state, *topplane, *lowplane);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
if (foglayer)
|
||||
{
|
||||
// If we get here we know that we have colored fog and no fixed colormap.
|
||||
di->SetFog(state, foglevel, rel, false, &Colormap, additivefog);
|
||||
SetFog(state, di->Level, di->lightmode, foglevel, rel, false, &Colormap, additivefog);
|
||||
state.SetTextureMode(TM_FOGLAYER);
|
||||
state.SetRenderStyle(STYLE_Translucent);
|
||||
state.Draw(DT_TriangleStrip, vertexindex, 4);
|
||||
|
|
|
@ -101,7 +101,7 @@ void HWWall::RenderFogBoundary(HWDrawInfo*di, FRenderState &state)
|
|||
{
|
||||
int rel = rellight + getExtraLight();
|
||||
state.EnableDrawBufferAttachments(false);
|
||||
di->SetFog(state, lightlevel, rel, false, &Colormap, false);
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, rel, false, &Colormap, false);
|
||||
state.SetEffect(EFF_FOGBOUNDARY);
|
||||
state.AlphaFunc(Alpha_GEqual, 0.f);
|
||||
state.SetDepthBias(-1, -128);
|
||||
|
@ -129,8 +129,8 @@ void HWWall::RenderMirrorSurface(HWDrawInfo*di, FRenderState &state)
|
|||
|
||||
// Use sphere mapping for this
|
||||
state.SetEffect(EFF_SPHEREMAP);
|
||||
di->SetColor(state, lightlevel, 0, di->isFullbrightScene(), Colormap, 0.1f);
|
||||
di->SetFog(state, lightlevel, 0, di->isFullbrightScene(), &Colormap, true);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, 0, di->isFullbrightScene(), Colormap, 0.1f);
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, 0, di->isFullbrightScene(), &Colormap, true);
|
||||
state.SetRenderStyle(STYLE_Add);
|
||||
state.AlphaFunc(Alpha_Greater, 0);
|
||||
|
||||
|
@ -216,7 +216,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
|
||||
if (type == RENDERWALL_M2SNF)
|
||||
{
|
||||
di->SetFog(state, 255, 0, di->isFullbrightScene(), nullptr, false);
|
||||
SetFog(state, di->Level, di->lightmode, 255, 0, di->isFullbrightScene(), nullptr, false);
|
||||
}
|
||||
if (type != RENDERWALL_COLOR && seg->sidedef != nullptr)
|
||||
{
|
||||
|
@ -264,8 +264,8 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
float absalpha = fabsf(alpha);
|
||||
if (lightlist == nullptr)
|
||||
{
|
||||
if (type != RENDERWALL_M2SNF) di->SetFog(state, lightlevel, rel, di->isFullbrightScene(), &Colormap, RenderStyle == STYLE_Add);
|
||||
di->SetColor(state, lightlevel, rel, di->isFullbrightScene(), Colormap, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) SetFog(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), &Colormap, RenderStyle == STYLE_Add);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), Colormap, absalpha);
|
||||
RenderWall(di, state, rflags);
|
||||
}
|
||||
else
|
||||
|
@ -286,8 +286,8 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
thiscm.FadeColor = Colormap.FadeColor;
|
||||
thiscm.FogDensity = Colormap.FogDensity;
|
||||
CopyFrom3DLight(thiscm, &(*lightlist)[i]);
|
||||
di->SetColor(state, thisll, rel, false, thiscm, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) di->SetFog(state, thisll, rel, false, &thiscm, RenderStyle == STYLE_Add);
|
||||
SetColor(state, di->Level, di->lightmode, thisll, rel, false, thiscm, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) SetFog(state, di->Level, di->lightmode, thisll, rel, false, &thiscm, RenderStyle == STYLE_Add);
|
||||
SetSplitPlanes(state, (*lightlist)[i].plane, lowplane);
|
||||
RenderWall(di, state, rflags);
|
||||
}
|
||||
|
@ -325,8 +325,8 @@ void HWWall::RenderTranslucentWall(HWDrawInfo*di, FRenderState &state)
|
|||
else
|
||||
{
|
||||
state.AlphaFunc(Alpha_GEqual, 0.f);
|
||||
di->SetColor(state, lightlevel, 0, false, Colormap, fabsf(alpha));
|
||||
di->SetFog(state, lightlevel, 0, false, &Colormap, RenderStyle == STYLE_Add);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, 0, false, Colormap, fabsf(alpha));
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, 0, false, &Colormap, RenderStyle == STYLE_Add);
|
||||
state.EnableTexture(false);
|
||||
RenderWall(di, state, HWWall::RWF_NOSPLIT);
|
||||
state.EnableTexture(true);
|
||||
|
|
|
@ -69,7 +69,7 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
|||
}
|
||||
else
|
||||
{
|
||||
SetColor(state, huds->lightlevel, 0, isFullbrightScene(), huds->cm, huds->alpha, true);
|
||||
SetColor(state, Level, lightmode, huds->lightlevel, 0, isFullbrightScene(), huds->cm, huds->alpha, true);
|
||||
}
|
||||
state.SetLightIndex(-1);
|
||||
state.SetRenderStyle(huds->RenderStyle);
|
||||
|
@ -121,7 +121,7 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
|
|||
void HWDrawInfo::DrawPlayerSprites(bool hudModelStep, FRenderState &state)
|
||||
{
|
||||
auto oldlightmode = lightmode;
|
||||
if (!hudModelStep && isSoftwareLighting()) SetFallbackLightMode(); // Software lighting cannot handle 2D content.
|
||||
if (!hudModelStep && isSoftwareLighting(oldlightmode)) SetFallbackLightMode(); // Software lighting cannot handle 2D content.
|
||||
for (auto &hudsprite : hudsprites)
|
||||
{
|
||||
if ((!!hudsprite.mframe) == hudModelStep)
|
||||
|
@ -353,9 +353,9 @@ WeaponLighting HWDrawInfo::GetWeaponLighting(sector_t *viewsector, const DVector
|
|||
if (Level->flags3 & LEVEL3_NOCOLOREDSPRITELIGHTING) l.cm.ClearColor();
|
||||
}
|
||||
|
||||
l.lightlevel = CalcLightLevel(l.lightlevel, getExtraLight(), true, 0);
|
||||
l.lightlevel = CalcLightLevel(lightmode, l.lightlevel, getExtraLight(), true, 0);
|
||||
|
||||
if (isSoftwareLighting() || l.lightlevel < 92)
|
||||
if (isSoftwareLighting(lightmode) || l.lightlevel < 92)
|
||||
{
|
||||
// Korshun: the way based on max possible light level for sector like in software renderer.
|
||||
double min_L = 36.0 / 31.0 - ((l.lightlevel / 255.0) * (63.0 / 31.0)); // Lightlevel in range 0-63
|
||||
|
@ -701,7 +701,7 @@ void HWDrawInfo::PreparePlayerSprites2D(sector_t * viewsector, area_t in_area)
|
|||
// hack alert! Rather than changing everything in the underlying lighting code let's just temporarily change
|
||||
// light mode here to draw the weapon sprite.
|
||||
auto oldlightmode = lightmode;
|
||||
if (isSoftwareLighting()) SetFallbackLightMode();
|
||||
if (isSoftwareLighting(oldlightmode)) SetFallbackLightMode();
|
||||
|
||||
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
|
@ -787,7 +787,7 @@ void HWDrawInfo::PreparePlayerSprites3D(sector_t * viewsector, area_t in_area)
|
|||
// hack alert! Rather than changing everything in the underlying lighting code let's just temporarily change
|
||||
// light mode here to draw the weapon sprite.
|
||||
auto oldlightmode = lightmode;
|
||||
if (isSoftwareLighting()) SetFallbackLightMode();
|
||||
if (isSoftwareLighting(oldlightmode)) SetFallbackLightMode();
|
||||
|
||||
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue