mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
This commit is contained in:
commit
cf400ba2db
2 changed files with 11 additions and 3 deletions
|
@ -150,7 +150,7 @@ bool FRenderState::ApplyShader()
|
|||
|
||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||
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->muCameraPos.Set(mCameraPos.vec);
|
||||
activeShader->muLightParms.Set(mLightParms);
|
||||
|
|
|
@ -113,13 +113,21 @@ float R_DoomLightingEquation(float light)
|
|||
float L = light * 255.0;
|
||||
|
||||
// z is the depth in view/eye space, positive going into the screen
|
||||
float z = pixelpos.w;
|
||||
float z;
|
||||
if ((uPalLightLevels >> 8) == 2)
|
||||
{
|
||||
z = distance(pixelpos.xyz, uCameraPos.xyz);
|
||||
}
|
||||
else
|
||||
{
|
||||
z = pixelpos.w;
|
||||
}
|
||||
|
||||
// The zdoom light equation
|
||||
float vis = min(globVis / z, 24.0 / 32.0);
|
||||
float shade = 2.0 - (L + 12.0) / 128.0;
|
||||
float lightscale;
|
||||
if (uPalLightLevels != 0)
|
||||
if ((uPalLightLevels & 0xff) != 0)
|
||||
lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0;
|
||||
else
|
||||
lightscale = shade - vis;
|
||||
|
|
Loading…
Reference in a new issue