You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #rnx #jira UE-139757 #preflight 61f572d9e52a8a4a910990f1 #ROBOMERGE-AUTHOR: ryan.schmidt #ROBOMERGE-SOURCE: CL 18784197 in //UE5/Release-5.0/... via CL 18784203 via CL 18784222 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472) [CL 18784226 by ryan schmidt in ue5-main branch]
82 lines
3.4 KiB
C++
82 lines
3.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "PreviewMesh.h"
|
|
#include "DynamicMesh/DynamicMesh3.h"
|
|
#include "DynamicMesh/DynamicMeshAABBTree3.h"
|
|
#include "DynamicSubmesh3.h"
|
|
#include "PolyEditPreviewMesh.generated.h"
|
|
|
|
/**
|
|
* UPolyEditPreviewMesh is a variant of UPreviewMesh intended for use as a 'live preview' of
|
|
* a mesh creation/editing operation. The class supports initializing the preview mesh in various
|
|
* ways, generally as a submesh of a base mesh.
|
|
*/
|
|
UCLASS(Transient)
|
|
class MODELINGCOMPONENTS_API UPolyEditPreviewMesh : public UPreviewMesh
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
|
|
//
|
|
// "Static Type" is just a static mesh
|
|
//
|
|
|
|
void InitializeStaticType(const FDynamicMesh3* SourceMesh, const TArray<int32>& Triangles,
|
|
const FTransform3d* MeshTransform = nullptr);
|
|
void UpdateStaticType(TFunctionRef<void(FDynamicMesh3&)> UpdateMeshFunc, bool bFullRecalculate);
|
|
void MakeStaticTypeTargetMesh(FDynamicMesh3& TargetMesh);
|
|
|
|
//
|
|
// "Extrude Type" duplicates the input faces, offsets them using FExtrudeMesh, and stitches them together
|
|
//
|
|
|
|
void InitializeExtrudeType(const FDynamicMesh3* SourceMesh, const TArray<int32>& Triangles,
|
|
const FVector3d& TransformedOffsetDirection,
|
|
const FTransform3d* MeshTransform = nullptr,
|
|
bool bDeleteExtrudeBaseFaces = true);
|
|
void InitializeExtrudeType(FDynamicMesh3&& BaseMesh,
|
|
const FVector3d& TransformedOffsetDirection,
|
|
const FTransform3d* MeshTransform = nullptr,
|
|
bool bDeleteExtrudeBaseFaces = true);
|
|
/** Update extrude-type preview mesh by moving existing offset vertices */
|
|
void UpdateExtrudeType(double NewOffset, bool bUseNormalDirection = false);
|
|
/** Update extrude-type preview mesh by moving existing offset vertices along their connected triangle normals and then averaging positions */
|
|
void UpdateExtrudeType_FaceNormalAvg(double NewOffset);
|
|
/** Update extrude-type preview mesh using external function. if bFullRecalculate, mesh is re-initialized w/ initial extrusion patch SourceMesh before calling function */
|
|
void UpdateExtrudeType(TFunctionRef<void(FDynamicMesh3&)> UpdateMeshFunc, bool bFullRecalculate);
|
|
/** Make a hit-target mesh that is an infinite extrusion along extrude direction. If bUseNormalDirection, use per-vertex normals instead */
|
|
void MakeExtrudeTypeHitTargetMesh(FDynamicMesh3& TargetMesh, bool bUseNormalDirection = false);
|
|
|
|
|
|
//
|
|
// "Inset Type" duplicates the input faces and insets them using FInsetMeshRegion
|
|
//
|
|
|
|
void InitializeInsetType(const FDynamicMesh3* SourceMesh, const TArray<int32>& Triangles,
|
|
const FTransform3d* MeshTransform = nullptr);
|
|
void UpdateInsetType(double NewOffset, bool bReproject = false, double Softness = 0.0, double AreaScaleT = 1.0, bool bBoundaryOnly = false);
|
|
void MakeInsetTypeTargetMesh(FDynamicMesh3& TargetMesh);
|
|
|
|
const FDynamicMesh3& GetInitialPatchMesh() const { return InitialEditPatch; }
|
|
|
|
// must be non-const because query functions are non-const
|
|
UE::Geometry::FDynamicMeshAABBTree3& GetInitialPatchMeshSpatial() { return InitialEditPatchBVTree; }
|
|
|
|
protected:
|
|
TUniquePtr<UE::Geometry::FDynamicSubmesh3> ActiveSubmesh;
|
|
FDynamicMesh3 InitialEditPatch;
|
|
UE::Geometry::FDynamicMeshAABBTree3 InitialEditPatchBVTree;
|
|
|
|
TArray<int32> EditVertices;
|
|
TArray<FVector3d> InitialPositions;
|
|
TArray<FVector3d> InitialNormals;
|
|
TArray<FVector3d> InitialTriNormals;
|
|
TMap<int32,int32> ExtrudeToInitialVerts;
|
|
|
|
FVector3d InputDirection;
|
|
|
|
FTransform3d MeshTransform;
|
|
bool bHaveMeshTransform;
|
|
}; |