Merge pull request #968 from aws-lumberyard-dev/animation-transform-scale

update usages of vector scale on Transform to use uniform scale
This commit is contained in:
greerdv
2021-05-27 16:44:26 +01:00
committed by GitHub
6 changed files with 6 additions and 29 deletions
@@ -1297,18 +1297,6 @@ namespace MCommon
}
// render a cube
void RenderUtil::RenderCube(const AZ::Vector3& size, const AZ::Vector3& position, const MCore::RGBAColor& color)
{
// setup the world space matrix of the cube
AZ::Transform cubeTransform = AZ::Transform::CreateScale(size);
cubeTransform.SetTranslation(position);
// render the cube
RenderCube(color, cubeTransform);
}
// construct the arrow head mesh used for rendering
RenderUtil::UtilMesh* RenderUtil::CreateArrowHead(float height, float radius)
{
@@ -297,14 +297,6 @@ namespace MCommon
*/
void RenderCylinder(float baseRadius, float topRadius, float length, const AZ::Vector3& position, const AZ::Vector3& direction, const MCore::RGBAColor& color);
/**
* Render a cube.
* @param size The size of the cube.
* @param position The position of the center of the cube.
* @param color The desired cube color.
*/
void RenderCube(const AZ::Vector3& size, const AZ::Vector3& position, const MCore::RGBAColor& color);
/**
* Render a triangle (CCW).
* @param v1 The first corner of the triangle.
@@ -169,7 +169,6 @@ namespace MCommon
if (mXAxisVisible)
{
renderUtil->RenderLine(mPosition, mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + 0.5f * mBaseRadius, 0.0f, 0.0f), xAxisColor);
//renderUtil->RenderCube( Vector3(mBaseRadius, mBaseRadius, mBaseRadius), mPosition + mSignX * Vector3(mScaledSize.x+mBaseRadius, 0, 0), ManipulatorColors::mRed );
AZ::Vector3 quadPos = MCore::Project(mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + mBaseRadius, 0, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight);
renderUtil->RenderBorderedRect(static_cast<int32>(quadPos.GetX() - 2.0f), static_cast<int32>(quadPos.GetX() + 3.0f), static_cast<int32>(quadPos.GetY() - 2.0f), static_cast<int32>(quadPos.GetY() + 3.0f), ManipulatorColors::mRed, ManipulatorColors::mRed);
@@ -186,7 +185,6 @@ namespace MCommon
if (mYAxisVisible)
{
renderUtil->RenderLine(mPosition, mPosition + mSignY * AZ::Vector3(0.0f, mScaledSize.GetY(), 0.0f), yAxisColor);
//renderUtil->RenderCube( Vector3(mBaseRadius, mBaseRadius, mBaseRadius), mPosition + mSignY * Vector3(0, mScaledSize.y+0.5*mBaseRadius, 0), ManipulatorColors::mGreen );
AZ::Vector3 quadPos = MCore::Project(mPosition + mSignY * AZ::Vector3(0, mScaledSize.GetY() + 0.5f * mBaseRadius, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight);
renderUtil->RenderBorderedRect(static_cast<int32>(quadPos.GetX() - 2.0f), static_cast<int32>(quadPos.GetX() + 3.0f), static_cast<int32>(quadPos.GetY() - 2.0f), static_cast<int32>(quadPos.GetY() + 3.0f), ManipulatorColors::mGreen, ManipulatorColors::mGreen);
@@ -203,7 +201,6 @@ namespace MCommon
if (mZAxisVisible)
{
renderUtil->RenderLine(mPosition, mPosition + mSignZ * AZ::Vector3(0.0f, 0.0f, mScaledSize.GetZ()), zAxisColor);
//renderUtil->RenderCube( Vector3(mBaseRadius, mBaseRadius, mBaseRadius), mPosition + mSignZ * Vector3(0, 0, mScaledSize.z+0.5*mBaseRadius), ManipulatorColors::mBlue );
AZ::Vector3 quadPos = MCore::Project(mPosition + mSignZ * AZ::Vector3(0, 0, mScaledSize.GetZ() + 0.5f * mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight);
renderUtil->RenderBorderedRect(static_cast<int32>(quadPos.GetX() - 2.0f), static_cast<int32>(quadPos.GetX() + 3.0f), static_cast<int32>(quadPos.GetY() - 2.0f), static_cast<int32>(quadPos.GetY() + 3.0f), ManipulatorColors::mBlue, ManipulatorColors::mBlue);
@@ -183,7 +183,7 @@ namespace EMotionFX
{
#ifndef EMFX_SCALE_DISABLED
mPosition = transform.GetTranslation();
mScale = transform.GetScale();
mScale = AZ::Vector3(transform.GetUniformScale());
mRotation = transform.GetRotation();
#else
mPosition = transform.GetTranslation();
@@ -58,7 +58,7 @@ namespace MCore
AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(emfxTransform.mRotation, emfxTransform.mPosition);
EMFX_SCALECODE
(
transform.MultiplyByScale(emfxTransform.mScale);
transform.MultiplyByUniformScale(emfxTransform.mScale.GetMaxElement());
)
return transform;
}
@@ -386,7 +386,7 @@ namespace MCore
AZ::Transform result;
result.SetTranslation(translation);
result.SetRotation(rotation);
result.SetScale(scale);
result.SetUniformScale(scale.GetMaxElement());
return result;
}
+3 -3
View File
@@ -96,9 +96,9 @@ namespace MCore
// create the AABB of (box1 in space of box0)
const AZ::Transform& mtx = _1in0.mRotation;
AZ::Vector3 transformedAxisX = mtx.GetScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisX()));
AZ::Vector3 transformedAxisY = mtx.GetScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisY()));
AZ::Vector3 transformedAxisZ = mtx.GetScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisZ()));
AZ::Vector3 transformedAxisX = mtx.GetUniformScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisX()));
AZ::Vector3 transformedAxisY = mtx.GetUniformScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisY()));
AZ::Vector3 transformedAxisZ = mtx.GetUniformScale() * (mtx.GetRotation().GetConjugate().TransformVector(AZ::Vector3::CreateAxisZ()));
float f = transformedAxisX.GetAbs().Dot(mExtents) - box.mExtents.GetX();
if (f > _1in0.mCenter.GetX())