PxQueryFiltering.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 
31 #ifndef PX_PHYSICS_NX_SCENE_QUERY_FILTERING
32 #define PX_PHYSICS_NX_SCENE_QUERY_FILTERING
33 
37 #include "PxPhysXConfig.h"
38 #include "PxFiltering.h"
39 #include "PxQueryReport.h"
40 #include "PxClient.h"
41 
42 #if !PX_DOXYGEN
43 namespace physx
44 {
45 #endif
46 
47 class PxShape;
48 class PxRigidActor;
49 struct PxQueryHit;
50 
51 
58 {
59  enum Enum
60  {
61  eSTATIC = (1<<0),
62 
63  eDYNAMIC = (1<<1),
64 
65  ePREFILTER = (1<<2),
66 
67  ePOSTFILTER = (1<<3),
68 
69  eANY_HIT = (1<<4),
70 
72  eNO_BLOCK = (1<<5),
73 
75  eRESERVED = (1<<15)
76  };
77 };
80 
86 PX_FLAGS_OPERATORS(PxQueryFlag::Enum,PxU16)
87 
88 
109 {
110  enum Enum
111  {
112  eNONE = 0,
113  eTOUCH = 1,
114  eBLOCK = 2
115  };
116 };
117 
133 {
135  explicit PX_INLINE PxQueryFilterData() : flags(PxQueryFlag::eDYNAMIC | PxQueryFlag::eSTATIC) {}
136 
138  explicit PX_INLINE PxQueryFilterData(const PxFilterData& fd, PxQueryFlags f) : data(fd), flags(f) {}
139 
142 
145 };
146 
170 {
171 public:
172 
182  virtual PxQueryHitType::Enum preFilter(
183  const PxFilterData& filterData, const PxShape* shape, const PxRigidActor* actor, PxHitFlags& queryFlags) = 0;
184 
192  virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit) = 0;
193 
198 };
199 
234  PxFilterData queryFilterData, PxFilterData objectFilterData,
235  const void* constantBlock, PxU32 constantBlockSize,
236  PxHitFlags& hitFlags);
237 
267  PxFilterData queryFilterData, PxFilterData objectFilterData,
268  const void* constantBlock, PxU32 constantBlockSize,
269  const PxQueryHit& hit);
270 
271 #if !PX_DOXYGEN
272 } // namespace physx
273 #endif
274 
276 #endif
Definition: GuContactBuffer.h:37
PX_INLINE PxQueryFilterData()
default constructor
Definition: PxQueryFiltering.h:135
Scene query filtering callbacks.
Definition: PxQueryFiltering.h:169
PxFilterData data
Filter data associated with the scene query.
Definition: PxQueryFiltering.h:143
PX_DEPRECATED PxQueryHitType::Enum(* PxBatchQueryPreFilterShader)(PxFilterData queryFilterData, PxFilterData objectFilterData, const void *constantBlock, PxU32 constantBlockSize, PxHitFlags &hitFlags)
Batched query pre-filter shader.
Definition: PxQueryFiltering.h:233
PxFilterData is user-definable data which gets passed into the collision filtering shader and/or call...
Definition: PxFiltering.h:366
Abstract class for collision shapes.
Definition: PxShape.h:142
Classification of scene query hits (intersections).
Definition: PxQueryFiltering.h:108
Scene query filtering data.
Definition: PxQueryFiltering.h:132
Enum
Definition: PxQueryFiltering.h:110
PxQueryFlags flags
Filter flags (see PxQueryFlags)
Definition: PxQueryFiltering.h:144
PX_INLINE PxQueryFilterData(const PxFilterData &fd, PxQueryFlags f)
constructor to set both filter data and filter flags
Definition: PxQueryFiltering.h:138
PX_COMPILE_TIME_ASSERT(PxQueryFlag::eSTATIC==(1<< 0))
PxFlags< PxQueryFlag::Enum, PxU16 > PxQueryFlags
Flags typedef for the set of bits defined in PxQueryFlag.
Definition: PxQueryFiltering.h:85
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition: PxRigidActor.h:58
#define PX_DEPRECATED
Definition: PxPreprocessor.h:424
Traverse static shapes.
Definition: PxQueryFiltering.h:61
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
Scene query hit information.
Definition: PxQueryReport.h:117
PX_INLINE PxQueryFilterData(PxQueryFlags f)
constructor to set filter flags only
Definition: PxQueryFiltering.h:141
Filtering flags for scene queries.
Definition: PxQueryFiltering.h:57
virtual ~PxQueryFilterCallback()
virtual destructor
Definition: PxQueryFiltering.h:197
Traverse dynamic shapes.
Definition: PxQueryFiltering.h:63
PX_DEPRECATED PxQueryHitType::Enum(* PxBatchQueryPostFilterShader)(PxFilterData queryFilterData, PxFilterData objectFilterData, const void *constantBlock, PxU32 constantBlockSize, const PxQueryHit &hit)
Batched query post-filter shader.
Definition: PxQueryFiltering.h:266
uint16_t PxU16
Definition: PxSimpleTypes.h:73
uint32_t PxU32
Definition: Px.h:48
Enum
Definition: PxQueryFiltering.h:59
#define PX_INLINE
Definition: PxPreprocessor.h:336