diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-29 14:12:40 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-29 14:12:40 +0000 |
commit | 048f18e2a0b32044525cef41fa053984433c74b9 (patch) | |
tree | dfa4a11169654924c55a4dbfb0de3863e1f33342 /lib/maths.h | |
parent | Remove weird operator! on vec2/3 (diff) | |
download | ilt-048f18e2a0b32044525cef41fa053984433c74b9.tar.bz2 ilt-048f18e2a0b32044525cef41fa053984433c74b9.tar.xz ilt-048f18e2a0b32044525cef41fa053984433c74b9.zip |
Remove misleading power operator^ on vec2/3
Diffstat (limited to 'lib/maths.h')
-rw-r--r-- | lib/maths.h | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/maths.h b/lib/maths.h index dd83c4b..f7ff148 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -99,18 +99,6 @@ perspective_divide(glm::vec<4, T, Q> v) return v / v.w; } -constexpr inline Position3D -operator^(const Position2D & v, float z) -{ - return {v.x, v.y, z}; -} - -constexpr inline glm::vec4 -operator^(const Position3D & v, float w) -{ - return {v.x, v.y, v.z, w}; -} - template<glm::length_t L1, glm::length_t L2, typename T, glm::qualifier Q> inline constexpr glm::vec<L1 + L2, T, Q> operator||(const glm::vec<L1, T, Q> v1, const glm::vec<L2, T, Q> v2) @@ -125,15 +113,17 @@ operator||(const glm::vec<L, T, Q> v1, const T v2) return {v1, v2}; } -inline Position3D -operator%(const Position3D & p, const glm::mat4 & mutation) +template<glm::length_t L, typename T, glm::qualifier Q> +inline constexpr glm::vec<L, T, Q> +operator%(const glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation) { - const auto p2 = mutation * (p ^ 1); + const auto p2 = mutation * (p || T(1)); return p2 / p2.w; } -inline Position3D -operator%=(Position3D & p, const glm::mat4 & mutation) +template<glm::length_t L, typename T, glm::qualifier Q> +inline constexpr glm::vec<L, T, Q> +operator%=(glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation) { return p = p % mutation; } |