Helios - LYN-3250 - Fixed morph targets for meshes that had multiple … (#696)

* Helios - LYN-3250 - Fixed morph targets for meshes that had multiple materials (#374)

Fixed morph targets for meshes that had multiple materials and were split by AssImp: Recombined them into one mesh in the O3DE scene graph, so the behavior would match FBX SDK.
This commit is contained in:
AMZN-stankowi
2021-05-19 13:02:31 -07:00
committed by GitHub
parent 25e811ff6c
commit f779821ac0
25 changed files with 457 additions and 281 deletions
@@ -45,7 +45,6 @@ namespace AZ
behaviorContext->Class<MeshData>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Module, "scene")
->Method("GetSdkMeshIndex", &MeshData::GetSdkMeshIndex)
->Method("GetControlPointIndex", &MeshData::GetControlPointIndex)
->Method("GetUsedControlPointCount", &MeshData::GetUsedControlPointCount)
->Method("GetUsedPointIndexForControlPoint", &MeshData::GetUsedPointIndexForControlPoint)
@@ -77,10 +76,6 @@ namespace AZ
void MeshData::CloneAttributesFrom(const IGraphObject* sourceObject)
{
IMeshData::CloneAttributesFrom(sourceObject);
if (const auto* typedSource = azrtti_cast<const MeshData*>(sourceObject))
{
SetSdkMeshIndex(typedSource->GetSdkMeshIndex());
}
}
void MeshData::AddPosition(const AZ::Vector3& position)
@@ -111,15 +106,6 @@ namespace AZ
m_faceMaterialIds.push_back(faceMaterialId);
}
void MeshData::SetSdkMeshIndex(int sdkMeshIndex)
{
m_sdkMeshIndex = sdkMeshIndex;
}
int MeshData::GetSdkMeshIndex() const
{
return m_sdkMeshIndex;
}
void MeshData::SetVertexIndexToControlPointIndexMap(int vertexIndex, int controlPointIndex)
{
m_vertexIndexToControlPointIndexMap[vertexIndex] = controlPointIndex;
@@ -206,8 +192,26 @@ namespace AZ
void MeshData::GetDebugOutput(SceneAPI::Utilities::DebugOutput& output) const
{
output.Write("Positions", m_positions);
int index = 0;
for (const auto& position : m_positions)
{
output.Write(AZStd::string::format("\t%d", index).c_str(), position);
++index;
}
index = 0;
output.Write("Normals", m_normals);
for (const auto& normal : m_normals)
{
output.Write(AZStd::string::format("\t%d", index).c_str(), normal);
++index;
}
index = 0;
output.Write("FaceList", m_faceList);
for (const auto& face : m_faceList)
{
output.WriteArray(AZStd::string::format("\t%d", index).c_str(), face.vertexIndex, 3);
++index;
}
output.Write("FaceMaterialIds", m_faceMaterialIds);
}
}