diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp index a10f5fe80b..123ef00333 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp @@ -8,7 +8,7 @@ #include "RotateManipulator.h" #include - +#include namespace MCommon { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h index 022a6d5bd7..1b40b3fa2a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h @@ -10,6 +10,7 @@ #define __EMSTUDIO_LOGWINDOWPLUGIN_H #if !defined(Q_MOC_RUN) +#include #include "../StandardPluginsConfig.h" #include "../../../../EMStudioSDK/Source/DockWidgetPlugin.h" #endif diff --git a/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h b/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h index 79e3ef9608..78cc99bd98 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h +++ b/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -37,18 +38,6 @@ namespace MCore return RGBAColor(static_cast(azColor.GetR()), static_cast(azColor.GetG()), static_cast(azColor.GetB()), static_cast(azColor.GetA())); } - // Deprecated - AZ_FORCE_INLINE AZ::Quaternion EmfxQuatToAzQuat(const MCore::Quaternion& emfxQuat) - { - return AZ::Quaternion(emfxQuat.x, emfxQuat.y, emfxQuat.z, emfxQuat.w); - } - - // Deprecated - AZ_FORCE_INLINE MCore::Quaternion AzQuatToEmfxQuat(const AZ::Quaternion& azQuat) - { - return MCore::Quaternion(azQuat.GetX(), azQuat.GetY(), azQuat.GetZ(), azQuat.GetW()); - } - AZ_FORCE_INLINE AZ::Transform EmfxTransformToAzTransform(const EMotionFX::Transform& emfxTransform) { AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(emfxTransform.mRotation, emfxTransform.mPosition); @@ -530,91 +519,4 @@ namespace MCore AZ::Vector3ToVector4(m33.GetRow(2), translation.GetZ()), mat.GetRow(3)); } - - // Deprecated. Please use AZ::Transform instead of MCore::Matrix. - MCORE_INLINE AZ::Quaternion MCoreMatrixToQuaternion(const MCore::Matrix& m) - { - const float trace = MMAT(m, 0, 0) + MMAT(m, 1, 1) + MMAT(m, 2, 2); - if (trace > 0.0f /*Math::epsilon*/) - { - const float s = 0.5f / Math::Sqrt(trace + 1.0f); - return AZ::Quaternion((MMAT(m, 1, 2) - MMAT(m, 2, 1)) * s, - (MMAT(m, 2, 0) - MMAT(m, 0, 2)) * s, - (MMAT(m, 0, 1) - MMAT(m, 1, 0)) * s, - 0.25f / s); - } - else - { - if (MMAT(m, 0, 0) > MMAT(m, 1, 1) && MMAT(m, 0, 0) > MMAT(m, 2, 2)) - { - const float s = 2.0f * Math::Sqrt(1.0f + MMAT(m, 0, 0) - MMAT(m, 1, 1) - MMAT(m, 2, 2)); - const float oneOverS = 1.0f / s; - return AZ::Quaternion(0.25f * s, - (MMAT(m, 1, 0) + MMAT(m, 0, 1)) * oneOverS, - (MMAT(m, 2, 0) + MMAT(m, 0, 2)) * oneOverS, - (MMAT(m, 1, 2) - MMAT(m, 2, 1)) * oneOverS); - } - else if (MMAT(m, 1, 1) > MMAT(m, 2, 2)) - { - const float s = 2.0f * Math::Sqrt(1.0f + MMAT(m, 1, 1) - MMAT(m, 0, 0) - MMAT(m, 2, 2)); - const float oneOverS = 1.0f / s; - return AZ::Quaternion((MMAT(m, 1, 0) + MMAT(m, 0, 1)) * oneOverS, - 0.25f * s, - (MMAT(m, 2, 1) + MMAT(m, 1, 2)) * oneOverS, - (MMAT(m, 2, 0) - MMAT(m, 0, 2)) * oneOverS); - } - else - { - const float s = 2.0f * Math::Sqrt(1.0f + MMAT(m, 2, 2) - MMAT(m, 0, 0) - MMAT(m, 1, 1)); - const float oneOverS = 1.0f / s; - return AZ::Quaternion((MMAT(m, 2, 0) + MMAT(m, 0, 2)) * oneOverS, - (MMAT(m, 2, 1) + MMAT(m, 1, 2)) * oneOverS, - 0.25f * s, - (MMAT(m, 0, 1) - MMAT(m, 1, 0)) * oneOverS); - } - } - - /* - const float trace = MMAT(m,0,0) + MMAT(m,1,1) + MMAT(m,2,2) + 1.0f; - if (trace > Math::epsilon) - { - const float s = 0.5f / Math::Sqrt(trace); - result.w = 0.25f / s; - result.x = ( MMAT(m,1,2) - MMAT(m,2,1) ) * s; - result.y = ( MMAT(m,2,0) - MMAT(m,0,2) ) * s; - result.z = ( MMAT(m,0,1) - MMAT(m,1,0) ) * s; - } - else - { - if (MMAT(m,0,0) > MMAT(m,1,1) && MMAT(m,0,0) > MMAT(m,2,2)) - { - const float s = 2.0f * Math::Sqrt( 1.0f + MMAT(m,0,0) - MMAT(m,1,1) - MMAT(m,2,2)); - const float oneOverS = 1.0f / s; - result.x = 0.25f * s; - result.y = (MMAT(m,1,0) + MMAT(m,0,1) ) * oneOverS; - result.z = (MMAT(m,2,0) + MMAT(m,0,2) ) * oneOverS; - result.w = (MMAT(m,2,1) - MMAT(m,1,2) ) * oneOverS; - } - else - if (MMAT(m,1,1) > MMAT(m,2,2)) - { - const float s = 2.0f * Math::Sqrt( 1.0f + MMAT(m,1,1) - MMAT(m,0,0) - MMAT(m,2,2)); - const float oneOverS = 1.0f / s; - result.x = (MMAT(m,1,0) + MMAT(m,0,1) ) * oneOverS; - result.y = 0.25f * s; - result.z = (MMAT(m,2,1) + MMAT(m,1,2) ) * oneOverS; - result.w = (MMAT(m,2,0) - MMAT(m,0,2) ) * oneOverS; - } - else - { - const float s = 2.0f * Math::Sqrt( 1.0f + MMAT(m,2,2) - MMAT(m,0,0) - MMAT(m,1,1) ); - const float oneOverS = 1.0f / s; - result.x = (MMAT(m,2,0) + MMAT(m,0,2) ) * oneOverS; - result.y = (MMAT(m,2,1) + MMAT(m,1,2) ) * oneOverS; - result.z = 0.25f * s; - result.w = (MMAT(m,1,0) - MMAT(m,0,1) ) * oneOverS; - } - } - */ - } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp b/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp index 7314e9fe9c..229f67ec0c 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp @@ -2248,27 +2248,6 @@ namespace MCore } - - // simple decompose a matrix into translation and rotation - void Matrix::Decompose(AZ::Vector3* outTranslation, AZ::Quaternion* outRotation) const - { - // make a copy of the matrix - Matrix mat(*this); - - // normalize the basis vectors - mat.SetRight(SafeNormalize(mat.GetRight())); - mat.SetUp(SafeNormalize(mat.GetUp())); - mat.SetForward(SafeNormalize(mat.GetForward())); - - // extract the translation from the matrix - *outTranslation = mat.GetTranslation(); - - // convert the normalized 3x3 rotation part into a AZ::Quaternion - *outRotation = MCore::MCoreMatrixToQuaternion(*this); - } - - - // calculate a rotation matrix from two vectors void Matrix::SetRotationMatrixTwoVectors(const AZ::Vector3& from, const AZ::Vector3& to) { @@ -2365,30 +2344,6 @@ namespace MCore } - // - void Matrix::DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot, AZ::Vector3& scale, AZ::Vector3& shear) const - { - Matrix rotMatrix; - DecomposeQRGramSchmidt(translation, rotMatrix, scale, shear); - rot = MCore::MCoreMatrixToQuaternion(*this); - } - - // - void Matrix::DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot, AZ::Vector3& scale) const - { - Matrix rotMatrix; - DecomposeQRGramSchmidt(translation, rotMatrix, scale); - rot = MCore::MCoreMatrixToQuaternion(rotMatrix); - } - - - // - void Matrix::DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot) const - { - Matrix rotMatrix; - DecomposeQRGramSchmidt(translation, rotMatrix); - rot = MCore::MCoreMatrixToQuaternion(rotMatrix); - } // diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h index 8cb09aa769..4be819bcc1 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h @@ -685,26 +685,11 @@ namespace MCore */ void Frustum(float left, float right, float top, float bottom, float znear, float zfar); - /** - * Decompose a transformation matrix into translation and rotation components. - * The translation part is just the translation part of the matrix. - * The rotation AZ::Quaternion is calculated by normalizing the basis vectors and converting the - * 3x3 rotation part of the matrix to a AZ::Quaternion. - * It is allowed for the matrix to contain scaling. - * The matrix where you call Decompose on remains unchanged. - * @param outTranslation A pointer to a vector where the translation will be written to. - * @param outRotation A pointer to a AZ::Quaternion where the rotation will be written to. - * @note Please keep in mind that nullptr values for the parameters are NOT allowed. - */ - void Decompose(AZ::Vector3* outTranslation, AZ::Quaternion* outRotation) const; // QR Gram-Schmidt decomposition - void DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot) const; void DecomposeQRGramSchmidt(AZ::Vector3& translation, Matrix& rot) const; void DecomposeQRGramSchmidt(AZ::Vector3& translation, Matrix& rot, AZ::Vector3& scale) const; void DecomposeQRGramSchmidt(AZ::Vector3& translation, Matrix& rot, AZ::Vector3& scale, AZ::Vector3& shear) const; - void DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot, AZ::Vector3& scale, AZ::Vector3& shear) const; - void DecomposeQRGramSchmidt(AZ::Vector3& translation, AZ::Quaternion& rot, AZ::Vector3& scale) const; static Matrix OuterProduct(const AZ::Vector4& column, const AZ::Vector4& row);