mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +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.
This commit is contained in:
parent
4ab6034a36
commit
e77cba1fd8
2 changed files with 20 additions and 9 deletions
|
@ -137,7 +137,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
||||||
|
|
||||||
extern int ScriptDepth;
|
extern int ScriptDepth;
|
||||||
|
|
||||||
void AddLightDefaults(FLightDefaults *defaults)
|
void AddLightDefaults(FLightDefaults *defaults, double attnFactor)
|
||||||
{
|
{
|
||||||
FLightDefaults *temp;
|
FLightDefaults *temp;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -153,6 +153,11 @@ void AddLightDefaults(FLightDefaults *defaults)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include "textures/skyboxtexture.h"
|
#include "textures/skyboxtexture.h"
|
||||||
#include "gl/shaders/gl_postprocessshader.h"
|
#include "gl/shaders/gl_postprocessshader.h"
|
||||||
|
|
||||||
void AddLightDefaults(FLightDefaults *defaults);
|
void AddLightDefaults(FLightDefaults *defaults, double attnFactor);
|
||||||
void AddLightAssociation(const char *actor, const char *frame, const char *light);
|
void AddLightAssociation(const char *actor, const char *frame, const char *light);
|
||||||
void InitializeActorLights(TArray<FLightAssociation> &LightAssociations);
|
void InitializeActorLights(TArray<FLightAssociation> &LightAssociations);
|
||||||
|
|
||||||
|
@ -193,6 +193,7 @@ static const char *CoreKeywords[]=
|
||||||
"detail",
|
"detail",
|
||||||
"#include",
|
"#include",
|
||||||
"material",
|
"material",
|
||||||
|
"lightsizefactor",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -215,7 +216,8 @@ enum
|
||||||
TAG_HARDWARESHADER,
|
TAG_HARDWARESHADER,
|
||||||
TAG_DETAIL,
|
TAG_DETAIL,
|
||||||
TAG_INCLUDE,
|
TAG_INCLUDE,
|
||||||
TAG_MATERIAL
|
TAG_MATERIAL,
|
||||||
|
TAG_LIGHTSIZEFACTOR,
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -230,6 +232,7 @@ class GLDefsParser
|
||||||
int workingLump;
|
int workingLump;
|
||||||
int ScriptDepth = 0;
|
int ScriptDepth = 0;
|
||||||
TArray<FLightAssociation> &LightAssociations;
|
TArray<FLightAssociation> &LightAssociations;
|
||||||
|
double lightSizeFactor = 1.;
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -470,7 +473,7 @@ class GLDefsParser
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -565,7 +568,7 @@ class GLDefsParser
|
||||||
}
|
}
|
||||||
defaults->OrderIntensities();
|
defaults->OrderIntensities();
|
||||||
|
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -660,7 +663,7 @@ class GLDefsParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defaults->OrderIntensities();
|
defaults->OrderIntensities();
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -760,7 +763,7 @@ class GLDefsParser
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -846,7 +849,7 @@ class GLDefsParser
|
||||||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddLightDefaults(defaults);
|
AddLightDefaults(defaults, lightSizeFactor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1427,7 +1430,6 @@ class GLDefsParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -1461,6 +1463,7 @@ public:
|
||||||
sc.ScriptError("Lump '%s' not found", sc.String);
|
sc.ScriptError("Lump '%s' not found", sc.String);
|
||||||
|
|
||||||
GLDefsParser newscanner(lump, LightAssociations);
|
GLDefsParser newscanner(lump, LightAssociations);
|
||||||
|
newscanner.lightSizeFactor = lightSizeFactor;
|
||||||
newscanner.DoParseDefs();
|
newscanner.DoParseDefs();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1508,6 +1511,9 @@ public:
|
||||||
case TAG_DETAIL:
|
case TAG_DETAIL:
|
||||||
ParseDetailTexture();
|
ParseDetailTexture();
|
||||||
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