Class to manage sharing data between the game thread and the simulation thread (which may not be different than the game thread) for a FGeometryDynamicCollection.
更多...
#include <GeometryCollectionPhysicsProxy.h>
类 TGeometryCollectionPhysicsProxy< Traits > 继承关系图:Public 类型 | |
| using | FInitFunc = TFunction< void(FSimulationParameters &)> |
| Proxy publics | |
Public 成员函数 | |
| void | BufferCommand (Chaos::TPBDRigidsSolver< Traits > *, const FFieldSystemCommand &Command) |
Enqueue a field Command to be processed by ProcessCommands() or FieldForcesUpdateCallback(). | |
| void | BufferPhysicsResults () |
Push physics state into the PhysToGameInterchange. | |
| void | ClearAccumulatedData () |
Called at the end of FPBDRigidsSolver::PushPhysicsStateExec(). | |
| void | FlipBuffer () |
Does nothing as BufferPhysicsResults() already did this. | |
| void | Initialize () |
Construct PTDynamicCollection, copying attributes from the game thread, and prepare for simulation. | |
| void | InitializeBodiesPT (Chaos::TPBDRigidsSolver< Traits > *RigidsSolver, typename Chaos::TPBDRigidsSolver< Traits >::FParticlesType &Particles) |
| Finish initialization on the physics thread. 更多... | |
| Chaos::FParticleData * | NewData () |
Pushes current game thread particle state into the GameToPhysInterchange. 更多... | |
| bool | PullFromPhysicsState (const int32 SolverSyncTimestamp) |
Pulls data out of the PhysToGameInterchange and updates GTDynamicCollection. 更多... | |
| TGeometryCollectionPhysicsProxy (UObject *InOwner, FGeometryDynamicCollection &GameThreadCollection, const FSimulationParameters &SimulationParameters, FCollisionFilterData InSimFilter, FCollisionFilterData InQueryFilter, FInitFunc InInitFunc, FCacheSyncFunc InCacheSyncFunc, FFinalSyncFunc InFinalSyncFunc, const Chaos::EMultiBufferMode BufferMode=Chaos::EMultiBufferMode::TripleGuarded) | |
InOwner InDynamicCollection game thread owned geometry collection. 更多... | |
Public 成员函数 继承自 TPhysicsProxy< TGeometryCollectionPhysicsProxy< Traits >, FStubGeometryCollectionData > | |
| void | BindParticleCallbackMapping (Chaos::TArrayCollectionArray< PhysicsProxyWrapper > &PhysicsProxyReverseMap, Chaos::TArrayCollectionArray< int32 > &ParticleIDReverseMap) |
| The Particle Binding creates a connection between the particles in the simulation and the solver objects dataset. | |
| void | BufferCommand (Chaos::TPBDRigidsSolver< Traits > *InSolver, const FFieldSystemCommand &InCommand) |
| Called to buffer a command to be processed at the next available safe opportunity | |
| void | BufferPhysicsResults () |
| CONTEXT: PHYSICSTHREAD Called per-tick after the simulation has completed. 更多... | |
| void | ClearAccumulatedData () |
| CONTEXT: GAMETHREAD Returns a new unmanaged allocation of the data saved on the handle, otherwise nullptr 更多... | |
| EPhysicsProxyType | ConcreteType () |
| Returns the concrete type of the derived class | |
| void | FlipBuffer () |
| CONTEXT: PHYSICSTHREAD (Write Locked) Called by the physics thread to signal that it is safe to perform any double-buffer flips here. 更多... | |
| virtual UObject * | GetOwner () const override |
| Gets the owning external object for this solver object, never used internally | |
| bool | IsSimulating () const |
| The following functions are to be implemented by all solver objects as we're using CRTP / F-Bound to statically dispatch the calls. 更多... | |
| void | OnRemoveFromScene () |
| CONTEXT: PHYSICSTHREAD Called on the physics thread when the engine is shutting down the proxy and we need to remove it from any active simulations. 更多... | |
| bool | PullFromPhysicsState (const int32 SolverSyncTimestamp) |
| CONTEXT: GAMETHREAD (Read Locked) Perform a similar operation to Sync, but take the data from a gamethread-safe buffer. 更多... | |
| void | SyncBeforeDestroy () |
| CONTEXT: GAMETHREAD Called during the gamethread sync after the proxy has been removed from its solver intended for final handoff of any data the proxy has that the gamethread may be interested in | |
| virtual | ~TPhysicsProxy () |
| Virtual destructor for derived objects, ideally no other virtuals should exist in this chain | |
Protected 成员函数 | |
| Chaos::TPBDRigidClusteredParticleHandle< float, 3 > * | BuildClusters (const uint32 CollectionClusterIndex, TArray< Chaos::TPBDRigidParticleHandle< float, 3 > * > &ChildHandles, const TArray< int32 > &ChildTransformGroupIndices, const Chaos::FClusterCreationParameters< float > &Parameters) |
| Build a physics thread cluster parent particle. 更多... | |
| int32 | CalculateHierarchyLevel (const FGeometryDynamicCollection &GeometryCollection, int32 TransformIndex) const |
Traverses the parents of TransformIndex in GeometryCollection, counting the number of levels until the next parent is INDEX_NONE. | |
Class to manage sharing data between the game thread and the simulation thread (which may not be different than the game thread) for a FGeometryDynamicCollection.
| TGeometryCollectionPhysicsProxy< Traits >::TGeometryCollectionPhysicsProxy | ( | UObject * | InOwner, |
| FGeometryDynamicCollection & | GameThreadCollection, | ||
| const FSimulationParameters & | SimulationParameters, | ||
| FCollisionFilterData | InSimFilter, | ||
| FCollisionFilterData | InQueryFilter, | ||
| FInitFunc | InInitFunc, | ||
| FCacheSyncFunc | InCacheSyncFunc, | ||
| FFinalSyncFunc | InFinalSyncFunc, | ||
| const Chaos::EMultiBufferMode | BufferMode = Chaos::EMultiBufferMode::TripleGuarded |
||
| ) |
InOwner InDynamicCollection game thread owned geometry collection.
InInitFunc callback invoked from Initialize(). InCacheSyncFunc callback invoked from PullFromPhysicsState(). InFinalSyncFunc callback invoked from SyncBeforeDestory().
|
protected |
Build a physics thread cluster parent particle.
CollectionClusterIndex - the source geometry collection transform index. ChildHandles - physics particle handles of the cluster children. ChildTransformGroupIndices - geometry collection indices of the children. \P Parameters - uh, yeah... Other parameters.
| void TGeometryCollectionPhysicsProxy< Traits >::InitializeBodiesPT | ( | Chaos::TPBDRigidsSolver< Traits > * | RigidsSolver, |
| typename Chaos::TPBDRigidsSolver< Traits >::FParticlesType & | Particles | ||
| ) |
Finish initialization on the physics thread.
Called by solver command registered by FPBDRigidsSolver::RegisterObject().
|
inline |
Pushes current game thread particle state into the GameToPhysInterchange.
Redirects to BufferGameState(), and returns nullptr as this class manages data transport to the physics thread itself, without allocating memory.
| bool TGeometryCollectionPhysicsProxy< Traits >::PullFromPhysicsState | ( | const int32 | SolverSyncTimestamp | ) |
Pulls data out of the PhysToGameInterchange and updates GTDynamicCollection.
Called from FPhysScene_ChaosInterface::SyncBodies(), NOT the solver.