Changed 'reg', 'area' arrays to byte arrays for uniformity and efficiency in DtTileCacheContour

This commit is contained in:
ikpil 2024-06-12 00:03:59 +09:00
parent b88b6096f6
commit 650849b11b
4 changed files with 11 additions and 21 deletions

View File

@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed ### Changed
- Changed to reuse samples and edges list in BuildPolyDetail() - Changed to reuse samples and edges list in BuildPolyDetail()
- Changed 'heights', 'areas', 'cons', and 'regs' arrays to byte arrays for uniformity and efficiency in DtTileCacheLayer - Changed 'heights', 'areas', 'cons', and 'regs' arrays to byte arrays for uniformity and efficiency in DtTileCacheLayer
- Changed 'reg', 'area' arrays to byte arrays for uniformity and efficiency in DtTileCacheContour
### Removed ### Removed
- Removed RcMeshDetails.VdistSq2(float[], float[]) - Removed RcMeshDetails.VdistSq2(float[], float[])

View File

@ -655,7 +655,7 @@ namespace DotRecast.Detour.TileCache
for (int x = 0; x < w; ++x) for (int x = 0; x < w; ++x)
{ {
int idx = x + y * w; int idx = x + y * w;
int ri = layer.regs[idx]; byte ri = layer.regs[idx];
if (ri == 0xff) if (ri == 0xff)
continue; continue;

View File

@ -24,7 +24,7 @@ namespace DotRecast.Detour.TileCache
{ {
public int nverts; public int nverts;
public int[] verts; public int[] verts;
public int reg; public byte reg;
public int area; public byte area;
} }
} }

View File

@ -23,24 +23,13 @@ namespace DotRecast.Detour.TileCache
public class DtTileCachePolyMesh public class DtTileCachePolyMesh
{ {
public int nvp; public int nvp;
public int nverts; public int nverts; // < Number of vertices.
public int npolys; // < Number of polygons.
public int[] verts; // < Vertices of the mesh, 3 elements per vertex.
public int[] polys; // < Polygons of the mesh, nvp*2 elements per polygon.
public int[] flags; // < Per polygon flags.
public int[] areas; // < Area ID of polygons.
/// < Number of vertices.
public int npolys;
/// < Number of polygons.
public int[] verts;
/// < Vertices of the mesh, 3 elements per vertex.
public int[] polys;
/// < Polygons of the mesh, nvp*2 elements per polygon.
public int[] flags;
/// < Per polygon flags.
public int[] areas;
/// < Area ID of polygons.
public DtTileCachePolyMesh(int nvp) public DtTileCachePolyMesh(int nvp)
{ {
this.nvp = nvp; this.nvp = nvp;