From db0b1f9c7a7630ace9b75c60bdcb18036d10fc72 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 28 Jan 2025 17:35:52 +0000 Subject: [PATCH] Pre-compute cell visibility in parallel --- KeepersCompound.Lightmapper/LightMapper.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KeepersCompound.Lightmapper/LightMapper.cs b/KeepersCompound.Lightmapper/LightMapper.cs index 63df56c..85cff24 100644 --- a/KeepersCompound.Lightmapper/LightMapper.cs +++ b/KeepersCompound.Lightmapper/LightMapper.cs @@ -481,9 +481,14 @@ public class LightMapper } } }); + + var pvs = new PotentiallyVisibleSet(worldRep.Cells); + Parallel.ForEach(lightCellMap, i => + { + pvs.ComputeVisibility(i); + }); var visibleCellMap = new List(_lights.Count); - var pvs = new PotentiallyVisibleSet(worldRep.Cells); for (var i = 0; i < _lights.Count; i++) { var cellIdx = lightCellMap[i];