44#ifdef JPH_TRACK_BROADPHASE_STATS
45 virtual void ReportStats()
override;
54 BodyID * mBodyStart =
nullptr;
62#ifdef JPH_ENABLE_ASSERTS
64 PhysicsLockContext mLockContext =
nullptr;
68 size_t mMaxBodies = 0;
71 TrackingVector mTracking;
84 struct UpdateStateImpl
90 static_assert(
sizeof(UpdateStateImpl) <=
sizeof(
UpdateState));
91 static_assert(
alignof(UpdateStateImpl) <=
alignof(
UpdateState));
101 atomic<uint32> mQueryLockIdx { 0 };
104 uint32 mNextLayerToUpdate = 0;
uint32_t uint32
Definition Core.h:312
unsigned int uint
Definition Core.h:309
#define JPH_NAMESPACE_END
Definition Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:29
Axis aligned box.
Definition AABox.h:16
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
Class that contains all bodies.
Definition BodyManager.h:30
Used to do coarse collision detection operations to quickly prune out bodies that will not collide.
Definition BroadPhase.h:26
void * AddState
Handle used during adding bodies to the broadphase.
Definition BroadPhase.h:57
Filter class for broadphase layers.
Definition BroadPhaseLayer.h:89
Interface that the application should implement to allow mapping object layers to broadphase layers.
Definition BroadPhaseLayer.h:56
Fast SIMD based quad tree BroadPhase that is multithreading aware and tries to do a minimal amount of...
Definition BroadPhaseQuadTree.h:15
virtual AddState AddBodiesPrepare(BodyID *ioBodies, int inNumber) override
Definition BroadPhaseQuadTree.cpp:154
virtual void Optimize() override
Should be called after many objects have been inserted to make the broadphase more efficient,...
Definition BroadPhaseQuadTree.cpp:72
virtual JPH_OVERRIDE_NEW_DELETE ~BroadPhaseQuadTree() override
Destructor.
Definition BroadPhaseQuadTree.cpp:14
virtual void CollideOrientedBox(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Get bodies intersecting with an oriented box and any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:492
virtual void CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Cast a ray and add any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:400
virtual void NotifyBodiesAABBChanged(BodyID *ioBodies, int inNumber, bool inTakeLock) override
Definition BroadPhaseQuadTree.cpp:324
virtual void NotifyBodiesLayerChanged(BodyID *ioBodies, int inNumber) override
Call whenever the layer (and optionally the aabb as well) of a body changes (can change order of ioBo...
Definition BroadPhaseQuadTree.cpp:364
virtual UpdateState UpdatePrepare() override
Definition BroadPhaseQuadTree.cpp:102
virtual void AddBodiesFinalize(BodyID *ioBodies, int inNumber, AddState inAddState) override
Definition BroadPhaseQuadTree.cpp:207
virtual void AddBodiesAbort(BodyID *ioBodies, int inNumber, AddState inAddState) override
Definition BroadPhaseQuadTree.cpp:243
virtual void LockModifications() override
Must be called before UpdatePrepare to prevent modifications from being made to the tree.
Definition BroadPhaseQuadTree.cpp:96
virtual void UpdateFinalize(const UpdateState &inUpdateState) override
Finalizing the update will quickly apply the changes.
Definition BroadPhaseQuadTree.cpp:132
virtual void CastAABoxNoLock(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Same as BroadPhaseQuery::CastAABox but can be implemented in a way to take no broad phase locks.
Definition BroadPhaseQuadTree.cpp:515
virtual void UnlockModifications() override
Must be called after UpdateFinalize to allow modifications to the broadphase.
Definition BroadPhaseQuadTree.cpp:148
virtual void CollideAABox(const AABox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Get bodies intersecting with inBox and any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:423
virtual void CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Cast a box and add any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:535
virtual void CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Get bodies intersecting with a sphere and any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:446
virtual void RemoveBodies(BodyID *ioBodies, int inNumber) override
Definition BroadPhaseQuadTree.cpp:277
virtual void FrameSync() override
Must be called just before updating the broadphase when none of the body mutexes are locked.
Definition BroadPhaseQuadTree.cpp:58
virtual void CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const override
Get bodies intersecting with a point and any hits to ioCollector.
Definition BroadPhaseQuadTree.cpp:469
virtual void FindCollidingPairs(BodyID *ioActiveBodies, int inNumActiveBodies, float inSpeculativeContactDistance, const ObjectVsBroadPhaseLayerFilter &inObjectVsBroadPhaseLayerFilter, const ObjectLayerPairFilter &inObjectLayerPairFilter, BodyPairCollector &ioPairCollector) const override
Definition BroadPhaseQuadTree.cpp:543
virtual void Init(BodyManager *inBodyManager, const BroadPhaseLayerInterface &inLayerInterface) override
Definition BroadPhaseQuadTree.cpp:19
Virtual interface that allows collecting multiple collision results.
Definition CollisionCollector.h:45
Filter class for object layers.
Definition ObjectLayer.h:28
Filter class to test if two objects can collide based on their object layer. Used while finding colli...
Definition ObjectLayer.h:50
Class to test if an object can collide with a broadphase layer. Used while finding collision pairs.
Definition BroadPhaseLayer.h:75
Oriented box.
Definition OrientedBox.h:18
Array< Tracking > TrackingVector
Definition QuadTree.h:169
Structure that holds AABox moving linearly through 3d space.
Definition AABoxCast.h:13
Context used during broadphase update.
Definition BroadPhase.h:44
Temporary data structure to pass information between AddBodiesPrepare and AddBodiesFinalize/Abort.
Definition QuadTree.h:207
Data to track location of a Body in the tree.
Definition QuadTree.h:156
Definition QuadTree.h:193