29#ifndef SC_NPHASE_CORE_H
30#define SC_NPHASE_CORE_H
32#include "common/PxRenderOutput.h"
33#include "foundation/PxHash.h"
34#include "foundation/PxUserAllocated.h"
35#include "foundation/PxHashSet.h"
36#include "foundation/PxHashMap.h"
37#include "foundation/PxMutex.h"
38#include "foundation/PxAtomic.h"
39#include "PxPhysXConfig.h"
41#include "foundation/PxPool.h"
43#include "PxSimulationEventCallback.h"
44#include "ScTriggerPairs.h"
46#include "ScContactReportBuffer.h"
55 struct BroadPhasePair;
65 class ElementSimInteraction;
66 class ElementInteractionMarker;
67 class TriggerInteraction;
69 class ShapeInteraction;
71 class ActorPairReport;
73 class ActorPairContactReportData;
74 struct ContactShapePair;
77 class ContactStreamManager;
80 class FilterPairManager;
88 eRUN_LOST_TOUCH_LOGIC = (1 << 0),
89 eWAKE_ON_LOST_TOUCH = (1 << 1)
111 const PxU32 add0 = key.mSim0;
112 const PxU32 add1 = key.mSim1;
114 const PxU32 base = PxU32((add0 & 0xFFFF) | (add1 << 16));
116 return physx::PxComputeHash(base);
139 PxU32 add0 = (size_t(key.mSim0)) & 0xFFFFFFFF;
140 PxU32 add1 = (size_t(key.mSim1)) & 0xFFFFFFFF;
146 const PxU32 base = PxU32((add0 & 0xFFFF) | (add1 << 16));
148 return physx::PxComputeHash(base);
155 PxU32 mCurrentBufferIndex;
156 PxU32 mCurrentOffset;
159 const PxU32 mBuferBlockSize;
164 mCurrentOffset(0), mReportBuffer(buffer), mMutex(mutex), mBuferBlockSize(bufferBlockSize)
168 PxU8* allocate(
const PxU32 size, PxU32& index, PxU32 alignment = 16u)
171 PxU32 pad = ((mCurrentBufferIndex + alignment - 1)&~(alignment - 1)) - mCurrentBufferIndex;
172 PxU32 currOffset = mCurrentOffset + pad;
174 if ((currOffset + size) > mBufferSize)
176 const PxU32 allocSize =
PxMax(size, mBuferBlockSize);
179 mBuffer = mReportBuffer.allocateNotThreadSafe(allocSize, mCurrentBufferIndex, alignment);
180 mCurrentOffset = currOffset = 0;
181 mBufferSize = allocSize;
185 PxU8* ret = mBuffer + currOffset;
186 index = mCurrentBufferIndex + currOffset;
187 mCurrentOffset = currOffset + size;
203 PxU32& nbToKeep, PxU32& nbToSuppress, PxU32& nbToCallback, PxU32*
PX_RESTRICT keepMap, PxU32*
PX_RESTRICT callbackMap);
211 PxU32 getDefaultContactReportStreamBufferSize()
const;
215 void addToDirtyInteractionList(
Interaction* interaction);
216 void removeFromDirtyInteractionList(
Interaction* interaction);
222 void processTriggerInteractions(
PxBaseTask* continuation);
227 void mergeProcessedTriggerInteractions(
PxBaseTask* continuation);
242 void clearContactReportActorPairs(
bool shrinkToZero);
243 PX_FORCE_INLINE PxU32 getNbContactReportActorPairs()
const {
return mContactReportActorPairSet.size(); }
251 PX_FORCE_INLINE PxU32 getCurrentPersistentContactEventPairCount()
const {
return mNextFramePersistentContactEventPairIndex; }
253 PX_FORCE_INLINE PxU32 getAllPersistentContactEventPairCount()
const {
return mPersistentContactEventPairList.size(); }
261 PX_FORCE_INLINE PxU32 getForceThresholdContactEventPairCount()
const {
return mForceThresholdContactEventPairList.size(); }
264 PX_FORCE_INLINE PxU8* getContactReportPairData(
const PxU32& bufferIndex)
const {
return mContactReportBuffer.getData(bufferIndex); }
267 PX_FORCE_INLINE void clearContactReportStream() { mContactReportBuffer.reset(); }
268 PX_FORCE_INLINE void freeContactReportStreamMemory() { mContactReportBuffer.flush(); }
273 void reserveInteraction(PxU32 nbNewInteractions);
280 void lockReports() { mReportAllocLock.
lock(); }
281 void unlockReports() { mReportAllocLock.
unlock(); }
320 PxU32 mNextFramePersistentContactEventPairIndex;
346 void* mTmpTriggerProcessingBlock;
348 volatile PxI32 mTriggerPairsToDeactivateCount;
365 mFilterShader (scene.getFilterShaderFast()),
366 mFilterShaderData (scene.getFilterShaderDataFast()),
367 mFilterShaderDataSize (scene.getFilterShaderDataSizeFast()),
368 mFilterCallback (scene.getFilterCallbackFast()),
369 mFilterPairManager (filterPairManager),
370 mKineKineFilteringMode (scene.getKineKineFilteringMode()),
371 mStaticKineFilteringMode(scene.getStaticKineFilteringMode())
376 const void* mFilterShaderData;
377 PxU32 mFilterShaderDataSize;
391PX_FORCE_INLINE void Sc::NPhaseCore::preparePersistentContactEventListForNextFrame()
394 mNextFramePersistentContactEventPairIndex = mPersistentContactEventPairList.size();
Definition ScNPhaseCore.cpp:58
Base class of all task types.
Definition PxTask.h:45
Definition PxHashSet.h:100
Definition PxHashMap.h:78
PX_FORCE_INLINE void unlock() const
Definition PxMutex.h:149
PX_FORCE_INLINE void lock() const
Definition PxMutex.h:130
Definition PxRenderOutput.h:50
Descriptor class for scenes. See #PxScene.
Definition PxSceneDesc.h:426
Filter callback to specify handling of collision pairs.
Definition PxFiltering.h:633
Definition PxUserAllocated.h:43
Class shared by all shape interactions for a pair of actors if contact reports are requested.
Definition ScActorPair.h:110
Class shared by all shape interactions for a pair of actors.
Definition ScActorPair.h:69
Definition ScActorSim.h:83
Definition ScElementInteractionMarker.h:40
Definition ScElementSimInteraction.h:40
Definition ScElementSim.h:50
Definition ScInteraction.h:50
Definition ScNPhaseCore.h:193
Definition ScShapeInteraction.h:54
Definition ScShapeSimBase.h:54
Definition ScTriggerInteraction.h:41
#define PX_RESTRICT
Definition PxPreprocessor.h:355
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFilterFlags(* PxSimulationFilterShader)(PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, PxPairFlags &pairFlags, const void *constantBlock, PxU32 constantBlockSize)
Filter method to specify how a pair of potentially colliding objects should be processed.
Definition PxFiltering.h:604
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b)
The return value is the greater of the two specified values.
Definition PxMath.h:72
Changes to the configuration of overlap pairs are reported as void* pairs.
Definition BpAABBManagerBase.h:64
Enum
Definition PxFiltering.h:717
Definition ScNPhaseCore.h:102
Definition ScNPhaseCore.h:120
Definition ScNPhaseCore.h:361
Definition ScNPhaseCore.h:85