Renamed constants to new style.

This commit is contained in:
Branimir Karadžić
2017-06-09 20:08:38 -07:00
parent 4021acc6b8
commit 31b09521a6
7 changed files with 30 additions and 28 deletions

View File

@@ -26,7 +26,7 @@ namespace bx
void debugPrintfData(const void* _data, uint32_t _size, const char* _format, ...);
///
class WriterI* getDebugOut();
struct WriterI* getDebugOut();
} // namespace bx

View File

@@ -12,12 +12,13 @@
namespace bx
{
extern const float pi;
extern const float invPi;
extern const float piHalf;
extern const float sqrt2;
extern const float invLogNat2;
extern const float huge;
extern const float kPi;
extern const float kPi2;
extern const float kInvPi;
extern const float kPiHalf;
extern const float kSqrt2;
extern const float kInvLogNat2;
extern const float kHuge;
///
typedef float (*LerpFn)(float _a, float _b, float _t);

View File

@@ -111,7 +111,7 @@ namespace bx
inline float easeInSine(float _t)
{
return 1.0f - fcos(_t*piHalf);
return 1.0f - fcos(_t*kPiHalf);
}
inline float easeOutSine(float _t)
@@ -171,7 +171,7 @@ namespace bx
inline float easeOutElastic(float _t)
{
return fpow(2.0f, -10.0f*_t)*fsin( (_t-0.3f/4.0f)*(2.0f*pi)/0.3f) + 1.0f;
return fpow(2.0f, -10.0f*_t)*fsin( (_t-0.3f/4.0f)*(2.0f*kPi)/0.3f) + 1.0f;
}
inline float easeInElastic(float _t)
@@ -191,7 +191,7 @@ namespace bx
inline float easeInBack(float _t)
{
return easeInCubic(_t) - _t*fsin(_t*pi);
return easeInCubic(_t) - _t*fsin(_t*kPi);
}
inline float easeOutBack(float _t)

View File

@@ -13,12 +13,12 @@ namespace bx
{
inline float toRad(float _deg)
{
return _deg * pi / 180.0f;
return _deg * kPi / 180.0f;
}
inline float toDeg(float _rad)
{
return _rad * 180.0f / pi;
return _rad * 180.0f / kPi;
}
inline uint32_t floatToBits(float _a)
@@ -138,7 +138,7 @@ namespace bx
inline float flog2(float _a)
{
return flog(_a) * invLogNat2;
return flog(_a) * kInvLogNat2;
}
inline float frsqrt(float _a)
@@ -208,8 +208,8 @@ namespace bx
inline float angleDiff(float _a, float _b)
{
const float dist = fwrap(_b - _a, pi*2.0f);
return fwrap(dist*2.0f, pi*2.0f) - dist;
const float dist = fwrap(_b - _a, kPi*2.0f);
return fwrap(dist*2.0f, kPi*2.0f) - dist;
}
inline float angleLerp(float _a, float _b, float _t)

View File

@@ -81,7 +81,7 @@ namespace bx
template <typename Rng>
inline void randUnitCircle(float _result[3], Rng* _rng)
{
const float angle = frnd(_rng) * pi * 2.0f;
const float angle = frnd(_rng) * kPi2;
_result[0] = fcos(angle);
_result[1] = 0.0f;
@@ -92,7 +92,7 @@ namespace bx
inline void randUnitSphere(float _result[3], Rng* _rng)
{
const float rand0 = frnd(_rng) * 2.0f - 1.0f;
const float rand1 = frnd(_rng) * pi * 2.0f;
const float rand1 = frnd(_rng) * kPi2;
const float sqrtf1 = fsqrt(1.0f - rand0*rand0);
_result[0] = sqrtf1 * fcos(rand1);
@@ -140,7 +140,7 @@ namespace bx
tt = 2.0f * tt - 1.0f;
const float phi = (ii + 0.5f) / _num;
const float phirad = phi * 2.0f * pi;
const float phirad = phi * kPi2;
const float st = fsqrt(1.0f-tt*tt) * _scale;
float* xyz = (float*)data;