PxBatchQueryDesc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_PHYSICS_NX_SCENEQUERYDESC
15 #define PX_PHYSICS_NX_SCENEQUERYDESC
16 
19 #include "PxPhysXConfig.h"
20 #include "PxClient.h"
21 #include "PxFiltering.h"
22 #include "PxQueryFiltering.h"
23 #include "PxQueryReport.h"
24 
25 #ifndef PX_DOXYGEN
26 namespace physx
27 {
28 #endif
29 
30 struct PxSweepHit;
31 struct PxRaycastHit;
32 
34 {
35  enum Enum
36  {
40  ePENDING = 0,
41 
46 
50  eOVERFLOW
51  };
52 };
53 
57 template<typename HitType>
59 {
60  HitType block;
61  HitType* touches;
62 
64  void* userData;
66  bool hasBlock;
68 
70  PX_INLINE PxU32 getNbAnyHits() const { return nbTouches + (hasBlock ? 1 : 0); }
71 
73  PX_INLINE const HitType& getAnyHit(const PxU32 index) const { PX_ASSERT(index < nbTouches + (hasBlock ? 1 : 0));
74  return index < nbTouches ? touches[index] : block; }
75 };
76 
79 
82 
85 
92  {
102 
111 
121 
130 
140 
149 
152 
155 
158 
160  PX_FORCE_INLINE PxU32 getMaxRaycastsPerExecute() const { return raycastResultBufferSize; }
161 
163  PX_FORCE_INLINE PxU32 getMaxSweepsPerExecute() const { return sweepResultBufferSize; }
164 
166  PX_FORCE_INLINE PxU32 getMaxOverlapsPerExecute() const { return overlapResultBufferSize; }
167 
168  PxBatchQueryMemory(PxU32 raycastResultBufferSize_, PxU32 sweepResultBufferSize_, PxU32 overlapResultBufferSize_) :
169  userRaycastResultBuffer (NULL),
170  userRaycastTouchBuffer (NULL),
171  userSweepResultBuffer (NULL),
172  userSweepTouchBuffer (NULL),
173  userOverlapResultBuffer (NULL),
174  userOverlapTouchBuffer (NULL),
175  raycastTouchBufferSize (0),
176  sweepTouchBufferSize (0),
177  overlapTouchBufferSize (0),
178  raycastResultBufferSize (raycastResultBufferSize_),
179  sweepResultBufferSize (sweepResultBufferSize_),
180  overlapResultBufferSize (overlapResultBufferSize_)
181  {
182  }
183 
184 protected:
188 };
189 
193 #define PX_QUERY_SPU_SHADER_LIMIT 2048
194 
201 {
202 public:
203 
214 
223 
230 
237 
250 
263 
277 
290 
299 
306 
312  bool runOnSpu;
313 
326  PX_INLINE PxBatchQueryDesc(PxU32 maxRaycastsPerExecute, PxU32 maxSweepsPerExecute, PxU32 maxOverlapsPerExecute);
327  PX_INLINE bool isValid() const;
328 };
329 
330 
331 PX_INLINE PxBatchQueryDesc::PxBatchQueryDesc(PxU32 maxRaycastsPerExecute, PxU32 maxSweepsPerExecute, PxU32 maxOverlapsPerExecute) :
332  filterShaderData (NULL),
333  filterShaderDataSize (0),
334  preFilterShader (NULL),
335  postFilterShader (NULL),
336  spuPreFilterShader (NULL),
337  spuPreFilterShaderSize (0),
338  spuPostFilterShader (NULL),
339  spuPostFilterShaderSize (0),
340  ownerClient (PX_DEFAULT_CLIENT),
341  queryMemory (maxRaycastsPerExecute, maxSweepsPerExecute, maxOverlapsPerExecute),
342  runOnSpu (true)
343 {
344 }
345 
346 
348 {
349  if ( ((filterShaderDataSize == 0) && (filterShaderData != NULL)) ||
350  ((filterShaderDataSize > 0) && (filterShaderData == NULL)) )
351  return false;
352 
353 #if defined(PX_PS3)
354 
355  if ( ((spuPreFilterShaderSize == 0) && (spuPreFilterShader != NULL)) ||
359  return false;
360 
361  if ( ((spuPreFilterShader != NULL) && (preFilterShader == NULL)) ||
363  return false;
364 
367  return false;
368 
369 #endif
370 
371  return true;
372 }
373 
374 #ifndef PX_DOXYGEN
375 } // namespace physx
376 #endif
377 
379 #endif


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com