You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb jimmy.andrews, semion.piskarev #jira none [CL 15661651 by Ryan Schmidt in ue5-main branch]
64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Polygroups/PolygroupUtil.h"
|
|
|
|
#include "ExplicitUseGeometryMathTypes.h" // using UE::Geometry::(math types)
|
|
using namespace UE::Geometry;
|
|
|
|
FDynamicMeshPolygroupAttribute* UE::Geometry::FindPolygroupLayerByName(FDynamicMesh3& Mesh, FName Name)
|
|
{
|
|
FDynamicMeshAttributeSet* AttributeSet = Mesh.Attributes();
|
|
if (AttributeSet == nullptr) return nullptr;
|
|
int32 NumPolygroupLayers = AttributeSet->NumPolygroupLayers();
|
|
for (int32 k = 0; k < NumPolygroupLayers; ++k)
|
|
{
|
|
if (AttributeSet->GetPolygroupLayer(k)->GetName() == Name)
|
|
{
|
|
return AttributeSet->GetPolygroupLayer(k);
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
|
|
int32 UE::Geometry::FindPolygroupLayerIndexByName(const FDynamicMesh3& Mesh, FName Name)
|
|
{
|
|
const FDynamicMeshAttributeSet* AttributeSet = Mesh.Attributes();
|
|
if (AttributeSet == nullptr) return -1;
|
|
int32 NumPolygroupLayers = AttributeSet->NumPolygroupLayers();
|
|
for (int32 k = 0; k < NumPolygroupLayers; ++k)
|
|
{
|
|
if (AttributeSet->GetPolygroupLayer(k)->GetName() == Name)
|
|
{
|
|
return k;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int32 UE::Geometry::FindPolygroupLayerIndex(const FDynamicMesh3& Mesh, const FDynamicMeshPolygroupAttribute* Layer)
|
|
{
|
|
const FDynamicMeshAttributeSet* AttributeSet = Mesh.Attributes();
|
|
if (AttributeSet == nullptr) return -1;
|
|
int32 NumPolygroupLayers = AttributeSet->NumPolygroupLayers();
|
|
for (int32 k = 0; k < NumPolygroupLayers; ++k)
|
|
{
|
|
if (AttributeSet->GetPolygroupLayer(k) == Layer)
|
|
{
|
|
return k;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int32 UE::Geometry::ComputeGroupIDBound(const FDynamicMesh3& Mesh, const FDynamicMeshPolygroupAttribute* Layer)
|
|
{
|
|
int Bound = 0;
|
|
for (int TID : Mesh.TriangleIndicesItr())
|
|
{
|
|
Bound = FMath::Max(Bound, Layer->GetValue(TID) + 1);
|
|
}
|
|
return Bound;
|
|
} |