RavEngine
Loading...
Searching...
No Matches
BpBroadPhaseMBP.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_MBP_H
30#define BP_BROADPHASE_MBP_H
31
32#include "BpBroadPhase.h"
33#include "BpBroadPhaseMBPCommon.h"
34#include "foundation/PxArray.h"
35
36namespace internalMBP
37{
38 class MBP;
39}
40
41namespace physx
42{
43namespace Bp
44{
46 {
47 PX_NOCOPY(BroadPhaseMBP)
48 public:
49 BroadPhaseMBP( PxU32 maxNbRegions,
50 PxU32 maxNbBroadPhaseOverlaps,
51 PxU32 maxNbStaticShapes,
52 PxU32 maxNbDynamicShapes,
53 PxU64 contextID);
54 virtual ~BroadPhaseMBP();
55
56 // BroadPhaseBase
57 virtual void getCaps(PxBroadPhaseCaps& caps) const;
58 virtual PxU32 getNbRegions() const;
59 virtual PxU32 getRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const;
60 virtual PxU32 addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const PxReal* contactDistance);
61 virtual bool removeRegion(PxU32 handle);
62 virtual PxU32 getNbOutOfBoundsObjects() const;
63 virtual const PxU32* getOutOfBoundsObjects() const;
64 //~BroadPhaseBase
65
66 // BroadPhase
67 virtual PxBroadPhaseType::Enum getType() const PX_OVERRIDE { return PxBroadPhaseType::eMBP; }
68 virtual void release() PX_OVERRIDE { PX_DELETE_THIS; }
69 virtual void update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, physx::PxBaseTask* continuation) PX_OVERRIDE;
72 virtual const BroadPhasePair* getCreatedPairs(PxU32&) const PX_OVERRIDE;
73 virtual const BroadPhasePair* getDeletedPairs(PxU32&) const PX_OVERRIDE;
74 virtual void freeBuffers() PX_OVERRIDE;
75 virtual void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances) PX_OVERRIDE;
76#if PX_CHECKED
77 virtual bool isValid(const BroadPhaseUpdateData& updateData) const PX_OVERRIDE;
78#endif
79 //~BroadPhase
80
81 internalMBP::MBP* mMBP; // PT: TODO: aggregate
82
83 MBP_Handle* mMapping;
84 PxU32 mCapacity;
87
88 const Bp::FilterGroup::Enum*mGroups;
89 const BpFilter* mFilter;
90
91 const PxU64 mContextID;
92
93 void setUpdateData(const BroadPhaseUpdateData& updateData);
94 void addObjects(const BroadPhaseUpdateData& updateData);
95 void removeObjects(const BroadPhaseUpdateData& updateData);
96 void updateObjects(const BroadPhaseUpdateData& updateData);
97
98 void update();
99 void postUpdate();
100 void allocateMappingArray(PxU32 newCapacity);
101
102 PxU32 getCurrentNbPairs() const;
103 };
104
105} //namespace Bp
106
107} //namespace physx
108
109#endif // BP_BROADPHASE_MBP_H
Definition BpBroadPhaseMBP.cpp:492
Definition BpFiltering.h:119
Definition BpBroadPhaseMBP.h:46
virtual void freeBuffers() PX_OVERRIDE
After the broadphase has completed its update() function and the created/deleted pairs have been quer...
Definition BpBroadPhaseMBP.cpp:3275
virtual void preBroadPhase(const Bp::BroadPhaseUpdateData &) PX_OVERRIDE
prepare broad phase data.
Definition BpBroadPhaseMBP.h:70
virtual void getCaps(PxBroadPhaseCaps &caps) const
Gets broad-phase caps.
Definition BpBroadPhaseMBP.cpp:2975
virtual void shiftOrigin(const PxVec3 &shift, const PxBounds3 *boundsArray, const PxReal *contactDistances) PX_OVERRIDE
Adjust internal structures after all bounds have been adjusted due to a scene origin shift.
Definition BpBroadPhaseMBP.cpp:3341
virtual void fetchBroadPhaseResults() PX_OVERRIDE
Fetch the results of any asynchronous broad phase work.
Definition BpBroadPhaseMBP.h:71
virtual const BroadPhasePair * getDeletedPairs(PxU32 &) const PX_OVERRIDE
Get deleted pairs.
Definition BpBroadPhaseMBP.cpp:3245
virtual void release() PX_OVERRIDE
Shutdown of the broadphase.
Definition BpBroadPhaseMBP.h:68
virtual bool removeRegion(PxU32 handle)
Removes a broad-phase region.
Definition BpBroadPhaseMBP.cpp:3034
virtual PxU32 getRegions(PxBroadPhaseRegionInfo *userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const
Gets broad-phase regions.
Definition BpBroadPhaseMBP.cpp:2996
virtual PxU32 addRegion(const PxBroadPhaseRegion &region, bool populateRegion, const PxBounds3 *boundsArray, const PxReal *contactDistance)
Adds a new broad-phase region.
Definition BpBroadPhaseMBP.cpp:3029
virtual PxU32 getNbRegions() const
Returns number of regions currently registered in the broad-phase.
Definition BpBroadPhaseMBP.cpp:2980
Definition BpBroadPhaseUpdate.h:47
Definition BpBroadPhase.h:99
Definition PxArray.h:53
Base class of all task types.
Definition PxTask.h:45
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
3 Element vector class.
Definition PxVec3.h:50
Definition PxcScratchAllocator.h:42
#define PX_OVERRIDE
Definition PxPreprocessor.h:375
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition BpBroadPhase.h:82
Caps class for broad phase.
Definition PxBroadPhase.h:131
Information & stats structure for a region.
Definition PxBroadPhase.h:119
"Region of interest" for the broad-phase.
Definition PxBroadPhase.h:110
Enum
Definition PxBroadPhase.h:79
@ eMBP
Multi box pruning.
Definition PxBroadPhase.h:81