diff options
author | Chris Robinson <[email protected]> | 2020-10-23 18:40:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-10-23 18:40:54 -0700 |
commit | 7cb1cc8ab5f525b3f0cb3fb6681f66ff17dd07ae (patch) | |
tree | fe3f5e9bd6be39d44e088d4f09853727ac77ad3f /common/vecmat.h | |
parent | 7bb37deb51c6c1d0faa4f2fbe92f8051e64d6401 (diff) |
Add some constexpr
Diffstat (limited to 'common/vecmat.h')
-rw-r--r-- | common/vecmat.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/common/vecmat.h b/common/vecmat.h index 7186ec6c..dbf51009 100644 --- a/common/vecmat.h +++ b/common/vecmat.h @@ -58,7 +58,7 @@ public: : mVals{{{{aa, ab, ac, ad}}, {{ba, bb, bc, bd}}, {{ca, cb, cc, cd}}, {{da, db, dc, dd}}}} { } - std::array<float,4>& operator[](size_t idx) noexcept { return mVals[idx]; } + constexpr std::array<float,4>& operator[](size_t idx) noexcept { return mVals[idx]; } constexpr const std::array<float,4>& operator[](size_t idx) const noexcept { return mVals[idx]; } void setRow(size_t idx, float a, float b, float c, float d) noexcept @@ -69,15 +69,14 @@ public: mVals[idx][3] = d; } - static const Matrix &Identity() noexcept + static constexpr Matrix Identity() noexcept { - static constexpr Matrix identity{ + return Matrix{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; - return identity; } }; |