Changed RcLayerRegion.layerId to byte

This commit is contained in:
ikpil 2024-06-25 00:30:51 +09:00
parent 35f5c63d77
commit bdb9463d88
2 changed files with 11 additions and 11 deletions

View File

@ -4,20 +4,20 @@ namespace DotRecast.Recast
{ {
public class RcLayerRegion public class RcLayerRegion
{ {
public int id; public readonly int index;
public int layerId; // Layer ID public List<int> layers;
public bool @base; // Flag indicating if the region is the base of merged regions. public List<int> neis;
public int ymin, ymax; public int ymin, ymax;
public List<int> layers; // Layer count public byte layerId; // Layer ID
public List<int> neis; // Neighbour count public bool @base; // Flag indicating if the region is the base of merged regions.
public RcLayerRegion(int i) public RcLayerRegion(int i)
{ {
id = i; index = i;
ymin = 0xFFFF;
layerId = 0xff;
layers = new List<int>(); layers = new List<int>();
neis = new List<int>(); neis = new List<int>();
ymin = 0xFFFF;
layerId = 0xff;
} }
}; };
} }

View File

@ -266,7 +266,7 @@ namespace DotRecast.Recast
} }
// Create 2D layers from regions. // Create 2D layers from regions.
int layerId = 0; byte layerId = 0;
List<int> stack = new List<int>(); List<int> stack = new List<int>();
@ -335,7 +335,7 @@ namespace DotRecast.Recast
if (!ri.@base) if (!ri.@base)
continue; continue;
int newId = ri.layerId; byte newId = ri.layerId;
for (;;) for (;;)
{ {
@ -411,7 +411,7 @@ namespace DotRecast.Recast
} }
// Compact layerIds // Compact layerIds
int[] remap = new int[256]; Span<byte> remap = stackalloc byte[256];
// Find number of unique layers. // Find number of unique layers.
layerId = 0; layerId = 0;