From e81bc351f7a7550addea94adb9c445adb1c8ed5c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 1 Feb 2023 00:27:05 +0000 Subject: Add helper operator to perform vec3*mat4 and perspective divide --- lib/maths.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 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) { -- cgit v1.2.3