20#ifndef CHAOS_DETERMINISTIC
21#define CHAOS_DETERMINISTIC 1
27 class FConstraintHandle;
28 class FParticleCollisions;
40 class FPBDIslandParticle;
58 , bIsSingleShape(
true)
63 , bIsSingleShape(
true)
68 , bIsSingleShape(
false)
78 check(bIsSingleShape);
85 check(!bIsSingleShape);
101 return ::GetTypeHash(
Unique.GlobalID);
116 return SharedData->Handle;
124 SharedData->Handle =
nullptr;
130 return SharedData !=
nullptr;
150 template<
class T,
int d, EGeometryParticlesSimType SimType>
176 , MGeometryParticleHandle(
MoveTemp(
Other.MGeometryParticleHandle))
183 , MWorldSpaceInflatedBounds(
MoveTemp(
Other.MWorldSpaceInflatedBounds))
226 UE_DEPRECATED(5.4,
"Please use GetGeometry instead")
229 UE_DEPRECATED(5.4,
"Please use GetGeometry instead")
237 UE_DEPRECATED(5.4,
"Please use GetGeometry instead")
253#if CHAOS_DETERMINISTIC
258 UE_DEPRECATED(5.4,
"Please use SetGeometry with FImplicitObjectPtr instead")
261 UE_DEPRECATED(5.4,
"Please use SetGeometry with FImplicitObjectPtr instead")
265 void RegisterArrays()
268#if CHAOS_DETERMINISTIC
309 UpdateShapesArray(
Index);
312 if (MHasBounds[
Index])
317 UpdateCCDAxisThreshold(
Index);
326 void UpdateCCDAxisThreshold(
const int32 Index)
338 MCCDAxisThreshold[
Index] = MLocalBounds[
Index].Extents();
361 for (
int32 AxisIndex = 0; AxisIndex < d; ++AxisIndex)
385 return MLocalBounds[
Index];
390 return MLocalBounds[
Index];
395 return MCCDAxisThreshold[
Index];
400 return MHasBounds[
Index];
405 return MHasBounds[
Index];
410 return MSpatialIdx[
Index];
415 return MSpatialIdx[
Index];
443 return MWorldSpaceInflatedBounds[
Index];
455 for (
const auto& Shape : Shapes)
457 Shape->UpdateWorldSpaceState(WorldTransform);
458 WorldBounds.
GrowToInclude(Shape->GetWorldSpaceShapeBounds());
461 MWorldSpaceInflatedBounds[
Index] =
TAABB<T, d>(WorldBounds).ThickenSymmetrically(BoundsExpansion);
470 MWorldSpaceInflatedBounds[
Index].GrowByVector(DeltaX);
505 return MParticleConstraints[
Index];
526 return MParticleCollisions[
Index];
550 void ResetWeakParticleHandle(
const int32 Index)
579 SerializeGeometryParticleHelper(Ar,
this);
591 for (
int32 Idx = 0; Idx < MShapesArray.Num(); ++Idx)
664 template <
typename T2,
int d2, EGeometryParticlesSimType SimType2>
674#if CHAOS_DETERMINISTIC
682 template <
typename T,
int d, EGeometryParticlesSimType SimType>
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define check(expr)
Definition AssertionMacros.h:314
#define CHAOS_DEBUG_NAME
Definition BodyInstance.h:63
#define CHAOS_ENSURE(Condition)
Definition ChaosCheck.h:22
@ INDEX_NONE
Definition CoreMiscDefines.h:150
TSharedRef< InObjectType, InMode > MakeShared(InArgTypes &&... Args)
Definition SharedPointer.h:2009
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define CHAOS_DETERMINISTIC
Definition GeometryParticles.h:21
#define LLM_SCOPE(...)
Definition LowLevelMemTracker.h:1095
ESPMode
Definition SharedPointerFwd.h:12
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
if(Failed) console_printf("Failed.\n")
Definition ChaosArchive.h:167
Base class for constraint handles.
Definition ConstraintHandle.h:102
Definition ImplicitObject.h:111
virtual CHAOS_API const FAABB3 BoundingBox() const
Definition ImplicitObject.cpp:118
Knows about all the collisions detectors associated with a particular particle. Used when particles a...
Definition ParticleCollisions.h:21
Definition ShapeInstance.h:36
Definition GeometryParticles.h:50
const FShapesArray * ShapeArray
Definition GeometryParticles.h:93
const FPerShapeData * Shape
Definition GeometryParticles.h:92
FShapeOrShapesArray(const FPerShapeData *InShape)
Definition GeometryParticles.h:61
FShapeOrShapesArray(const FShapesArray *InShapeArray)
Definition GeometryParticles.h:66
bool IsSingleShape() const
Definition GeometryParticles.h:71
const FShapesArray * GetShapesArray() const
Definition GeometryParticles.h:83
FShapeOrShapesArray()
Definition GeometryParticles.h:56
bool IsValid() const
Definition GeometryParticles.h:73
const FPerShapeData * GetShape() const
Definition GeometryParticles.h:76
Definition GeometryParticles.h:107
bool IsInitialized()
Definition GeometryParticles.h:128
void ResetHandle()
Definition GeometryParticles.h:120
FWeakParticleHandle()=default
TGeometryParticleHandle< FReal, 3 > * GetHandle() const
Definition GeometryParticles.h:119
FWeakParticleHandle(TGeometryParticleHandle< FReal, 3 > *InHandle)
Definition GeometryParticles.h:111
TGeometryParticleHandle< FReal, 3 > * GetHandleUnsafe() const
Definition GeometryParticles.h:114
Definition IslandManager.h:41
FORCEINLINE void GrowToInclude(const TVector< T, d > &V)
Definition AABB.h:393
FORCEINLINE TVector< T, d > Extents() const
Definition AABB.h:453
static FORCEINLINE TAABB< FReal, d > ZeroAABB()
Definition AABB.h:630
static FORCEINLINE TAABB< FReal, d > EmptyAABB()
Definition AABB.h:623
Definition ArrayCollectionArray.h:15
int32 AddArray(TArrayCollectionArrayBase *Array)
Definition ArrayCollection.h:36
uint32 Size() const
Definition ArrayCollection.h:66
static void SerializeAsAABBs(FArchive &Ar, TArray< TAABB< OtherType, d > > &AABBs)
Definition Box.h:484
Definition ParticleHandle.h:436
Definition ParticleHandle.h:2739
Definition GeometryParticles.h:152
FORCEINLINE bool & EnabledDuringResim(const int32 Index)
Definition GeometryParticles.h:536
FGeometryParticle *& GTGeometryParticle(const int32 Index)
Definition GeometryParticles.h:479
FUniqueIdx & UniqueIdx(const int32 Index)
Definition GeometryParticles.h:220
TGeometryParticlesImp()
Definition GeometryParticles.h:164
FParticleID & ParticleID(const int32 Idx)
Definition GeometryParticles.h:255
const IPhysicsProxyBase * PhysicsProxy(const int32 Index) const
Definition GeometryParticles.h:481
TGeometryParticlesImp(TGeometryParticlesImp< T, d, SimType > &&Other)
Definition GeometryParticles.h:172
TGeometryParticlesImp(TParticles< T, d > &&Other)
Definition GeometryParticles.h:208
const TUniquePtr< FImplicitObject > & DynamicGeometry(const int32 Index) const
Definition GeometryParticles.h:230
FORCEINLINE TArray< bool > & AllHasBounds()
Definition GeometryParticles.h:634
bool & HasBounds(const int32 Index)
Definition GeometryParticles.h:403
UE_DEPRECATED(5.3, "Use ConstraintGraphNode") int32 &ConstraintGraphIndex(const int32 Index)
Definition GeometryParticles.h:546
FORCEINLINE bool EnabledDuringResim(const int32 Index) const
Definition GeometryParticles.h:535
ESyncState & SyncState(const int32 Index)
Definition GeometryParticles.h:222
ESyncState SyncState(const int32 Index) const
Definition GeometryParticles.h:223
FSpatialAccelerationIdx SpatialIdx(const int32 Index) const
Definition GeometryParticles.h:408
FGeometryParticle * GTGeometryParticle(const int32 Index) const
Definition GeometryParticles.h:478
const FShapeInstanceArray & ShapeInstances(const int32 Index) const
Definition GeometryParticles.h:251
FParticleID ParticleID(const int32 Idx) const
Definition GeometryParticles.h:254
FORCEINLINE bool & LightWeightDisabled(const int32 Index)
Definition GeometryParticles.h:539
const TVector< T, d > & CCDAxisThreshold(const int32 Index) const
Definition GeometryParticles.h:393
void UpdateWorldSpaceState(const int32 Index, const FRigidTransform3 &WorldTransform, const FVec3 &BoundsExpansion)
Definition GeometryParticles.h:446
const FShapesArray & ShapesArray(const int32 Index) const
Definition GeometryParticles.h:248
FORCEINLINE bool LightWeightDisabled(const int32 Index) const
Definition GeometryParticles.h:538
FORCEINLINE EGeometryParticleListMask ListMask(const int32 Index) const
Definition GeometryParticles.h:541
FORCEINLINE TArray< TAABB< T, d > > & AllWorldSpaceInflatedBounds()
Definition GeometryParticles.h:633
FConstraintHandleArray & ParticleConstraints(const int32 Index)
All of the persistent (non-collision) constraints affecting the particle.
Definition GeometryParticles.h:503
FWeakParticleHandle & WeakParticleHandle(const int32 Index)
Definition GeometryParticles.h:488
FORCEINLINE EGeometryParticleListMask GetContainerListMask() const
Definition GeometryParticles.h:629
FSpatialAccelerationIdx & SpatialIdx(const int32 Index)
Definition GeometryParticles.h:413
FORCEINLINE THandleType * Handle(int32 Index) const
Definition GeometryParticles.h:474
FORCEINLINE EResimType & ResimType(const int32 Index)
Definition GeometryParticles.h:533
void RemoveConstraintHandle(const int32 &Index, FConstraintHandle *InConstraintHandle)
Definition GeometryParticles.h:515
const FString & GetDebugName(const int32 Index) const
Definition GeometryParticles.h:430
FORCEINLINE Private::FPBDIslandParticle *& ConstraintGraphNode(const int32 Index)
Definition GeometryParticles.h:530
void UpdateWorldSpaceStateSwept(const int32 Index, const FRigidTransform3 &WorldTransform, const FVec3 &BoundsExpansion, const FVec3 &DeltaX)
Definition GeometryParticles.h:464
FORCEINLINE EGeometryParticleListMask & ListMask(const int32 Index)
Definition GeometryParticles.h:542
const TAABB< T, d > & LocalBounds(const int32 Index) const
Definition GeometryParticles.h:383
FORCEINLINE EResimType ResimType(const int32 Index) const
Definition GeometryParticles.h:532
FORCEINLINE EParticleType ParticleType() const
Definition GeometryParticles.h:627
FString ToString(int32 index) const
Definition GeometryParticles.h:560
static CHAOS_API TGeometryParticlesImp< T, d, SimType > * SerializationFactory(FChaosArchive &Ar, TGeometryParticlesImp< T, d, SimType > *Particles)
Definition GeometryParticles.cpp:92
void SetContainerListMask(const EGeometryParticleListMask InMask)
Definition GeometryParticles.h:630
CHAOS_API void SetHandle(int32 Index, FGeometryParticleHandle *Handle)
Definition GeometryParticles.cpp:73
FGeometryParticleHandle THandleType
Definition GeometryParticles.h:473
EParticleType MParticleType
Definition GeometryParticles.h:637
bool HasCollision(const int32 Index) const
Definition GeometryParticles.h:245
TGeometryParticlesImp(const TGeometryParticlesImp< T, d, SimType > &Other)=delete
FParticleCollisions & ParticleCollisions(const int32 Index)
All of the collision constraints affecting the particle.
Definition GeometryParticles.h:524
const TSharedPtr< const FImplicitObject, ESPMode::ThreadSafe > & SharedGeometry(const int32 Index) const
Definition GeometryParticles.h:238
virtual void Serialize(FChaosArchive &Ar) override
Definition GeometryParticles.h:566
FORCEINLINE TArray< TAABB< T, d > > & AllLocalBounds()
Definition GeometryParticles.h:632
IPhysicsProxyBase * PhysicsProxy(const int32 Index)
Definition GeometryParticles.h:482
EGeometryParticleListMask MContainerListMask
Definition GeometryParticles.h:638
UE_DEPRECATED(5.3, "Use ConstraintGraphNode") const int32 ConstraintGraphIndex(const int32 Index) const
Definition GeometryParticles.h:545
bool HasBounds(const int32 Index) const
Definition GeometryParticles.h:398
FORCEINLINE Private::FPBDIslandParticle * ConstraintGraphNode(const int32 Index) const
Definition GeometryParticles.h:529
bool & HasCollision(const int32 Index)
Definition GeometryParticles.h:246
void RemoveShapesAtSortedIndices(const int32 ParticleIndex, const TArrayView< const int32 > &InIndices)
Definition GeometryParticles.cpp:50
virtual ~TGeometryParticlesImp()
Definition GeometryParticles.h:216
void SetSharedGeometry(const int32 Index, TSharedPtr< const FImplicitObject, ESPMode::ThreadSafe > InShared)
Definition GeometryParticles.h:262
static constexpr bool IsRigidBodySim()
Definition GeometryParticles.h:206
void SetPhysicsProxy(const int32 Index, IPhysicsProxyBase *InPhysicsProxy)
Definition GeometryParticles.h:483
const TAABB< T, d > & WorldSpaceInflatedBounds(const int32 Index) const
Definition GeometryParticles.h:441
void AddConstraintHandle(const int32 &Index, FConstraintHandle *InConstraintHandle)
Definition GeometryParticles.h:508
TAABB< T, d > & LocalBounds(const int32 Index)
Definition GeometryParticles.h:388
FUniqueIdx UniqueIdx(const int32 Index) const
Definition GeometryParticles.h:219
void SetDynamicGeometry(const int32 Index, TUniquePtr< FImplicitObject > &&InUnique)
Definition GeometryParticles.h:259
Definition Particles.h:32
const TVector< T, d > & GetX(const int32 Index) const
Definition Particles.h:156
FString ToString(int32 index) const
Definition Particles.h:166
Definition Serializable.h:10
Definition SimpleGeometryParticles.h:16
virtual void SetGeometryImpl(const int32 Index, const FImplicitObjectPtr &InGeometry)
Definition SimpleGeometryParticles.h:121
FORCEINLINE const FImplicitObjectPtr & GetGeometry(const int32 Index) const
Definition SimpleGeometryParticles.h:61
const TArrayCollectionArray< TRotation< FRealSingle, d > > & GetR() const
Definition SimpleGeometryParticles.h:58
virtual void Serialize(FChaosArchive &Ar)
Definition SimpleGeometryParticles.h:70
void SetGeometry(const int32 Index, const FImplicitObjectPtr &InGeometry)
Definition SimpleGeometryParticles.h:62
FORCEINLINE const TArray< FImplicitObjectPtr > & GetAllGeometry() const
Definition SimpleGeometryParticles.h:67
virtual CORE_API void UsingCustomVersion(const struct FGuid &Guid)
Definition Archive.cpp:590
CORE_API int32 CustomVer(const struct FGuid &Key) const
Definition Archive.cpp:602
Definition PhysicsProxyBase.h:97
Definition ArrayView.h:139
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition SharedPointer.h:692
Definition UniquePtr.h:107
bool bCCDAxisThresholdUsesProbeShapes
Definition CCDUtilities.cpp:53
int32 CCDAxisThresholdMode
Definition CCDUtilities.cpp:50
FString EmptyParticleName
Definition GeometryParticles.cpp:20
int32 GetMin(const FIntVector3 &V)
Definition Utilities.h:53
Definition SkeletalMeshComponent.h:307
EParticleType
Definition GeometryParticlesfwd.h:11
FImplicitObject * FImplicitObjectRef
Definition ImplicitFwd.h:48
ESyncState
Definition GeometryParticlesfwd.h:29
EResimType
Definition GeometryParticles.h:143
TRefCountPtr< FImplicitObject > FImplicitObjectPtr
Definition ImplicitFwd.h:33
TRigidTransform< FReal, 3 > FRigidTransform3
Definition Core.h:22
FChaosArchive & operator<<(FChaosArchive &Ar, FRigidParticleControlFlags &Flags)
Definition RigidParticleControlFlags.cpp:15
FORCEINLINE uint32 GetTypeHash(const FParticleID &Unique)
Definition GeometryParticles.h:99
TVector< FReal, 3 > FVec3
Definition Core.h:17
EGeometryParticleListMask
Definition GeometryParticlesfwd.h:115
Definition OverriddenPropertySet.cpp:45
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition ParticleDirtyFlags.h:37
Definition GeometryParticlesfwd.h:59
Definition GeometryParticlesfwd.h:87
CORE_API static const FGuid GUID
Definition ExternalPhysicsCustomObjectVersion.h:144
@ SerializeShapeWorldSpaceBounds
Definition ExternalPhysicsCustomObjectVersion.h:61
@ SpatialIdxSerialized
Definition ExternalPhysicsCustomObjectVersion.h:31
@ SerializeHashResult
Definition ExternalPhysicsCustomObjectVersion.h:55
@ SerializeParticleBounds
Definition ExternalPhysicsCustomObjectVersion.h:19
@ SerializeGTGeometryParticles
Definition PhysicsObjectVersion.h:18
@ PerShapeData
Definition PhysicsObjectVersion.h:16
CORE_API static const FGuid GUID
Definition PhysicsObjectVersion.h:78