summaryrefslogtreecommitdiff
path: root/lib/maths.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-06-01 14:02:42 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-06-01 14:02:42 +0100
commit519ebadf219ef3b6b75dd84842ef5b56589c4c3b (patch)
tree591fa2783d4d579325662da42dcdbb7fb9f55d74 /lib/maths.h
parentFix setting of pedantic warnings (diff)
downloadilt-519ebadf219ef3b6b75dd84842ef5b56589c4c3b.tar.bz2
ilt-519ebadf219ef3b6b75dd84842ef5b56589c4c3b.tar.xz
ilt-519ebadf219ef3b6b75dd84842ef5b56589c4c3b.zip
Remove conflicting glm::vec operators
% and %= already exist and abusing them for simplifying perspective multiplication was always a bad idea. Here they just become named functions.
Diffstat (limited to 'lib/maths.h')
-rw-r--r--lib/maths.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/maths.h b/lib/maths.h
index 63b752a..018ef0e 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -176,7 +176,7 @@ operator||(const glm::vec<L, T, Q> v1, const T v2)
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)
+perspectiveMultiply(const glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation)
{
const auto p2 = mutation * (p || T(1));
return p2 / p2.w;
@@ -184,9 +184,9 @@ operator%(const glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & muta
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)
+perspectiveApply(glm::vec<L, T, Q> & p, const glm::mat<L + 1, L + 1, T, Q> & mutation)
{
- return p = p % mutation;
+ return p = perspectiveMultiply(p, mutation);
}
float normalize(float ang);