diff --git a/SHADE_Engine/src/Math/SHQuaternion.cpp b/SHADE_Engine/src/Math/SHQuaternion.cpp index 2b1ac173..6164dcb3 100644 --- a/SHADE_Engine/src/Math/SHQuaternion.cpp +++ b/SHADE_Engine/src/Math/SHQuaternion.cpp @@ -212,14 +212,16 @@ namespace SHADE SHQuaternion SHQuaternion::RotateTowards(const SHQuaternion&, float) const noexcept { - // TODO(Diren): Figure this out. + SHQuaternion result; - return Identity; + // TODO (Diren) + + return result; } SHVec3 SHQuaternion::ToEuler() const noexcept { - // TODO(Diren): Figure this out. + // TODO (Diren) return SHVec3::Zero; } @@ -236,5 +238,60 @@ namespace SHADE /* Static Function Member Definitions */ /*-----------------------------------------------------------------------------------*/ + SHQuaternion SHQuaternion::Normalise(const SHQuaternion& q) noexcept + { + SHQuaternion result; + + const XMVECTOR Q = XMLoadFloat4(&q); + + XMStoreFloat4(&result, XMQuaternionNormalize(Q)); + return result; + } + + SHQuaternion SHQuaternion::Conjugate(const SHQuaternion& q) noexcept + { + SHQuaternion result; + + const XMVECTOR Q = XMLoadFloat4(&q); + + XMStoreFloat4(&result, XMQuaternionConjugate(Q)); + return result; + } + + float SHQuaternion::Angle(const SHQuaternion&, const SHQuaternion&) noexcept + { + // TODO (Diren) + + return 0.0f; + } + + SHQuaternion SHQuaternion::Lerp(const SHQuaternion&, const SHQuaternion&, float) noexcept + { + SHQuaternion result; + + // TODO (Diren) + + return result; + } + + SHQuaternion SHQuaternion::Slerp(const SHQuaternion& q1, const SHQuaternion& q2, float t) noexcept + { + SHQuaternion result; + + const XMVECTOR Q1 = XMLoadFloat4(&q1); + const XMVECTOR Q2 = XMLoadFloat4(&q2); + + XMStoreFloat4(&result, XMQuaternionSlerp(Q1, Q2, t)); + return result; + } + + SHQuaternion SHQuaternion::Rotate(const SHVec3& , const SHVec3&) noexcept + { + SHQuaternion result; + + // TODO (Diren) + + return result; + } } // namespace SHADE \ No newline at end of file diff --git a/SHADE_Engine/src/Math/SHQuaternion.h b/SHADE_Engine/src/Math/SHQuaternion.h index 103019ae..27088284 100644 --- a/SHADE_Engine/src/Math/SHQuaternion.h +++ b/SHADE_Engine/src/Math/SHQuaternion.h @@ -92,12 +92,12 @@ namespace SHADE [[nodiscard]] static SHQuaternion Normalise (const SHQuaternion& q) noexcept; [[nodiscard]] static SHQuaternion Conjugate (const SHQuaternion& q) noexcept; - [[nodiscard]] static SHQuaternion Angle (const SHQuaternion& q1, const SHQuaternion& q2) noexcept; + [[nodiscard]] static SHQuaternion Inverse (const SHQuaternion& q) noexcept; + [[nodiscard]] static float Angle (const SHQuaternion& q1, const SHQuaternion& q2) noexcept; [[nodiscard]] static SHQuaternion Lerp (const SHQuaternion& q1, const SHQuaternion& q2, float t) noexcept; [[nodiscard]] static SHQuaternion Slerp (const SHQuaternion& q1, const SHQuaternion& q2, float t) noexcept; - [[nodiscard]] static SHQuaternion Concat (const SHQuaternion& q1, const SHQuaternion& q2) noexcept; [[nodiscard]] static SHQuaternion Rotate (const SHVec3& from, const SHVec3& to) noexcept; };