RavEngine
Loading...
Searching...
No Matches
BpBroadPhaseUpdate.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef BP_BROADPHASE_UPDATE_H
30#define BP_BROADPHASE_UPDATE_H
31
32#include "BpFiltering.h"
33#include "foundation/PxBounds3.h"
34#include "foundation/PxUnionCast.h"
35
36namespace physx
37{
38namespace Bp
39{
40typedef PxU32 ShapeHandle;
41typedef PxU32 BpHandle;
42#define BP_INVALID_BP_HANDLE 0x3fffffff
43
44class BroadPhase;
45
47{
48public:
49
91 const ShapeHandle* created, PxU32 createdSize,
92 const ShapeHandle* updated, PxU32 updatedSize,
93 const ShapeHandle* removed, PxU32 removedSize,
94 const PxBounds3* boxBounds, const Bp::FilterGroup::Enum* boxGroups, const PxReal* boxContactDistances, PxU32 boxesCapacity,
95 const BpFilter& filter,
96 bool stateChanged,
97 bool gpuStateChanged
98 ) :
99 mCreated (created),
100 mCreatedSize (createdSize),
101 mUpdated (updated),
102 mUpdatedSize (updatedSize),
103 mRemoved (removed),
104 mRemovedSize (removedSize),
105 mBoxBounds (boxBounds),
106 mBoxGroups (boxGroups),
107 mBoxDistances (boxContactDistances),
108 mBoxesCapacity (boxesCapacity),
109 mFilter (filter),
110 mStateChanged (stateChanged),
111 mGpuStateChanged(gpuStateChanged)
112 {
113 }
114
116 mCreated (other.mCreated),
117 mCreatedSize (other.mCreatedSize),
118 mUpdated (other.mUpdated),
119 mUpdatedSize (other.mUpdatedSize),
120 mRemoved (other.mRemoved),
121 mRemovedSize (other.mRemovedSize),
122 mBoxBounds (other.mBoxBounds),
123 mBoxGroups (other.mBoxGroups),
124 mBoxDistances (other.mBoxDistances),
125 mBoxesCapacity (other.mBoxesCapacity),
126 mFilter (other.mFilter),
127 mStateChanged (other.mStateChanged),
128 mGpuStateChanged(other.mGpuStateChanged)
129 {
130 }
131
132 BroadPhaseUpdateData& operator=(const BroadPhaseUpdateData& other);
133
134 PX_FORCE_INLINE const ShapeHandle* getCreatedHandles() const { return mCreated; }
135 PX_FORCE_INLINE PxU32 getNumCreatedHandles() const { return mCreatedSize; }
136
137 PX_FORCE_INLINE const ShapeHandle* getUpdatedHandles() const { return mUpdated; }
138 PX_FORCE_INLINE PxU32 getNumUpdatedHandles() const { return mUpdatedSize; }
139
140 PX_FORCE_INLINE const ShapeHandle* getRemovedHandles() const { return mRemoved; }
141 PX_FORCE_INLINE PxU32 getNumRemovedHandles() const { return mRemovedSize; }
142
143 PX_FORCE_INLINE const PxBounds3* getAABBs() const { return mBoxBounds; }
144 PX_FORCE_INLINE const Bp::FilterGroup::Enum* getGroups() const { return mBoxGroups; }
145 PX_FORCE_INLINE const PxReal* getContactDistance() const { return mBoxDistances; }
146 PX_FORCE_INLINE PxU32 getCapacity() const { return mBoxesCapacity; }
147
148 PX_FORCE_INLINE const BpFilter& getFilter() const { return mFilter; }
149
150 PX_FORCE_INLINE bool getStateChanged() const { return mStateChanged; }
151 PX_FORCE_INLINE bool getGpuStateChanged() const { return mGpuStateChanged; }
152
153#if PX_CHECKED
154 static bool isValid(const BroadPhaseUpdateData& updateData, const BroadPhase& bp, const bool skipBoundValidation, PxU64 contextID);
155 bool isValid(const bool skipBoundValidation) const;
156#endif
157
158private:
159
160 const ShapeHandle* mCreated;
161 const PxU32 mCreatedSize;
162
163 const ShapeHandle* mUpdated;
164 const PxU32 mUpdatedSize;
165
166 const ShapeHandle* mRemoved;
167 const PxU32 mRemovedSize;
168
169 const PxBounds3* mBoxBounds;
170 const Bp::FilterGroup::Enum* mBoxGroups;
171 const PxReal* mBoxDistances;
172 const PxU32 mBoxesCapacity;
173
174 const BpFilter& mFilter;
175
176 const bool mStateChanged;
177 const bool mGpuStateChanged;
178};
179
180} //namespace Bp
181
182} //namespace physx
183
184#endif
Definition BpFiltering.h:119
Definition BpBroadPhaseUpdate.h:47
BroadPhaseUpdateData(const ShapeHandle *created, PxU32 createdSize, const ShapeHandle *updated, PxU32 updatedSize, const ShapeHandle *removed, PxU32 removedSize, const PxBounds3 *boxBounds, const Bp::FilterGroup::Enum *boxGroups, const PxReal *boxContactDistances, PxU32 boxesCapacity, const BpFilter &filter, bool stateChanged, bool gpuStateChanged)
A structure detailing the changes to the collection of aabbs, whose overlaps are computed in the broa...
Definition BpBroadPhaseUpdate.h:90
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39