You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
GeometryCore: minor DynamicMesh fixes. Change ensure to a checkSlow in DynamicMesh3::AppendTriangle. Add FDynamicMeshOverlay::GetTriangleIfValid(). Handle unset triangles in CountVertexElements().
#rb tyson.brochu #rnx #jira none #preflight 612fa9a575bca200010b8148 #ROBOMERGE-SOURCE: CL 17393286 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139) [CL 17393312 by ryan schmidt in ue5-release-engine-test branch]
This commit is contained in:
@@ -155,8 +155,9 @@ int FDynamicMesh3::AppendTriangle(const FIndex3i& tv, int gid)
|
||||
checkSlow(false);
|
||||
return InvalidID;
|
||||
}
|
||||
if (!ensure(tv[0] != tv[1] && tv[0] != tv[2] && tv[1] != tv[2]))
|
||||
if (tv[0] == tv[1] || tv[0] == tv[2] || tv[1] == tv[2])
|
||||
{
|
||||
checkSlow(false);
|
||||
return InvalidID;
|
||||
}
|
||||
|
||||
|
||||
@@ -785,16 +785,19 @@ template<typename RealType, int ElementSize>
|
||||
int TDynamicMeshOverlay<RealType, ElementSize>::CountVertexElements(int vid, bool bBruteForce) const
|
||||
{
|
||||
TArray<int> VertexElements;
|
||||
FIndex3i Triangle;
|
||||
if (bBruteForce)
|
||||
{
|
||||
for (int tid : ParentMesh->TriangleIndicesItr())
|
||||
{
|
||||
FIndex3i Triangle = GetTriangle(tid);
|
||||
for (int j = 0; j < 3; ++j)
|
||||
if (GetTriangleIfValid(tid, Triangle))
|
||||
{
|
||||
if (ParentVertices[Triangle[j]] == vid)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
VertexElements.AddUnique(Triangle[j]);
|
||||
if (ParentVertices[Triangle[j]] == vid)
|
||||
{
|
||||
VertexElements.AddUnique(Triangle[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,12 +806,14 @@ int TDynamicMeshOverlay<RealType, ElementSize>::CountVertexElements(int vid, boo
|
||||
{
|
||||
for (int tid : ParentMesh->VtxTrianglesItr(vid))
|
||||
{
|
||||
FIndex3i Triangle = GetTriangle(tid);
|
||||
for (int j = 0; j < 3; ++j)
|
||||
if (GetTriangleIfValid(tid, Triangle))
|
||||
{
|
||||
if (ParentVertices[Triangle[j]] == vid)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
VertexElements.AddUnique(Triangle[j]);
|
||||
if (ParentVertices[Triangle[j]] == vid)
|
||||
{
|
||||
VertexElements.AddUnique(Triangle[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,6 +399,19 @@ public:
|
||||
return FIndex3i(ElementTriangles[i], ElementTriangles[i + 1], ElementTriangles[i + 2]);
|
||||
}
|
||||
|
||||
/** If the triangle is set to valid element indices, return the indices in TriangleOut and return true, otherwise return false */
|
||||
inline bool GetTriangleIfValid(int TriangleID, FIndex3i& TriangleOut) const
|
||||
{
|
||||
int i = 3 * TriangleID;
|
||||
int a = ElementTriangles[i];
|
||||
if ( a >= 0 )
|
||||
{
|
||||
TriangleOut = FIndex3i(a, ElementTriangles[i+1], ElementTriangles[i+2]);
|
||||
checkSlow(TriangleOut.B >= 0 && TriangleOut.C >= 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set the element at a given index */
|
||||
inline void SetElement(int ElementID, const RealType* Data)
|
||||
|
||||
Reference in New Issue
Block a user