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. /// @return The absolute value of the specified value.
template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; } 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. /// @param[in] a The value.
/// @return The square of the value. /// @return The square of the value.
template<class T> inline T rcSqr(T a) { return a*a; } 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. /// @return The square root of the vlaue.
float rcSqrt(float x); 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. /// @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[out] dest The cross product. [(x, y, z)]
/// @param[in] v1 A Vector [(x, y, z)] /// @param[in] v1 A Vector [(x, y, z)]
/// @param[in] v2 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]; 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] v1 A Vector [(x, y, z)]
/// @param[in] v2 A vector [(x, y, z)] /// @param[in] v2 A vector [(x, y, z)]
/// @return The dot product. /// @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]; 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[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] 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. /// @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) 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) /// Performs a vector addition. (@p v1 + @p v2)
/// @param[out] dest The result vector. [(x, y, z)] /// @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)] /// @param[in] v2 The vector to add to @p v1. [(x, y, z)]
inline void rcVadd(float* dest, const float* v1, const float* v2) 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) /// Performs a vector subtraction. (@p v1 - @p v2)
/// @param[out] dest The result vector. [(x, y, z)] /// @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)] /// @param[in] v2 The vector to subtract from @p v1. [(x, y, z)]
inline void rcVsub(float* dest, const float* v1, const float* v2) inline void rcVsub(float* dest, const float* v1, const float* v2)
{ {
@ -673,7 +668,7 @@ inline void rcVmax(float* mx, const float* v)
/// Performs a vector copy. /// Performs a vector copy.
/// @param[out] dest The result. [(x, y, z)] /// @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) inline void rcVcopy(float* dest, const float* v)
{ {
dest[0] = v[0]; dest[0] = v[0];
@ -715,17 +710,6 @@ inline void rcVnormalize(float* v)
v[2] *= d; 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 /// @name Heightfield Functions
/// @see rcHeightfield /// @see rcHeightfield
@ -766,8 +750,8 @@ bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int heigh
/// to #RC_WALKABLE_AREA. /// to #RC_WALKABLE_AREA.
/// @ingroup recast /// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation. /// @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] /// @param[in] walkableSlopeAngle The maximum slope that is considered walkable.
/// [Units: Degrees] /// [Limits: 0 <= value < 90] [Units: Degrees]
/// @param[in] verts The vertices. [(x, y, z) * @p nv] /// @param[in] verts The vertices. [(x, y, z) * @p nv]
/// @param[in] nv The number of vertices. /// @param[in] nv The number of vertices.
/// @param[in] tris The triangle vertex indices. [(vertA, vertB, vertC) * @p nt] /// @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. /// Sets the area id of all triangles with a slope greater than or equal to the specified value to #RC_NULL_AREA.
/// @ingroup recast /// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation. /// @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] /// @param[in] walkableSlopeAngle The maximum slope that is considered walkable.
/// [Units: Degrees] /// [Limits: 0 <= value < 90] [Units: Degrees]
/// @param[in] verts The vertices. [(x, y, z) * @p nv] /// @param[in] verts The vertices. [(x, y, z) * @p nv]
/// @param[in] nv The number of vertices. /// @param[in] nv The number of vertices.
/// @param[in] tris The triangle vertex indices. [(vertA, vertB, vertC) * @p nt] /// @param[in] tris The triangle vertex indices. [(vertA, vertB, vertC) * @p nt]
@ -974,9 +958,10 @@ bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf);
/// @ingroup recast /// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation. /// @param[in,out] ctx The build context to use during the operation.
/// @param[in,out] chf A populated compact heightfield. /// @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] borderSize The size of the non-navigable border around the heightfield.
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas. [Limit: >=0] /// [Limit: >=0] [Units: vx]
/// [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, /// @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] /// be merged with larger regions. [Limit: >=0] [Units: vx]
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.
@ -987,9 +972,10 @@ bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
/// @ingroup recast /// @ingroup recast
/// @param[in,out] ctx The build context to use during the operation. /// @param[in,out] ctx The build context to use during the operation.
/// @param[in,out] chf A populated compact heightfield. /// @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] borderSize The size of the non-navigable border around the heightfield.
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas. [Limit: >=0] /// [Limit: >=0] [Units: vx]
/// [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, /// @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] /// be merged with larger regions. [Limit: >=0] [Units: vx]
/// @returns True if the operation completed successfully. /// @returns True if the operation completed successfully.

View File

@ -35,8 +35,8 @@ enum rcAllocHint
typedef void* (rcAllocFunc)(int size, rcAllocHint hint); typedef void* (rcAllocFunc)(int size, rcAllocHint hint);
/// A memory deallocation function. /// A memory deallocation function.
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAllocFunc.
/// @see rcAllocSetCustom /// @see rcAllocSetCustom
// @param[in] ptr
typedef void (rcFreeFunc)(void* ptr); typedef void (rcFreeFunc)(void* ptr);
/// Sets the base custom allocation functions to be used by Recast. /// 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] 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. /// @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. /// @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); void* rcAlloc(int size, rcAllocHint hint);
/// Deallocates a memory block. /// Deallocates a memory block.
/// @param[in] ptr A pointer to a memory block previously allocated using #rcAlloc. /// @param[in] ptr A pointer to a memory block previously allocated using #rcAlloc.
/// @see rcAlloc
void rcFree(void* ptr); void rcFree(void* ptr);