Add inner radius support

This commit is contained in:
Jarrod Doyle 2024-09-26 16:03:50 +01:00
parent cb526c634c
commit 22600a27e5
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,7 @@ class Program
{ {
public Vector3 position; public Vector3 position;
public Vector3 color; public Vector3 color;
public float innerRadius;
public float radius; public float radius;
public float r2; public float r2;
} }
@ -23,7 +24,7 @@ class Program
var misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/JAYRUDE_Tests/lm_test.cow"; var misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/JAYRUDE_Tests/lm_test.cow";
// misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/AtdV/miss20.mis"; // misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/AtdV/miss20.mis";
misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/TDP20AC_a_burrick_in_a_room/miss20.mis"; // misPath = "/stuff/Games/thief/drive_c/GOG Games/TG ND 1.27 (MAPPING)/FMs/TDP20AC_a_burrick_in_a_room/miss20.mis";
Timing.TimeStage("Total", () => LightmapMission(misPath)); Timing.TimeStage("Total", () => LightmapMission(misPath));
Timing.LogAll(); Timing.LogAll();
@ -103,6 +104,7 @@ class Program
{ {
position = brush.position, position = brush.position,
color = HsbToRgb(sz.Y, sz.Z, Math.Min(sz.X, 255.0f)), color = HsbToRgb(sz.Y, sz.Z, Math.Min(sz.X, 255.0f)),
innerRadius = 0.0f,
radius = float.MaxValue, radius = float.MaxValue,
r2 = float.MaxValue r2 = float.MaxValue
}); });
@ -123,6 +125,7 @@ class Program
{ {
position = brush.position + propLight.Offset, position = brush.position + propLight.Offset,
color = HsbToRgb(propLightColor.Hue, propLightColor.Saturation, propLight.Brightness), color = HsbToRgb(propLightColor.Hue, propLightColor.Saturation, propLight.Brightness),
innerRadius = propLight.InnerRadius,
radius = propLight.Radius, radius = propLight.Radius,
r2 = propLight.Radius * propLight.Radius, r2 = propLight.Radius * propLight.Radius,
}; };
@ -358,6 +361,12 @@ class Program
var slen = len / 4.0f; var slen = len / 4.0f;
var strength = (angle + 1.0f) / slen; var strength = (angle + 1.0f) / slen;
// Inner radius starts a linear falloff to 0 at the radius
if (light.innerRadius != 0 && len > light.innerRadius)
{
strength *= (light.radius - len) / (light.radius - light.innerRadius);
}
return strength; return strength;
} }