Pre-compute cell visibility in parallel

This commit is contained in:
Jarrod Doyle 2025-01-28 17:35:52 +00:00
parent b493c447c7
commit db0b1f9c7a
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 6 additions and 1 deletions

View File

@ -482,8 +482,13 @@ public class LightMapper
} }
}); });
var visibleCellMap = new List<int[]>(_lights.Count);
var pvs = new PotentiallyVisibleSet(worldRep.Cells); var pvs = new PotentiallyVisibleSet(worldRep.Cells);
Parallel.ForEach(lightCellMap, i =>
{
pvs.ComputeVisibility(i);
});
var visibleCellMap = new List<int[]>(_lights.Count);
for (var i = 0; i < _lights.Count; i++) for (var i = 0; i < _lights.Count; i++)
{ {
var cellIdx = lightCellMap[i]; var cellIdx = lightCellMap[i];