NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxVolumeCache Class Reference

NVIDIA PhysX SDK 3.4 API

PxVolumeCache Class Reference
[Physics]

Volumetric cache for local collision geometry. More...

#include <PxVolumeCache.h>

List of all members.


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 ()

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.

Deprecated:
The volume cache feature has been deprecated in PhysX version 3.4
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 (  )  [inline, protected, virtual]


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] cacheVolume Geometry of the cached volume (supported types are: sphere, box, capsule).
[in] pose Pose 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:
iter Iterator 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] 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.
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] 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.
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:
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.

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

Parameters:
[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.
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-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com