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 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<int> layers;
public List<int> neis;
public int ymin, ymax;
public List<int> layers; // Layer count
public List<int> 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<int>();
neis = new List<int>();
ymin = 0xFFFF;
layerId = 0xff;
}
};
}

View File

@ -266,7 +266,7 @@ namespace DotRecast.Recast
}
// Create 2D layers from regions.
int layerId = 0;
byte layerId = 0;
List<int> stack = new List<int>();
@ -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<byte> remap = stackalloc byte[256];
// Find number of unique layers.
layerId = 0;