From 3040914afb40d3a9358923982a854ca59d35b805 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 28 Jan 2025 17:21:17 +0000 Subject: [PATCH] Precalculate edge list capacity --- KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs b/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs index 566618f..99cc401 100644 --- a/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs +++ b/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Numerics; using KeepersCompound.LGS.Database.Chunks; +using Serilog; namespace KeepersCompound.Lightmapper; @@ -98,7 +99,6 @@ public class PotentiallyVisibleSet public PotentiallyVisibleSet(WorldRep.Cell[] cells) { _graph = new Node[cells.Length]; - _edges = []; var portalCount = 0; foreach (var cell in cells) @@ -106,6 +106,9 @@ public class PotentiallyVisibleSet portalCount += cell.PortalPolyCount; } + _edges = new List(portalCount); + Log.Information("Mission contains {PortalCount} portals.", portalCount); + for (var i = 0; i < cells.Length; i++) { var cell = cells[i];