From 22600a27e53b2ebedb79b5f8bbb705e96ee3300a Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Thu, 26 Sep 2024 16:03:50 +0100 Subject: [PATCH] Add inner radius support --- KeepersCompound.Lightmapper/Program.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/KeepersCompound.Lightmapper/Program.cs b/KeepersCompound.Lightmapper/Program.cs index ee448b3..8d889ef 100644 --- a/KeepersCompound.Lightmapper/Program.cs +++ b/KeepersCompound.Lightmapper/Program.cs @@ -13,6 +13,7 @@ class Program { public Vector3 position; public Vector3 color; + public float innerRadius; public float radius; 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"; // 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.LogAll(); @@ -103,6 +104,7 @@ class Program { position = brush.position, color = HsbToRgb(sz.Y, sz.Z, Math.Min(sz.X, 255.0f)), + innerRadius = 0.0f, radius = float.MaxValue, r2 = float.MaxValue }); @@ -123,6 +125,7 @@ class Program { position = brush.position + propLight.Offset, color = HsbToRgb(propLightColor.Hue, propLightColor.Saturation, propLight.Brightness), + innerRadius = propLight.InnerRadius, radius = propLight.Radius, r2 = propLight.Radius * propLight.Radius, }; @@ -358,6 +361,12 @@ class Program var slen = len / 4.0f; 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; }