Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
PhysicsUpdateContext::Step Struct Reference

Structure that contains data needed for each collision step. More...

#include <PhysicsUpdateContext.h>

Classes

struct  CCDBody
 Contains the information needed to cast a body through the scene to do continuous collision detection. More...
 

Public Member Functions

 Step ()=default
 
 Step (const Step &)
 

Public Attributes

PhysicsUpdateContextmContext
 The physics update context. More...
 
bool mIsFirst
 If this is the first step. More...
 
bool mIsLast
 If this is the last step. More...
 
BroadPhase::UpdateState mBroadPhaseUpdateState
 Handle returned by Broadphase::UpdatePrepare. More...
 
uint32 mNumActiveBodiesAtStepStart
 Number of bodies that were active at the start of the physics update step. Only these bodies will receive gravity (they are the first N in the active body list). More...
 
atomic< uint32mDetermineActiveConstraintReadIdx { 0 }
 Next constraint for determine active constraints. More...
 
uint8 mPadding1 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
atomic< uint32mNumActiveConstraints { 0 }
 Number of constraints in the mActiveConstraints array. More...
 
uint8 mPadding2 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
atomic< uint32mSetupVelocityConstraintsReadIdx { 0 }
 Next constraint for setting up velocity constraints. More...
 
uint8 mPadding3 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
atomic< uint32mStepListenerReadIdx { 0 }
 Next step listener to call. More...
 
uint8 mPadding4 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
atomic< uint32mApplyGravityReadIdx { 0 }
 Next body to apply gravity to. More...
 
uint8 mPadding5 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
atomic< uint32mActiveBodyReadIdx { 0 }
 Index of fist active body that has not yet been processed by the broadphase. More...
 
uint8 mPadding6 [JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]
 Padding to avoid sharing cache line with the next atomic. More...
 
BodyPairQueues mBodyPairQueues
 Queues in which to put body pairs that need to be tested by the narrowphase. More...
 
uint32 mMaxBodyPairsPerQueue
 Amount of body pairs that we can queue per queue. More...
 
atomic< JobMaskmActiveFindCollisionJobs
 A bitmask that indicates which jobs are still active. More...
 
atomic< uintmNumBodyPairs { 0 }
 The number of body pairs found in this step (used to size the contact cache in the next step) More...
 
atomic< uintmNumManifolds { 0 }
 The number of manifolds found in this step (used to size the contact cache in the next step) More...
 
atomic< uint32mSolveVelocityConstraintsNextIsland { 0 }
 Next island that needs to be processed for the solve velocity constraints step (doesn't need own cache line since position jobs don't run at same time) More...
 
atomic< uint32mSolvePositionConstraintsNextIsland { 0 }
 Next island that needs to be processed for the solve position constraints step (doesn't need own cache line since velocity jobs don't run at same time) More...
 
atomic< uint32mIntegrateVelocityReadIdx { 0 }
 Next active body index to take when integrating velocities. More...
 
CCDBodymCCDBodies = nullptr
 List of bodies that need to do continuous collision detection. More...
 
uint32 mCCDBodiesCapacity = 0
 Capacity of the mCCDBodies list. More...
 
atomic< uint32mNumCCDBodies = 0
 Number of CCD bodies in mCCDBodies. More...
 
atomic< uint32mNextCCDBody { 0 }
 Next unprocessed body index in mCCDBodies. More...
 
int * mActiveBodyToCCDBody = nullptr
 A mapping between an index in BodyManager::mActiveBodies and the index in mCCDBodies. More...
 
uint32 mNumActiveBodyToCCDBody = 0
 Number of indices in mActiveBodyToCCDBody. More...
 
JobHandle mBroadPhasePrepare
 Prepares the new tree in the background. More...
 
JobHandleArray mStepListeners
 Listeners to notify of the beginning of a physics step. More...
 
JobHandleArray mDetermineActiveConstraints
 Determine which constraints will be active during this step. More...
 
JobHandleArray mApplyGravity
 Update velocities of bodies with gravity. More...
 
JobHandleArray mFindCollisions
 Find all collisions between active bodies an the world. More...
 
JobHandle mUpdateBroadphaseFinalize
 Swap the newly built tree with the current tree. More...
 
JobHandleArray mSetupVelocityConstraints
 Calculate properties for all constraints in the constraint manager. More...
 
JobHandle mBuildIslandsFromConstraints
 Go over all constraints and assign the bodies they're attached to to an island. More...
 
JobHandle mFinalizeIslands
 Finalize calculation simulation islands. More...
 
JobHandle mBodySetIslandIndex
 Set the current island index on each body (not used by the simulation, only for drawing purposes) More...
 
JobHandleArray mSolveVelocityConstraints
 Solve the constraints in the velocity domain. More...
 
JobHandle mPreIntegrateVelocity
 Setup integration of all body positions. More...
 
