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]
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Selections/MeshFaceSelection.h"
|
|
#include "Selections/MeshVertexSelection.h"
|
|
#include "DynamicMesh3.h"
|
|
|
|
#include "ExplicitUseGeometryMathTypes.h" // using UE::Geometry::(math types)
|
|
using namespace UE::Geometry;
|
|
|
|
// convert vertex selection to face selection. Require at least minCount verts of
|
|
// tri to be selected (valid values are 1,2,3)
|
|
FMeshFaceSelection::FMeshFaceSelection(const FDynamicMesh3* mesh, const FMeshVertexSelection& convertV, int minCount) : Mesh(mesh)
|
|
{
|
|
minCount = FMathd::Clamp(minCount, 1, 3);
|
|
|
|
if (minCount == 1)
|
|
{
|
|
for ( int vid : convertV )
|
|
{
|
|
for (int tid : Mesh->VtxTrianglesItr(vid))
|
|
{
|
|
add(tid);
|
|
}
|
|
}
|
|
} else {
|
|
for (int tid : Mesh->TriangleIndicesItr()) {
|
|
FIndex3i tri = Mesh->GetTriangle(tid);
|
|
if (minCount == 3)
|
|
{
|
|
if (convertV.IsSelected(tri.A) && convertV.IsSelected(tri.B) && convertV.IsSelected(tri.C))
|
|
{
|
|
add(tid);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
int n = (convertV.IsSelected(tri.A) ? 1 : 0) +
|
|
(convertV.IsSelected(tri.B) ? 1 : 0) +
|
|
(convertV.IsSelected(tri.C) ? 1 : 0);
|
|
if (n >= minCount)
|
|
{
|
|
add(tid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |