- Added "gl_bandedswlight" to reduce the software light emulation gradient to 32 levels.

This commit is contained in:
Rachael Alexanderson 2017-01-24 13:44:12 -05:00 committed by Christoph Oelckers
parent eb3f83f908
commit 9a777f719b
7 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,7 @@ void gl_SetTextureMode(int type);
FRenderState gl_RenderState;
CVAR(Bool, gl_direct_state_change, true, 0)
CVAR(Bool, gl_bandedswlight, true, CVAR_ARCHIVE)
static VSMatrix identityMatrix(1);
@ -146,6 +147,7 @@ bool FRenderState::ApplyShader()
activeShader->muDesaturation.Set(mDesaturation / 255.f);
activeShader->muFogEnabled.Set(fogset);
activeShader->muPalLightLevels.Set(gl_bandedswlight);
activeShader->muTextureMode.Set(mTextureMode);
activeShader->muCameraPos.Set(mCameraPos.vec);
activeShader->muLightParms.Set(mLightParms);

View File

@ -214,6 +214,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
muDesaturation.Init(hShader, "uDesaturationFactor");
muFogEnabled.Init(hShader, "uFogEnabled");
muPalLightLevels.Init(hShader, "uPalLightLevels");
muTextureMode.Init(hShader, "uTextureMode");
muCameraPos.Init(hShader, "uCameraPos");
muLightParms.Init(hShader, "uLightAttr");

View File

@ -259,6 +259,7 @@ class FShader
FBufferedUniform1f muDesaturation;
FBufferedUniform1i muFogEnabled;
FBufferedUniform1i muPalLightLevels;
FBufferedUniform1i muTextureMode;
FBufferedUniform4f muCameraPos;
FBufferedUniform4f muLightParms;

View File

@ -2647,6 +2647,7 @@ GLPREFMNU_SSAO_PORTALS = "Portals with AO";
GLPREFMNU_FXAA = "FXAA Quality";
GLPREFMNU_PALTONEMAPORDER = "Tonemap Palette Order";
GLPREFMNU_PALTONEMAPPOWER = "Tonemap Palette Exponent";
GLPREFMNU_SWLMBANDED = "Banded SW Lightmode";
// Option Values
OPTVAL_SMART = "Smart";

View File

@ -232,6 +232,7 @@ OptionMenu "GLPrefOptions"
{
Title "$GLPREFMNU_TITLE"
Option "$GLPREFMNU_SECLIGHTMODE", gl_lightmode, "LightingModes"
Option "$GLPREFMNU_SWLMBANDED", gl_bandedswlight, "OnOff"
Option "$GLPREFMNU_FOGMODE", gl_fogmode, "FogMode"
Option "$GLPREFMNU_FOGFORCEFULLBRIGHT", gl_brightfog, "YesNo"
Slider "$GLPREFMNU_WPNLIGHTSTR", gl_weaponlight, 0,32, 2

View File

@ -121,7 +121,11 @@ float R_DoomLightingEquation(float light)
/* The zdoom light equation */
float vis = globVis / z;
float shade = 64.0 - (L + 12.0) * 32.0/128.0;
float lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
float lightscale;
if (uPalLightLevels != 0)
lightscale = clamp(int(shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
else
lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
// Result is the normalized colormap index (0 bright .. 1 dark)
return lightscale;

View File

@ -41,6 +41,7 @@ uniform vec4 uLightAttr;
#define uLightFactor uLightAttr.g
#define uLightDist uLightAttr.r
uniform int uFogEnabled;
uniform int uPalLightLevels;
// dynamic lights
uniform int uLightIndex;