22template<
typename TriangleMeshType>
83 for (
int SourceIdx = 0; SourceIdx <
Sources.
Num(); SourceIdx++)
85 if (
Sources[SourceIdx] ==
nullptr)
128 if (!bReuseComputed || ComputedSpatials[SourceIdx].GetMesh() != Sources[SourceIdx] || !ComputedSpatials[SourceIdx].IsValid(false))
130 ComputedSpatials[SourceIdx].SetMesh(Sources[SourceIdx], true);
142 ComputedSDFs.Reserve(Sources.Num());
143 SDFMaxDistances.Reserve(Sources.Num());
144 for (
int i = 0; i < Sources.Num(); i++)
146 ComputedSDFs.Emplace(Sources[i], GridCellSize, &ComputedSpatials[i],
false);
147 SDFMaxDistances.Add(0.0);
155 if (bReuseComputed && NeedDistance <= SDFMaxDistances[SourceIdx])
165 ComputedSDFs[SourceIdx].MaxOffsetDistance =
UseMaxOffset;
166 ComputedSDFs[SourceIdx].CellSize = GridCellSize;
168 ComputedSDFs[SourceIdx].CancelF = CancelF;
169 ComputedSDFs[SourceIdx].Initialize();
198 Blend.bSubtract = bSubtract;
199 Blend.Children.Reserve(Sources.Num());
202 for (
int SourceIdx = 0; SourceIdx < Sources.Num(); SourceIdx++)
204 Interpolants.Add(ComputedSDFs[SourceIdx].MakeInterpolant());
209 MarchingCubes.CancelF = CancelF;
211 MarchingCubes.CubeSize = MeshCellSize;
214 MarchingCubes.
Bounds = CombinedBounds;
215 MarchingCubes.Bounds.Expand(BlendFalloff);
216 MarchingCubes.RootMode = ERootfindingModes::LerpSteps;
217 MarchingCubes.RootModeSteps = 3;
227 for (
int VID = 0; VID < Source->MaxVertexID(); VID++)
229 if (!Source->IsVertex(VID))
236 if (MarchingCubes.Bounds.Contains(
Seed))
245 MarchingCubes.GenerateContinuation(
Seeds);
247 if (
Seeds.Num() > 0 && MarchingCubes.Triangles.Num() == 0)
250 MarchingCubes.Generate();
255 MarchingCubes.Implicit =
nullptr;
#define ensure( InExpression)
Definition AssertionMacros.h:464
void ParallelFor(int32 Num, TFunctionRef< void(int32)> Body, bool bForceSingleThread, bool bPumpRenderingThread=false)
Definition ParallelFor.h:481
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition AndroidPlatformMisc.h:14
Definition MarchingCubes.h:51
Definition MeshShapeGenerator.h:19
void Reset()
Definition MeshShapeGenerator.h:80
const FMeshShapeGenerator & Generate(bool bReuseComputed=false)
Definition Blend.h:98
FAxisAlignedBox3d CombinedBounds
Intermediate.
Definition Blend.h:73
void ComputeBounds()
Definition Blend.h:114
TArray< double > SDFMaxDistances
Definition Blend.h:76
TArray< const TriangleMeshType * > Sources
Definition Blend.h:35
double GridCellSize
Definition Blend.h:45
TArray< FAxisAlignedBox3d > SourceBounds
Definition Blend.h:36
void ComputeSpatials(bool bReuseComputed)
Definition Blend.h:123
bool bSubtract
Definition Blend.h:51
void SetCellSizesAndFalloff(FAxisAlignedBox3d Bounds, double BlendFalloffIn, int TargetInputVoxelCount, int TargetOutputVoxelCount)
Definition Blend.h:54
void ComputeLazySDFs(bool bReuseComputed)
Definition Blend.h:136
FMarchingCubes MarchingCubes
Definition Blend.h:69
double BlendFalloff
Definition Blend.h:42
double BlendPower
Definition Blend.h:39
void GenerateBlendAnalytic(bool bReuseComputed)
Definition Blend.h:175
TArray< TCachingMeshSDF< TriangleMeshType > > ComputedSDFs
Definition Blend.h:75
TFunction< bool(void)> CancelF
Definition Blend.h:62
bool Validate()
Definition Blend.h:80
double MeshCellSize
Definition Blend.h:48
TArray< TMeshAABBTree3< TriangleMeshType > > ComputedSpatials
Definition Blend.h:74
virtual ~TImplicitBlend()
Definition Blend.h:27
Definition AdvancedWidgetsModule.cpp:13
static TAxisAlignedBox3< double > Empty()
Definition BoxTypes.h:382
void Contain(const TVector< RealType > &V)
Definition BoxTypes.h:438
RealType MaxDim() const
Definition BoxTypes.h:598
Definition ImplicitFunctions.h:135
TAxisAlignedBox3< RealType > Bounds()
Definition ImplicitFunctions.h:146
Definition ImplicitFunctions.h:177
RealType BlendPower
Definition ImplicitFunctions.h:179