You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#ROBOMERGE-AUTHOR: michael.balzer #ROBOMERGE-SOURCE: CL 18227685 in //UE5/Release-5.0/... via CL 18229350 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) #ROBOMERGE[STARSHIP]: UE5-Main [CL 18231457 by michael balzer in ue5-release-engine-test branch]
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Polygroups/PolygroupUtil.h"
|
|
|
|
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;
|
|
}
|
|
|
|
const FDynamicMeshPolygroupAttribute* UE::Geometry::FindPolygroupLayerByName(const FDynamicMesh3& Mesh, FName Name)
|
|
{
|
|
const 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;
|
|
} |