diff options
author | quou <quou@disroot.org> | 2025-01-21 00:16:30 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2025-01-21 00:16:30 +1100 |
commit | a98215feea95f3a87ead802e7815f62c83ebf77d (patch) | |
tree | 6b030aaf70d323330c84bb64a4d31cbd83b3fea6 | |
parent | 9cab0d4634ab6cdc180f9ab49939854f3d72bf01 (diff) |
vector swizzle
-rw-r--r-- | maths.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; } |