mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-05-31 01:11:08 +00:00
- User definable dynamic lights
This hasn't been tested yet! # Conflicts: # src/g_shared/a_dynlight.h # Conflicts: # src/g_shared/a_dynlightdata.cpp
This commit is contained in:
parent
3000e15aec
commit
0c4fc385cc
7 changed files with 234 additions and 6 deletions
|
@ -51,6 +51,7 @@
|
|||
#include "v_text.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "a_dynlight.h"
|
||||
#include "serializer.h"
|
||||
#include "textures/skyboxtexture.h"
|
||||
|
||||
|
||||
|
@ -78,12 +79,60 @@ TDeletingArray<FLightDefaults *> LightDefaults;
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FLightDefaults::FLightDefaults(FName name, ELightType type)
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FLightDefaults &value, FLightDefaults *def)
|
||||
{
|
||||
m_Name = name;
|
||||
m_type = type;
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("name", value.m_Name)
|
||||
.Array("args", value.m_Args, 5, nullptr)
|
||||
("param", value.m_Param)
|
||||
("pos", value.m_Pos)
|
||||
("type", value.m_type)
|
||||
("attenuate", value.m_attenuate)
|
||||
("flags", value.m_lightFlags)
|
||||
("swapped", value.m_swapped)
|
||||
("spot", value.m_spot)
|
||||
("explicitpitch", value.m_explicitPitch)
|
||||
("spotinner", value.m_spotInnerAngle)
|
||||
("spotouter", value.m_spotOuterAngle)
|
||||
("pitch", value.m_pitch)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, TDeletingArray<FLightDefaults *> &value, TDeletingArray<FLightDefaults *> *def)
|
||||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (value.Size() == 0) return arc; // do not save empty arrays
|
||||
}
|
||||
bool res = arc.BeginArray(key);
|
||||
if (arc.isReading())
|
||||
{
|
||||
if (!res)
|
||||
{
|
||||
value.Clear();
|
||||
return arc;
|
||||
}
|
||||
value.Resize(arc.ArraySize());
|
||||
for (auto &entry : value) entry = new FLightDefaults(NAME_None);
|
||||
}
|
||||
for (unsigned i = 0; i < value.Size(); i++)
|
||||
{
|
||||
Serialize(arc, nullptr, *value[i], nullptr);
|
||||
}
|
||||
arc.EndArray();
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FLightDefaults::ApplyProperties(FDynamicLight * light) const
|
||||
{
|
||||
auto oldtype = light->lighttype;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue