From fe3f13e372821884a2285f2458a84284b548de19 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 22 Sep 2024 12:01:02 +0100 Subject: [PATCH] Fix reapplying ambient on non-lit pixels --- KeepersCompound.Lightmapper/Program.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/KeepersCompound.Lightmapper/Program.cs b/KeepersCompound.Lightmapper/Program.cs index c0e1bd8..bdb6406 100644 --- a/KeepersCompound.Lightmapper/Program.cs +++ b/KeepersCompound.Lightmapper/Program.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using KeepersCompound.LGS.Database; using KeepersCompound.LGS.Database.Chunks; using TinyEmbree; @@ -220,12 +220,14 @@ class Program Console.WriteLine($"Pos: {hit.Position}, Target Pos: {renderPoly.Center}"); // Iterate all pixels - var color = goodHit ? light.color : ambientLight; - for (var y = 0; y < lightmap.Height; y++) + if (goodHit) { - for (var x = 0; x < lightmap.Width; x++) + for (var y = 0; y < lightmap.Height; y++) { - lightmap.AddLight(0, x, y, (byte)color.X, (byte)color.Y, (byte)color.Z); + for (var x = 0; x < lightmap.Width; x++) + { + lightmap.AddLight(0, x, y, (byte)light.color.X, (byte)light.color.Y, (byte)light.color.Z); + } } } }