Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
PxVolumeCache Class Referenceabstract

Volumetric cache for local collision geometry. More...

#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. More...
 
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. More...
 
virtual void invalidate ()=0
 Invalidates the cache. More...
 
virtual bool getCacheVolume (PxGeometryHolder &resultVolume, PxTransform &resultPose)=0
 Retrieves the last cached volume geometry. More...
 
virtual PxI32 getNbCachedShapes ()=0
 Returns the total number of cached shapes. More...
 
virtual void release ()=0
 Releases the cache object and its resources. More...
 
virtual void forEach (Iterator &iter)=0
 Iterates over the scene shapes overlapping with the cache volume. More...
 
virtual void setMaxNbStaticShapes (PxU32 maxCount)=0
 Sets the limit on the maximum number of static shapes allowed to be stored in the cache. More...
 
virtual void setMaxNbDynamicShapes (PxU32 maxCount)=0
 Sets the limit on the maximum number of dynamic shapes allowed to be stored in the cache. More...
 
virtual PxU32 getMaxNbStaticShapes ()=0
 Returns the current maximum number of static cached shapes. More...
 
virtual PxU32 getMaxNbDynamicShapes ()=0
 Returns the current maximum number of dynamic cached shapes. More...
 
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. More...
 
virtual bool sweep (const PxGeometry &geometry, const PxTransform &pose, const PxVec3 &unitDir, const PxReal distance, PxSweepCallback &hitCall, PxHitFlags hitFlags=PxHitFlags(PxHitFlag::ePOSITION|PxHitFlag::eNORMAL|PxHitFlag::eDISTANCE), 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. More...
 
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. More...
 

Protected Member Functions

virtual ~PxVolumeCache ()
 

Detailed Description

Volumetric cache for local collision geometry.

Provides a mechanism for caching objects within a specified volume and performing raycast, sweep, overlap and forEach queries on the cached objects.

See Also
PxScene.createVolumeCache()

Member Enumeration Documentation

describes fill() return status.

See Also
PxVolumeCache.fill()
Enumerator
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.

See Also
PxScene.createVolumeCache() setMaxNbStaticShapes() setMaxNbDynamicShapes()
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.

Constructor & Destructor Documentation

virtual PxVolumeCache::~PxVolumeCache ( )
inlineprotectedvirtual

Member Function Documentation

virtual FillStatus PxVolumeCache::fill ( const PxGeometry cacheVolume,
const PxTransform pose 
)
pure virtual

Fills the cache with objects intersecting the specified cacheVolume.

Parameters
[in]cacheVolumeGeometry of the cached volume (supported types are: sphere, box, capsule).
[in]posePose of the cache volume.
Returns
a FillStatus enum.
See Also
PxVolumeCache.FillStatus
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.

Parameters
iterIterator callback. forEach() will invokes iter.shapes() function (possibly multiple times) to return blocks of actor+shape pairs overlapped with cacheVolume to the user.
virtual bool PxVolumeCache::getCacheVolume ( PxGeometryHolder resultVolume,
PxTransform resultPose 
)
pure virtual

Retrieves the last cached volume geometry.

Returns
False if the cache wasn't previously filled. True otherwise with cacheVolume from the last fill() call returned in resultVolume and corresponding transform in resultPose.
See Also
fill()
virtual PxU32 PxVolumeCache::getMaxNbDynamicShapes ( )
pure virtual

Returns the current maximum number of dynamic cached shapes.

Returns
The max number of cached dynamics.
virtual PxU32 PxVolumeCache::getMaxNbStaticShapes ( )
pure virtual

Returns the current maximum number of static cached shapes.

Returns
The max number of cached statics.
virtual PxI32 PxVolumeCache::getNbCachedShapes ( )
pure virtual

Returns the total number of cached shapes.

Returns
The number of shapes stored in the cache (statics+dynamics). Returns -1 if the cache is invalid.
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.

Returns
True if the cache is valid and up-to-date. Cache can become out-of-date if any statics or dynamics are moved or added or deleted from the scene.
See Also
PxVolumeCache.FillStatus
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.

Note
Filtering: Overlap tests do not distinguish between touching and blocking hit types (see PxQueryHitType). Both get written to the hit buffer.
Parameters
[in]geometryGeometry of object to check for overlap (supported types are: box, sphere, capsule, convex).
[in]posePose of the object.
[out]hitCallOverlap hit callback or hit buffer object.
[in]filterDataFiltering data and simple logic.
[in]filterCallCustom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to overlap.
Returns
True if a blocking hit was found or any hit was found in case PxQueryFlag::eANY_HIT flag was specified.
See Also
PxOverlapCallback PxOverlapBuffer PxQueryFilterData PxQueryFilterCallback
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.

Note
Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in user guide article SceneQuery. User can ignore such objects by employing one of the provided filter mechanisms.
Parameters
[in]originOrigin of the ray.
[in]unitDirNormalized direction of the ray.
[in]distanceLength of the ray. Needs to be larger than 0.
[out]hitCallRaycast hit callback or hit buffer object.
[in]hitFlagsSpecifies which properties per hit should be computed and returned via the hit callback.
[in]filterDataFiltering data and simple logic.
[in]filterCallCustom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking.
Returns
True if a blocking hit was found or any hit was found in case PxQueryFlag::eANY_HIT flag was used.
See Also
PxRaycastCallback PxRaycastBuffer PxQueryFilterData PxQueryFilterCallback PxQueryCache PxRaycastHit PxQueryFlag PxQueryFlag::eANY_HIT
virtual void PxVolumeCache::release ( )
pure virtual

Releases the cache object and its resources.

See Also
PxScene.createVolumeCache
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.

Parameters
maxCountMaximum 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.

Parameters
maxCountMaximum 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 = PxHitFlags(PxHitFlag::ePOSITION|PxHitFlag::eNORMAL|PxHitFlag::eDISTANCE),
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.

Parameters
[in]geometryGeometry of object to sweep (supported types are: box, sphere, capsule, convex).
[in]posePose of the sweep object.
[in]unitDirNormalized direction of the sweep.
[in]distanceSweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE.
[out]hitCallSweep hit callback or hit buffer object.
[in]hitFlagsSpecifies which properties per hit should be computed and returned via the hit callback.
[in]filterDataFiltering data and simple logic.
[in]filterCallCustom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking.
[in]inflationThis 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.
Returns
True if a blocking hit was found or any hit was found in case PxQueryFlag::eANY_HIT flag was specified.
See Also
PxSweepCallback PxSweepBuffer PxQueryFilterData PxQueryFilterCallback PxSweepHit PxQueryCache PxHitFlags

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


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com