add DT_VERTS_PER_POLYGON

This commit is contained in:
ikpil 2024-05-25 00:34:24 +09:00
parent 1b4f5af155
commit aeefed7fbb
2 changed files with 18 additions and 10 deletions

View File

@ -4,6 +4,10 @@ namespace DotRecast.Detour
{ {
public static class DtDetour 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. */ /** A magic number used to detect compatibility of navigation tile data. */
public const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V'; public const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V';

View File

@ -111,8 +111,11 @@ namespace DotRecast.Detour
node.bmin = minmax[0]; node.bmin = minmax[0];
node.bmax = minmax[1]; node.bmax = minmax[1];
int axis = LongestAxis(node.bmax[0] - node.bmin[0], node.bmax[1] - node.bmin[1], int axis = LongestAxis(
node.bmax[2] - node.bmin[2]); node.bmax[0] - node.bmin[0],
node.bmax[1] - node.bmin[1],
node.bmax[2] - node.bmin[2]
);
if (axis == 0) if (axis == 0)
{ {
@ -253,14 +256,15 @@ namespace DotRecast.Detour
return 0xff; return 0xff;
} }
/** // TODO: Better error handling.
* Builds navigation mesh tile data from the provided tile creation data.
* /// @par
* @param option ///
* Tile creation data. /// 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
* @return created tile data /// mesh.
*/ ///
/// @see dtNavMesh, dtNavMesh::addTile()
public static DtMeshData CreateNavMeshData(DtNavMeshCreateParams option) public static DtMeshData CreateNavMeshData(DtNavMeshCreateParams option)
{ {
if (option.vertCount >= 0xffff) if (option.vertCount >= 0xffff)