Only add sunlight index to cells if sunlight is enabled

This commit is contained in:
Jarrod Doyle 2024-12-09 19:03:20 +00:00
parent df9b21de46
commit 16dddcb497
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 11 additions and 6 deletions

View File

@ -88,7 +88,7 @@ public class LightMapper
};
Timing.TimeStage("Gather Lights", BuildLightList);
Timing.TimeStage("Set Light Indices", SetCellLightIndices);
Timing.TimeStage("Set Light Indices", () => SetCellLightIndices(settings));
Timing.TimeStage("Trace Scene", () => TraceScene(settings));
Timing.TimeStage("Update AnimLight Cell Mapping", SetAnimLightCellMaps);
@ -309,7 +309,7 @@ public class LightMapper
}
}
private void SetCellLightIndices()
private void SetCellLightIndices(Settings settings)
{
// TODO: Doors aren't blocking lights. Need to do some cell traversal to remove light indices :(
@ -330,10 +330,15 @@ public class LightMapper
cell.LightIndexCount++;
cell.LightIndices.Add(0);
// Additionally we'll add the sun to everything (yucky)
// If we have sunlight, then we just assume the sun has the potential to reach everything (ew)
// The sun enabled option doesn't actually seem to do anything at runtime, it's purely about if
// the cell has the sunlight idx on it.
if (settings.Sunlight.Enabled)
{
cell.LightIndexCount++;
cell.LightIndices.Add(0);
cell.LightIndices[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