diff --git a/src/DotRecast.Recast/RcLayerRegion.cs b/src/DotRecast.Recast/RcLayerRegion.cs index 7c94007..dc98ecb 100644 --- a/src/DotRecast.Recast/RcLayerRegion.cs +++ b/src/DotRecast.Recast/RcLayerRegion.cs @@ -4,20 +4,20 @@ namespace DotRecast.Recast { public class RcLayerRegion { - public int id; - public int layerId; // Layer ID - public bool @base; // Flag indicating if the region is the base of merged regions. + public readonly int index; + public List layers; + public List neis; public int ymin, ymax; - public List layers; // Layer count - public List neis; // Neighbour count + public byte layerId; // Layer ID + public bool @base; // Flag indicating if the region is the base of merged regions. public RcLayerRegion(int i) { - id = i; - ymin = 0xFFFF; - layerId = 0xff; + index = i; layers = new List(); neis = new List(); + ymin = 0xFFFF; + layerId = 0xff; } }; } \ No newline at end of file diff --git a/src/DotRecast.Recast/RcLayers.cs b/src/DotRecast.Recast/RcLayers.cs index 98cee66..b9a2996 100644 --- a/src/DotRecast.Recast/RcLayers.cs +++ b/src/DotRecast.Recast/RcLayers.cs @@ -266,7 +266,7 @@ namespace DotRecast.Recast } // Create 2D layers from regions. - int layerId = 0; + byte layerId = 0; List stack = new List(); @@ -335,7 +335,7 @@ namespace DotRecast.Recast if (!ri.@base) continue; - int newId = ri.layerId; + byte newId = ri.layerId; for (;;) { @@ -411,7 +411,7 @@ namespace DotRecast.Recast } // Compact layerIds - int[] remap = new int[256]; + Span remap = stackalloc byte[256]; // Find number of unique layers. layerId = 0;