Removed math.h dependancy from Recast.h, moved sqrtf to Recast.cpp.
This commit is contained in:
parent
5d91c09e00
commit
fb369a2efd
@ -303,6 +303,7 @@ template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
|
|||||||
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; }
|
||||||
template<class T> inline T rcSqr(T a) { return a*a; }
|
template<class T> inline T rcSqr(T a) { return a*a; }
|
||||||
template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
|
template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
|
||||||
|
float rcSqrt(float x);
|
||||||
|
|
||||||
// Common vector helper functions.
|
// Common vector helper functions.
|
||||||
inline void rcVcross(float* dest, const float* v1, const float* v2)
|
inline void rcVcross(float* dest, const float* v1, const float* v2)
|
||||||
@ -364,7 +365,7 @@ inline float rcVdist(const float* v1, const float* v2)
|
|||||||
float dx = v2[0] - v1[0];
|
float dx = v2[0] - v1[0];
|
||||||
float dy = v2[1] - v1[1];
|
float dy = v2[1] - v1[1];
|
||||||
float dz = v2[2] - v1[2];
|
float dz = v2[2] - v1[2];
|
||||||
return sqrtf(dx*dx + dy*dy + dz*dz);
|
return rcSqrt(dx*dx + dy*dy + dz*dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float rcVdistSqr(const float* v1, const float* v2)
|
inline float rcVdistSqr(const float* v1, const float* v2)
|
||||||
@ -377,7 +378,7 @@ inline float rcVdistSqr(const float* v1, const float* v2)
|
|||||||
|
|
||||||
inline void rcVnormalize(float* v)
|
inline void rcVnormalize(float* v)
|
||||||
{
|
{
|
||||||
float d = 1.0f / sqrtf(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
|
float d = 1.0f / rcSqrt(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
|
||||||
v[0] *= d;
|
v[0] *= d;
|
||||||
v[1] *= d;
|
v[1] *= d;
|
||||||
v[2] *= d;
|
v[2] *= d;
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
#include "RecastLog.h"
|
#include "RecastLog.h"
|
||||||
#include "RecastTimer.h"
|
#include "RecastTimer.h"
|
||||||
|
|
||||||
|
float rcSqrt(float x)
|
||||||
|
{
|
||||||
|
return sqrtf(x);
|
||||||
|
}
|
||||||
|
|
||||||
void rcIntArray::resize(int n)
|
void rcIntArray::resize(int n)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user