diff options
-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 5bb69d3..c651af5 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -80,6 +80,13 @@ ratio(glm::vec<2, T, Q> v) return ratio<R>(v.x, v.y); } +template<glm::length_t L = 3, typename T, glm::qualifier Q> +inline constexpr glm::vec<L, T, Q> +perspective_divide(glm::vec<4, T, Q> v) +{ + return v / v.w; +} + constexpr inline glm::vec2 operator!(const glm::vec3 & v) { |