mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 12:19:12 +00:00
Common: Add additional Matrix/Vec functions.
This commit is contained in:
parent
d8c62b5965
commit
1e028025e5
2 changed files with 23 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue