UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LevelSetElem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "LevelSetElem.generated.h"
9
10namespace Chaos
11{
12 class FLevelSet;
13}
14
15USTRUCT()
17{
19
23
25 {
26 CloneElem(Other);
27 }
28
30 {
31 CloneElem(Other);
32 return *this;
33 }
34
35 ENGINE_API void BuildLevelSet(const FTransform& GridTransform, const TArray<double>& GridValues, const FIntVector& GridDims, float GridCellSize);
36
38
39 virtual FTransform GetTransform() const override final
40 {
41 return Transform;
42 };
43
45 {
46 ensure(InTransform.IsValid());
48 }
49
50 // Get the tranform of the center of the level set. In contrast, GetTransform() gets a transform relative to the corner.
52 {
53 return FTransform(
54 Transform.GetRotation(),
55 Transform.GetLocation() + Transform.TransformVector(UntransformedAABB().GetCenter()),
56 Transform.GetScale3D());
57 }
58
59 // Set the tranform of the center of the level set. In contrast, SetTransform() sets a transform relative to the corner.
61 {
62 ensure(CenteredTransform.IsValid());
64 CenteredTransform.GetRotation(),
65 CenteredTransform.GetLocation() - CenteredTransform.TransformVector(UntransformedAABB().GetCenter()),
66 CenteredTransform.GetScale3D());
67 }
68
69 ENGINE_API void ScaleElem(FVector DeltaSize, float MinSize);
70
71 // Draw helpers
72
74 ENGINE_API void GetInteriorGridCells(TArray<FBox>& CellBoxes, double InteriorThreshold = 0.0) const;
75
77 ENGINE_API void GetZeroIsosurfaceGridCellFaces(TArray<FVector3f>& Vertices, TArray<FIntVector>& Tris) const;
78
79 // Draw functions
80 ENGINE_API virtual void DrawElemWire(class FPrimitiveDrawInterface* PDI, const FTransform& ElemTM, const float Scale, const FColor Color) const override;
81 ENGINE_API virtual void DrawElemSolid(class FPrimitiveDrawInterface* PDI, const FTransform& ElemTM, const float Scale, const FMaterialRenderProxy* MaterialRenderProxy) const override;
82 ENGINE_API void GetElemSolid(const FTransform& ElemTM, const FVector& Scale3D, const FMaterialRenderProxy* MaterialRenderProxy, int32 ViewIndex, class FMeshElementCollector& Collector) const;
83
84 ENGINE_API FBox CalcAABB(const FTransform& BoneTM, const FVector& Scale3D) const;
85 ENGINE_API FBox UntransformedAABB() const;
86 ENGINE_API FIntVector3 GridResolution() const;
87
88 bool Serialize(FArchive& Ar);
89
91 {
92 return LevelSet;
93 }
94
95private:
96
98 UPROPERTY()
100
101 TSharedPtr<Chaos::FLevelSet, ESPMode::ThreadSafe> LevelSet;
102
104 ENGINE_API void CloneElem(const FKLevelSetElem& Other);
105};
106
107/* Enable our own serialization function to handle FLevelSet */
108template<>
110{
111 enum
112 {
113 WithSerializer = true
114 };
115 static constexpr EPropertyObjectReferenceType WithSerializerObjectReferences = EPropertyObjectReferenceType::None;
116};
#define ensure( InExpression)
Definition AssertionMacros.h:464
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::Math::TTransform< double > FTransform
Definition MathFwd.h:53
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define USTRUCT(...)
Definition ObjectMacros.h:746
EPropertyObjectReferenceType
Definition ObjectMacros.h:533
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
ESPMode
Definition SharedPointerFwd.h:12
Definition Archive.h:1208
Definition MaterialRenderProxy.h:102
Definition MeshElementCollector.h:26
Definition PrimitiveDrawInterface.h:19
Definition Array.h:670
Definition SharedPointer.h:692
Definition SkeletalMeshComponent.h:307
Definition PhysicsAsset.h:13
Definition Color.h:486
Definition LevelSetElem.h:17
const TSharedPtr< Chaos::FLevelSet, ESPMode::ThreadSafe > GetLevelSet() const
Definition LevelSetElem.h:90
FTransform GetCenteredTransform() const
Definition LevelSetElem.h:51
const FKLevelSetElem & operator=(const FKLevelSetElem &Other)
Definition LevelSetElem.h:29
void SetTransform(const FTransform &InTransform)
Definition LevelSetElem.h:44
void SetCenteredTransform(const FTransform &CenteredTransform)
Definition LevelSetElem.h:60
FKLevelSetElem(const FKLevelSetElem &Other)
Definition LevelSetElem.h:24
virtual FTransform GetTransform() const override final
Definition LevelSetElem.h:39
Definition ShapeElem.h:35
Definition StructOpsTypeTraits.h:11
Definition StructOpsTypeTraits.h:46