diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-01 00:27:05 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-02-01 00:27:05 +0000 |
commit | e81bc351f7a7550addea94adb9c445adb1c8ed5c (patch) | |
tree | 84c36ae8750e87cc52d0581ee4dd292723f36055 /lib/maths.h | |
parent | Add utilities for mutating, concatenating, creating vectors (diff) | |
download | ilt-e81bc351f7a7550addea94adb9c445adb1c8ed5c.tar.bz2 ilt-e81bc351f7a7550addea94adb9c445adb1c8ed5c.tar.xz ilt-e81bc351f7a7550addea94adb9c445adb1c8ed5c.zip |
Add helper operator to perform vec3*mat4 and perspective divide
Diffstat (limited to 'lib/maths.h')
-rw-r--r-- | lib/maths.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h index c651af5..d4bcd16 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -125,6 +125,13 @@ operator||(const glm::vec<L, T, Q> v1, const T v2) return {v1, v2}; } +inline glm::vec3 +operator%(const glm::vec3 & p, const glm::mat4 & mutation) +{ + const auto p2 = mutation * (p ^ 1); + return p2 / p2.w; +} + constexpr inline float arc_length(const Arc & arc) { |