|
RavEngine
|
A custom scene query system. More...
#include <PxCustomSceneQuerySystem.h>
Public Member Functions | |
| virtual PxU32 | addPruner (PxPruningStructureType::Enum primaryType, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxU32 preallocated=0)=0 |
| Adds a pruner to the system. | |
| virtual PxU32 | startCustomBuildstep ()=0 |
| Start custom build-steps for all pruners. | |
| virtual void | customBuildstep (PxU32 index)=0 |
| Perform a custom build-step for a given pruner. | |
| virtual void | finishCustomBuildstep ()=0 |
| Finish custom build-steps. | |
Public Member Functions inherited from physx::PxSceneQuerySystem | |
| virtual void | release ()=0 |
| Decrements the reference count of the object and releases it if the new reference count is zero. | |
| virtual void | acquireReference ()=0 |
| Acquires a counted reference to this object. | |
| virtual void | preallocate (PxU32 prunerIndex, PxU32 nbShapes)=0 |
| Preallocates internal arrays to minimize the amount of reallocations. | |
| virtual void | flushMemory ()=0 |
| Frees internal memory that may not be in-use anymore. | |
| virtual void | addSQShape (const PxRigidActor &actor, const PxShape &shape, const PxBounds3 &bounds, const PxTransform &transform, const PxSQCompoundHandle *compoundHandle=NULL, bool hasPruningStructure=false)=0 |
| Adds a shape to the SQ system. | |
| virtual void | removeSQShape (const PxRigidActor &actor, const PxShape &shape)=0 |
| Removes a shape from the SQ system. | |
| virtual void | updateSQShape (const PxRigidActor &actor, const PxShape &shape, const PxTransform &transform)=0 |
| Updates a shape in the SQ system. | |
| virtual PxSQCompoundHandle | addSQCompound (const PxRigidActor &actor, const PxShape **shapes, const PxBVH &bvh, const PxTransform *transforms)=0 |
| Adds a compound to the SQ system. | |
| virtual void | removeSQCompound (PxSQCompoundHandle compoundHandle)=0 |
| Removes a compound from the SQ system. | |
| virtual void | updateSQCompound (PxSQCompoundHandle compoundHandle, const PxTransform &compoundTransform)=0 |
| Updates a compound in the SQ system. | |
| virtual void | shiftOrigin (const PxVec3 &shift)=0 |
| Shift the data structures' origin by the specified vector. | |
| virtual void | visualize (PxU32 prunerIndex, PxRenderOutput &out) const =0 |
| Visualizes the system's internal data-structures, for debugging purposes. | |
| virtual void | merge (const PxPruningStructure &pruningStructure)=0 |
| Merges a pruning structure with the SQ system's internal pruners. | |
| virtual PxSQPrunerHandle | getHandle (const PxRigidActor &actor, const PxShape &shape, PxU32 &prunerIndex) const =0 |
| Shape to SQ-pruner-handle mapping function. | |
| virtual void | sync (PxU32 prunerIndex, const PxSQPrunerHandle *handles, const PxU32 *indices, const PxBounds3 *bounds, const PxTransform32 *transforms, PxU32 count, const PxBitMap &ignoredIndices)=0 |
| Synchronizes the scene-query system with another system that references the same objects. | |
| virtual void | finalizeUpdates ()=0 |
| Finalizes updates made to the SQ system. | |
| virtual PxSQBuildStepHandle | prepareSceneQueryBuildStep (PxU32 prunerIndex)=0 |
| Prepares asynchronous build step. | |
| virtual void | sceneQueryBuildStep (PxSQBuildStepHandle handle)=0 |
| Executes asynchronous build step. | |
Public Member Functions inherited from physx::PxSceneQuerySystemBase | |
| virtual void | setDynamicTreeRebuildRateHint (PxU32 dynamicTreeRebuildRateHint)=0 |
| Sets the rebuild rate of the dynamic tree pruning structures. | |
| virtual PxU32 | getDynamicTreeRebuildRateHint () const =0 |
| Retrieves the rebuild rate of the dynamic tree pruning structures. | |
| virtual void | forceRebuildDynamicTree (PxU32 prunerIndex)=0 |
| Forces dynamic trees to be immediately rebuilt. | |
| virtual void | setUpdateMode (PxSceneQueryUpdateMode::Enum updateMode)=0 |
| Sets scene query update mode. | |
| virtual PxSceneQueryUpdateMode::Enum | getUpdateMode () const =0 |
| Gets scene query update mode. | |
| virtual PxU32 | getStaticTimestamp () const =0 |
| Retrieves the system's internal scene query timestamp, increased each time a change to the static scene query structure is performed. | |
| virtual void | flushUpdates ()=0 |
| Flushes any changes to the scene query representation. | |
| virtual bool | raycast (const PxVec3 &origin, const PxVec3 &unitDir, const PxReal distance, PxRaycastCallback &hitCall, PxHitFlags hitFlags=PxHitFlag::eDEFAULT, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL, const PxQueryCache *cache=NULL, PxGeometryQueryFlags queryFlags=PxGeometryQueryFlag::eDEFAULT) const =0 |
| Performs a raycast against objects in the scene, returns results in a PxRaycastBuffer object or via a custom user callback implementation inheriting from PxRaycastCallback. | |
| virtual bool | sweep (const PxGeometry &geometry, const PxTransform &pose, const PxVec3 &unitDir, const PxReal distance, PxSweepCallback &hitCall, PxHitFlags hitFlags=PxHitFlag::eDEFAULT, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL, const PxQueryCache *cache=NULL, const PxReal inflation=0.0f, PxGeometryQueryFlags queryFlags=PxGeometryQueryFlag::eDEFAULT) const =0 |
| Performs a sweep test against objects in the scene, returns results in a PxSweepBuffer object or via a custom user callback implementation inheriting from PxSweepCallback. | |
| virtual bool | overlap (const PxGeometry &geometry, const PxTransform &pose, PxOverlapCallback &hitCall, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL, const PxQueryCache *cache=NULL, PxGeometryQueryFlags queryFlags=PxGeometryQueryFlag::eDEFAULT) const =0 |
| Performs an overlap test of a given geometry against objects in the scene, returns results in a PxOverlapBuffer object or via a custom user callback implementation inheriting from PxOverlapCallback. | |
A custom scene query system.
This is an example of a custom scene query system. It augments the PxSceneQuerySystem API to support an arbitrary number of "pruners", instead of the usual hardcoded two.
It might not be possible to support the whole PxSceneQuerySystem API in this context. See the source code for details.
|
pure virtual |
Adds a pruner to the system.
The internal PhysX scene-query system uses two regular pruners (one for static shapes, one for dynamic shapes) and an optional compound pruner. Our custom scene query system supports an arbitrary number of regular pruners.
This can be useful to reduce the load on each pruner, in particular during updates, when internal trees are rebuilt in the background. On the other hand this implementation simply iterates over all created pruners to perform queries, so their cost might increase if a large number of pruners is used.
In any case this serves as an example of how the PxSceneQuerySystem API can be used to customize scene queries.
| [in] | primaryType | Desired primary (main) type for the new pruner |
| [in] | secondaryType | Secondary type when primary type is PxPruningStructureType::eDYNAMIC_AABB_TREE. |
| [in] | preallocated | Optional number of preallocated shapes in the new pruner |
|
pure virtual |
Perform a custom build-step for a given pruner.
| [in] | index | Pruner index (should be between 0 and the number returned by startCustomBuildstep) |
|
pure virtual |
Finish custom build-steps.
Call this function once after all the customBuildstep() calls are done.
|
pure virtual |
Start custom build-steps for all pruners.
This function is used in combination with customBuildstep() and finishCustomBuildstep() to let users take control of the pruners' build-step & commit calls - basically the pruners' update functions. These functions should be used with the PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED update mode, otherwise the build-steps will happen automatically in fetchResults. For N pruners it can be more efficient to use these custom build-step functions to perform the updates in parallel:
The multi-threaded update is more efficient here than what it is in PxScene, because the "flushShapes()" call is also multi-threaded (while it is not in PxScene).
Note that users are responsible for locks here, and these calls should not overlap with other SQ calls. In particular one should not add new objects to the SQ system or perform queries while these calls are happening.