Remove PVS lighting stage

This commit is contained in:
Jarrod Doyle 2025-02-23 10:21:06 +00:00
parent db0a70607d
commit ccd1c6ef82
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 63 additions and 71 deletions

View File

@ -477,13 +477,9 @@ public class LightMapper
private void SetCellLightIndices(Settings settings) private void SetCellLightIndices(Settings settings)
{ {
// TODO: Doors aren't blocking lights. Need to do some cell traversal to remove light indices :(
if (!_mission.TryGetChunk<WorldRep>("WREXT", out var worldRep)) if (!_mission.TryGetChunk<WorldRep>("WREXT", out var worldRep))
return; return;
var lightVisibleCells = Timing.TimeStage("Light PVS", () =>
{
var cellCount = worldRep.Cells.Length; var cellCount = worldRep.Cells.Length;
var aabbs = new MathUtils.Aabb[worldRep.Cells.Length]; var aabbs = new MathUtils.Aabb[worldRep.Cells.Length];
Parallel.For(0, cellCount, i => aabbs[i] = new MathUtils.Aabb(worldRep.Cells[i].Vertices)); Parallel.For(0, cellCount, i => aabbs[i] = new MathUtils.Aabb(worldRep.Cells[i].Vertices));
@ -564,10 +560,6 @@ public class LightMapper
visibleCellMap[i] = visibleSet; visibleCellMap[i] = visibleSet;
}); });
return visibleCellMap;
});
// TODO: Move this functionality to the LGS library // TODO: Move this functionality to the LGS library
// We set up light indices in separately from lighting because the actual // We set up light indices in separately from lighting because the actual
// lighting phase takes a lot of shortcuts that we don't want // lighting phase takes a lot of shortcuts that we don't want
@ -610,7 +602,7 @@ public class LightMapper
continue; continue;
} }
if (!lightVisibleCells[j].Contains(i)) if (!visibleCellMap[j].Contains(i))
{ {
continue; continue;
} }