JobHandleArray mIntegrateVelocity
 Integrate all body positions. More...
 
JobHandle mPostIntegrateVelocity
 Finalize integration of all body positions. More...
 
JobHandle mResolveCCDContacts
 Updates the positions and velocities for all bodies that need continuous collision detection. More...
 
JobHandleArray mSolvePositionConstraints
 Solve all constraints in the position domain. More...
 
JobHandle mContactRemovedCallbacks
 Calls the contact removed callbacks. More...
 
JobHandle mSoftBodyPrepare
 Prepares updating the soft bodies. More...
 
JobHandleArray mSoftBodyCollide
 Finds all colliding shapes for soft bodies. More...
 
JobHandleArray mSoftBodySimulate
 Simulates all particles. More...
 
JobHandle mSoftBodyFinalize
 Finalizes the soft body update. More...
 
JobHandle mStartNextStep
 Job that kicks the next step (empty for the last step) More...
 

Detailed Description

Structure that contains data needed for each collision step.

Constructor & Destructor Documentation

◆ Step() [1/2]

PhysicsUpdateContext::Step::Step ( )
default

◆ Step() [2/2]

PhysicsUpdateContext::Step::Step ( const Step )
inline

Member Data Documentation

◆ mActiveBodyReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mActiveBodyReadIdx { 0 }

Index of fist active body that has not yet been processed by the broadphase.

◆ mActiveBodyToCCDBody

int* PhysicsUpdateContext::Step::mActiveBodyToCCDBody = nullptr

A mapping between an index in BodyManager::mActiveBodies and the index in mCCDBodies.

◆ mActiveFindCollisionJobs

atomic<JobMask> PhysicsUpdateContext::Step::mActiveFindCollisionJobs

A bitmask that indicates which jobs are still active.

◆ mApplyGravity

JobHandleArray PhysicsUpdateContext::Step::mApplyGravity

Update velocities of bodies with gravity.

◆ mApplyGravityReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mApplyGravityReadIdx { 0 }

Next body to apply gravity to.

◆ mBodyPairQueues

BodyPairQueues PhysicsUpdateContext::Step::mBodyPairQueues

Queues in which to put body pairs that need to be tested by the narrowphase.

◆ mBodySetIslandIndex

JobHandle PhysicsUpdateContext::Step::mBodySetIslandIndex

Set the current island index on each body (not used by the simulation, only for drawing purposes)

◆ mBroadPhasePrepare

JobHandle PhysicsUpdateContext::Step::mBroadPhasePrepare

Prepares the new tree in the background.

◆ mBroadPhaseUpdateState

BroadPhase::UpdateState PhysicsUpdateContext::Step::mBroadPhaseUpdateState

Handle returned by Broadphase::UpdatePrepare.

◆ mBuildIslandsFromConstraints

JobHandle PhysicsUpdateContext::Step::mBuildIslandsFromConstraints

Go over all constraints and assign the bodies they're attached to to an island.

◆ mCCDBodies

CCDBody* PhysicsUpdateContext::Step::mCCDBodies = nullptr

List of bodies that need to do continuous collision detection.

◆ mCCDBodiesCapacity

uint32 PhysicsUpdateContext::Step::mCCDBodiesCapacity = 0

Capacity of the mCCDBodies list.

◆ mContactRemovedCallbacks

JobHandle PhysicsUpdateContext::Step::mContactRemovedCallbacks

Calls the contact removed callbacks.

◆ mContext

PhysicsUpdateContext* PhysicsUpdateContext::Step::mContext

The physics update context.

◆ mDetermineActiveConstraintReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mDetermineActiveConstraintReadIdx { 0 }

Next constraint for determine active constraints.

◆ mDetermineActiveConstraints

JobHandleArray PhysicsUpdateContext::Step::mDetermineActiveConstraints

Determine which constraints will be active during this step.

◆ mFinalizeIslands

JobHandle PhysicsUpdateContext::Step::mFinalizeIslands

Finalize calculation simulation islands.

◆ mFindCollisions

JobHandleArray PhysicsUpdateContext::Step::mFindCollisions

Find all collisions between active bodies an the world.

◆ mIntegrateVelocity

JobHandleArray PhysicsUpdateContext::Step::mIntegrateVelocity

Integrate all body positions.

◆ mIntegrateVelocityReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mIntegrateVelocityReadIdx { 0 }

Next active body index to take when integrating velocities.

◆ mIsFirst

bool PhysicsUpdateContext::Step::mIsFirst

If this is the first step.

◆ mIsLast

bool PhysicsUpdateContext::Step::mIsLast

If this is the last step.

◆ mMaxBodyPairsPerQueue

uint32 PhysicsUpdateContext::Step::mMaxBodyPairsPerQueue

Amount of body pairs that we can queue per queue.

◆ mNextCCDBody

atomic<uint32> PhysicsUpdateContext::Step::mNextCCDBody { 0 }

