summaryrefslogtreecommitdiff
path: root/maths.hpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-21 00:16:30 +1100
committerquou <quou@disroot.org>2025-01-21 00:16:30 +1100
commita98215feea95f3a87ead802e7815f62c83ebf77d (patch)
tree6b030aaf70d323330c84bb64a4d31cbd83b3fea6 /maths.hpp
parent9cab0d4634ab6cdc180f9ab49939854f3d72bf01 (diff)
vector swizzle
Diffstat (limited to 'maths.hpp')
-rw-r--r--maths.hpp5
1 files changed, 5 insertions, 0 deletions
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<T> yz) : x(x), y(yz.x), z(yz.y) {}
v3(T x, T y, T z) : x(x), y(y), z(z) {}
+ v2<T> xy() const { return v2<T>(x, y); }
+
bool operator>(const v3<T>& other) const {
return x > other.x && y > other.y && z > other.z;
}
@@ -309,6 +311,9 @@ struct v4 {
v4(T x, v3<T> 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<T> xyz() const { return v3<T>(x, y, z); }
+ v2<T> xy() const { return v2<T>(x, y); }
+
bool operator>(const v4<T>& other) const {
return x > other.x && y > other.y && z > other.z && w > other.w;
}