diff --git a/include/bx/fpumath.h b/include/bx/fpumath.h index a4a3b14..03017d7 100644 --- a/include/bx/fpumath.h +++ b/include/bx/fpumath.h @@ -631,7 +631,7 @@ namespace bx mtxLookAtLh(_result, _eye, _at, _up); } - template + template inline void mtxProjXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _oglNdc = false) { const float diff = _far-_near; @@ -648,8 +648,8 @@ namespace bx _result[14] = -bb; } - template - inline void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) + template + inline void mtxProj_impl(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { const float invDiffRl = 1.0f/(_rt - _lt); const float invDiffUd = 1.0f/(_ut - _dt); @@ -660,24 +660,25 @@ namespace bx mtxProjXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc); } - template - inline void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false) + template + inline void mtxProj_impl(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false) { - mtxProj(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _oglNdc); + mtxProj_impl(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _oglNdc); } - template - inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false) + template + inline void mtxProj_impl(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false) { const float height = 1.0f/tanf(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; mtxProjXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _oglNdc); } - #define mtxProjLh mtxProj - #define mtxProjRh mtxProj + #define mtxProj mtxProj_impl + #define mtxProjLh mtxProj_impl + #define mtxProjRh mtxProj_impl - template + template inline void mtxProjInfXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, bool _oglNdc = false) { float aa; @@ -703,8 +704,8 @@ namespace bx _result[14] = -bb; } - template - inline void mtxProjInf(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false) + template + inline void mtxProjInf_impl(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _oglNdc = false) { const float invDiffRl = 1.0f/(_rt - _lt); const float invDiffUd = 1.0f/(_ut - _dt); @@ -715,27 +716,28 @@ namespace bx mtxProjInfXYWH(_result, xx, yy, width, height, _near, _oglNdc); } - template - inline void mtxProjInf(float* _result, const float _fov[4], float _near, bool _oglNdc = false) + template + inline void mtxProjInf_impl(float* _result, const float _fov[4], float _near, bool _oglNdc = false) { - mtxProjInf(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _oglNdc); + mtxProjInf_impl(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _oglNdc); } - template - inline void mtxProjInf(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false) + template + inline void mtxProjInf_impl(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc = false) { const float height = 1.0f/tanf(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; mtxProjInfXYWH(_result, 0.0f, 0.0f, width, height, _near, _oglNdc); } - #define mtxProjInfLh mtxProjInf - #define mtxProjInfRh mtxProjInf - #define mtxProjRevInfLh mtxProjInf - #define mtxProjRevInfRh mtxProjInf + #define mtxProjInf mtxProjInf_impl + #define mtxProjInfLh mtxProjInf_impl + #define mtxProjInfRh mtxProjInf_impl + #define mtxProjRevInfLh mtxProjInf_impl + #define mtxProjRevInfRh mtxProjInf_impl - template - inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + template + inline void mtxOrtho_impl(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); @@ -754,8 +756,9 @@ namespace bx _result[15] = 1.0f; } - #define mtxOrthoLh mtxOrtho - #define mtxOrthoRh mtxOrtho + #define mtxOrtho mtxOrtho_impl + #define mtxOrthoLh mtxOrtho_impl + #define mtxOrthoRh mtxOrtho_impl inline void mtxRotateX(float* _result, float _ax) {