|
RavEngine
|
#include <GuBVH.h>
Public Member Functions | |
| PX_PHYSX_COMMON_API | BVH (MeshFactory *factory) |
| PX_PHYSX_COMMON_API | BVH (MeshFactory *factory, BVHData &data) |
| PX_PHYSX_COMMON_API | BVH (const PxBVHInternalData &data) |
| PX_PHYSX_COMMON_API bool | init (PxU32 nbPrims, AABBTreeBounds *bounds, const void *boundsData, PxU32 stride, BVHBuildStrategy bs, PxU32 nbPrimsPerLeaf, float enlargement) |
| bool | load (PxInputStream &desc) |
| void | release () |
| Releases the PxBase instance, please check documentation of release in derived class. | |
| virtual bool | raycast (const PxVec3 &origin, const PxVec3 &unitDir, float distance, RaycastCallback &cb, PxGeometryQueryFlags flags) const |
| Raycast test against a BVH. | |
| virtual bool | overlap (const PxGeometry &geom, const PxTransform &pose, OverlapCallback &cb, PxGeometryQueryFlags flags) const |
| Overlap test against a BVH. | |
| virtual bool | sweep (const PxGeometry &geom, const PxTransform &pose, const PxVec3 &unitDir, float distance, RaycastCallback &cb, PxGeometryQueryFlags flags) const |
| Sweep test against a BVH. | |
| virtual bool | cull (PxU32 nbPlanes, const PxPlane *planes, OverlapCallback &cb, PxGeometryQueryFlags flags) const |
| Frustum culling test against a BVH. | |
| virtual PxU32 | raycast (const PxVec3 &origin, const PxVec3 &unitDir, PxReal maxDist, PxU32 maxHits, PxU32 *PX_RESTRICT rayHits) const |
| Raycast test against a BVH. | |
| virtual PxU32 | sweep (const PxBounds3 &aabb, const PxVec3 &unitDir, PxReal maxDist, PxU32 maxHits, PxU32 *PX_RESTRICT sweepHits) const |
| Sweep test against a BVH. | |
| virtual PxU32 | overlap (const PxBounds3 &aabb, PxU32 maxHits, PxU32 *PX_RESTRICT overlapHits) const |
| AABB overlap test against a BVH. | |
| virtual PxU32 | getNbBounds () const |
| Returns the number of bounds in the BVH. | |
| virtual const PxBounds3 * | getBounds () const |
| Retrieve the read-only bounds in the BVH. | |
| virtual void | refit () |
| Refit the BVH. | |
| virtual bool | updateBounds (PxU32 boundsIndex, const PxBounds3 &newBounds) |
| Update single bounds. | |
| virtual void | partialRefit () |
| Refits subset of marked nodes. | |
| virtual bool | traverse (TraversalCallback &cb) const |
| Generic BVH traversal function. | |
| virtual void | onRefCountZero () |
| PX_FORCE_INLINE const BVHNode * | getNodes () const |
| PX_FORCE_INLINE const PxU32 * | getIndices () const |
| PX_FORCE_INLINE const BVHData & | getData () const |
| bool | getInternalData (PxBVHInternalData &, bool) const |
| bool | updateBoundsInternal (PxU32 localIndex, const PxBounds3 &bounds) |
| bool | overlap (const ShapeData &shapeData, OverlapCallback &cb, PxGeometryQueryFlags flags) const |
| bool | sweep (const ShapeData &shapeData, const PxVec3 &unitDir, float distance, RaycastCallback &cb, PxGeometryQueryFlags flags) const |
Public Member Functions inherited from physx::PxBVH | |
| PX_FORCE_INLINE PxBounds3 * | getBoundsForModification () |
| Retrieve the bounds in the BVH. | |
| virtual const char * | getConcreteTypeName () const |
| Returns string name of dynamic type. | |
Public Member Functions inherited from physx::PxBase | |
| template<class T > | |
| T * | is () |
| template<class T > | |
| const T * | is () const |
| PX_FORCE_INLINE PxType | getConcreteType () const |
| Returns concrete type of object. | |
| PX_FORCE_INLINE void | setBaseFlag (PxBaseFlag::Enum flag, bool value) |
| Set PxBaseFlag | |
| PX_FORCE_INLINE void | setBaseFlags (PxBaseFlags inFlags) |
| Set PxBaseFlags | |
| PX_FORCE_INLINE PxBaseFlags | getBaseFlags () const |
| Returns PxBaseFlags. | |
| virtual bool | isReleasable () const |
| Whether the object is subordinate. | |
Public Member Functions inherited from physx::PxUserAllocated | |
| PX_INLINE void * | operator new (size_t, void *address) |
| PX_INLINE void | operator delete (void *, void *) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new (size_t size, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new[] (size_t size, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void * | operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void | operator delete (void *ptr, Alloc alloc, const char *fileName, int line) |
| template<typename Alloc > | |
| PX_INLINE void | operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line) |
| PX_INLINE void | operator delete (void *ptr) |
| PX_INLINE void | operator delete[] (void *ptr) |
Public Member Functions inherited from physx::Cm::RefCountable | |
| RefCountable (const PxEMPTY) | |
| void | preExportDataReset () |
| RefCountable (PxU32 initialCount=1) | |
| void | incRefCount () |
| void | decRefCount () |
| PX_FORCE_INLINE PxU32 | getRefCount () const |
Additional Inherited Members | |
Static Public Member Functions inherited from physx::Cm::RefCountable | |
| static void | getBinaryMetaData (PxOutputStream &stream) |
Protected Member Functions inherited from physx::PxBVH | |
| PX_INLINE | PxBVH (PxType concreteType, PxBaseFlags baseFlags) |
| PX_INLINE | PxBVH (PxBaseFlags baseFlags) |
| virtual bool | isKindOf (const char *name) const |
| Returns whether a given type name matches with the type of this instance. | |
Protected Member Functions inherited from physx::PxBase | |
| PX_INLINE | PxBase (PxType concreteType, PxBaseFlags baseFlags) |
| Constructor setting concrete type and base flags. | |
| PX_INLINE | PxBase (PxBaseFlags baseFlags) |
| Deserialization constructor setting base flags. | |
| virtual | ~PxBase () |
| Destructor. | |
| template<class T > | |
| bool | typeMatch () const |
Protected Attributes inherited from physx::PxBase | |
| PxType | mConcreteType |
| PxBaseFlags | mBaseFlags |
| PxU32 | mBuiltInRefCount |
Represents a BVH.
|
virtual |
Frustum culling test against a BVH.
This is similar in spirit to an overlap query using a convex object around the frustum. However this specialized query has better performance, and can support more than the 6 planes of a frustum, which can be useful in portal-based engines.
On the other hand this test only returns a conservative number of bounds, i.e. some of the returned bounds may actually be outside the frustum volume, close to it but not touching it. This is usually an ok performance trade-off when the function is used for view-frustum culling.
| [in] | nbPlanes | Number of planes. Only 32 planes max are supported. |
| [in] | planes | Array of planes, should be in the same space as the BVH. |
| [in] | cb | Overlap callback, called once per visible object |
| [in] | queryFlags | Optional flags controlling the query. |
Implements physx::PxBVH.
|
inlinevirtual |
Retrieve the read-only bounds in the BVH.
Implements physx::PxBVH.
|
inlinevirtual |
Returns the number of bounds in the BVH.
You can use getBounds() to retrieve the bounds.
Implements physx::PxBVH.
|
virtual |
Calls 'delete this;'. It needs to be overloaded for classes also deriving from PxBase and call 'Cm::deletePxBase(this);' instead.
Reimplemented from physx::Cm::RefCountable.
|
virtual |
AABB overlap test against a BVH.
| [in] | aabb | The axis aligned bounding box |
| [in] | maxHits | Max number of returned hits = size of 'overlapHits' buffer |
| [out] | overlapHits | Overlap hits information, bounds indices |
Implements physx::PxBVH.
|
virtual |
Overlap test against a BVH.
| [in] | geom | The query volume |
| [in] | pose | The pose of the query volume |
| [in] | cb | Overlap callback, called once per hit |
| [in] | queryFlags | Optional flags controlling the query. |
Implements physx::PxBVH.
|
virtual |
Refits subset of marked nodes.
This is an alternative to the refit() function, to be called after updateBounds() calls. See updateBounds() for details.
Implements physx::PxBVH.
|
virtual |
Raycast test against a BVH.
| [in] | origin | The origin of the ray. |
| [in] | unitDir | Normalized direction of the ray. |
| [in] | maxDist | Maximum ray length, has to be in the [0, inf) range |
| [in] | cb | Raycast callback, called once per hit |
| [in] | queryFlags | Optional flags controlling the query. |
Implements physx::PxBVH.
|
virtual |
Raycast test against a BVH.
| [in] | origin | The origin of the ray. |
| [in] | unitDir | Normalized direction of the ray. |
| [in] | maxDist | Maximum ray length, has to be in the [0, inf) range |
| [in] | maxHits | Max number of returned hits = size of 'rayHits' buffer |
| [out] | rayHits | Raycast hits information, bounds indices |
Implements physx::PxBVH.
|
virtual |
Refit the BVH.
This function "refits" the tree, i.e. takes the new (leaf) bounding boxes into account and recomputes all the BVH bounds accordingly. This is an O(n) operation with n = number of bounds in the BVH.
This works best with minor bounds modifications, i.e. when the bounds remain close to their initial values. With large modifications the tree quality degrades more and more, and subsequent query performance suffers. It might be a better strategy to create a brand new BVH if bounds change drastically.
This function refits the whole tree after an arbitrary number of bounds have potentially been modified by users (via getBoundsForModification()). If you only have a small number of bounds to update, it might be more efficient to use setBounds() and partialRefit() instead.
Implements physx::PxBVH.
|
virtual |
Releases the PxBase instance, please check documentation of release in derived class.
Implements physx::PxBase.
|
virtual |
Sweep test against a BVH.
| [in] | aabb | The axis aligned bounding box to sweep |
| [in] | unitDir | Normalized direction of the sweep. |
| [in] | maxDist | Maximum sweep length, has to be in the [0, inf) range |
| [in] | maxHits | Max number of returned hits = size of 'sweepHits' buffer |
| [out] | sweepHits | Sweep hits information, bounds indices |
Implements physx::PxBVH.
|
virtual |
Sweep test against a BVH.
| [in] | geom | The query volume |
| [in] | pose | The pose of the query volume |
| [in] | unitDir | Normalized direction of the sweep. |
| [in] | maxDist | Maximum sweep length, has to be in the [0, inf) range |
| [in] | cb | Raycast callback, called once per hit |
| [in] | queryFlags | Optional flags controlling the query. |
Implements physx::PxBVH.
|
virtual |
Generic BVH traversal function.
This can be used to implement custom BVH traversal functions if provided ones are not enough. In particular this can be used to visualize the tree's bounds.
| [in] | cb | Traversal callback, called for each visited node |
Implements physx::PxBVH.
|
virtual |
Update single bounds.
This is an alternative to getBoundsForModification() / refit(). If you only have a small set of bounds to update, it can be inefficient to call the refit() function, because it refits the whole BVH.
Instead, one can update individual bounds with this updateBounds() function. It sets the new bounds and marks the corresponding BVH nodes for partial refit. Once all the individual bounds have been updated, call partialRefit() to only refit the subset of marked nodes.
| [in] | boundsIndex | Index of updated bounds. Valid range is between 0 and getNbBounds(). |
| [in] | newBounds | Updated bounds. |
Implements physx::PxBVH.