Fix incorrect light table

This commit is contained in:
Jarrod Doyle 2024-10-27 12:26:01 +00:00
parent c8e13a7f7b
commit b263bdd77e
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 8 additions and 0 deletions

View File

@ -554,6 +554,7 @@ class Program
private static void SetCellLightIndices(WorldRep wr, Light[] lights)
{
// TODO: Move this functionality to the LGS library
// We set up light indices in separately from lighting because the actual
// lighting phase takes a lot of shortcuts that we don't want
Parallel.ForEach(wr.Cells, cell =>
@ -561,6 +562,12 @@ class Program
cell.LightIndexCount = 0;
cell.LightIndices.Clear();
// The first element of the light indices array is used to store how many
// actual lights are in the list. Which is just LightIndexCount - 1...
// Odd choice I know
cell.LightIndexCount++;
cell.LightIndices.Add(0);
// The OG lightmapper uses the cell traversal to work out all the cells that
// are actually visited. We're a lot more coarse and just say if a cell is
// in range then we potentially affect the lighting in the cell and add it
@ -573,6 +580,7 @@ class Program
{
cell.LightIndexCount++;
cell.LightIndices.Add((ushort)light.lightTableIndex);
cell.LightIndices[0]++;
}
}
});