From b9501348c596b68e5e655a8308df5c55f61ecd80 Mon Sep 17 00:00:00 2001 From: Cleroth Date: Tue, 19 Jul 2022 18:13:35 +0100 Subject: [PATCH] Fix misspelling (Handness -> Handedness) (#277) --- include/bx/math.h | 18 ++++++++-------- src/math.cpp | 52 +++++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/bx/math.h b/include/bx/math.h index bc8c764..ee9f945 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -31,7 +31,7 @@ namespace bx typedef float (*LerpFn)(float _a, float _b, float _t); /// - struct Handness + struct Handedness { enum Enum { @@ -574,7 +574,7 @@ namespace bx , const Vec3& _eye , const Vec3& _at , const Vec3& _up = { 0.0f, 1.0f, 0.0f } - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left ); /// @@ -587,7 +587,7 @@ namespace bx , float _near , float _far , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left ); /// @@ -597,7 +597,7 @@ namespace bx , float _near , float _far , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left ); /// @@ -608,7 +608,7 @@ namespace bx , float _near , float _far , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left ); /// @@ -617,7 +617,7 @@ namespace bx , const float _fov[4] , float _near , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left , NearFar::Enum _nearFar = NearFar::Default ); @@ -630,7 +630,7 @@ namespace bx , float _rt , float _near , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left , NearFar::Enum _nearFar = NearFar::Default ); @@ -641,7 +641,7 @@ namespace bx , float _aspect , float _near , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left , NearFar::Enum _nearFar = NearFar::Default ); @@ -656,7 +656,7 @@ namespace bx , float _far , float _offset , bool _homogeneousNdc - , Handness::Enum _handness = Handness::Left + , Handedness::Enum _handedness = Handedness::Left ); /// diff --git a/src/math.cpp b/src/math.cpp index accdb31..af41dd2 100644 --- a/src/math.cpp +++ b/src/math.cpp @@ -238,10 +238,10 @@ namespace bx return result; } - void mtxLookAt(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up, Handness::Enum _handness) + void mtxLookAt(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up, Handedness::Enum _handedness) { const Vec3 view = normalize( - Handness::Right == _handness + Handedness::Right == _handedness ? sub(_eye, _at) : sub(_at, _eye) ); @@ -268,7 +268,7 @@ namespace bx _result[15] = 1.0f; } - static void mtxProjXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _homogeneousNdc, Handness::Enum _handness) + static void mtxProjXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _homogeneousNdc, Handedness::Enum _handedness) { const float diff = _far-_near; const float aa = _homogeneousNdc ? ( _far+_near)/diff : _far/diff; @@ -277,14 +277,14 @@ namespace bx memSet(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = (Handness::Right == _handness) ? _x : -_x; - _result[ 9] = (Handness::Right == _handness) ? _y : -_y; - _result[10] = (Handness::Right == _handness) ? -aa : aa; - _result[11] = (Handness::Right == _handness) ? -1.0f : 1.0f; + _result[ 8] = (Handedness::Right == _handedness) ? _x : -_x; + _result[ 9] = (Handedness::Right == _handedness) ? _y : -_y; + _result[10] = (Handedness::Right == _handedness) ? -aa : aa; + _result[11] = (Handedness::Right == _handedness) ? -1.0f : 1.0f; _result[14] = -bb; } - void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _homogeneousNdc, Handness::Enum _handness) + void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _homogeneousNdc, Handedness::Enum _handedness) { const float invDiffRl = 1.0f/(_rt - _lt); const float invDiffUd = 1.0f/(_ut - _dt); @@ -292,22 +292,22 @@ namespace bx const float height = 2.0f*_near * invDiffUd; const float xx = (_rt + _lt) * invDiffRl; const float yy = (_ut + _dt) * invDiffUd; - mtxProjXYWH(_result, xx, yy, width, height, _near, _far, _homogeneousNdc, _handness); + mtxProjXYWH(_result, xx, yy, width, height, _near, _far, _homogeneousNdc, _handedness); } - void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _homogeneousNdc, Handness::Enum _handness) + void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _homogeneousNdc, Handedness::Enum _handedness) { - mtxProj(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _homogeneousNdc, _handness); + mtxProj(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _far, _homogeneousNdc, _handedness); } - void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _homogeneousNdc, Handness::Enum _handness) + void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _homogeneousNdc, Handedness::Enum _handedness) { const float height = 1.0f/tan(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; - mtxProjXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _homogeneousNdc, _handness); + mtxProjXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _homogeneousNdc, _handedness); } - static void mtxProjInfXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, bool _homogeneousNdc, Handness::Enum _handness, NearFar::Enum _nearFar) + static void mtxProjInfXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, bool _homogeneousNdc, Handedness::Enum _handedness, NearFar::Enum _nearFar) { float aa; float bb; @@ -325,14 +325,14 @@ namespace bx memSet(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = (Handness::Right == _handness) ? _x : -_x; - _result[ 9] = (Handness::Right == _handness) ? _y : -_y; - _result[10] = (Handness::Right == _handness) ? -aa : aa; - _result[11] = (Handness::Right == _handness) ? -1.0f : 1.0f; + _result[ 8] = (Handedness::Right == _handedness) ? _x : -_x; + _result[ 9] = (Handedness::Right == _handedness) ? _y : -_y; + _result[10] = (Handedness::Right == _handedness) ? -aa : aa; + _result[11] = (Handedness::Right == _handedness) ? -1.0f : 1.0f; _result[14] = -bb; } - void mtxProjInf(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _homogeneousNdc, Handness::Enum _handness, NearFar::Enum _nearFar) + void mtxProjInf(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, bool _homogeneousNdc, Handedness::Enum _handedness, NearFar::Enum _nearFar) { const float invDiffRl = 1.0f/(_rt - _lt); const float invDiffUd = 1.0f/(_ut - _dt); @@ -340,22 +340,22 @@ namespace bx const float height = 2.0f*_near * invDiffUd; const float xx = (_rt + _lt) * invDiffRl; const float yy = (_ut + _dt) * invDiffUd; - mtxProjInfXYWH(_result, xx, yy, width, height, _near, _homogeneousNdc, _handness, _nearFar); + mtxProjInfXYWH(_result, xx, yy, width, height, _near, _homogeneousNdc, _handedness, _nearFar); } - void mtxProjInf(float* _result, const float _fov[4], float _near, bool _homogeneousNdc, Handness::Enum _handness, NearFar::Enum _nearFar) + void mtxProjInf(float* _result, const float _fov[4], float _near, bool _homogeneousNdc, Handedness::Enum _handedness, NearFar::Enum _nearFar) { - mtxProjInf(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _homogeneousNdc, _handness, _nearFar); + mtxProjInf(_result, _fov[0], _fov[1], _fov[2], _fov[3], _near, _homogeneousNdc, _handedness, _nearFar); } - void mtxProjInf(float* _result, float _fovy, float _aspect, float _near, bool _homogeneousNdc, Handness::Enum _handness, NearFar::Enum _nearFar) + void mtxProjInf(float* _result, float _fovy, float _aspect, float _near, bool _homogeneousNdc, Handedness::Enum _handedness, NearFar::Enum _nearFar) { const float height = 1.0f/tan(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; - mtxProjInfXYWH(_result, 0.0f, 0.0f, width, height, _near, _homogeneousNdc, _handness, _nearFar); + mtxProjInfXYWH(_result, 0.0f, 0.0f, width, height, _near, _homogeneousNdc, _handedness, _nearFar); } - void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset, bool _homogeneousNdc, Handness::Enum _handness) + void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset, bool _homogeneousNdc, Handedness::Enum _handedness) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); @@ -370,7 +370,7 @@ namespace bx memSet(_result, 0, sizeof(float)*16); _result[ 0] = aa; _result[ 5] = bb; - _result[10] = Handness::Right == _handness ? -cc : cc; + _result[10] = Handedness::Right == _handedness ? -cc : cc; _result[12] = dd + _offset; _result[13] = ee; _result[14] = ff;