Merge branch 'development' into cmake/SPEC-7484
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> # Conflicts: # Code/Editor/ConfigGroup.cpp # Code/Editor/ControlMRU.cpp # Code/Editor/CryEdit.cpp # Code/Editor/CryEdit.h # Code/Editor/IEditorImpl.cpp # Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.cpp
This commit is contained in:
@@ -58,8 +58,8 @@ namespace
|
||||
const AZ::RHI::Format BoneIndexFormat = AZ::RHI::Format::R32G32B32A32_UINT;
|
||||
const AZ::RHI::Format BoneWeightFormat = AZ::RHI::Format::R32G32B32A32_FLOAT;
|
||||
|
||||
const size_t LinearSkinningFloatsPerBone = 12;
|
||||
const size_t DualQuaternionSkinningFloatsPerBone = 8;
|
||||
const uint32_t LinearSkinningFloatsPerBone = 12;
|
||||
const uint32_t DualQuaternionSkinningFloatsPerBone = 8;
|
||||
const uint32_t MaxSupportedSkinInfluences = 4;
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessMorphsForLod(const EMotionFX::Actor* actor, const Data::Asset<RPI::BufferAsset>& morphBufferAsset, uint32_t lodIndex, const AZStd::string& fullFileName, SkinnedMeshInputLod& skinnedMeshLod)
|
||||
static void ProcessMorphsForLod(const EMotionFX::Actor* actor, const Data::Asset<RPI::BufferAsset>& morphBufferAsset, size_t lodIndex, const AZStd::string& fullFileName, SkinnedMeshInputLod& skinnedMeshLod)
|
||||
{
|
||||
EMotionFX::MorphSetup* morphSetup = actor->GetMorphSetup(lodIndex);
|
||||
if (morphSetup)
|
||||
@@ -275,8 +275,8 @@ namespace AZ
|
||||
const AZStd::vector<AZ::RPI::MorphTargetMetaAsset::MorphTarget>& metaDatas = actor->GetMorphTargetMetaAsset()->GetMorphTargets();
|
||||
|
||||
// Loop over all the EMotionFX morph targets
|
||||
const AZ::u32 numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (AZ::u32 morphTargetIndex = 0; morphTargetIndex < numMorphTargets; ++morphTargetIndex)
|
||||
const size_t numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (size_t morphTargetIndex = 0; morphTargetIndex < numMorphTargets; ++morphTargetIndex)
|
||||
{
|
||||
EMotionFX::MorphTargetStandard* morphTarget = static_cast<EMotionFX::MorphTargetStandard*>(morphSetup->GetMorphTarget(morphTargetIndex));
|
||||
for (const auto& metaData : metaDatas)
|
||||
@@ -288,7 +288,7 @@ namespace AZ
|
||||
if (metaData.m_morphTargetName == morphTarget->GetNameString() && metaData.m_numVertices > 0)
|
||||
{
|
||||
// The skinned mesh lod gets a unique morph for each meta, since each one has unique min/max delta values to use for decompression
|
||||
AZStd::string morphString = AZStd::string::format("%s_Lod%u_Morph_%s", fullFileName.c_str(), lodIndex, metaData.m_meshNodeName.c_str());
|
||||
const AZStd::string morphString = AZStd::string::format("%s_Lod%zu_Morph_%s", fullFileName.c_str(), lodIndex, metaData.m_meshNodeName.c_str());
|
||||
|
||||
float minWeight = morphTarget->GetRangeMin();
|
||||
float maxWeight = morphTarget->GetRangeMax();
|
||||
@@ -562,8 +562,8 @@ namespace AZ
|
||||
for (size_t i = 0; i < numBoneTransforms; ++i)
|
||||
{
|
||||
MCore::DualQuaternion dualQuat = MCore::DualQuaternion::ConvertFromTransform(AZ::Transform::CreateFromMatrix3x4(skinningMatrices[i]));
|
||||
dualQuat.mReal.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone]);
|
||||
dualQuat.mDual.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone + 4]);
|
||||
dualQuat.m_real.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone]);
|
||||
dualQuat.m_dual.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone + 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,7 +574,7 @@ namespace AZ
|
||||
AZStd::vector<float> boneTransforms;
|
||||
GetBoneTransformsFromActorInstance(actorInstance, boneTransforms, skinningMethod);
|
||||
|
||||
size_t floatsPerBone = 0;
|
||||
uint32_t floatsPerBone = 0;
|
||||
if (skinningMethod == EMotionFX::Integration::SkinningMethod::Linear)
|
||||
{
|
||||
floatsPerBone = LinearSkinningFloatsPerBone;
|
||||
|
||||
@@ -83,10 +83,10 @@ namespace AZ
|
||||
// Update RenderActorInstance world bounding box
|
||||
// The bounding box is moving with the actor instance.
|
||||
// The entity and actor transforms are kept in sync already.
|
||||
m_worldAABB = AZ::Aabb::CreateFromMinMax(m_actorInstance->GetAABB().GetMin(), m_actorInstance->GetAABB().GetMax());
|
||||
m_worldAABB = m_actorInstance->GetAabb();
|
||||
|
||||
// Update RenderActorInstance local bounding box
|
||||
// NB: computing the local bbox from the world bbox makes the local bbox artifically larger than it should be
|
||||
// NB: computing the local bbox from the world bbox makes the local bbox artificially larger than it should be
|
||||
// instead EMFX should support getting the local bbox from the actor instance directly
|
||||
m_localAABB = m_worldAABB.GetTransformedAabb(m_transformInterface->GetWorldTM().GetInverse());
|
||||
|
||||
@@ -107,9 +107,8 @@ namespace AZ
|
||||
{
|
||||
if (debugOptions.m_drawAABB)
|
||||
{
|
||||
const MCore::AABB emfxAabb = m_actorInstance->GetAABB();
|
||||
const AZ::Aabb azAabb = AZ::Aabb::CreateFromMinMax(emfxAabb.GetMin(), emfxAabb.GetMax());
|
||||
auxGeom->DrawAabb(azAabb, AZ::Color(0.0f, 1.0f, 1.0f, 1.0f), RPI::AuxGeomDraw::DrawStyle::Line);
|
||||
const AZ::Aabb& aabb = m_actorInstance->GetAabb();
|
||||
auxGeom->DrawAabb(aabb, AZ::Color(0.0f, 1.0f, 1.0f, 1.0f), RPI::AuxGeomDraw::DrawStyle::Line);
|
||||
}
|
||||
|
||||
if (debugOptions.m_drawSkeleton)
|
||||
@@ -132,14 +131,13 @@ namespace AZ
|
||||
const EMotionFX::Skeleton* skeleton = m_actorInstance->GetActor()->GetSkeleton();
|
||||
const EMotionFX::Pose* pose = transformData->GetCurrentPose();
|
||||
|
||||
const AZ::u32 transformCount = transformData->GetNumTransforms();
|
||||
const AZ::u32 lodLevel = m_actorInstance->GetLODLevel();
|
||||
const AZ::u32 numJoints = skeleton->GetNumNodes();
|
||||
const size_t lodLevel = m_actorInstance->GetLODLevel();
|
||||
const size_t numJoints = skeleton->GetNumNodes();
|
||||
|
||||
m_auxVertices.clear();
|
||||
m_auxVertices.reserve(numJoints * 2);
|
||||
|
||||
for (AZ::u32 jointIndex = 0; jointIndex < numJoints; ++jointIndex)
|
||||
for (size_t jointIndex = 0; jointIndex < numJoints; ++jointIndex)
|
||||
{
|
||||
const EMotionFX::Node* joint = skeleton->GetNode(jointIndex);
|
||||
if (!joint->GetSkeletalLODStatus(lodLevel))
|
||||
@@ -147,23 +145,23 @@ namespace AZ
|
||||
continue;
|
||||
}
|
||||
|
||||
const AZ::u32 parentIndex = joint->GetParentIndex();
|
||||
if (parentIndex == InvalidIndex32)
|
||||
const size_t parentIndex = joint->GetParentIndex();
|
||||
if (parentIndex == InvalidIndex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const AZ::Vector3 parentPos = pose->GetWorldSpaceTransform(parentIndex).mPosition;
|
||||
const AZ::Vector3 parentPos = pose->GetWorldSpaceTransform(parentIndex).m_position;
|
||||
m_auxVertices.emplace_back(parentPos);
|
||||
|
||||
const AZ::Vector3 bonePos = pose->GetWorldSpaceTransform(jointIndex).mPosition;
|
||||
const AZ::Vector3 bonePos = pose->GetWorldSpaceTransform(jointIndex).m_position;
|
||||
m_auxVertices.emplace_back(bonePos);
|
||||
}
|
||||
|
||||
const AZ::Color skeletonColor(0.604f, 0.804f, 0.196f, 1.0f);
|
||||
RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs;
|
||||
lineArgs.m_verts = m_auxVertices.data();
|
||||
lineArgs.m_vertCount = static_cast<uint32_t>(m_auxVertices.size());
|
||||
lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size());
|
||||
lineArgs.m_colors = &skeletonColor;
|
||||
lineArgs.m_colorCount = 1;
|
||||
lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off;
|
||||
@@ -204,9 +202,9 @@ namespace AZ
|
||||
|
||||
RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs;
|
||||
lineArgs.m_verts = m_auxVertices.data();
|
||||
lineArgs.m_vertCount = static_cast<uint32_t>(m_auxVertices.size());
|
||||
lineArgs.m_vertCount = aznumeric_caster(m_auxVertices.size());
|
||||
lineArgs.m_colors = m_auxColors.data();
|
||||
lineArgs.m_colorCount = static_cast<uint32_t>(m_auxColors.size());
|
||||
lineArgs.m_colorCount = aznumeric_caster(m_auxColors.size());
|
||||
lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off;
|
||||
auxGeom->DrawLines(lineArgs);
|
||||
}
|
||||
@@ -451,13 +449,13 @@ namespace AZ
|
||||
|
||||
AZ::u32 AtomActorInstance::GetJointCount()
|
||||
{
|
||||
return m_actorInstance->GetActor()->GetSkeleton()->GetNumNodes();
|
||||
return aznumeric_caster(m_actorInstance->GetActor()->GetSkeleton()->GetNumNodes());
|
||||
}
|
||||
|
||||
const char* AtomActorInstance::GetJointNameByIndex(AZ::u32 jointIndex)
|
||||
{
|
||||
EMotionFX::Skeleton* skeleton = m_actorInstance->GetActor()->GetSkeleton();
|
||||
const AZ::u32 numNodes = skeleton->GetNumNodes();
|
||||
const size_t numNodes = skeleton->GetNumNodes();
|
||||
if (jointIndex < numNodes)
|
||||
{
|
||||
return skeleton->GetNode(jointIndex)->GetName();
|
||||
@@ -471,12 +469,12 @@ namespace AZ
|
||||
if (jointName)
|
||||
{
|
||||
EMotionFX::Skeleton* skeleton = m_actorInstance->GetActor()->GetSkeleton();
|
||||
const AZ::u32 numNodes = skeleton->GetNumNodes();
|
||||
for (AZ::u32 nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex)
|
||||
const size_t numNodes = skeleton->GetNumNodes();
|
||||
for (size_t nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex)
|
||||
{
|
||||
if (0 == azstricmp(jointName, skeleton->GetNode(nodeIndex)->GetName()))
|
||||
{
|
||||
return nodeIndex;
|
||||
return aznumeric_caster(nodeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -585,7 +583,8 @@ namespace AZ
|
||||
|
||||
// Update the morph weights for every lod. This does not mean they will all be dispatched, but they will all have up to date weights
|
||||
// TODO: once culling is hooked up such that EMotionFX and Atom are always in sync about which lod to update, only update the currently visible lods [ATOM-13564]
|
||||
for (uint32_t lodIndex = 0; lodIndex < m_actorInstance->GetActor()->GetNumLODLevels(); ++lodIndex)
|
||||
const auto lodCount = aznumeric_cast<uint32_t>(m_actorInstance->GetActor()->GetNumLODLevels());
|
||||
for (uint32_t lodIndex = 0; lodIndex < lodCount; ++lodIndex)
|
||||
{
|
||||
EMotionFX::MorphSetup* morphSetup = m_actorInstance->GetActor()->GetMorphSetup(lodIndex);
|
||||
if (morphSetup)
|
||||
@@ -594,9 +593,9 @@ namespace AZ
|
||||
m_wrinkleMasks.clear();
|
||||
m_wrinkleMaskWeights.clear();
|
||||
|
||||
uint32_t morphTargetCount = morphSetup->GetNumMorphTargets();
|
||||
size_t morphTargetCount = morphSetup->GetNumMorphTargets();
|
||||
m_morphTargetWeights.clear();
|
||||
for (uint32_t morphTargetIndex = 0; morphTargetIndex < morphTargetCount; ++morphTargetIndex)
|
||||
for (size_t morphTargetIndex = 0; morphTargetIndex < morphTargetCount; ++morphTargetIndex)
|
||||
{
|
||||
EMotionFX::MorphTarget* morphTarget = morphSetup->GetMorphTarget(morphTargetIndex);
|
||||
// check if we are dealing with a standard morph target
|
||||
@@ -612,11 +611,11 @@ namespace AZ
|
||||
|
||||
// Each morph target is split into several deform datas, all of which share the same weight but have unique min/max delta values
|
||||
// and thus correspond with unique dispatches in the morph target pass
|
||||
for (uint32_t deformDataIndex = 0; deformDataIndex < morphTargetStandard->GetNumDeformDatas(); ++deformDataIndex)
|
||||
for (size_t deformDataIndex = 0; deformDataIndex < morphTargetStandard->GetNumDeformDatas(); ++deformDataIndex)
|
||||
{
|
||||
// Morph targets that don't deform any vertices (e.g. joint-based morph targets) are not registered in the render proxy. Skip adding their weights.
|
||||
const EMotionFX::MorphTargetStandard::DeformData* deformData = morphTargetStandard->GetDeformData(deformDataIndex);
|
||||
if (deformData->mNumVerts > 0)
|
||||
if (deformData->m_numVerts > 0)
|
||||
{
|
||||
float weight = morphTargetSetupInstance->GetWeight();
|
||||
m_morphTargetWeights.push_back(weight);
|
||||
@@ -817,8 +816,8 @@ namespace AZ
|
||||
{
|
||||
const AZStd::vector<AZ::RPI::MorphTargetMetaAsset::MorphTarget>& metaDatas = actor->GetMorphTargetMetaAsset()->GetMorphTargets();
|
||||
// Loop over all the EMotionFX morph targets
|
||||
uint32_t numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (uint32_t morphTargetIndex = 0; morphTargetIndex < numMorphTargets; ++morphTargetIndex)
|
||||
size_t numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (size_t morphTargetIndex = 0; morphTargetIndex < numMorphTargets; ++morphTargetIndex)
|
||||
{
|
||||
EMotionFX::MorphTargetStandard* morphTarget = static_cast<EMotionFX::MorphTargetStandard*>(morphSetup->GetMorphTarget(morphTargetIndex));
|
||||
for (const RPI::MorphTargetMetaAsset::MorphTarget& metaData : metaDatas)
|
||||
@@ -862,7 +861,7 @@ namespace AZ
|
||||
// Set the weights for any active masks
|
||||
for (size_t i = 0; i < m_wrinkleMaskWeights.size(); ++i)
|
||||
{
|
||||
wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], static_cast<uint32_t>(i));
|
||||
wrinkleMaskObjectSrg->SetConstant(wrinkleMaskWeightsIndex, m_wrinkleMaskWeights[i], aznumeric_caster(i));
|
||||
}
|
||||
AZ_Error("AtomActorInstance", m_wrinkleMaskWeights.size() <= s_maxActiveWrinkleMasks, "The skinning shader supports no more than %d active morph targets with wrinkle masks.", s_maxActiveWrinkleMasks);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user