forked from bit/DotRecastNetSim
update comments
This commit is contained in:
parent
ae0f21c808
commit
648d7bd703
|
@ -154,22 +154,17 @@ namespace DotRecast.Detour
|
|||
return DtStatus.DT_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns random location on navmesh within the reach of specified location. Polygons are chosen weighted by area.
|
||||
* The search runs in linear related to number of polygon. The location is not exactly constrained by the circle,
|
||||
* but it limits the visited polygons.
|
||||
*
|
||||
* @param startRef
|
||||
* The reference id of the polygon where the search starts.
|
||||
* @param centerPos
|
||||
* The center of the search circle. [(x, y, z)]
|
||||
* @param maxRadius
|
||||
* @param filter
|
||||
* The polygon filter to apply to the query.
|
||||
* @param frand
|
||||
* Function returning a random number [0..1).
|
||||
* @return Random location
|
||||
*/
|
||||
/// Returns random location on navmesh within the reach of specified location.
|
||||
/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
|
||||
/// The location is not exactly constrained by the circle, but it limits the visited polygons.
|
||||
/// @param[in] startRef The reference id of the polygon where the search starts.
|
||||
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
|
||||
/// @param[in] maxRadius The radius of the search circle. [Units: wu]
|
||||
/// @param[in] filter The polygon filter to apply to the query.
|
||||
/// @param[in] frand Function returning a random number [0..1).
|
||||
/// @param[out] randomRef The reference id of the random location.
|
||||
/// @param[out] randomPt The random location. [(x, y, z)]
|
||||
/// @returns The status flags for the query.
|
||||
public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius,
|
||||
IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt)
|
||||
{
|
||||
|
@ -197,6 +192,18 @@ namespace DotRecast.Detour
|
|||
return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, DtStrictDtPolygonByCircleConstraint.Shared, out randomRef, out randomPt);
|
||||
}
|
||||
|
||||
/// Returns random location on navmesh within the reach of specified location.
|
||||
/// Polygons are chosen weighted by area. The search runs in linear related to number of polygon.
|
||||
/// The location is not exactly constrained by the circle, but it limits the visited polygons.
|
||||
/// @param[in] startRef The reference id of the polygon where the search starts.
|
||||
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
|
||||
/// @param[in] maxRadius The radius of the search circle. [Units: wu]
|
||||
/// @param[in] filter The polygon filter to apply to the query.
|
||||
/// @param[in] frand Function returning a random number [0..1).
|
||||
/// @param[in] constraint
|
||||
/// @param[out] randomRef The reference id of the random location.
|
||||
/// @param[out] randomPt The random location. [(x, y, z)]
|
||||
/// @returns The status flags for the query.
|
||||
public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius,
|
||||
IDtQueryFilter filter, IRcRand frand, IDtPolygonByCircleConstraint constraint,
|
||||
out long randomRef, out RcVec3f randomPt)
|
||||
|
@ -393,13 +400,13 @@ namespace DotRecast.Detour
|
|||
///
|
||||
/// @p pos does not have to be within the bounds of the polygon or navigation mesh.
|
||||
///
|
||||
/// See ClosestPointOnPolyBoundary() for a limited but faster option.
|
||||
/// See closestPointOnPolyBoundary() for a limited but faster option.
|
||||
///
|
||||
/// Finds the closest point on the specified polygon.
|
||||
/// @param[in] ref The reference id of the polygon.
|
||||
/// @param[in] pos The position to check. [(x, y, z)]
|
||||
/// @param[out] closest
|
||||
/// @param[out] posOverPoly
|
||||
/// @param[out] closest The closest point on the polygon. [(x, y, z)]
|
||||
/// @param[out] posOverPoly True of the position is over the polygon.
|
||||
/// @returns The status flags for the query.
|
||||
public DtStatus ClosestPointOnPoly(long refs, RcVec3f pos, out RcVec3f closest, out bool posOverPoly)
|
||||
{
|
||||
|
|
|
@ -6,48 +6,20 @@ namespace DotRecast.Recast
|
|||
/// @see rcHeightfieldLayerSet
|
||||
public class RcHeightfieldLayer
|
||||
{
|
||||
public RcVec3f bmin = new RcVec3f();
|
||||
|
||||
/// < The minimum bounds in world space. [(x, y, z)]
|
||||
public RcVec3f bmax = new RcVec3f();
|
||||
|
||||
/// < The maximum bounds in world space. [(x, y, z)]
|
||||
public float cs;
|
||||
|
||||
/// < The size of each cell. (On the xz-plane.)
|
||||
public float ch;
|
||||
|
||||
/// < The height of each cell. (The minimum increment along the y-axis.)
|
||||
public int width;
|
||||
|
||||
/// < The width of the heightfield. (Along the x-axis in cell units.)
|
||||
public int height;
|
||||
|
||||
/// < The height of the heightfield. (Along the z-axis in cell units.)
|
||||
public int minx;
|
||||
|
||||
/// < The minimum x-bounds of usable data.
|
||||
public int maxx;
|
||||
|
||||
/// < The maximum x-bounds of usable data.
|
||||
public int miny;
|
||||
|
||||
/// < The minimum y-bounds of usable data. (Along the z-axis.)
|
||||
public int maxy;
|
||||
|
||||
/// < The maximum y-bounds of usable data. (Along the z-axis.)
|
||||
public int hmin;
|
||||
|
||||
/// < The minimum height bounds of usable data. (Along the y-axis.)
|
||||
public int hmax;
|
||||
|
||||
/// < The maximum height bounds of usable data. (Along the y-axis.)
|
||||
public int[] heights;
|
||||
|
||||
/// < The heightfield. [Size: width * height]
|
||||
public int[] areas;
|
||||
|
||||
/// < Area ids. [Size: Same as #heights]
|
||||
public int[] cons; /// < Packed neighbor connection information. [Size: Same as #heights]
|
||||
public RcVec3f bmin = new RcVec3f(); // < The minimum bounds in world space. [(x, y, z)]
|
||||
public RcVec3f bmax = new RcVec3f(); // < The maximum bounds in world space. [(x, y, z)]
|
||||
public float cs; // < The size of each cell. (On the xz-plane.)
|
||||
public float ch; // < The height of each cell. (The minimum increment along the y-axis.)
|
||||
public int width; // < The width of the heightfield. (Along the x-axis in cell units.)
|
||||
public int height; // < The height of the heightfield. (Along the z-axis in cell units.)
|
||||
public int minx; // < The minimum x-bounds of usable data.
|
||||
public int maxx; // < The maximum x-bounds of usable data.
|
||||
public int miny; // < The minimum y-bounds of usable data. (Along the z-axis.)
|
||||
public int maxy; // < The maximum y-bounds of usable data. (Along the z-axis.)
|
||||
public int hmin; // < The minimum height bounds of usable data. (Along the y-axis.)
|
||||
public int hmax; // < The maximum height bounds of usable data. (Along the y-axis.)
|
||||
public int[] heights; // < The heightfield. [Size: width * height]
|
||||
public int[] areas; // < Area ids. [Size: Same as #heights]
|
||||
public int[] cons; // < Packed neighbor connection information. [Size: Same as #heights]
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using DotRecast.Core.Numerics;
|
||||
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
|
|
|
@ -869,9 +869,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
if (@in[vj + 2] > @in[vi + 2])
|
||||
{
|
||||
int temp = vi;
|
||||
vi = vj;
|
||||
vj = temp;
|
||||
(vi, vj) = (vj, vi);
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
@ -879,9 +877,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
if (@in[vj + 0] > @in[vi + 0])
|
||||
{
|
||||
int temp = vi;
|
||||
vi = vj;
|
||||
vj = temp;
|
||||
(vi, vj) = (vj, vi);
|
||||
swapped = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,52 +22,26 @@ using DotRecast.Core.Numerics;
|
|||
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
/** Represents a polygon mesh suitable for use in building a navigation mesh. */
|
||||
/// Represents a polygon mesh suitable for use in building a navigation mesh.
|
||||
/// @ingroup recast
|
||||
public class RcPolyMesh
|
||||
{
|
||||
/** The mesh vertices. [Form: (x, y, z) coordinates * #nverts] */
|
||||
public int[] verts;
|
||||
public int[] verts; // The mesh vertices. [Form: (x, y, z) coordinates * #nverts]
|
||||
public int[] polys; // Polygon and neighbor data. [Length: #maxpolys * 2 * #nvp]
|
||||
public int[] regs; // The region id assigned to each polygon. [Length: #maxpolys]
|
||||
public int[] areas; // The area id assigned to each polygon. [Length: #maxpolys]
|
||||
public int nverts; // The number of vertices.
|
||||
public int npolys; // The number of polygons.
|
||||
public int nvp; // The maximum number of vertices per polygon.
|
||||
public int maxpolys; // The number of allocated polygons.
|
||||
public int[] flags; // The user defined flags for each polygon. [Length: #maxpolys]
|
||||
public RcVec3f bmin = new RcVec3f(); // The minimum bounds in world space. [(x, y, z)]
|
||||
public RcVec3f bmax = new RcVec3f(); // The maximum bounds in world space. [(x, y, z)]
|
||||
|
||||
/** Polygon and neighbor data. [Length: #maxpolys * 2 * #nvp] */
|
||||
public int[] polys;
|
||||
public float cs; // The size of each cell. (On the xz-plane.)
|
||||
public float ch; // The height of each cell. (The minimum increment along the y-axis.)
|
||||
|
||||
/** The region id assigned to each polygon. [Length: #maxpolys] */
|
||||
public int[] regs;
|
||||
|
||||
/** The area id assigned to each polygon. [Length: #maxpolys] */
|
||||
public int[] areas;
|
||||
|
||||
/** The number of vertices. */
|
||||
public int nverts;
|
||||
|
||||
/** The number of polygons. */
|
||||
public int npolys;
|
||||
|
||||
/** The maximum number of vertices per polygon. */
|
||||
public int nvp;
|
||||
|
||||
/** The number of allocated polygons. */
|
||||
public int maxpolys;
|
||||
|
||||
/** The user defined flags for each polygon. [Length: #maxpolys] */
|
||||
public int[] flags;
|
||||
|
||||
/** The minimum bounds in world space. [(x, y, z)] */
|
||||
public RcVec3f bmin = new RcVec3f();
|
||||
|
||||
/** The maximum bounds in world space. [(x, y, z)] */
|
||||
public RcVec3f bmax = new RcVec3f();
|
||||
|
||||
/** The size of each cell. (On the xz-plane.) */
|
||||
public float cs;
|
||||
|
||||
/** The height of each cell. (The minimum increment along the y-axis.) */
|
||||
public float ch;
|
||||
|
||||
/** The AABB border size used to generate the source data from which the mesh was derived. */
|
||||
public int borderSize;
|
||||
|
||||
/** The max error of the polygon edges in the mesh. */
|
||||
public float maxEdgeError;
|
||||
public int borderSize; // The AABB border size used to generate the source data from which the mesh was derived.
|
||||
public float maxEdgeError; // The max error of the polygon edges in the mesh.
|
||||
}
|
||||
}
|
|
@ -20,28 +20,16 @@ freely, subject to the following restrictions:
|
|||
|
||||
namespace DotRecast.Recast
|
||||
{
|
||||
/**
|
||||
* Contains triangle meshes that represent detailed height data associated with the polygons in its associated polygon
|
||||
* mesh object.
|
||||
*/
|
||||
/// Contains triangle meshes that represent detailed height data associated
|
||||
/// with the polygons in its associated polygon mesh object.
|
||||
/// @ingroup recast
|
||||
public class RcPolyMeshDetail
|
||||
{
|
||||
/** The sub-mesh data. [Size: 4*#nmeshes] */
|
||||
public int[] meshes;
|
||||
|
||||
/** The mesh vertices. [Size: 3*#nverts] */
|
||||
public float[] verts;
|
||||
|
||||
/** The mesh triangles. [Size: 4*#ntris] */
|
||||
public int[] tris;
|
||||
|
||||
/** The number of sub-meshes defined by #meshes. */
|
||||
public int nmeshes;
|
||||
|
||||
/** The number of vertices in #verts. */
|
||||
public int nverts;
|
||||
|
||||
/** The number of triangles in #tris. */
|
||||
public int ntris;
|
||||
public int[] meshes; //< The sub-mesh data. [Size: 4*#nmeshes]
|
||||
public float[] verts; //< The mesh vertices. [Size: 3*#nverts]
|
||||
public int[] tris; //< The mesh triangles. [Size: 4*#ntris]
|
||||
public int nmeshes; //< The number of sub-meshes defined by #meshes.
|
||||
public int nverts; //< The number of vertices in #verts.
|
||||
public int ntris; //< The number of triangles in #tris.
|
||||
}
|
||||
}
|
|
@ -421,10 +421,10 @@ namespace DotRecast.Recast
|
|||
/// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag.
|
||||
/// [Limit: >= 0] [Units: vx]
|
||||
/// @returns True if the operation completed successfully.
|
||||
public static void RasterizeTriangles(RcTelemetry ctx, float[] verts, int[] tris, int[] triAreaIDs, int numTris,
|
||||
public static void RasterizeTriangles(RcTelemetry context, float[] verts, int[] tris, int[] triAreaIDs, int numTris,
|
||||
RcHeightfield heightfield, int flagMergeThreshold)
|
||||
{
|
||||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
|
||||
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
|
||||
|
||||
float inverseCellSize = 1.0f / heightfield.cs;
|
||||
float inverseCellHeight = 1.0f / heightfield.ch;
|
||||
|
@ -438,28 +438,25 @@ namespace DotRecast.Recast
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rasterizes a triangle list into the specified heightfield. Expects each triangle to be specified as three
|
||||
* sequential vertices of 3 floats. Spans will only be added for triangles that overlap the heightfield grid.
|
||||
*
|
||||
* @param heightfield
|
||||
* An initialized heightfield.
|
||||
* @param verts
|
||||
* The vertices. [(x, y, z) * numVerts]
|
||||
* @param areaIds
|
||||
* The area id's of the triangles. [Limit: <= WALKABLE_AREA] [Size: numTris]
|
||||
* @param tris
|
||||
* The triangle indices. [(vertA, vertB, vertC) * nt]
|
||||
* @param numTris
|
||||
* The number of triangles.
|
||||
* @param flagMergeThreshold
|
||||
* The distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]
|
||||
* @see Heightfield
|
||||
*/
|
||||
public static void RasterizeTriangles(RcHeightfield heightfield, float[] verts, int[] areaIds, int numTris,
|
||||
int flagMergeThreshold, RcTelemetry ctx)
|
||||
/// Rasterizes a triangle list into the specified heightfield.
|
||||
///
|
||||
/// Expects each triangle to be specified as three sequential vertices of 3 floats.
|
||||
///
|
||||
/// Spans will only be added for triangles that overlap the heightfield grid.
|
||||
///
|
||||
/// @see rcHeightfield
|
||||
/// @ingroup recast
|
||||
/// @param[in,out] context The build context to use during the operation.
|
||||
/// @param[in] verts The triangle vertices. [(ax, ay, az, bx, by, bz, cx, by, cx) * @p nt]
|
||||
/// @param[in] triAreaIDs The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
||||
/// @param[in] numTris The number of triangles.
|
||||
/// @param[in,out] heightfield An initialized heightfield.
|
||||
/// @param[in] flagMergeThreshold The distance where the walkable flag is favored over the non-walkable flag.
|
||||
/// [Limit: >= 0] [Units: vx]
|
||||
/// @returns True if the operation completed successfully.
|
||||
public static void RasterizeTriangles(RcTelemetry context, float[] verts, int[] triAreaIDs, int numTris, RcHeightfield heightfield, int flagMergeThreshold)
|
||||
{
|
||||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
|
||||
using var timer = context.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_TRIANGLES);
|
||||
|
||||
float inverseCellSize = 1.0f / heightfield.cs;
|
||||
float inverseCellHeight = 1.0f / heightfield.ch;
|
||||
|
@ -468,7 +465,7 @@ namespace DotRecast.Recast
|
|||
int v0 = (triIndex * 3 + 0);
|
||||
int v1 = (triIndex * 3 + 1);
|
||||
int v2 = (triIndex * 3 + 2);
|
||||
RasterizeTri(verts, v0, v1, v2, areaIds[triIndex], heightfield, heightfield.bmin, heightfield.bmax, heightfield.cs,
|
||||
RasterizeTri(verts, v0, v1, v2, triAreaIDs[triIndex], heightfield, heightfield.bmin, heightfield.bmax, heightfield.cs,
|
||||
inverseCellSize, inverseCellHeight, flagMergeThreshold);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue