This commit is contained in:
Бранимир Караџић
2023-06-28 19:45:32 -07:00
parent 8153ff35ae
commit 781ad4a290
2 changed files with 12 additions and 12 deletions

View File

@@ -14,12 +14,12 @@
namespace bx
{
inline BX_CONST_FUNC float toRad(float _deg)
inline BX_CONSTEXPR_FUNC float toRad(float _deg)
{
return _deg * kPi / 180.0f;
}
inline BX_CONST_FUNC float toDeg(float _rad)
inline BX_CONSTEXPR_FUNC float toDeg(float _rad)
{
return _rad * 180.0f / kPi;
}
@@ -342,7 +342,7 @@ namespace bx
return 1.0f / _a;
}
inline BX_CONST_FUNC float mod(float _a, float _b)
inline BX_CONSTEXPR_FUNC float mod(float _a, float _b)
{
return _a - _b * floor(_a / _b);
}
@@ -368,7 +368,7 @@ namespace bx
return result;
}
inline BX_CONST_FUNC float wrap(float _a, float _wrap)
inline BX_CONSTEXPR_FUNC float wrap(float _a, float _wrap)
{
const float tmp0 = mod(_a, _wrap);
const float result = tmp0 < 0.0f ? _wrap + tmp0 : tmp0;
@@ -415,13 +415,13 @@ namespace bx
return bias(_time * 2.0f - 1.0f, 1.0f - _gain) * 0.5f + 0.5f;
}
inline BX_CONST_FUNC float angleDiff(float _a, float _b)
inline BX_CONSTEXPR_FUNC float angleDiff(float _a, float _b)
{
const float dist = wrap(_b - _a, kPi2);
return wrap(dist*2.0f, kPi2) - dist;
}
inline BX_CONST_FUNC float angleLerp(float _a, float _b, float _t)
inline BX_CONSTEXPR_FUNC float angleLerp(float _a, float _b, float _t)
{
return _a + angleDiff(_a, _b) * _t;
}

View File

@@ -100,11 +100,11 @@ namespace bx
/// Returns converted the argument _deg to radians.
///
BX_CONST_FUNC float toRad(float _deg);
BX_CONSTEXPR_FUNC float toRad(float _deg);
/// Returns converted the argument _rad to degrees.
///
BX_CONST_FUNC float toDeg(float _rad);
BX_CONSTEXPR_FUNC float toDeg(float _rad);
/// Reinterprets the bit pattern of _a as uint32_t.
///
@@ -316,7 +316,7 @@ namespace bx
/// Returns the floating-point remainder of the division operation _a/_b.
///
BX_CONST_FUNC float mod(float _a, float _b);
BX_CONSTEXPR_FUNC float mod(float _a, float _b);
///
BX_CONSTEXPR_FUNC bool isEqual(float _a, float _b, float _epsilon);
@@ -325,7 +325,7 @@ namespace bx
BX_CONST_FUNC bool isEqual(const float* _a, const float* _b, uint32_t _num, float _epsilon);
///
BX_CONST_FUNC float wrap(float _a, float _wrap);
BX_CONSTEXPR_FUNC float wrap(float _a, float _wrap);
///
BX_CONSTEXPR_FUNC float step(float _edge, float _a);
@@ -346,11 +346,11 @@ namespace bx
BX_CONSTEXPR_FUNC float gain(float _time, float _gain);
///
BX_CONST_FUNC float angleDiff(float _a, float _b);
BX_CONSTEXPR_FUNC float angleDiff(float _a, float _b);
/// Returns shortest distance linear interpolation between two angles.
///
BX_CONST_FUNC float angleLerp(float _a, float _b, float _t);
BX_CONSTEXPR_FUNC float angleLerp(float _a, float _b, float _t);
///
template<typename Ty>