Replace Thing UDMF keys for the ZDRayInfo with args instead

This commit is contained in:
nashmuhandes 2022-02-20 04:46:19 +08:00
parent 05eed4d4a2
commit 25345c2477
2 changed files with 18 additions and 31 deletions

View file

@ -52,10 +52,6 @@ Usage: zdray [options] sourcefile.wad
thing // ZDRayInfo (ZDRay properties for the map)
{
type = 9890;
suncolor = <int> (color)
sampledistance = <int> (default: 8, map units each lightmap texel covers, must be in powers of two)
bounces = <int> (default: 1, how many times light bounces off walls)
gridsize = <float> (default: 32, grid density for the automatic light probes)
}
thing // Static point light (Light color and distance properties use the same args as dynamic lights)

View file

@ -113,33 +113,24 @@ void FLevel::SetupLights()
sundir.z = -sdz;
//printf("sun vector: %f, %f, %f\n", sundir.x, sundir.y, sundir.z);
for (unsigned int propIndex = 0; propIndex < thing->props.Size(); propIndex++)
{
const UDMFKey& key = thing->props[propIndex];
if (!stricmp(key.key, "suncolor"))
{
lightcolor = atoi(key.value);
}
else if (!stricmp(key.key, "sampledistance"))
{
Samples = atoi(key.value);
// sun color
lightcolor = thing->args[0];
// sample distance
Samples = thing->args[1];
if (Samples <= 0) Samples = 1;
if (Samples > 128) Samples = 128;
Samples = Math::RoundPowerOfTwo(Samples);
}
else if (!stricmp(key.key, "bounces"))
{
LightBounce = atoi(key.value);
// number of light bounces
LightBounce = thing->args[2];
if (LightBounce < 0) LightBounce = 0;
if (LightBounce > 8) LightBounce = 8;
}
else if (!stricmp(key.key, "gridsize"))
{
GridSize = atof(key.value);
// auto probe grid size
GridSize = thing->args[3];
if (GridSize < 0.f) GridSize = 0.f;
if (GridSize > 1024.f) GridSize = 1024.f;
}
}
if (dot(sundir, sundir) > 0.01f)
{