change light strength to light linearity 0.0 = inverse square, 1.0 = linear

This commit is contained in:
Ricardo Luís Vaz Silva 2024-10-10 16:51:09 -03:00 committed by Magnus Norddahl
commit 74a49ca919
13 changed files with 54 additions and 56 deletions

View file

@ -118,6 +118,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TDeletingArray<FLightD
//
//-----------------------------------------------------------------------------
extern float LightCalcStrength(float radius);
void FLightDefaults::ApplyProperties(FDynamicLight * light) const
{
auto oldtype = light->lighttype;
@ -128,15 +130,8 @@ void FLightDefaults::ApplyProperties(FDynamicLight * light) const
light->pArgs = m_Args;
light->pSoftShadowRadius = &SoftShadowRadius;
if(Strength > 0.0)
{
light->pStrength = const_cast<double*>(&Strength); // casting const to non-const, but positive strength values will not be modified
}
else
{
light->tmpStrength = 0.0;
light->pStrength = &light->tmpStrength;
}
light->pLinearity = &Linearity;
light->lightStrength = LightCalcStrength(light->pArgs[LIGHT_INTENSITY]);
light->pLightFlags = &m_lightFlags;
if (m_lightFlags & LF_SPOT)