Recast: Removed unused inline functions and standardized tab/space use.

Removed the unused rcAlign4 function from Recast.h.
Removed the unused rcVequal function from Recast.h.
Standardized the use of tab/space indenting in the API documentation.
This commit is contained in:
Stephen Pratt 2011-09-13 13:14:40 +00:00
parent 986c8becf8
commit 79a61cbdb1
2 changed files with 306 additions and 318 deletions

View File

@ -571,7 +571,7 @@ template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
/// @return The absolute value of the specified value.
template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
/// Return the square of a value.
/// Returns the square of the value.
/// @param[in] a The value.
/// @return The square of the value.
template<class T> inline T rcSqr(T a) { return a*a; }
@ -588,16 +588,11 @@ template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v >
/// @return The square root of the vlaue.
float rcSqrt(float x);
/// Not documented. Internal use only.
/// @param[in] x Not documented.
/// @return Not documented.
inline int rcAlign4(int x) { return (x+3) & ~3; }
/// @}
/// @name Vector helper functions.
/// @{
/// Derives the cross product of two vectors. (v1 x v2)
/// Derives the cross product of two vectors. (@p v1 x @p v2)
/// @param[out] dest The cross product. [(x, y, z)]
/// @param[in] v1 A Vector [(x, y, z)]
/// @param[in] v2 A vector [(x, y, z)]
@ -608,7 +603,7 @@ inline void rcVcross(float* dest, const float* v1, const float* v2)
dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
}
/// Derives the dot product of two vectors. (v1 . v2)
/// Derives the dot product of two vectors. (@p v1 . @p v2)
/// @param[in] v1 A Vector [(x, y, z)]
/// @param[in] v2 A vector [(x, y, z)]
/// @return The dot product.
@ -617,9 +612,9 @@ inline float rcVdot(const float* v1, const float* v2)
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
}
/// Performs a scaled vector addition. (v1 + (v2 * s))
/// Performs a scaled vector addition. (@p v1 + (@p v2 * @p s))
/// @param[out] dest The result vector. [(x, y, z)]
/// @param[in] v1 The base vector [(x, y, z)]
/// @param[in] v1 The base vector. [(x, y, z)]
/// @param[in] v2 The vector to scale and add to @p v1. [(x, y, z)]
/// @param[in] s The amount to scale @p v2 by before adding to @p v1.
inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
@ -631,7 +626,7 @@ inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
/// Performs a vector addition. (@p v1 + @p v2)
/// @param[out] dest The result vector. [(x, y, z)]
/// @param[in] v1 The base vector [(x, y, z)]
/// @param[in] v1 The base vector. [(x, y, z)]
/// @param[in] v2 The vector to add to @p v1. [(x, y, z)]
inline void rcVadd(float* dest, const float* v1, const float* v2)
{
@ -642,7 +637,7 @@ inline void rcVadd(float* dest, const float* v1, const float* v2)
/// Performs a vector subtraction. (@p v1 - @p v2)
/// @param[out] dest The result vector. [(x, y, z)]
/// @param[in] v1 The base vector [(x, y, z)]
/// @param[in] v1 The base vector. [(x, y, z)]
/// @param[in] v2 The vector to subtract from @p v1. [(x, y, z)]
inline void rcVsub(float* dest, const float* v1, const float* v2)
{
@ -652,7 +647,7 @@ inline void rcVsub(float* dest, const float* v1, const float* v2)
}
/// Selects the minimum value of each element from the specified vectors.
/// @param[in, out] mn A vector. (Will be updated with the result.) [(x, y, z)]
/// @param[in,out] mn A vector. (Will be updated with the result.) [(x, y, z)]
/// @param[in] v A vector. [(x, y, z)]
inline void rcVmin(float* mn, const float* v)
{
@ -662,7 +657,7 @@ inline void rcVmin(float* mn, const float* v)
}
/// Selects the maximum value of each element from the specified vectors.
/// @param[in, out] mx A vector. (Will be updated with the result.) [(x, y, z)]
/// @param[in,out] mx A vector. (Will be updated with the result.) [(x, y, z)]
/// @param[in] v A vector. [(x, y, z)]
inline void rcVmax(float* mx, const float* v)
{
@ -673,7 +668,7 @@ inline void rcVmax(float* mx, const float* v)
/// Performs a vector copy.
/// @param[out] dest The result. [(x, y, z)]
/// @param[in] v The vector to copy [(x, y, z)]
/// @param[in] v The vector to copy. [(x, y, z)]
inline void rcVcopy(float* dest, const float* v)
{
dest[0] = v[0];
@ -715,17 +710,6 @@ inline void rcVnormalize(float* v)
v[2] *= d;
}
/// Not documented. Internal use only.
/// @param[in] p0 Not documented.
/// @param[in] p1 Not documented.
/// @return Not documented.
inline bool rcVequal(const float* p0, const float* p1)
{
static const float thr = rcSqr(1.0f/16384.0f);
const float d = rcVdistSqr(p0, p1);
return d < thr;
}
/// @}
/// @name Heightfield Functions
/// @see rcHeightfield
@ -766,8 +750,8 @@ bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int heigh
/// to #RC_WALKABLE_AREA.
/// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation.
/// @param[in] walkableSlopeAngle The maximum slope that is considered walkable. [Limits: 0 <= value < 90]
/// [Units: Degrees]
/// @param[in] walkableSlopeAngle The maximum slope that is considered walkable.
/// [Limits: 0 <= value < 90] [Units: Degrees]
/// @param[in] verts The vertices. [(x, y, z) * @p nv]
/// @param[in] nv The number of vertices.
/// @param[in] tris The triangle vertex indices. [(vertA, vertB, vertC) * @p nt]
@ -779,8 +763,8 @@ void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, con
/// Sets the area id of all triangles with a slope greater than or equal to the specified value to #RC_NULL_AREA.
/// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation.
/// @param[in] walkableSlopeAngle The maximum slope that is considered walkable. [Limits: 0 <= value < 90]
/// [Units: Degrees]
/// @param[in] walkableSlopeAngle The maximum slope that is considered walkable.
/// [Limits: 0 <= value < 90] [Units: Degrees]
/// @param[in] verts The vertices. [(x, y, z) * @p nv]
/// @param[in] nv The number of vertices.
/// @param[in] tris The triangle vertex indices. [(vertA, vertB, vertC) * @p nt]
@ -812,7 +796,7 @@ void rcAddSpan(rcContext* ctx, rcHeightfield& hf, const int x, const int y,
/// @param[in] v1 Triangle vertex 1 [(x, y, z)]
/// @param[in] v2 Triangle vertex 2 [(x, y, z)]
/// @param[in] area The area id of the triangle. [Limit: <= #RC_WALKABLE_AREA]
/// @param[in, out] solid An initialized heightfield.
/// @param[in,out] solid An initialized heightfield.
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx]
void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const float* v2,
@ -827,7 +811,7 @@ void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const
/// @param[in] tris The triangle indices. [(vertA, vertB, vertC) * @p nt]
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
/// @param[in] nt The number of triangles.
/// @param[in, out] solid An initialized heightfield.
/// @param[in,out] solid An initialized heightfield.
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx]
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
@ -842,7 +826,7 @@ void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
/// @param[in] tris The triangle indices. [(vertA, vertB, vertC) * @p nt]
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
/// @param[in] nt The number of triangles.
/// @param[in, out] solid An initialized heightfield.
/// @param[in,out] solid An initialized heightfield.
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx]
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
@ -855,7 +839,7 @@ void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
/// @param[in] verts The triangle vertices. [(ax, ay, az, bx, by, bz, cx, by, cx) * @p nt]
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
/// @param[in] nt The number of triangles.
/// @param[in, out] solid An initialized heightfield.
/// @param[in,out] solid An initialized heightfield.
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
/// [Limit: >= 0] [Units: vx]
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
@ -974,9 +958,10 @@ bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf);
/// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation.
/// @param[in,out] chf A populated compact heightfield.
/// @param[in] borderSize The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas. [Limit: >=0]
/// [Units: vx].
/// @param[in] borderSize The size of the non-navigable border around the heightfield.
/// [Limit: >=0] [Units: vx]
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
/// [Limit: >=0] [Units: vx].
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
/// be merged with larger regions. [Limit: >=0] [Units: vx]
/// @returns True if the operation completed successfully.
@ -987,9 +972,10 @@ bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
/// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation.
/// @param[in,out] chf A populated compact heightfield.
/// @param[in] borderSize The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas. [Limit: >=0]
/// [Units: vx].
/// @param[in] borderSize The size of the non-navigable border around the heightfield.
/// [Limit: >=0] [Units: vx]
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
/// [Limit: >=0] [Units: vx].
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
/// be merged with larger regions. [Limit: >=0] [Units: vx]
/// @returns True if the operation completed successfully.

View File

@ -35,8 +35,8 @@ enum rcAllocHint
typedef void* (rcAllocFunc)(int size, rcAllocHint hint);
/// A memory deallocation function.
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAllocFunc.
/// @see rcAllocSetCustom
// @param[in] ptr
typedef void (rcFreeFunc)(void* ptr);
/// Sets the base custom allocation functions to be used by Recast.
@ -48,10 +48,12 @@ void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc);
/// @param[in] size The size, in bytes of memory, to allocate.
/// @param[in] hint A hint to the allocator on how long the memory is expected to be in use.
/// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed.
/// @see rcFree
void* rcAlloc(int size, rcAllocHint hint);
/// Deallocates a memory block.
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAlloc.
/// @see rcAlloc
void rcFree(void* ptr);