summaryrefslogtreecommitdiff
path: root/lib/maths.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-12-29 14:12:40 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-12-29 14:12:40 +0000
commit048f18e2a0b32044525cef41fa053984433c74b9 (patch)
treedfa4a11169654924c55a4dbfb0de3863e1f33342 /lib/maths.h
parentRemove weird operator! on vec2/3 (diff)
downloadilt-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.h24
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;
}