diff options
| author | JMC47 <JMC4789@gmail.com> | 2022-09-23 20:08:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-23 20:08:02 -0400 |
| commit | c297474d87ff8fda965ebc33a3fb1d50b1ecb2af (patch) | |
| tree | 89b236650e1c5af86cd3423a4f571f9c5d152471 /Source/Core/Common | |
| parent | 3fa9fdf57a546b37797e222b1dd290ccfc15fd1b (diff) | |
| parent | 02a967f78625ce226c0590948d49f29d6e35ebe1 (diff) | |
Merge pull request #11085 from AdmiralCurtiss/tvec-equality
Add TVec and RawValue equality operators.
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Matrix.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/Core/Common/Matrix.h b/Source/Core/Common/Matrix.h index 1c6c53787e..c2bd78d36c 100644 --- a/Source/Core/Common/Matrix.h +++ b/Source/Core/Common/Matrix.h @@ -24,6 +24,11 @@ union TVec3 { } + constexpr bool operator==(const TVec3& other) const + { + return x == other.x && y == other.y && z == other.z; + } + constexpr TVec3 Cross(const TVec3& rhs) const { return {(y * rhs.z) - (rhs.y * z), (z * rhs.x) - (rhs.z * x), (x * rhs.y) - (rhs.x * y)}; @@ -153,6 +158,11 @@ union TVec4 constexpr TVec4(TVec3<T> _vec, T _w) : TVec4{_vec.x, _vec.y, _vec.z, _w} {} constexpr TVec4(T _x, T _y, T _z, T _w) : data{_x, _y, _z, _w} {} + constexpr bool operator==(const TVec4& other) const + { + return x == other.x && y == other.y && z == other.z && w == other.w; + } + constexpr T Dot(const TVec4& other) const { return x * other.x + y * other.y + z * other.z + w * other.w; @@ -216,6 +226,8 @@ union TVec2 { } + constexpr bool operator==(const TVec2& other) const { return x == other.x && y == other.y; } + constexpr T Cross(const TVec2& rhs) const { return (x * rhs.y) - (y * rhs.x); } constexpr T Dot(const TVec2& rhs) const { return (x * rhs.x) + (y * rhs.y); } constexpr T LengthSquared() const { return Dot(*this); } |
