Merge pull request #211 from SHADE-DP/SP3-16-Math

Fixed Vector3.GetNormalised!!!!!!!
This commit is contained in:
XiaoQiDigipen 2022-11-15 19:27:27 +08:00 committed by GitHub
commit ec215b944e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 25 deletions

View File

@ -483,6 +483,16 @@ namespace SHADE
return result; return result;
} }
SHMatrix SHMatrix::Transform(const SHVec3& pos, const SHVec3& eulerAngles, const SHVec3& scale) noexcept
{
return Scale(scale) * Rotate(eulerAngles) * Translate(pos);
}
SHMatrix SHMatrix::Transform(const SHVec3& pos, const SHQuaternion& rot, const SHVec3& scale) noexcept
{
return Scale(scale) * Rotate(rot) * Translate(pos);
}
SHMatrix SHMatrix::LookAtRH(const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept SHMatrix SHMatrix::LookAtRH(const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept
{ {
SHMatrix result; SHMatrix result;

View File

@ -149,6 +149,9 @@ namespace SHADE
[[nodiscard]] static SHMatrix Scale (float x, float y, float z) noexcept; [[nodiscard]] static SHMatrix Scale (float x, float y, float z) noexcept;
[[nodiscard]] static SHMatrix Scale (const SHVec3& scale) noexcept; [[nodiscard]] static SHMatrix Scale (const SHVec3& scale) noexcept;
[[nodiscard]] static SHMatrix Transform (const SHVec3& pos, const SHVec3& eulerAngles, const SHVec3& scale) noexcept;
[[nodiscard]] static SHMatrix Transform (const SHVec3& pos, const SHQuaternion& rot, const SHVec3& scale) noexcept;
[[nodiscard]] static SHMatrix LookAtRH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; [[nodiscard]] static SHMatrix LookAtRH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept;
[[nodiscard]] static SHMatrix LookAtLH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept; [[nodiscard]] static SHMatrix LookAtLH (const SHVec3& eye, const SHVec3& target, const SHVec3& up) noexcept;
[[nodiscard]] static SHMatrix CamToWorldRH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept; [[nodiscard]] static SHMatrix CamToWorldRH (const SHVec3& pos, const SHVec3& forward, const SHVec3& up) noexcept;

View File

@ -52,7 +52,7 @@ namespace SHADE
Vector3 Vector3::GetNormalised() Vector3 Vector3::GetNormalised()
{ {
return *this / GetSqrMagnitude(); return *this / GetMagnitude();
} }
float Vector3::GetMagnitude() float Vector3::GetMagnitude()