From 650849b11baf5a2b2489e01a7d323fac88d1f4f0 Mon Sep 17 00:00:00 2001 From: ikpil Date: Wed, 12 Jun 2024 00:03:59 +0900 Subject: [PATCH] Changed 'reg', 'area' arrays to byte arrays for uniformity and efficiency in DtTileCacheContour --- CHANGELOG.md | 3 ++- .../DtTileCacheBuilder.cs | 2 +- .../DtTileCacheContour.cs | 4 ++-- .../DtTileCachePolyMesh.cs | 23 +++++-------------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd5c25..96910a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - 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 'reg', 'area' arrays to byte arrays for uniformity and efficiency in DtTileCacheContour + ### Removed - Removed RcMeshDetails.VdistSq2(float[], float[]) - Removed RcVecUtils.Dot() diff --git a/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs index 21b104f..819ac9e 100644 --- a/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheBuilder.cs @@ -655,7 +655,7 @@ namespace DotRecast.Detour.TileCache for (int x = 0; x < w; ++x) { int idx = x + y * w; - int ri = layer.regs[idx]; + byte ri = layer.regs[idx]; if (ri == 0xff) continue; diff --git a/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs b/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs index 43da3a5..1f297a8 100644 --- a/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCacheContour.cs @@ -24,7 +24,7 @@ namespace DotRecast.Detour.TileCache { public int nverts; public int[] verts; - public int reg; - public int area; + public byte reg; + public byte area; } } \ No newline at end of file diff --git a/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs b/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs index eebe326..b73e2db 100644 --- a/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs +++ b/src/DotRecast.Detour.TileCache/DtTileCachePolyMesh.cs @@ -23,24 +23,13 @@ namespace DotRecast.Detour.TileCache public class DtTileCachePolyMesh { 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) { this.nvp = nvp;