Precalculate edge list capacity
This commit is contained in:
parent
1f0b87f3de
commit
3040914afb
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using KeepersCompound.LGS.Database.Chunks;
|
using KeepersCompound.LGS.Database.Chunks;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace KeepersCompound.Lightmapper;
|
namespace KeepersCompound.Lightmapper;
|
||||||
|
|
||||||
|
@ -98,7 +99,6 @@ public class PotentiallyVisibleSet
|
||||||
public PotentiallyVisibleSet(WorldRep.Cell[] cells)
|
public PotentiallyVisibleSet(WorldRep.Cell[] cells)
|
||||||
{
|
{
|
||||||
_graph = new Node[cells.Length];
|
_graph = new Node[cells.Length];
|
||||||
_edges = [];
|
|
||||||
|
|
||||||
var portalCount = 0;
|
var portalCount = 0;
|
||||||
foreach (var cell in cells)
|
foreach (var cell in cells)
|
||||||
|
@ -106,6 +106,9 @@ public class PotentiallyVisibleSet
|
||||||
portalCount += cell.PortalPolyCount;
|
portalCount += cell.PortalPolyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_edges = new List<Edge>(portalCount);
|
||||||
|
Log.Information("Mission contains {PortalCount} portals.", portalCount);
|
||||||
|
|
||||||
for (var i = 0; i < cells.Length; i++)
|
for (var i = 0; i < cells.Length; i++)
|
||||||
{
|
{
|
||||||
var cell = cells[i];
|
var cell = cells[i];
|
||||||
|
|
Loading…
Reference in New Issue