PxBatchQueryDesc.h

Go to the documentation of this file.
00001 //
00002 // Redistribution and use in source and binary forms, with or without
00003 // modification, are permitted provided that the following conditions
00004 // are met:
00005 //  * Redistributions of source code must retain the above copyright
00006 //    notice, this list of conditions and the following disclaimer.
00007 //  * Redistributions in binary form must reproduce the above copyright
00008 //    notice, this list of conditions and the following disclaimer in the
00009 //    documentation and/or other materials provided with the distribution.
00010 //  * Neither the name of NVIDIA CORPORATION nor the names of its
00011 //    contributors may be used to endorse or promote products derived
00012 //    from this software without specific prior written permission.
00013 //
00014 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
00015 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017 // PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00018 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00021 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00022 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00024 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025 //
00026 // Copyright (c) 2008-2018 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-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com