mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -95,16 +95,32 @@ namespace bx
|
||||
return tmp == UINT64_C(0x7ff0000000000000);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC float round(float _f)
|
||||
inline BX_CONSTEXPR_FUNC float floor(float _a)
|
||||
{
|
||||
return floor(_f + 0.5f);
|
||||
if (_a < 0.0f)
|
||||
{
|
||||
const float fr = fract(-_a);
|
||||
const float result = -_a - fr;
|
||||
|
||||
return -(0.0f != fr
|
||||
? result + 1.0f
|
||||
: result)
|
||||
;
|
||||
}
|
||||
|
||||
return _a - fract(_a);
|
||||
}
|
||||
|
||||
inline BX_CONST_FUNC float ceil(float _a)
|
||||
inline BX_CONSTEXPR_FUNC float ceil(float _a)
|
||||
{
|
||||
return -floor(-_a);
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float round(float _f)
|
||||
{
|
||||
return floor(_f + 0.5f);
|
||||
}
|
||||
|
||||
inline BX_CONSTEXPR_FUNC float lerp(float _a, float _b, float _t)
|
||||
{
|
||||
return _a + (_b - _a) * _t;
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
// FPU math lib
|
||||
|
||||
#ifndef BX_MATH_H_HEADER_GUARD
|
||||
#define BX_MATH_H_HEADER_GUARD
|
||||
|
||||
@@ -112,15 +110,15 @@ namespace bx
|
||||
|
||||
/// Returns the largest integer value not greater than _f.
|
||||
///
|
||||
BX_CONST_FUNC float floor(float _f);
|
||||
BX_CONSTEXPR_FUNC float floor(float _f);
|
||||
|
||||
/// Returns the smallest integer value not less than _f.
|
||||
///
|
||||
BX_CONST_FUNC float ceil(float _f);
|
||||
BX_CONSTEXPR_FUNC float ceil(float _f);
|
||||
|
||||
/// Returns the nearest integer value to _f, rounding halfway cases away from zero,
|
||||
///
|
||||
BX_CONST_FUNC float round(float _f);
|
||||
BX_CONSTEXPR_FUNC float round(float _f);
|
||||
|
||||
/// Returns linear interpolation between two values _a and _b.
|
||||
///
|
||||
|
||||
16
src/math.cpp
16
src/math.cpp
@@ -239,22 +239,6 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
BX_CONST_FUNC float floor(float _a)
|
||||
{
|
||||
if (_a < 0.0f)
|
||||
{
|
||||
const float fr = fract(-_a);
|
||||
const float result = -_a - fr;
|
||||
|
||||
return -(0.0f != fr
|
||||
? result + 1.0f
|
||||
: result)
|
||||
;
|
||||
}
|
||||
|
||||
return _a - fract(_a);
|
||||
}
|
||||
|
||||
static void mtxLookAtImpl(float* _result, const Vec3& _eye, const Vec3& _view, const Vec3& _up)
|
||||
{
|
||||
const Vec3 uxv = cross(_up, _view);
|
||||
|
||||
Reference in New Issue
Block a user