mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Common: Add additional Matrix/Vec functions.
This commit is contained in:
@ -20,6 +20,10 @@ union TVec3
|
||||
TVec3() = default;
|
||||
TVec3(T _x, T _y, T _z) : data{_x, _y, _z} {}
|
||||
|
||||
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)};
|
||||
}
|
||||
T Dot(const TVec3& other) const { return x * other.x + y * other.y + z * other.z; }
|
||||
T LengthSquared() const { return Dot(*this); }
|
||||
T Length() const { return std::sqrt(LengthSquared()); }
|
||||
@ -275,6 +279,8 @@ public:
|
||||
static Matrix33 RotateY(float rad);
|
||||
static Matrix33 RotateZ(float rad);
|
||||
|
||||
static Matrix33 Rotate(float rad, const Vec3& axis);
|
||||
|
||||
static Matrix33 Scale(const Vec3& vec);
|
||||
|
||||
// set result = a x b
|
||||
|
Reference in New Issue
Block a user