mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-06-01 09:42:24 +00:00
- 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. # Conflicts: # src/hwrenderer/dynlights/hw_dynlightdata.cpp # src/swrenderer/line/r_walldraw.cpp # Conflicts: # src/g_level.cpp # src/gl/compatibility/gl_20.cpp
This commit is contained in:
parent
17b13f1a60
commit
8fecfb8f85
14 changed files with 76 additions and 66 deletions
|
@ -92,14 +92,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;
|
||||
|
@ -119,16 +114,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