mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
- made the new Build light mode operational
This commit is contained in:
parent
45210efb91
commit
b20de184a0
5 changed files with 17 additions and 4 deletions
|
@ -146,8 +146,16 @@ void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uni
|
||||||
VPUniforms.mViewMatrix.loadIdentity();
|
VPUniforms.mViewMatrix.loadIdentity();
|
||||||
VPUniforms.mNormalViewMatrix.loadIdentity();
|
VPUniforms.mNormalViewMatrix.loadIdentity();
|
||||||
VPUniforms.mViewHeight = viewheight;
|
VPUniforms.mViewHeight = viewheight;
|
||||||
VPUniforms.mGlobVis = (float)R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
|
if (gl_lightmode == 5)
|
||||||
VPUniforms.mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8) | ((int)lightmode << 16);
|
{
|
||||||
|
VPUniforms.mGlobVis = 1 / 64.f;
|
||||||
|
VPUniforms.mPalLightLevels = 32 | (static_cast<int>(gl_fogmode) << 8) | ((int)lightmode << 16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VPUniforms.mGlobVis = (float)R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
|
||||||
|
VPUniforms.mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8) | ((int)lightmode << 16);
|
||||||
|
}
|
||||||
VPUniforms.mClipLine.X = -10000000.0f;
|
VPUniforms.mClipLine.X = -10000000.0f;
|
||||||
VPUniforms.mShadowmapFilter = gl_shadowmap_filter;
|
VPUniforms.mShadowmapFilter = gl_shadowmap_filter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ float HWDrawInfo::GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfog
|
||||||
else if ((fogcolor.d & 0xffffff) == 0)
|
else if ((fogcolor.d & 0xffffff) == 0)
|
||||||
{
|
{
|
||||||
// case 2: black fog
|
// case 2: black fog
|
||||||
if ((!isSoftwareLighting() || blendfactor > 0) && !(Level->flags3 & LEVEL3_NOLIGHTFADE))
|
if ((!isDoomSoftwareLighting() || blendfactor > 0) && !(Level->flags3 & LEVEL3_NOLIGHTFADE))
|
||||||
{
|
{
|
||||||
density = distfogtable[lightmode != ELightMode::LinearStandard][hw_ClampLight(lightlevel)];
|
density = distfogtable[lightmode != ELightMode::LinearStandard][hw_ClampLight(lightlevel)];
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,10 @@ void HWDrawInfo::SetFog(FRenderState &state, int lightlevel, int rellight, bool
|
||||||
float light = (float)CalcLightLevel(lightlevel, rellight, false, cmap->BlendFactor);
|
float light = (float)CalcLightLevel(lightlevel, rellight, false, cmap->BlendFactor);
|
||||||
SetShaderLight(state, light, lightlevel);
|
SetShaderLight(state, light, lightlevel);
|
||||||
}
|
}
|
||||||
|
else if (lightmode == ELightMode::Build)
|
||||||
|
{
|
||||||
|
state.SetLightParms(0.2f * fogdensity, 1.f / 31.f);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state.SetLightParms(1.f, 0.f);
|
state.SetLightParms(1.f, 0.f);
|
||||||
|
|
|
@ -2401,6 +2401,7 @@ OptionValue "LightingModes"
|
||||||
2, "$OPTVAL_DOOM"
|
2, "$OPTVAL_DOOM"
|
||||||
3, "$OPTVAL_DARK"
|
3, "$OPTVAL_DARK"
|
||||||
4, "$OPTVAL_LEGACY"
|
4, "$OPTVAL_LEGACY"
|
||||||
|
5, "$OPTVAL_BUILD"
|
||||||
8, "$OPTVAL_SOFTWARE"
|
8, "$OPTVAL_SOFTWARE"
|
||||||
16, "$OPTVAL_VANILLA"
|
16, "$OPTVAL_VANILLA"
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ float R_DoomLightingEquation(float light)
|
||||||
{
|
{
|
||||||
// This is a lot more primitive than Doom's lighting...
|
// This is a lot more primitive than Doom's lighting...
|
||||||
float numShades = float(uPalLightLevels & 255);
|
float numShades = float(uPalLightLevels & 255);
|
||||||
float curshade = (1.0 - light) / (numShades - 1.0);
|
float curshade = (1.0 - light) * (numShades - 1.0);
|
||||||
float visibility = max(uGlobVis * uLightFactor * z, 0.0);
|
float visibility = max(uGlobVis * uLightFactor * z, 0.0);
|
||||||
float shade = clamp((curshade + visibility), 0.0, numShades - 1.0);
|
float shade = clamp((curshade + visibility), 0.0, numShades - 1.0);
|
||||||
return clamp(shade * uLightDist, 0.0, 1.0);
|
return clamp(shade * uLightDist, 0.0, 1.0);
|
||||||
|
|
Loading…
Reference in a new issue