mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +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;
|
||||
|
||||
void AddLightDefaults(FLightDefaults *defaults)
|
||||
void AddLightDefaults(FLightDefaults *defaults, double attnFactor)
|
||||
{
|
||||
FLightDefaults *temp;
|
||||
unsigned int i;
|
||||
|
@ -153,6 +153,11 @@ void AddLightDefaults(FLightDefaults *defaults)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "textures/skyboxtexture.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 InitializeActorLights(TArray<FLightAssociation> &LightAssociations);
|
||||
|
||||
|
@ -193,6 +193,7 @@ static const char *CoreKeywords[]=
|
|||
"detail",
|
||||
"#include",
|
||||
"material",
|
||||
"lightsizefactor",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
@ -215,7 +216,8 @@ enum
|
|||
TAG_HARDWARESHADER,
|
||||
TAG_DETAIL,
|
||||
TAG_INCLUDE,
|
||||
TAG_MATERIAL
|
||||
TAG_MATERIAL,
|
||||
TAG_LIGHTSIZEFACTOR,
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -230,6 +232,7 @@ class GLDefsParser
|
|||
int workingLump;
|
||||
int ScriptDepth = 0;
|
||||
TArray<FLightAssociation> &LightAssociations;
|
||||
double lightSizeFactor = 1.;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -470,7 +473,7 @@ class GLDefsParser
|
|||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||
}
|
||||
}
|
||||
AddLightDefaults(defaults);
|
||||
AddLightDefaults(defaults, lightSizeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -565,7 +568,7 @@ class GLDefsParser
|
|||
}
|
||||
defaults->OrderIntensities();
|
||||
|
||||
AddLightDefaults(defaults);
|
||||
AddLightDefaults(defaults, lightSizeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -660,7 +663,7 @@ class GLDefsParser
|
|||
}
|
||||
}
|
||||
defaults->OrderIntensities();
|
||||
AddLightDefaults(defaults);
|
||||
AddLightDefaults(defaults, lightSizeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -760,7 +763,7 @@ class GLDefsParser
|
|||
defaults->SetArg(LIGHT_SECONDARY_INTENSITY, defaults->GetArg(LIGHT_INTENSITY));
|
||||
defaults->SetArg(LIGHT_INTENSITY, v);
|
||||
}
|
||||
AddLightDefaults(defaults);
|
||||
AddLightDefaults(defaults, lightSizeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -846,7 +849,7 @@ class GLDefsParser
|
|||
sc.ScriptError("Unknown tag: %s\n", sc.String);
|
||||
}
|
||||
}
|
||||
AddLightDefaults(defaults);
|
||||
AddLightDefaults(defaults, lightSizeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1427,7 +1430,6 @@ class GLDefsParser
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
@ -1461,6 +1463,7 @@ public:
|
|||
sc.ScriptError("Lump '%s' not found", sc.String);
|
||||
|
||||
GLDefsParser newscanner(lump, LightAssociations);
|
||||
newscanner.lightSizeFactor = lightSizeFactor;
|
||||
newscanner.DoParseDefs();
|
||||
break;
|
||||
}
|
||||
|
@ -1508,6 +1511,9 @@ public:
|
|||
case TAG_DETAIL:
|
||||
ParseDetailTexture();
|
||||
break;
|
||||
case TAG_LIGHTSIZEFACTOR:
|
||||
lightSizeFactor = ParseFloat(sc);
|
||||
break;
|
||||
case TAG_DISABLE_FB:
|
||||
{
|
||||
/* not implemented.
|
||||
|
|
Loading…
Reference in a new issue