- added a 'nolightfade' MAPINFO option which disables light diminishing in OpenGL. Note that this only works for light modes 0-3. Modes 4 and 8 use special light math that would not work if such a setting was forced.

This commit is contained in:
Christoph Oelckers 2017-02-13 22:17:15 +01:00
parent 1a63450fe2
commit cb758f6dab
3 changed files with 21 additions and 1 deletions

View File

@ -212,6 +212,7 @@ struct FGLROptions : public FOptionalMapinfoData
lightmode = -1; lightmode = -1;
attenuate = -1; attenuate = -1;
nocoloredspritelighting = -1; nocoloredspritelighting = -1;
nolightfade = false;
notexturefill = -1; notexturefill = -1;
skyrotatevector = FVector3(0,0,1); skyrotatevector = FVector3(0,0,1);
skyrotatevector2 = FVector3(0,0,1); skyrotatevector2 = FVector3(0,0,1);
@ -228,6 +229,7 @@ struct FGLROptions : public FOptionalMapinfoData
newopt->lightmode = lightmode; newopt->lightmode = lightmode;
newopt->attenuate = attenuate; newopt->attenuate = attenuate;
newopt->nocoloredspritelighting = nocoloredspritelighting; newopt->nocoloredspritelighting = nocoloredspritelighting;
newopt->nolightfade = nolightfade;
newopt->notexturefill = notexturefill; newopt->notexturefill = notexturefill;
newopt->skyrotatevector = skyrotatevector; newopt->skyrotatevector = skyrotatevector;
newopt->skyrotatevector2 = skyrotatevector2; newopt->skyrotatevector2 = skyrotatevector2;
@ -244,6 +246,7 @@ struct FGLROptions : public FOptionalMapinfoData
int8_t lightadditivesurfaces; int8_t lightadditivesurfaces;
int8_t nocoloredspritelighting; int8_t nocoloredspritelighting;
int8_t notexturefill; int8_t notexturefill;
bool nolightfade;
FVector3 skyrotatevector; FVector3 skyrotatevector;
FVector3 skyrotatevector2; FVector3 skyrotatevector2;
float pixelstretch; float pixelstretch;
@ -303,6 +306,20 @@ DEFINE_MAP_OPTION(nocoloredspritelighting, false)
} }
} }
DEFINE_MAP_OPTION(nolightfade, false)
{
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
if (parse.CheckAssign())
{
parse.sc.MustGetNumber();
opt->nolightfade = !!parse.sc.Number;
}
else
{
opt->nolightfade = true;
}
}
DEFINE_MAP_OPTION(notexturefill, false) DEFINE_MAP_OPTION(notexturefill, false)
{ {
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer"); FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
@ -423,6 +440,7 @@ void InitGLRMapinfoData()
glset.skyrotatevector = opt->skyrotatevector; glset.skyrotatevector = opt->skyrotatevector;
glset.skyrotatevector2 = opt->skyrotatevector2; glset.skyrotatevector2 = opt->skyrotatevector2;
glset.pixelstretch = opt->pixelstretch; glset.pixelstretch = opt->pixelstretch;
glset.nolightfade = opt->nolightfade;
} }
else else
{ {
@ -436,6 +454,7 @@ void InitGLRMapinfoData()
glset.skyrotatevector = FVector3(0, 0, 1); glset.skyrotatevector = FVector3(0, 0, 1);
glset.skyrotatevector2 = FVector3(0, 0, 1); glset.skyrotatevector2 = FVector3(0, 0, 1);
glset.pixelstretch = 1.2f; glset.pixelstretch = 1.2f;
glset.nolightfade = false;
} }
ResetOpts(); ResetOpts();
} }

View File

@ -10,6 +10,7 @@ struct GLRenderSettings
SBYTE lightmode; SBYTE lightmode;
bool nocoloredspritelighting; bool nocoloredspritelighting;
bool nolightfade;
bool notexturefill; bool notexturefill;
bool brightfog; bool brightfog;
bool lightadditivesurfaces; bool lightadditivesurfaces;

View File

@ -312,7 +312,7 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
else if ((fogcolor.d & 0xffffff) == 0) else if ((fogcolor.d & 0xffffff) == 0)
{ {
// case 2: black fog // case 2: black fog
if (glset.lightmode != 8) if (glset.lightmode != 8 && !glset.nolightfade)
{ {
density = distfogtable[glset.lightmode != 0][gl_ClampLight(lightlevel)]; density = distfogtable[glset.lightmode != 0][gl_ClampLight(lightlevel)];
} }