00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PX_PHYSICS_NX_SCENEQUERYDESC
00032 #define PX_PHYSICS_NX_SCENEQUERYDESC
00033
00036 #include "PxPhysXConfig.h"
00037 #include "PxClient.h"
00038 #include "PxFiltering.h"
00039 #include "PxQueryFiltering.h"
00040 #include "foundation/PxAssert.h"
00041
00042 #if !PX_DOXYGEN
00043 namespace physx
00044 {
00045 #endif
00046
00047 struct PxSweepHit;
00048 struct PxRaycastHit;
00049
00055 struct PX_DEPRECATED PxBatchQueryStatus
00056 {
00057 enum Enum
00058 {
00062 ePENDING = 0,
00063
00067 eSUCCESS,
00068
00072 eOVERFLOW
00073 };
00074 };
00075
00081 template<typename HitType>
00082 struct PX_DEPRECATED PxBatchQueryResult
00083 {
00084 HitType block;
00085 HitType* touches;
00086
00087 PxU32 nbTouches;
00088 void* userData;
00089 PxU8 queryStatus;
00090 bool hasBlock;
00091 PxU16 pad;
00092
00094 PX_INLINE PxU32 getNbAnyHits() const { return nbTouches + (hasBlock ? 1 : 0); }
00095
00097 PX_INLINE const HitType& getAnyHit(const PxU32 index) const { PX_ASSERT(index < nbTouches + (hasBlock ? 1 : 0));
00098 return index < nbTouches ? touches[index] : block; }
00099 };
00100
00102 typedef PX_DEPRECATED PxBatchQueryResult<PxRaycastHit> PxRaycastQueryResult;
00103
00105 typedef PX_DEPRECATED PxBatchQueryResult<PxSweepHit> PxSweepQueryResult;
00106
00108 typedef PX_DEPRECATED PxBatchQueryResult<PxOverlapHit> PxOverlapQueryResult;
00109
00117 struct PX_DEPRECATED PxBatchQueryMemory
00118 {
00126 PxRaycastQueryResult* userRaycastResultBuffer;
00127
00134 PxRaycastHit* userRaycastTouchBuffer;
00135
00143 PxSweepQueryResult* userSweepResultBuffer;
00144
00151 PxSweepHit* userSweepTouchBuffer;
00152
00160 PxOverlapQueryResult* userOverlapResultBuffer;
00161
00168 PxOverlapHit* userOverlapTouchBuffer;
00169
00171 PxU32 raycastTouchBufferSize;
00172
00174 PxU32 sweepTouchBufferSize;
00175
00177 PxU32 overlapTouchBufferSize;
00178
00180 PX_FORCE_INLINE PxU32 getMaxRaycastsPerExecute() const { return raycastResultBufferSize; }
00181
00183 PX_FORCE_INLINE PxU32 getMaxSweepsPerExecute() const { return sweepResultBufferSize; }
00184
00186 PX_FORCE_INLINE PxU32 getMaxOverlapsPerExecute() const { return overlapResultBufferSize; }
00187
00188 PxBatchQueryMemory(PxU32 raycastResultBufferSize_, PxU32 sweepResultBufferSize_, PxU32 overlapResultBufferSize_) :
00189 userRaycastResultBuffer (NULL),
00190 userRaycastTouchBuffer (NULL),
00191 userSweepResultBuffer (NULL),
00192 userSweepTouchBuffer (NULL),
00193 userOverlapResultBuffer (NULL),
00194 userOverlapTouchBuffer (NULL),
00195 raycastTouchBufferSize (0),
00196 sweepTouchBufferSize (0),
00197 overlapTouchBufferSize (0),
00198 raycastResultBufferSize (raycastResultBufferSize_),
00199 sweepResultBufferSize (sweepResultBufferSize_),
00200 overlapResultBufferSize (overlapResultBufferSize_)
00201 {
00202 }
00203
00204 protected:
00205 PxU32 raycastResultBufferSize;
00206 PxU32 sweepResultBufferSize;
00207 PxU32 overlapResultBufferSize;
00208 };
00209
00217 class PX_DEPRECATED PxBatchQueryDesc
00218 {
00219 public:
00220
00230 void* filterShaderData;
00231
00239 PxU32 filterShaderDataSize;
00240
00246 PxBatchQueryPreFilterShader preFilterShader;
00247
00253 PxBatchQueryPostFilterShader postFilterShader;
00254
00262 PX_DEPRECATED PxClientID ownerClient;
00263
00269 PxBatchQueryMemory queryMemory;
00270
00283 PX_INLINE PxBatchQueryDesc(PxU32 maxRaycastsPerExecute, PxU32 maxSweepsPerExecute, PxU32 maxOverlapsPerExecute);
00284 PX_INLINE bool isValid() const;
00285 };
00286
00287
00288 PX_INLINE PxBatchQueryDesc::PxBatchQueryDesc(PxU32 maxRaycastsPerExecute, PxU32 maxSweepsPerExecute, PxU32 maxOverlapsPerExecute) :
00289 filterShaderData (NULL),
00290 filterShaderDataSize (0),
00291 preFilterShader (NULL),
00292 postFilterShader (NULL),
00293 ownerClient (PX_DEFAULT_CLIENT),
00294 queryMemory (maxRaycastsPerExecute, maxSweepsPerExecute, maxOverlapsPerExecute)
00295 {
00296 }
00297
00298
00299 PX_INLINE bool PxBatchQueryDesc::isValid() const
00300 {
00301 if ( ((filterShaderDataSize == 0) && (filterShaderData != NULL)) ||
00302 ((filterShaderDataSize > 0) && (filterShaderData == NULL)) )
00303 return false;
00304
00305 return true;
00306 }
00307
00308 #if !PX_DOXYGEN
00309 }
00310 #endif
00311
00313 #endif