Skip to content

Commit

Permalink
Use a light_ prefix for the soft shadows, in consideration for pote…
Browse files Browse the repository at this point in the history
…ntial future expansions with regards to lights.
  • Loading branch information
nashmuhandes committed Oct 6, 2024
1 parent 3750bdd commit 5fd4056
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ thing // ZDRayInfo (ZDRay properties for the map)
thing // Lightmap point light (Light color and distance properties use the same args as dynamic lights)
{
type = 9876;
SoftShadowRadius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
light_softshadowradius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
}

thing // Lightmap spotlight (Light color, distance and angle properties use the same args as dynamic lights)
{
type = 9881;
SoftShadowRadius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
light_softshadowradius = <float> (default: 5, radius of the light source in map units; controls the shadow softness. Note that dynamic raytraced lights can also use this feature)
}

linedef
Expand Down
7 changes: 4 additions & 3 deletions src/level/level_light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ void FLevel::CreateLights()

// UDB's color picker will assign the color as a hex string, stored
// in the arg0str field. detect this, so that it can be converted into an int
// this behavior is unique to spotlights.
if (thing->arg0str.Len() > 0)
{
FString hex = "0x" + thing->arg0str;
Expand All @@ -282,16 +283,16 @@ void FLevel::CreateLights()

for (const auto& prop : thing->props)
{
if (!stricmp(prop.key, "softshadowradius"))
if (!stricmp(prop.key, "light_softshadowradius"))
{
softshadowradius = atof(prop.value);
}
}

// this is known as "intensity" on dynamic lights (and in UDB)
// this is known as "intensity" on dynamic lights (and in UDB) - what it actually is though, is the radius
lightDistance = thing->args[3];

// lightmap light intensity (not to be confused with dynamic lights' intensity, which is actually lightmap light distance
// light intensity is how bright or dark a light is. can go below or above 1.0.
lightIntensity = thing->alpha;

if (lightDistance > 0.0f && lightIntensity > 0.0f && lightColor != FVector3(0, 0, 0))
Expand Down

0 comments on commit 5fd4056

Please sign in to comment.