Skip to content

Commit

Permalink
add DT_VERTS_PER_POLYGON
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed May 24, 2024
1 parent 1b4f5af commit aeefed7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/DotRecast.Detour/DtDetour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
24 changes: 14 additions & 10 deletions src/DotRecast.Detour/DtNavMeshBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ public static int Subdivide(BVItem[] items, int nitems, int imin, int imax, int
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)
{
Expand Down Expand Up @@ -253,14 +256,15 @@ public static int ClassifyOffMeshPoint(RcVec3f pt, RcVec3f bmin, RcVec3f bmax)
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)
Expand Down

0 comments on commit aeefed7

Please sign in to comment.