Public Member Functions | Protected Member Functions | List of all members
PxHitBuffer< HitType > Struct Template Reference

Returns scene query hits (intersections) to the user in a preallocated buffer. More...

#include <PxQueryReport.h>

Inheritance diagram for PxHitBuffer< HitType >:
Inheritance graph
[legend]
Collaboration diagram for PxHitBuffer< HitType >:
Collaboration graph
[legend]

Public Member Functions

 PxHitBuffer (HitType *aTouches=NULL, PxU32 aMaxNbTouches=0)
 Initializes the buffer with user memory. More...
 
PX_INLINE PxU32 getNbAnyHits () const
 Computes the number of any hits in this result, blocking or touching. More...
 
PX_INLINE const HitType & getAnyHit (const PxU32 index) const
 Convenience iterator used to access any hits in this result, blocking or touching. More...
 
PX_INLINE PxU32 getNbTouches () const
 
PX_INLINE const HitType * getTouches () const
 
PX_INLINE const HitType & getTouch (const PxU32 index) const
 
PX_INLINE PxU32 getMaxNbTouches () const
 
virtual ~PxHitBuffer ()
 
- Public Member Functions inherited from PxHitCallback< HitType >
 PxHitCallback (HitType *aTouches, PxU32 aMaxNbTouches)
 Initializes the class with user provided buffer. More...
 
virtual void finalizeQuery ()
 
virtual ~PxHitCallback ()
 
PX_FORCE_INLINE bool hasAnyHits ()
 Returns true if any blocking or touching hits were encountered during a query. More...
 

Protected Member Functions

virtual PxAgain processTouches (const HitType *buffer, PxU32 nbHits)
 virtual callback function used to communicate query results to the user. More...
 

Additional Inherited Members

- Public Attributes inherited from PxHitCallback< HitType >
HitType block
 
bool hasBlock
 
HitType * touches
 
PxU32 maxNbTouches
 Size of the user specified touching hits buffer. More...
 
PxU32 nbTouches
 Number of touching hits returned by the query. Used with PxHitBuffer. More...
 

Detailed Description

template<typename HitType>
struct PxHitBuffer< HitType >

Returns scene query hits (intersections) to the user in a preallocated buffer.

Will clip touch hits to maximum buffer capacity. When clipped, an arbitrary subset of touching hits will be discarded. Overflow does not trigger warnings or errors. block and hasBlock will be valid in finalizeQuery callback and after query completion. Touching hits are guaranteed to have closer or same distance ( <= condition) as the globally nearest blocking hit at the time any processTouches() callback is issued.

Note
Pre-made typedef shorthands, such as PxRaycastBuffer can be used for raycast, overlap and sweep queries.
See Also
PxHitCallback
PxRaycastBuffer PxOverlapBuffer PxSweepBuffer PxRaycastBufferN PxOverlapBufferN PxSweepBufferN

Constructor & Destructor Documentation

template<typename HitType>
PxHitBuffer< HitType >::PxHitBuffer ( HitType *  aTouches = NULL,
PxU32  aMaxNbTouches = 0 
)
inline

Initializes the buffer with user memory.

The buffer is initialized with 0 touch hits by default => query will only report a single closest blocking hit. Use PxQueryFlag::eANY_HIT to tell the query to abort and return any first hit encoutered as blocking.

Parameters
[in]aTouchesOptional buffer for recording PxQueryHitType::eTOUCH type hits.
[in]aMaxNbTouchesSize of touch buffer.
See Also
PxHitCallback
template<typename HitType>
virtual PxHitBuffer< HitType >::~PxHitBuffer ( )
inlinevirtual

Member Function Documentation

template<typename HitType>
PX_INLINE const HitType& PxHitBuffer< HitType >::getAnyHit ( const PxU32  index) const
inline

Convenience iterator used to access any hits in this result, blocking or touching.

template<typename HitType>
PX_INLINE PxU32 PxHitBuffer< HitType >::getMaxNbTouches ( ) const
inline
template<typename HitType>
PX_INLINE PxU32 PxHitBuffer< HitType >::getNbAnyHits ( ) const
inline

Computes the number of any hits in this result, blocking or touching.

template<typename HitType>
PX_INLINE PxU32 PxHitBuffer< HitType >::getNbTouches ( ) const
inline
template<typename HitType>
PX_INLINE const HitType& PxHitBuffer< HitType >::getTouch ( const PxU32  index) const
inline
template<typename HitType>
PX_INLINE const HitType* PxHitBuffer< HitType >::getTouches ( ) const
inline
template<typename HitType>
virtual PxAgain PxHitBuffer< HitType >::processTouches ( const HitType *  buffer,
PxU32  nbHits 
)
inlineprotectedvirtual

virtual callback function used to communicate query results to the user.

This callback will always be invoked with aTouches as a buffer if aTouches was specified as non-NULL. All reported touch hits are guaranteed to be closer than the closest blocking hit.

Parameters
[in]bufferCallback will report touch hits to the user in this buffer. This pointer will be the same as aTouches parameter.
[in]nbHitsNumber of touch hits reported in buffer. This number will not exceed aMaxNbTouches constructor parameter.
Note
There is a significant performance penalty in case multiple touch callbacks are issued (up to 2x)
to avoid the penalty use a bigger buffer so that all touching hits can be reported in a single buffer.
If true (again) is returned from the callback, nbTouches will be reset to 0,
If false is returned, nbTouched will remain unchanged.
By the time processTouches is first called, the globally closest blocking hit is already determined,
values of hasBlock and block are final and all touch hits are guaranteed to be closer than the blocking hit.
touches and maxNbTouches can be modified inside of processTouches callback.
Returns
true to continue receiving callbacks in case there are more hits or false to stop.
See Also
PxAgain PxRaycastHit PxSweepHit PxOverlapHit

Implements PxHitCallback< HitType >.


The documentation for this struct 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