Fix reapplying ambient on non-lit pixels

This commit is contained in:
Jarrod Doyle 2024-09-22 12:01:02 +01:00
parent 45ad76855f
commit fe3f13e372
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
using System.Numerics; using System.Numerics;
using KeepersCompound.LGS.Database; using KeepersCompound.LGS.Database;
using KeepersCompound.LGS.Database.Chunks; using KeepersCompound.LGS.Database.Chunks;
using TinyEmbree; using TinyEmbree;
@ -220,12 +220,14 @@ class Program
Console.WriteLine($"Pos: {hit.Position}, Target Pos: {renderPoly.Center}"); Console.WriteLine($"Pos: {hit.Position}, Target Pos: {renderPoly.Center}");
// Iterate all pixels // Iterate all pixels
var color = goodHit ? light.color : ambientLight; if (goodHit)
{
for (var y = 0; y < lightmap.Height; y++) for (var y = 0; y < lightmap.Height; y++)
{ {
for (var x = 0; x < lightmap.Width; x++) for (var x = 0; x < lightmap.Width; x++)
{ {
lightmap.AddLight(0, x, y, (byte)color.X, (byte)color.Y, (byte)color.Z); lightmap.AddLight(0, x, y, (byte)light.color.X, (byte)light.color.Y, (byte)light.color.Z);
}
} }
} }
} }