PxBroadPhase
Defined in include/PxBroadPhase.h
-
class PxBroadPhase
Low-level broadphase API.
This low-level API only supports batched updates and leaves most of the data management to its clients.
This is useful if you want to use the broadphase with your own memory buffers. Note however that the GPU broadphase works best with buffers allocated in CUDA memory. The getAllocator() function returns an allocator that is compatible with the selected broadphase. It is recommended to allocate and deallocate the broadphase data (bounds, groups, distances) using this allocator.
Important note: it must be safe to load 4 bytes past the end of the provided bounds array.
The high-level broadphase API (PxAABBManager) is an easier-to-use interface that automatically deals with these requirements.
See also
PxCreateBroadPhase
Public Functions
-
virtual void release() = 0
-
virtual PxBroadPhaseType::Enum getType() const = 0
Gets the broadphase type.
See also
PxBroadPhaseType::Enum
- Returns
Broadphase type.
-
virtual void getCaps(PxBroadPhaseCaps &caps) const = 0
Gets broad-phase caps.
See also
PxBroadPhaseCaps
- Parameters
caps – [out] Broad-phase caps
-
virtual PxBroadPhaseRegions *getRegions() = 0
Retrieves the regions API if applicable.
For broadphases that do not use explicit user-defined regions, this call returns NULL.
See also
PxBroadPhaseRegions
- Returns
Region API, or NULL.
-
virtual PxAllocatorCallback *getAllocator() = 0
Retrieves the broadphase allocator.
User-provided buffers should ideally be allocated with this allocator, for best performance. This is especially true for the GPU broadphases, whose buffers need to be allocated in CUDA host memory.
See also
PxAllocatorCallback
- Returns
The broadphase allocator.
-
virtual PxU64 getContextID() const = 0
Retrieves the profiler’s context ID.
See also
PxBroadPhaseDesc
- Returns
The context ID.
-
virtual void setScratchBlock(void *scratchBlock, PxU32 size) = 0
Sets a scratch buffer.
Some broadphases might take advantage of a scratch buffer to limit runtime allocations.
All broadphases still work without providing a scratch buffer, this is an optional function that can potentially reduce runtime allocations.
- Parameters
scratchBlock – [in] The scratch buffer
size – [in] Size of the scratch buffer in bytes
-
virtual void update(const PxBroadPhaseUpdateData &updateData, PxBaseTask *continuation = NULL) = 0
Updates the broadphase and computes the lists of created/deleted pairs.
The provided update data describes changes to objects since the last broadphase update.
To benefit from potentially multithreaded implementations, it is necessary to provide a continuation task to the function. It is legal to pass NULL there, but the underlying (CPU) implementations will then run single-threaded.
See also
PxBroadPhaseUpdateData PxBaseTask
- Parameters
updateData – [in] The update data
continuation – [in] Continuation task to enable multi-threaded implementations, or NULL.
-
virtual void fetchResults(PxBroadPhaseResults &results) = 0
Retrieves the broadphase results after an update.
This should be called once after each update call to retrieve the results of the broadphase. The results are incremental, i.e. the system only returns new and lost pairs, not all current pairs.
See also
PxBroadPhaseResults
- Parameters
results – [out] The broadphase results
-
inline void updateAndFetchResults(PxBroadPhaseResults &results, const PxBroadPhaseUpdateData &updateData)
Helper for single-threaded updates.
This short helper function performs a single-theaded update and reports the results in a single call.
See also
PxBroadPhaseUpdateData PxBroadPhaseResults
- Parameters
results – [out] The broadphase results
updateData – [in] The update data
-
inline void update(PxBroadPhaseResults &results, const PxBroadPhaseUpdateData &updateData)
Helper for single-threaded updates.
This short helper function performs a single-theaded update and reports the results in a single call.
See also
PxBroadPhaseUpdateData PxBroadPhaseResults
- Parameters
results – [out] The broadphase results
updateData – [in] The update data
-
virtual void release() = 0