NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxBatchQueryDesc.h Source File

NVIDIA PhysX SDK 3.4 API

PxBatchQueryDesc.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
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 } // namespace physx
00310 #endif
00311 
00313 #endif


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