Next unprocessed body index in mCCDBodies.

◆ mNumActiveBodiesAtStepStart

uint32 PhysicsUpdateContext::Step::mNumActiveBodiesAtStepStart

Number of bodies that were active at the start of the physics update step. Only these bodies will receive gravity (they are the first N in the active body list).

◆ mNumActiveBodyToCCDBody

uint32 PhysicsUpdateContext::Step::mNumActiveBodyToCCDBody = 0

Number of indices in mActiveBodyToCCDBody.

◆ mNumActiveConstraints

atomic<uint32> PhysicsUpdateContext::Step::mNumActiveConstraints { 0 }

Number of constraints in the mActiveConstraints array.

◆ mNumBodyPairs

atomic<uint> PhysicsUpdateContext::Step::mNumBodyPairs { 0 }

The number of body pairs found in this step (used to size the contact cache in the next step)

◆ mNumCCDBodies

atomic<uint32> PhysicsUpdateContext::Step::mNumCCDBodies = 0

Number of CCD bodies in mCCDBodies.

◆ mNumManifolds

atomic<uint> PhysicsUpdateContext::Step::mNumManifolds { 0 }

The number of manifolds found in this step (used to size the contact cache in the next step)

◆ mPadding1

uint8 PhysicsUpdateContext::Step::mPadding1[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPadding2

uint8 PhysicsUpdateContext::Step::mPadding2[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPadding3

uint8 PhysicsUpdateContext::Step::mPadding3[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPadding4

uint8 PhysicsUpdateContext::Step::mPadding4[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPadding5

uint8 PhysicsUpdateContext::Step::mPadding5[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPadding6

uint8 PhysicsUpdateContext::Step::mPadding6[JPH_CACHE_LINE_SIZE - sizeof(atomic< uint32 >)]

Padding to avoid sharing cache line with the next atomic.

◆ mPostIntegrateVelocity

JobHandle PhysicsUpdateContext::Step::mPostIntegrateVelocity

Finalize integration of all body positions.

◆ mPreIntegrateVelocity

JobHandle PhysicsUpdateContext::Step::mPreIntegrateVelocity

Setup integration of all body positions.

◆ mResolveCCDContacts

JobHandle PhysicsUpdateContext::Step::mResolveCCDContacts

Updates the positions and velocities for all bodies that need continuous collision detection.

◆ mSetupVelocityConstraints

JobHandleArray PhysicsUpdateContext::Step::mSetupVelocityConstraints

Calculate properties for all constraints in the constraint manager.

◆ mSetupVelocityConstraintsReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mSetupVelocityConstraintsReadIdx { 0 }

Next constraint for setting up velocity constraints.

◆ mSoftBodyCollide

JobHandleArray PhysicsUpdateContext::Step::mSoftBodyCollide

Finds all colliding shapes for soft bodies.

◆ mSoftBodyFinalize

JobHandle PhysicsUpdateContext::Step::mSoftBodyFinalize

Finalizes the soft body update.

◆ mSoftBodyPrepare

JobHandle PhysicsUpdateContext::Step::mSoftBodyPrepare

Prepares updating the soft bodies.

◆ mSoftBodySimulate

JobHandleArray PhysicsUpdateContext::Step::mSoftBodySimulate

Simulates all particles.

◆ mSolvePositionConstraints

JobHandleArray PhysicsUpdateContext::Step::mSolvePositionConstraints

Solve all constraints in the position domain.

◆ mSolvePositionConstraintsNextIsland

atomic<uint32> PhysicsUpdateContext::Step::mSolvePositionConstraintsNextIsland { 0 }

Next island that needs to be processed for the solve position constraints step (doesn't need own cache line since velocity jobs don't run at same time)

◆ mSolveVelocityConstraints

JobHandleArray PhysicsUpdateContext::Step::mSolveVelocityConstraints

Solve the constraints in the velocity domain.

◆ mSolveVelocityConstraintsNextIsland

atomic<uint32> PhysicsUpdateContext::Step::mSolveVelocityConstraintsNextIsland { 0 }

Next island that needs to be processed for the solve velocity constraints step (doesn't need own cache line since position jobs don't run at same time)

◆ mStartNextStep

JobHandle PhysicsUpdateContext::Step::mStartNextStep

Job that kicks the next step (empty for the last step)

◆ mStepListenerReadIdx

atomic<uint32> PhysicsUpdateContext::Step::mStepListenerReadIdx { 0 }

Next step listener to call.

◆ mStepListeners

JobHandleArray PhysicsUpdateContext::Step::mStepListeners

Listeners to notify of the beginning of a physics step.

◆ mUpdateBroadphaseFinalize

JobHandle PhysicsUpdateContext::Step::mUpdateBroadphaseFinalize

Swap the newly built tree with the current tree.


The documentation for this struct was generated from the following file: