- properly handle passing of the light flags.
Since these can be changed on the placed light actor they have to be read from there, so this is now a pointer in FDynamicLight, just like the other properties that can be user-changed. Also did some cleanup on the interface so that external code doesn't need to dereference the lightflags pointer but can use utility functions for all flags.
This commit is contained in:
parent
da735c0e87
commit
8da1b5c1b0
13 changed files with 74 additions and 64 deletions
|
|
@ -76,14 +76,9 @@ void FLightDefaults::ApplyProperties(FDynamicLight * light) const
|
|||
light->lighttype = m_type;
|
||||
light->specialf1 = m_Param;
|
||||
light->pArgs = m_Args;
|
||||
light->lightflags &= ~(LF_ADDITIVE | LF_SUBTRACTIVE | LF_DONTLIGHTSELF | LF_SPOT);
|
||||
if (m_subtractive) light->lightflags |= LF_SUBTRACTIVE;
|
||||
if (m_additive) light->lightflags |= LF_ADDITIVE;
|
||||
if (m_dontlightself) light->lightflags |= LF_DONTLIGHTSELF;
|
||||
if (m_dontlightactors) light->lightflags |= LF_DONTLIGHTACTORS;
|
||||
if (m_spot)
|
||||
light->pLightFlags = &m_lightFlags;
|
||||
if (m_lightFlags & LF_SPOT)
|
||||
{
|
||||
light->lightflags |= LF_SPOT;
|
||||
light->pSpotInnerAngle = &m_spotInnerAngle;
|
||||
light->pSpotOuterAngle = &m_spotOuterAngle;
|
||||
if (m_explicitPitch) light->pPitch = &m_pitch;
|
||||
|
|
@ -103,16 +98,19 @@ void FLightDefaults::ApplyProperties(FDynamicLight * light) const
|
|||
if (light->m_currentRadius <= 0) light->m_currentRadius = 1;
|
||||
light->swapped = m_swapped;
|
||||
}
|
||||
|
||||
switch (m_attenuate)
|
||||
{
|
||||
case 0: light->lightflags &= ~LF_ATTENUATE; break;
|
||||
case 1: light->lightflags |= LF_ATTENUATE; break;
|
||||
default: if (level.flags3 & LEVEL3_ATTENUATE) light->lightflags |= LF_ATTENUATE; else light->lightflags &= ~LF_ATTENUATE; break;
|
||||
}
|
||||
light->SetOffset(m_Pos); // this must be the last thing to do.
|
||||
}
|
||||
|
||||
void FLightDefaults::SetAttenuationForLevel()
|
||||
{
|
||||
for (auto ldef : LightDefaults)
|
||||
{
|
||||
if (ldef->m_attenuate == -1)
|
||||
{
|
||||
if (level.flags3 & LEVEL3_ATTENUATE) ldef->m_lightFlags |= LF_ATTENUATE; else ldef->m_lightFlags &= ~LF_ATTENUATE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue