From a98215feea95f3a87ead802e7815f62c83ebf77d Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 21 Jan 2025 00:16:30 +1100 Subject: vector swizzle --- maths.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'maths.hpp') diff --git a/maths.hpp b/maths.hpp index ef2dbfb..98a318f 100644 --- a/maths.hpp +++ b/maths.hpp @@ -163,6 +163,8 @@ struct v3 { v3(T x, v2 yz) : x(x), y(yz.x), z(yz.y) {} v3(T x, T y, T z) : x(x), y(y), z(z) {} + v2 xy() const { return v2(x, y); } + bool operator>(const v3& other) const { return x > other.x && y > other.y && z > other.z; } @@ -309,6 +311,9 @@ struct v4 { v4(T x, v3 yzw) : x(x), y(yzw.x), z(yzw.y), w(yzw.z) {} v4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {} + v3 xyz() const { return v3(x, y, z); } + v2 xy() const { return v2(x, y); } + bool operator>(const v4& other) const { return x > other.x && y > other.y && z > other.z && w > other.w; } -- cgit v1.2.3-54-g00ecf