From aeefed7fbb555ee49fc80d5b84e5219b5f3678dd Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 25 May 2024 00:34:24 +0900 Subject: [PATCH] add DT_VERTS_PER_POLYGON --- src/DotRecast.Detour/DtDetour.cs | 4 ++++ src/DotRecast.Detour/DtNavMeshBuilder.cs | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/DotRecast.Detour/DtDetour.cs b/src/DotRecast.Detour/DtDetour.cs index 20a2bc8..8ffb854 100644 --- a/src/DotRecast.Detour/DtDetour.cs +++ b/src/DotRecast.Detour/DtDetour.cs @@ -4,6 +4,10 @@ namespace DotRecast.Detour { public static class DtDetour { + /// The maximum number of vertices per navigation polygon. + /// @ingroup detour + public const int DT_VERTS_PER_POLYGON = 6; + /** A magic number used to detect compatibility of navigation tile data. */ public const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V'; diff --git a/src/DotRecast.Detour/DtNavMeshBuilder.cs b/src/DotRecast.Detour/DtNavMeshBuilder.cs index f22534d..62f7136 100644 --- a/src/DotRecast.Detour/DtNavMeshBuilder.cs +++ b/src/DotRecast.Detour/DtNavMeshBuilder.cs @@ -111,8 +111,11 @@ namespace DotRecast.Detour node.bmin = minmax[0]; node.bmax = minmax[1]; - int axis = LongestAxis(node.bmax[0] - node.bmin[0], node.bmax[1] - node.bmin[1], - node.bmax[2] - node.bmin[2]); + int axis = LongestAxis( + node.bmax[0] - node.bmin[0], + node.bmax[1] - node.bmin[1], + node.bmax[2] - node.bmin[2] + ); if (axis == 0) { @@ -253,14 +256,15 @@ namespace DotRecast.Detour return 0xff; } - /** - * Builds navigation mesh tile data from the provided tile creation data. - * - * @param option - * Tile creation data. - * - * @return created tile data - */ + // TODO: Better error handling. + + /// @par + /// + /// The output data array is allocated using the detour allocator (dtAlloc()). The method + /// used to free the memory will be determined by how the tile is added to the navigation + /// mesh. + /// + /// @see dtNavMesh, dtNavMesh::addTile() public static DtMeshData CreateNavMeshData(DtNavMeshCreateParams option) { if (option.vertCount >= 0xffff)