Files
UnrealEngineUWP/Engine/Plugins/Experimental/GeometryFlow/Source/GeometryFlowMeshProcessing/Private/MeshProcessingNodes/GenerateConvexHullMeshNode.cpp
tyson brochu 9c5894b63b AutoLOD: Pass EvaluationInfo to node ProcessMesh functions. Make GenerateUVs and GenerateConvexHullMesh cancellable.
#rnx
#rb rinat.abdrashitov
#robomerge[starship] 5.0
#preflight 614cb58d88dbdb000179f1cf

[CL 17611355 by tyson brochu in ue5-main branch]
2021-09-23 14:24:45 -04:00

39 lines
1.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MeshProcessingNodes/GenerateConvexHullMeshNode.h"
#include "Operations/MeshConvexHull.h"
#include "Util/ProgressCancel.h"
using namespace UE::Geometry;
using namespace UE::GeometryFlow;
EGeometryFlowResult FGenerateConvexHullMeshNode::MakeConvexHullMesh(const FDynamicMesh3& MeshIn,
const FGenerateConvexHullMeshSettings& Settings,
FDynamicMesh3& MeshOut,
TUniquePtr<FEvaluationInfo>& EvaluationInfo)
{
FMeshConvexHull Hull(&MeshIn);
if (Settings.bPrefilterVertices)
{
FMeshConvexHull::GridSample(MeshIn, Settings.PrefilterGridResolution, Hull.VertexSet);
}
Hull.bPostSimplify = false; // Mesh can be simplified later
if (Hull.Compute(EvaluationInfo->Progress))
{
MeshOut = MoveTemp(Hull.ConvexHull);
}
if (EvaluationInfo->Progress->Cancelled())
{
return EGeometryFlowResult::OperationCancelled;
}
// TODO: What if Hull.Compute() fails but not because of cancellation? Should we have a EGeometryFlowResult::Failed?
return EGeometryFlowResult::Ok;
}