#include <PxVolumeCache.h>
Classes | |
struct | Iterator |
A callback wrapper class for use with PxVolumeCache::forEach function. More... | |
Public Types | |
enum | FillStatus { FILL_OK, FILL_OVER_MAX_COUNT, FILL_UNSUPPORTED_GEOMETRY_TYPE, FILL_OUT_OF_MEMORY } |
describes fill() return status. More... | |
Public Member Functions | |
virtual FillStatus | fill (const PxGeometry &cacheVolume, const PxTransform &pose)=0 |
Fills the cache with objects intersecting the specified cacheVolume. | |
virtual bool | isValid () const =0 |
Checks if the cache is valid (not over specified max capacity, for both statics and dynamics) and up-to-date. | |
virtual void | invalidate ()=0 |
Invalidates the cache. | |
virtual bool | getCacheVolume (PxGeometryHolder &resultVolume, PxTransform &resultPose)=0 |
Retrieves the last cached volume geometry. | |
virtual PxI32 | getNbCachedShapes ()=0 |
Returns the total number of cached shapes. | |
virtual void | release ()=0 |
Releases the cache object and its resources. | |
virtual void | forEach (Iterator &iter)=0 |
Iterates over the scene shapes overlapping with the cache volume. | |
virtual void | setMaxNbStaticShapes (PxU32 maxCount)=0 |
Sets the limit on the maximum number of static shapes allowed to be stored in the cache. | |
virtual void | setMaxNbDynamicShapes (PxU32 maxCount)=0 |
Sets the limit on the maximum number of dynamic shapes allowed to be stored in the cache. | |
virtual PxU32 | getMaxNbStaticShapes ()=0 |
Returns the current maximum number of static cached shapes. | |
virtual PxU32 | getMaxNbDynamicShapes ()=0 |
Returns the current maximum number of dynamic cached shapes. | |
virtual bool | raycast (const PxVec3 &origin, const PxVec3 &unitDir, const PxReal distance, PxRaycastCallback &hitCall, PxHitFlags hitFlags=PxHitFlags(PxHitFlag::eDEFAULT), const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL) const =0 |
Raycast against objects in the cache, returning results via PxRaycastCallback callback or PxRaycastBuffer object or a custom user callback implementation. | |
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 PxReal inflation=0.f) const =0 |
Sweep against objects in the cache, returning results via PxRaycastCallback callback or PxRaycastBuffer object or a custom user callback implementation. | |
virtual bool | overlap (const PxGeometry &geometry, const PxTransform &pose, PxOverlapCallback &hitCall, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL) const =0 |
Test overlap between a geometry and objects in the cache. | |
Protected Member Functions | |
virtual | ~PxVolumeCache () |
Provides a mechanism for caching objects within a specified volume and performing raycast, sweep, overlap and forEach queries on the cached objects.
describes fill() return status.
FILL_OK | Cache fill() operation was successful, the cache is valid and had enough capacity to store all the objects within the specified cacheVolume. |
FILL_OVER_MAX_COUNT |
Over specified cache capacity.
Cache fill() was over max count specified in PxScene.createVolumeCache() or setMaxNbStaticShapes() and setMaxNbDynamicShapes(). If this value is returned the cache will be in invalid state (no caching), but all the queries will still return correct results within the specified cache volume.
|
FILL_UNSUPPORTED_GEOMETRY_TYPE |
Unsupported geometry type.
The geometry type of cacheVolume parameter provided to fill() is not supported. Supported types are sphere, box, capsule. |
FILL_OUT_OF_MEMORY | Cache fill() ran out of temporary memory for intermediate results, try reducing the cache size. |
virtual PxVolumeCache::~PxVolumeCache | ( | ) | [inline, protected, virtual] |
virtual FillStatus PxVolumeCache::fill | ( | const PxGeometry & | cacheVolume, | |
const PxTransform & | pose | |||
) | [pure virtual] |
Fills the cache with objects intersecting the specified cacheVolume.
[in] | cacheVolume | Geometry of the cached volume (supported types are: sphere, box, capsule). |
[in] | pose | Pose of the cache volume. |
virtual void PxVolumeCache::forEach | ( | Iterator & | iter | ) | [pure virtual] |
Iterates over the scene shapes overlapping with the cache volume.
forEach will invoke PxVolumeCache::Iterator::processShapes virtual function, returning all overlapping shapes (possibly by issuing multiple callbacks) to the user. The size of reported blocks can change depending on internal SDK implementation. Any pointers to the contents of the buffer are only valid within the scope of a single processShapes() callback function. If forEach is invoked on an invalid cache (empty or out of date), this call will attempt to refill the cache within specified capacity. If the cache is over capacity, an attempt will be made to allocate a temp internal buffer, retrieve the results directly from the scene and return to the user via provided iterator. Results from forEach will be current for the last set cacheVolume provided in fill() even if the cache is invalid and refill fails. If the number of overlapping shapes is so high that the internal temporary allocation fails this call will produce an error and return.
virtual bool PxVolumeCache::getCacheVolume | ( | PxGeometryHolder & | resultVolume, | |
PxTransform & | resultPose | |||
) | [pure virtual] |
virtual PxU32 PxVolumeCache::getMaxNbDynamicShapes | ( | ) | [pure virtual] |
Returns the current maximum number of dynamic cached shapes.
virtual PxU32 PxVolumeCache::getMaxNbStaticShapes | ( | ) | [pure virtual] |
Returns the current maximum number of static cached shapes.
virtual PxI32 PxVolumeCache::getNbCachedShapes | ( | ) | [pure virtual] |
Returns the total number of cached shapes.
virtual void PxVolumeCache::invalidate | ( | ) | [pure virtual] |
Invalidates the cache.
Marks the cache as invalid. Subsequent query will attempt to refill the cache from the scene.
virtual bool PxVolumeCache::isValid | ( | ) | const [pure virtual] |
Checks if the cache is valid (not over specified max capacity, for both statics and dynamics) and up-to-date.
virtual bool PxVolumeCache::overlap | ( | const PxGeometry & | geometry, | |
const PxTransform & | pose, | |||
PxOverlapCallback & | hitCall, | |||
const PxQueryFilterData & | filterData = PxQueryFilterData() , |
|||
PxQueryFilterCallback * | filterCall = NULL | |||
) | const [pure virtual] |
Test overlap between a geometry and objects in the cache.
[in] | geometry | Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). |
[in] | pose | Pose of the object. |
[out] | hitCall | Overlap hit callback or hit buffer object. |
[in] | filterData | Filtering data and simple logic. |
[in] | filterCall | Custom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to overlap. |
virtual bool PxVolumeCache::raycast | ( | const PxVec3 & | origin, | |
const PxVec3 & | unitDir, | |||
const PxReal | distance, | |||
PxRaycastCallback & | hitCall, | |||
PxHitFlags | hitFlags = PxHitFlags(PxHitFlag::eDEFAULT) , |
|||
const PxQueryFilterData & | filterData = PxQueryFilterData() , |
|||
PxQueryFilterCallback * | filterCall = NULL | |||
) | const [pure virtual] |
Raycast against objects in the cache, returning results via PxRaycastCallback callback or PxRaycastBuffer object or a custom user callback implementation.
Returns whether any rigid actor is hit along the ray.
[in] | origin | Origin of the ray. |
[in] | unitDir | Normalized direction of the ray. |
[in] | distance | Length of the ray. Needs to be larger than 0. |
[out] | hitCall | Raycast hit callback or hit buffer object. |
[in] | hitFlags | Specifies which properties per hit should be computed and returned via the hit callback. |
[in] | filterData | Filtering data and simple logic. |
[in] | filterCall | Custom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. |
virtual void PxVolumeCache::release | ( | ) | [pure virtual] |
virtual void PxVolumeCache::setMaxNbDynamicShapes | ( | PxU32 | maxCount | ) | [pure virtual] |
Sets the limit on the maximum number of dynamic shapes allowed to be stored in the cache.
If the number of cached objects goes over this limit, the query functions (forEach/raycast/sweep/overlap) will fall back to scene queries.
maxCount | Maximum number of dynamic shapes cached. |
virtual void PxVolumeCache::setMaxNbStaticShapes | ( | PxU32 | maxCount | ) | [pure virtual] |
Sets the limit on the maximum number of static shapes allowed to be stored in the cache.
If the number of cached objects goes over this limit, the query functions (forEach/raycast/sweep/overlap) will fall back to scene queries.
maxCount | Maximum number of static shapes cached. |
virtual bool PxVolumeCache::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 PxReal | inflation = 0.f | |||
) | const [pure virtual] |
Sweep against objects in the cache, returning results via PxRaycastCallback callback or PxRaycastBuffer object or a custom user callback implementation.
Returns whether any rigid actor is hit along the sweep path.
[in] | geometry | Geometry of object to sweep (supported types are: box, sphere, capsule, convex). |
[in] | pose | Pose of the sweep object. |
[in] | unitDir | Normalized direction of the sweep. |
[in] | distance | Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. |
[out] | hitCall | Sweep hit callback or hit buffer object. |
[in] | hitFlags | Specifies which properties per hit should be computed and returned via the hit callback. |
[in] | filterData | Filtering data and simple logic. |
[in] | filterCall | Custom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. |
[in] | inflation | This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. |