Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Nov 26, 2024
1 parent 88c2946 commit b198309
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions src/DotRecast.Detour/DtNavMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,22 @@ private static DtNavMeshParams GetNavMeshParams(DtMeshData data)
}


/**
* The maximum number of tiles supported by the navigation mesh.
*
* @return The maximum number of tiles supported by the navigation mesh.
*/
/// The maximum number of tiles supported by the navigation mesh.
/// @return The maximum number of tiles supported by the navigation mesh.
public int GetMaxTiles()
{
return m_maxTiles;
}

/**
* Returns tile in the tile array.
*/
/// Returns pointer to tile in the tile array.
public DtMeshTile GetTile(int i)
{
return m_tiles[i];
}

/**
* Gets the polygon reference for the tile's base polygon.
*
* @param tile
* The tile.
* @return The polygon reference for the base polygon in the specified tile.
*/
/// Gets the polygon reference for the tile's base polygon.
/// @param[in] tile The tile.
/// @return The polygon reference for the base polygon in the specified tile.
public long GetPolyRefBase(DtMeshTile tile)
{
if (tile == null)
Expand Down Expand Up @@ -151,13 +142,10 @@ private void FreeLink(DtMeshTile tile, int link)
tile.linksFreeList = link;
}

/**
* Calculates the tile grid location for the specified world position.
*
* @param pos
* The world position for the query. [(x, y, z)]
* @return 2-element int array with (tx,ty) tile location
*/
/// Calculates the tile grid location for the specified world position.
/// @param[in] pos The world position for the query. [(x, y, z)]
/// @param[out] tx The tile's x-location. (x, y)
/// @param[out] ty The tile's y-location. (x, y)
public void CalcTileLoc(RcVec3f pos, out int tx, out int ty)
{
tx = (int)MathF.Floor((pos.X - m_orig.X) / m_tileWidth);
Expand Down Expand Up @@ -207,13 +195,20 @@ public DtStatus GetTileAndPolyByRef(long refs, out DtMeshTile tile, out DtPoly p
/// reference is valid. This function is faster than #getTileAndPolyByRef,
/// but
/// it does not validate the reference.
/// Returns the tile and polygon for the specified polygon reference.
/// @param[in] ref A known valid reference for a polygon.
/// @param[out] tile The tile containing the polygon.
/// @param[out] poly The polygon.
public void GetTileAndPolyByRefUnsafe(long refs, out DtMeshTile tile, out DtPoly poly)
{
DecodePolyId(refs, out var salt, out var it, out var ip);
tile = m_tiles[it];
poly = m_tiles[it].data.polys[ip];
}

/// Checks the validity of a polygon reference.
/// @param[in] ref The polygon reference to check.
/// @return True if polygon reference is valid for the navigation mesh.
public bool IsValidPolyRef(long refs)
{
if (refs == 0)
Expand Down Expand Up @@ -246,9 +241,9 @@ public ref readonly DtNavMeshParams GetParams()
}


// TODO: These methods are duplicates from dtNavMeshQuery, but are needed
// for off-mesh connection finding.

// TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding.
/// Queries polygons within a tile.
List<long> QueryPolygonsInTile(DtMeshTile tile, RcVec3f qmin, RcVec3f qmax)
{
List<long> polys = new List<long>();
Expand Down Expand Up @@ -856,8 +851,8 @@ void ConnectExtOffMeshLinks(DtMeshTile tile, DtMeshTile target, int side)
}
}

private int FindConnectingPolys(float[] verts, int va, int vb, DtMeshTile tile, int side,
ref List<DtConnectPoly> cons)
/// Returns all polygons in neighbour tile based on portal defined by the segment.
private int FindConnectingPolys(float[] verts, int va, int vb, DtMeshTile tile, int side, ref List<DtConnectPoly> cons)
{
if (tile == null)
return 0;
Expand Down Expand Up @@ -1326,6 +1321,7 @@ DtMeshTile GetTileAt(int x, int y, int layer)
return null;
}

/// Returns neighbour tile based on side.
int GetNeighbourTilesAt(int x, int y, int side, DtMeshTile[] tiles, int maxTiles)
{
int nx = x, ny = y;
Expand Down Expand Up @@ -1364,6 +1360,7 @@ int GetNeighbourTilesAt(int x, int y, int side, DtMeshTile[] tiles, int maxTiles
return GetTilesAt(nx, ny, tiles, maxTiles);
}

/// Returns neighbour tile based on side.
public int GetTilesAt(int x, int y, DtMeshTile[] tiles, int maxTiles)
{
int n = 0;
Expand Down

0 comments on commit b198309

Please sign in to comment.