#include <PxQueryReport.h>
Public Member Functions | |
PxHitCallback (HitType *aTouches, PxU32 aMaxNbTouches) | |
Initializes the class with user provided buffer. | |
virtual PxAgain | processTouches (const HitType *buffer, PxU32 nbHits)=0 |
virtual callback function used to communicate query results to the user. | |
virtual void | finalizeQuery () |
Query finalization callback, called after the last processTouches callback. | |
virtual | ~PxHitCallback () |
PX_FORCE_INLINE bool | hasAnyHits () |
Returns true if any blocking or touching hits were encountered during a query. | |
Public Attributes | |
HitType | block |
Holds the closest blocking hit result for the query. Invalid if hasBlock is false. | |
bool | hasBlock |
Set to true if there was a blocking hit during query. | |
HitType * | touches |
User specified buffer for touching hits. | |
PxU32 | maxNbTouches |
Size of the user specified touching hits buffer. | |
PxU32 | nbTouches |
Number of touching hits returned by the query. Used with PxHitBuffer. |
User overrides the virtual processTouches function to receive hits in (possibly multiple) fixed size blocks.
Since the compiler doesn't look in template dependent base classes when looking for non-dependent names
with some compilers it will be necessary to use "this->hasBlock" notation to access a parent variable
in a child callback class.
Pre-made typedef shorthands, such as PxRaycastCallback can be used for raycast, overlap and sweep queries.
PxHitCallback< HitType >::PxHitCallback | ( | HitType * | aTouches, | |
PxU32 | aMaxNbTouches | |||
) | [inline] |
Initializes the class with user provided buffer.
[in] | aTouches | Optional buffer for recording PxQueryHitType::eTOUCH type hits. |
[in] | aMaxNbTouches | Size of touch buffer. |
If PxQueryFlag::eANY_HIT flag is used as a query parameter, hasBlock will be set to true and blockingHit will be used to receive the result.
Both eTOUCH and eBLOCK hits will be registered as hasBlock=true and stored in PxHitCallback.block when eANY_HIT flag is used.
virtual PxHitCallback< HitType >::~PxHitCallback | ( | ) | [inline, virtual] |
virtual void PxHitCallback< HitType >::finalizeQuery | ( | ) | [inline, virtual] |
Query finalization callback, called after the last processTouches callback.
PX_FORCE_INLINE bool PxHitCallback< HitType >::hasAnyHits | ( | ) | [inline] |
Returns true if any blocking or touching hits were encountered during a query.
virtual PxAgain PxHitCallback< HitType >::processTouches | ( | const HitType * | buffer, | |
PxU32 | nbHits | |||
) | [pure virtual] |
virtual callback function used to communicate query results to the user.
This callback will always be invoked with touches as a buffer if touches was specified as non-NULL. All reported touch hits are guaranteed to be closer than the closest blocking hit.
[in] | buffer | Callback will report touch hits to the user in this buffer. This pointer will be the same as touches. |
[in] | nbHits | Number of touch hits reported in buffer. This number will not exceed maxNbTouches. |
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.
Implemented in PxHitBuffer< HitType >, PxHitBuffer< PxOverlapHit >, PxHitBuffer< PxRaycastHit >, and PxHitBuffer< PxSweepHit >.
HitType PxHitCallback< HitType >::block |
Holds the closest blocking hit result for the query. Invalid if hasBlock is false.
bool PxHitCallback< HitType >::hasBlock |
Set to true if there was a blocking hit during query.
PxU32 PxHitCallback< HitType >::maxNbTouches |
Size of the user specified touching hits buffer.
Hit type returned from pre-filter overrides this default
PxU32 PxHitCallback< HitType >::nbTouches |
Number of touching hits returned by the query. Used with PxHitBuffer.
HitType* PxHitCallback< HitType >::touches |
User specified buffer for touching hits.