mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- Implemented radial fog support in software light mode
This commit is contained in:
parent
f34ededdef
commit
b6e035e796
2 changed files with 11 additions and 3 deletions
|
@ -150,7 +150,7 @@ bool FRenderState::ApplyShader()
|
||||||
|
|
||||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||||
activeShader->muFogEnabled.Set(fogset);
|
activeShader->muFogEnabled.Set(fogset);
|
||||||
activeShader->muPalLightLevels.Set(gl_bandedswlight);
|
activeShader->muPalLightLevels.Set(static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8));
|
||||||
activeShader->muTextureMode.Set(mTextureMode);
|
activeShader->muTextureMode.Set(mTextureMode);
|
||||||
activeShader->muCameraPos.Set(mCameraPos.vec);
|
activeShader->muCameraPos.Set(mCameraPos.vec);
|
||||||
activeShader->muLightParms.Set(mLightParms);
|
activeShader->muLightParms.Set(mLightParms);
|
||||||
|
|
|
@ -113,13 +113,21 @@ float R_DoomLightingEquation(float light)
|
||||||
float L = light * 255.0;
|
float L = light * 255.0;
|
||||||
|
|
||||||
// z is the depth in view/eye space, positive going into the screen
|
// z is the depth in view/eye space, positive going into the screen
|
||||||
float z = pixelpos.w;
|
float z;
|
||||||
|
if ((uPalLightLevels >> 8) == 1)
|
||||||
|
{
|
||||||
|
z = pixelpos.w;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
z = distance(pixelpos.xyz, uCameraPos.xyz);
|
||||||
|
}
|
||||||
|
|
||||||
// The zdoom light equation
|
// The zdoom light equation
|
||||||
float vis = min(globVis / z, 24.0 / 32.0);
|
float vis = min(globVis / z, 24.0 / 32.0);
|
||||||
float shade = 2.0 - (L + 12.0) / 128.0;
|
float shade = 2.0 - (L + 12.0) / 128.0;
|
||||||
float lightscale;
|
float lightscale;
|
||||||
if (uPalLightLevels != 0)
|
if ((uPalLightLevels & 0xff) != 0)
|
||||||
lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0;
|
lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0;
|
||||||
else
|
else
|
||||||
lightscale = shade - vis;
|
lightscale = shade - vis;
|
||||||
|
|
Loading…
Reference in a new issue