mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
- added a 'lightsizefactor' command to gldefs.
This is for mitigating the recently discovered problem with attenuated lights getting reduced in size, even on OpenGL 3+. The intent of the shrinking was to account for higher brightness of non-attenuated lights on OpenGL 2 and was never meant to be active on more modern versions. The factor will apply to any attenuated light defined after it and will be inherited by included sub-lumps, but it will only last for the lunp it is set in. If you have a definition for the broken behavior, AddLightAssociation 'lightsizefactor 0.667' at the top of your GLDEFS. (ported patch by Graf)
This commit is contained in:
parent
8d45611cab
commit
538897430d
1 changed files with 19 additions and 7 deletions
|
@ -104,6 +104,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
TArray<FLightAssociation> LightAssociations;
|
TArray<FLightAssociation> LightAssociations;
|
||||||
|
double lightSizeFactor = 1.;
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -313,7 +314,7 @@ static void ParseTriple(FScanner &sc, float floatVal[3])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void AddLightDefaults(FLightDefaults *defaults)
|
static void AddLightDefaults(FLightDefaults *defaults, double attnFactor)
|
||||||
{
|
{
|
||||||
FLightDefaults *temp;
|
FLightDefaults *temp;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -330,6 +331,12 @@ static void AddLightDefaults(FLightDefaults *defaults)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defaults->GetAttenuate())
|
||||||
|
{
|
||||||
|
defaults->SetArg(LIGHT_INTENSITY, int(defaults->GetArg(LIGHT_INTENSITY) * attnFactor));
|
||||||
|
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, int(defaults->GetArg(LIGHT_SECONDARY_INTENSITY) * attnFactor));
|
||||||
|
}
|
||||||
|
|
||||||
LightDefaults.Push(defaults);
|
LightDefaults.Push(defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +421,7 @@ static void ParsePointLight(FScanner &sc)
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -510,7 +517,7 @@ static void ParsePulseLight(FScanner &sc)
|
||||||
}
|
}
|
||||||
defaults->OrderIntensities();
|
defaults->OrderIntensities();
|
||||||
|
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -605,7 +612,7 @@ void ParseFlickerLight(FScanner &sc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defaults->OrderIntensities();
|
defaults->OrderIntensities();
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -705,7 +712,7 @@ void ParseFlickerLight2(FScanner &sc)
|
||||||
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_INTENSITY));
|
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_INTENSITY));
|
||||||
defaults->SetArg(LIGHT_INTENSITY, v);
|
defaults->SetArg(LIGHT_INTENSITY, v);
|
||||||
}
|
}
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -791,7 +798,7 @@ static void ParseSectorLight(FScanner &sc)
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -958,6 +965,7 @@ static const char *CoreKeywords[]=
|
||||||
"detail",
|
"detail",
|
||||||
"#include",
|
"#include",
|
||||||
"material",
|
"material",
|
||||||
|
"lightsizefactor",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -980,7 +988,8 @@ enum
|
||||||
TAG_HARDWARESHADER,
|
TAG_HARDWARESHADER,
|
||||||
TAG_DETAIL,
|
TAG_DETAIL,
|
||||||
TAG_INCLUDE,
|
TAG_INCLUDE,
|
||||||
TAG_MATERIAL
|
TAG_MATERIAL,
|
||||||
|
TAG_LIGHTSIZEFACTOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1347,6 +1356,9 @@ static void DoParseDefs(FScanner &sc, int workingLump)
|
||||||
case TAG_DETAIL:
|
case TAG_DETAIL:
|
||||||
gl_ParseDetailTexture(sc);
|
gl_ParseDetailTexture(sc);
|
||||||
break;
|
break;
|
||||||
|
case TAG_LIGHTSIZEFACTOR:
|
||||||
|
lightSizeFactor = ParseFloat(sc);
|
||||||
|
break;
|
||||||
case TAG_DISABLE_FB:
|
case TAG_DISABLE_FB:
|
||||||
{
|
{
|
||||||
/* not implemented.
|
/* not implemented.
|
||||||
|
|
Loading…
Reference in a new issue