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_SCP_SCENE
32#define PX_PHYSICS_SCP_SCENE
33
34#include "CmPhysXCommon.h"
35#include "PxPhysXConfig.h"
36#include "PxScene.h"
37#include "PxSceneDesc.h"
38#include "PxSimulationEventCallback.h"
39#include "PsPool.h"
40#include "PsHashSet.h"
41#include "CmRenderOutput.h"
42#include "CmTask.h"
43#include "CmFlushPool.h"
44#include "CmPreallocatingPool.h"
45#include "CmBitMap.h"
46#include "ScIterators.h"
47#include "PxsMaterialManager.h"
48#include "PxvManager.h"
49#include "ScBodyCore.h"
50#include "PxArticulationBase.h"
51
52#define PX_MAX_DOMINANCE_GROUP 32
53
54class OverlapFilterTask;
55
56namespace physx
57{
58
59// PT: TODO: move INVALID_FILTER_PAIR_INDEX out of public API
60struct PxFilterInfo
61{
62 PX_FORCE_INLINE PxFilterInfo() : filterFlags(0), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {}
63 PX_FORCE_INLINE PxFilterInfo(PxFilterFlags filterFlags_) : filterFlags(filterFlags_), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {}
64
65 PxFilterFlags filterFlags;
66 PxPairFlags pairFlags;
67 PxU32 filterPairIndex;
68};
69
70struct PxTriggerPair;
71
72class PxsContext;
73class PxsIslandManager;
74class PxsSimulationController;
75class PxsSimulationControllerCallback;
76class PxsMemoryManager;
77
78#if PX_SUPPORT_GPU_PHYSX
79class PxsKernelWranglerManager;
80class PxsHeapMemoryAllocatorManager;
81#endif
82
83namespace IG
84{
85 class SimpleIslandManager;
86}
87
88class PxsCCDContext;
89
90namespace Cm
91{
92 class IDPool;
93}
94
95namespace Bp
96{
97 class AABBManager;
98 class BroadPhase;
99 class BoundsArray;
100}
101
102namespace Sq
103{
104 typedef PxU32 PrunerHandle; // PT: we should get this from SqPruner.h but it cannot be included from here
105}
106
107namespace Dy
108{
109 class ArticulationV;
110 class Context;
111}
112
113namespace Sc
114{
115 class ActorSim;
116 class ElementSim;
117 class Interaction;
118
119 class ShapeCore;
120 class RigidCore;
121 class StaticCore;
122 class ConstraintCore;
123 class MaterialCore;
124 class ArticulationCore;
125 class ArticulationJointCore;
126 class LLArticulationPool;
127 class LLArticulationRCPool;
128 class BodyCore;
129
130 class NPhaseCore;
131 class Client;
132 class ConstraintInteraction;
133
134 class BodySim;
135 class ShapeSim;
136 class RigidSim;
137 class StaticSim;
138 class ConstraintSim;
139 struct ConstraintGroupNode;
140 class ConstraintProjectionManager;
141 struct TriggerPairExtraData;
142 class ObjectIDTracker;
143 class ActorPairReport;
144 class ContactStreamManager;
145 class SqBoundsManager;
146 class ShapeInteraction;
147 class ElementInteractionMarker;
148 class ArticulationSim;
149
150 class SimStats;
151
152 struct SimStateData;
153
154 struct BatchInsertionState
155 {
156 BodySim* bodySim;
157 StaticSim*staticSim;
158 ShapeSim* shapeSim;
159 ptrdiff_t staticActorOffset;
160 ptrdiff_t staticShapeTableOffset;
161 ptrdiff_t dynamicActorOffset;
162 ptrdiff_t dynamicShapeTableOffset;
163 ptrdiff_t shapeOffset;
164 };
165
166 struct BatchRemoveState
167 {
168 Ps::InlineArray<Sc::ShapeSim*, 64> bufferedShapes;
169 Ps::InlineArray<const Sc::ShapeCore*, 64> removedShapes;
170 };
171
172 struct InteractionType
173 {
174 enum Enum
175 {
176 eOVERLAP = 0, // corresponds to ShapeInteraction
177 eTRIGGER, // corresponds to TriggerInteraction
178 eMARKER, // corresponds to ElementInteractionMarker
179 eTRACKED_IN_SCENE_COUNT, // not a real type, interactions above this limit are tracked in the scene
180 eCONSTRAINTSHADER, // corresponds to ConstraintInteraction
181 eARTICULATION, // corresponds to ArticulationJointSim
182
183 eINVALID
184 };
185 };
186
187 struct SceneInternalFlag
188 {
189 enum Enum
190 {
191 eSCENE_SIP_STATES_DIRTY_DOMINANCE = (1<<1),
192 eSCENE_SIP_STATES_DIRTY_VISUALIZATION = (1<<2),
193 eSCENE_DEFAULT = 0
194 };
195 };
196
197 struct SimulationStage
198 {
199 enum Enum
200 {
201 eCOMPLETE,
202 eCOLLIDE,
203 eFETCHCOLLIDE,
204 eADVANCE,
205 eFETCHRESULT
206 };
207 };
208
209 // PT: TODO: revisit the need for a virtual interface
210 struct SqBoundsSync
211 {
212 virtual void sync(const Sq::PrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, PxU32 count, const Cm::BitMap& dirtyShapeSimMap) = 0;
213
214 virtual ~SqBoundsSync() {}
215 };
216
217 // PT: TODO: revisit the need for a virtual interface
218 struct SqRefFinder
219 {
220 virtual Sq::PrunerHandle find(const PxRigidBody* body, const PxShape* shape) = 0;
221
222 virtual ~SqRefFinder() {}
223 };
224
225 class Scene : public Ps::UserAllocated
226 {
227 struct SimpleBodyPair
228 {
229 BodySim* body1;
230 BodySim* body2;
231 PxU32 body1ID;
232 PxU32 body2ID;
233 };
234
235 PX_NOCOPY(Scene)
236
237 //---------------------------------------------------------------------------------
238 // External interface
239 //---------------------------------------------------------------------------------
240 public:
241
242 void release();
243
244 PX_FORCE_INLINE void setGravity(const PxVec3& g) { mGravity = g; mBodyGravityDirty = true; }
245 PX_FORCE_INLINE PxVec3 getGravity() const { return mGravity; }
246 PX_FORCE_INLINE void setElapsedTime(const PxReal t) { mDt = t; mOneOverDt = t > 0.0f ? 1.0f/t : 0.0f; }
247
248 void setBounceThresholdVelocity(const PxReal t);
249 PxReal getBounceThresholdVelocity() const;
250
251 PX_FORCE_INLINE void setPublicFlags(PxSceneFlags flags) { mPublicFlags = flags; }
252 PX_FORCE_INLINE PxSceneFlags getPublicFlags() const { return mPublicFlags; }
253
254 void setFrictionType(PxFrictionType::Enum model);
255 PxFrictionType::Enum getFrictionType() const;
256 void setPCM(bool enabled);
257 void setContactCache(bool enabled);
258
259 void addStatic(StaticCore&, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds);
260 void removeStatic(StaticCore&, Ps::InlineArray<const Sc::ShapeCore*,64>& removedShapes, bool wakeOnLostTouch);
261
262 void addBody(BodyCore&, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds, bool compound);
263 void removeBody(BodyCore&, Ps::InlineArray<const Sc::ShapeCore*,64>& removedShapes, bool wakeOnLostTouch);
264
265 // Batch insertion API.
266 // the bounds generated here are the uninflated bounds for the shapes, *if* they are trigger or sim shapes.
267 // It's up to the caller to ensure the bounds array is big enough.
268 // Some care is required in handling these since sim and SQ tweak the bounds in slightly different ways.
269
270 void startBatchInsertion(BatchInsertionState&);
271 void addStatic(PxActor* actor, BatchInsertionState&, PxBounds3* outBounds);
272 void addBody(PxActor* actor, BatchInsertionState&, PxBounds3* outBounds, bool compound);
273 void finishBatchInsertion(BatchInsertionState&);
274
275 // Batch remove helpers
276 PX_FORCE_INLINE void setBatchRemove(BatchRemoveState* bs) { mBatchRemoveState = bs; }
277 PX_FORCE_INLINE BatchRemoveState* getBatchRemove() const { return mBatchRemoveState; }
278 void prefetchForRemove(const BodyCore& ) const;
279 void prefetchForRemove(const StaticCore& ) const;
280
281 void addConstraint(ConstraintCore&, RigidCore*, RigidCore*);
282 void removeConstraint(ConstraintCore&);
283
284 void addArticulation(ArticulationCore&, BodyCore& root);
285 void removeArticulation(ArticulationCore&);
286
287 void addArticulationJoint(ArticulationJointCore&, BodyCore& parent, BodyCore& child);
288 void removeArticulationJoint(ArticulationJointCore&);
289
290 void addArticulationSimControl(Sc::ArticulationCore& core);
291 void removeArticulationSimControl(Sc::ArticulationCore& core);
292
293 PxU32 getNbArticulations() const;
294 Sc::ArticulationCore* const* getArticulations();
295
296 PxU32 getNbConstraints() const;
297 Sc::ConstraintCore*const * getConstraints();
298
299 void initContactsIterator(ContactIterator&, PxsContactManagerOutputIterator&);
300
301 // Simulation events
302 void setSimulationEventCallback(PxSimulationEventCallback* callback);
303 PxSimulationEventCallback* getSimulationEventCallback() const;
304
305 // Contact modification
306 void setContactModifyCallback(PxContactModifyCallback* callback);
307 PxContactModifyCallback* getContactModifyCallback() const;
308 void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback);
309 PxCCDContactModifyCallback* getCCDContactModifyCallback() const;
310
311 void setCCDMaxPasses(PxU32 ccdMaxPasses);
312 PxU32 getCCDMaxPasses() const;
313
314 // Broad-phase callback
315 PX_FORCE_INLINE void setBroadPhaseCallback(PxBroadPhaseCallback* callback) { mBroadPhaseCallback = callback; }
316 PX_FORCE_INLINE PxBroadPhaseCallback* getBroadPhaseCallback() const { return mBroadPhaseCallback; }
317
318 // Broad-phase management
319 void finishBroadPhase(PxBaseTask* continuation);
320 void finishBroadPhaseStage2(const PxU32 ccdPass);
321 void preallocateContactManagers(PxBaseTask* continuation);
322
323 void islandInsertion(PxBaseTask* continuation);
324 void registerContactManagers(PxBaseTask* continuation);
325 void registerInteractions(PxBaseTask* continuation);
326 void registerSceneInteractions(PxBaseTask* continuation);
327
328 void secondPassNarrowPhase(PxBaseTask* continuation);
329
330 // Groups
331 void setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance);
332 PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const;
333
334 void setSolverBatchSize(PxU32 solverBatchSize);
335 PxU32 getSolverBatchSize() const;
336
337 void setSolverArticBatchSize(PxU32 solverBatchSize);
338 PxU32 getSolverArticBatchSize() const;
339
340 void setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value);
341 PxReal getVisualizationParameter(PxVisualizationParameter::Enum param) const;
342
343 void setVisualizationCullingBox(const PxBounds3& box);
344 const PxBounds3& getVisualizationCullingBox() const;
345
346 // Run
347 void simulate(PxReal timeStep, PxBaseTask* continuation);
348 void advance(PxReal timeStep, PxBaseTask* continuation);
349 void collide(PxReal timeStep, PxBaseTask* continuation);
350 void endSimulation();
351 void flush(bool sendPendingReports);
352 void fireBrokenConstraintCallbacks();
353 void fireTriggerCallbacks();
354 void fireQueuedContactCallbacks(bool asPartOfFlush);
355 void fireOnAdvanceCallback();
356
357 const Ps::Array<PxContactPairHeader>&
358 getQueuedContactPairHeaders();
359
360 bool fireOutOfBoundsCallbacks();
361 void prepareOutOfBoundsCallbacks();
362 void postCallbacksPreSync();
363 void postReportsCleanup();
364 void fireCallbacksPostSync();
365 void syncSceneQueryBounds(SqBoundsSync& sync, SqRefFinder& finder);
366
367 PxU32 getDefaultContactReportStreamBufferSize() const;
368
369 PxReal getFrictionOffsetThreshold() const;
370
371 PX_FORCE_INLINE void setLimits(const PxSceneLimits& limits) { mLimits = limits; }
372 PX_FORCE_INLINE const PxSceneLimits& getLimits() const { return mLimits; }
373
374 void visualizeStartStep();
375 void visualizeEndStep();
376 Cm::RenderBuffer& getRenderBuffer();
377
378 void setNbContactDataBlocks(PxU32 blockCount);
379 PxU32 getNbContactDataBlocksUsed() const;
380 PxU32 getMaxNbContactDataBlocksUsed() const;
381 PxU32 getMaxNbConstraintDataBlocksUsed() const;
382
383 void setScratchBlock(void* addr, PxU32 size);
384
385// PX_ENABLE_SIM_STATS
386 void getStats(PxSimulationStatistics& stats) const;
387 PX_FORCE_INLINE SimStats& getStatsInternal() { return *mStats; }
388// PX_ENABLE_SIM_STATS
389
390 void buildActiveActors();
391 void buildActiveAndFrozenActors();
392 PxActor** getActiveActors(PxU32& nbActorsOut);
393 void setActiveActors(PxActor** actors, PxU32 nbActors);
394
395 PxActor** getFrozenActors(PxU32& nbActorsOut);
396
397 void finalizeContactStreamAndCreateHeader(PxContactPairHeader& header,
398 const ActorPairReport& aPair,
399 ContactStreamManager& cs, PxU32 removedShapeTestMask);
400
401 PxClientID createClient();
402 PX_FORCE_INLINE PxU32 getNbClients() const { return mClients.size(); }
403
404 PxTaskManager* getTaskManagerPtr() const { return mTaskManager; }
405 PxCudaContextManager* getCudaContextManager() const { return mCudaContextManager; }
406
407 void shiftOrigin(const PxVec3& shift);
408
409 PX_FORCE_INLINE Ps::Pool<SimStateData>* getSimStateDataPool() { return mSimStateDataPool; }
410
411 //---------------------------------------------------------------------------------
412 // Miscellaneous
413 //---------------------------------------------------------------------------------
414 //internal public methods:
415 public:
416 Scene(const PxSceneDesc& desc, PxU64 contextID);
417 ~Scene() {} //use release() plz.
418
419 void preAllocate(PxU32 nbStatics, PxU32 nbBodies, PxU32 nbStaticShapes, PxU32 nbDynamicShapes);
420
421 PX_FORCE_INLINE PxsContext* getLowLevelContext() { return mLLContext; }
422 PX_FORCE_INLINE const PxsContext* getLowLevelContext() const { return mLLContext; }
423
424 PX_FORCE_INLINE Dy::Context* getDynamicsContext() { return mDynamicsContext; }
425 PX_FORCE_INLINE const Dy::Context* getDynamicsContext() const { return mDynamicsContext; }
426
427 PX_FORCE_INLINE PxsSimulationController* getSimulationController() { return mSimulationController; }
428 PX_FORCE_INLINE const PxsSimulationController* getSimulationController() const { return mSimulationController; }
429
430 PX_FORCE_INLINE Bp::AABBManager* getAABBManager() { return mAABBManager; }
431 PX_FORCE_INLINE const Bp::AABBManager* getAABBManager() const { return mAABBManager; }
432 PX_FORCE_INLINE Ps::Array<BodySim*>& getCcdBodies() { return mCcdBodies; }
433
434 /*PX_FORCE_INLINE PxsIslandManager* getIslandManager() { return mIslandManager; }
435 PX_FORCE_INLINE const PxsIslandManager* getIslandManager() const { return mIslandManager; }*/
436
437 PX_FORCE_INLINE IG::SimpleIslandManager* getSimpleIslandManager() { return mSimpleIslandManager; }
438 PX_FORCE_INLINE const IG::SimpleIslandManager* getSimpleIslandManager() const { return mSimpleIslandManager; }
439
440 PX_FORCE_INLINE Sc::SimulationStage::Enum getSimulationStage() const { return mSimulationStage; }
441 PX_FORCE_INLINE void setSimulationStage(Sc::SimulationStage::Enum stage) { mSimulationStage = stage; }
442
443 void addShape_(RigidSim&, ShapeCore&);
444 void removeShape_(ShapeSim&, bool wakeOnLostTouch);
445
446 void registerShapeInNphase(const ShapeCore& shapeCore);
447 void unregisterShapeFromNphase(const ShapeCore& shapeCore);
448
449 void notifyNphaseOnUpdateShapeMaterial(const ShapeCore& shapeCore);
450
451 // Get an array of the active actors.
452 PX_FORCE_INLINE BodyCore*const* getActiveBodiesArray() const { return mActiveBodies.begin(); }
453 PX_FORCE_INLINE PxU32 getNumActiveBodies() const { return mActiveBodies.size(); }
454
455 PX_FORCE_INLINE BodyCore*const* getActiveCompoundBodiesArray() const { return mActiveCompoundBodies.begin(); }
456 PX_FORCE_INLINE PxU32 getNumActiveCompoundBodies() const { return mActiveCompoundBodies.size(); }
457
458 PX_FORCE_INLINE PxU32 getNbInteractions(InteractionType::Enum type) const { return mInteractions[type].size(); }
459 PX_FORCE_INLINE PxU32 getNbActiveInteractions(InteractionType::Enum type) const { return mActiveInteractionCount[type]; }
460 // Get all interactions of a certain type
461 PX_FORCE_INLINE Interaction** getInteractions(InteractionType::Enum type) { return mInteractions[type].begin(); }
462 PX_FORCE_INLINE Interaction** getActiveInteractions(InteractionType::Enum type) { return mInteractions[type].begin(); }
463
464 void registerInteraction(Interaction* interaction, bool active);
465 void unregisterInteraction(Interaction* interaction);
466
467 void notifyInteractionActivated(Interaction* interaction);
468 void notifyInteractionDeactivated(Interaction* interaction);
469
470 // for pool management of interaction arrays, a major cause of dynamic allocation
471 void** allocatePointerBlock(PxU32 size);
472 void deallocatePointerBlock(void**, PxU32 size);
473 private:
474 // Get the number of active one-way dominator actors
475 PX_FORCE_INLINE PxU32 getActiveKinematicBodiesCount() const { return mActiveKinematicBodyCount; }
476
477 // Get an iterator to the active one-way dominator actors
478 PX_FORCE_INLINE BodyCore*const* getActiveKinematicBodies() const { return mActiveBodies.begin(); }
479
480 // Get the number of active non-kinematic actors
481 PX_FORCE_INLINE PxU32 getActiveDynamicBodiesCount() const { return mActiveBodies.size() - mActiveKinematicBodyCount; }
482
483 // Get the active non-kinematic actors
484 PX_FORCE_INLINE BodyCore*const* getActiveDynamicBodies() const { return mActiveBodies.begin() + mActiveKinematicBodyCount; }
485
486 void swapInteractionArrayIndices(PxU32 id1, PxU32 id2, InteractionType::Enum type);
487 public:
488
489 PX_FORCE_INLINE Cm::BitMap& getDirtyShapeSimMap() { return mDirtyShapeSimMap; }
490
491 void addToActiveBodyList(BodySim& actor);
492 void addToActiveCompoundBodyList(BodySim& actor);
493 void removeFromActiveBodyList(BodySim& actor);
494 void removeFromActiveCompoundBodyList(BodySim& actor);
495 void swapInActiveBodyList(BodySim& body); // call when an active body gets switched from dynamic to kinematic or vice versa
496
497 void addToFrozenBodyList(BodySim& actor);
498 void removeFromFrozenBodyList(BodySim& actor);
499 void addBrokenConstraint(Sc::ConstraintCore*);
500 void addActiveBreakableConstraint(Sc::ConstraintSim*, ConstraintInteraction*);
501 void removeActiveBreakableConstraint(Sc::ConstraintSim*);
502 //the Actor should register its top level shapes with these.
503 void removeBody(BodySim&);
504
505 void raiseSceneFlag(SceneInternalFlag::Enum flag) { mInternalFlags |= flag; }
506
507 //lists of actors woken up or put to sleep last simulate
508 void onBodyWakeUp(BodySim* body);
509 void onBodySleep(BodySim* body);
510
511 PX_FORCE_INLINE bool isValid() const { return (mLLContext != NULL); }
512
513 void addToLostTouchList(BodySim* body1, BodySim* body2);
514
515 void initDominanceMatrix();
516
517 void setCreateContactReports(bool s);
518
519 PxU32 createAggregate(void* userData, bool selfCollisions);
520 void deleteAggregate(PxU32 id);
521
522 Dy::ArticulationV* createLLArticulation(Sc::ArticulationSim* sim);
523 void destroyLLArticulation(Dy::ArticulationV&);
524
525
526 Ps::Pool<ConstraintInteraction>*
527 getConstraintInteractionPool() const { return mConstraintInteractionPool; }
528 public:
529 PxBroadPhaseType::Enum getBroadPhaseType() const;
530 bool getBroadPhaseCaps(PxBroadPhaseCaps& caps) const;
531 PxU32 getNbBroadPhaseRegions() const;
532 PxU32 getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex) const;
533 PxU32 addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion);
534 bool removeBroadPhaseRegion(PxU32 handle);
535 void** getOutOfBoundsAggregates();
536 PxU32 getNbOutOfBoundsAggregates();
537 void clearOutOfBoundsAggregates();
538
539 PX_FORCE_INLINE const PxsMaterialManager& getMaterialManager() const { return mMaterialManager; }
540 PX_FORCE_INLINE PxsMaterialManager& getMaterialManager() { return mMaterialManager; }
541
542 //material management functions to be called from Scb::Scene
543 void registerMaterialInNP(const PxsMaterialCore& materialCore);
544 void updateMaterialInNP(const PxsMaterialCore& materialCore);
545 void unregisterMaterialInNP(const PxsMaterialCore& materialCore);
546
547 // Collision filtering
548 void setFilterShaderData(const void* data, PxU32 dataSize);
549 PX_FORCE_INLINE const void* getFilterShaderDataFast() const { return mFilterShaderData; }
550 PX_FORCE_INLINE PxU32 getFilterShaderDataSizeFast() const { return mFilterShaderDataSize; }
551 PX_FORCE_INLINE PxSimulationFilterShader getFilterShaderFast() const { return mFilterShader; }
552 PX_FORCE_INLINE PxSimulationFilterCallback* getFilterCallbackFast() const { return mFilterCallback; }
553 PX_FORCE_INLINE PxPairFilteringMode::Enum getKineKineFilteringMode() const { return mKineKineFilteringMode; }
554 PX_FORCE_INLINE PxPairFilteringMode::Enum getStaticKineFilteringMode() const { return mStaticKineFilteringMode; }
555
556 PX_FORCE_INLINE PxU32 getTimeStamp() const { return mTimeStamp; }
557 PX_FORCE_INLINE PxU32 getReportShapePairTimeStamp() const { return mReportShapePairTimeStamp; }
558
559 PX_FORCE_INLINE PxReal getOneOverDt() const { return mOneOverDt; }
560 PX_FORCE_INLINE PxReal getDt() const { return mDt; }
561
562 PX_FORCE_INLINE const PxVec3& getGravityFast() const { return mGravity; }
563 PX_FORCE_INLINE bool readFlag(SceneInternalFlag::Enum flag) const { return (mInternalFlags & flag) != 0; }
564 PX_FORCE_INLINE bool readPublicFlag(PxSceneFlag::Enum flag) const { return (mPublicFlags & flag); }
565
566 PX_FORCE_INLINE NPhaseCore* getNPhaseCore() const { return mNPhaseCore; }
567
568 void checkConstraintBreakage();
569
570 PX_FORCE_INLINE Ps::Array<TriggerPairExtraData>&
571 getTriggerBufferExtraData() { return *mTriggerBufferExtraData; }
572 PX_FORCE_INLINE Ps::Array<PxTriggerPair>& getTriggerBufferAPI() { return mTriggerBufferAPI; }
573 void reserveTriggerReportBufferSpace(const PxU32 pairCount, PxTriggerPair*& triggerPairBuffer, TriggerPairExtraData*& triggerPairExtraBuffer);
574
575 PX_FORCE_INLINE ObjectIDTracker& getRigidIDTracker() { return *mRigidIDTracker; }
576 PX_FORCE_INLINE ObjectIDTracker& getShapeIDTracker() { return *mShapeIDTracker; }
577
578 PX_FORCE_INLINE void markReleasedBodyIDForLostTouch(PxU32 id) { mLostTouchPairsDeletedBodyIDs.growAndSet(index: id); }
579 void resizeReleasedBodyIDMaps(PxU32 maxActors, PxU32 numActors);
580
581 PX_FORCE_INLINE StaticSim& getStaticAnchor() { return *mStaticAnchor; }
582
583 PX_FORCE_INLINE ConstraintProjectionManager& getProjectionManager() { return *mProjectionManager; }
584
585 PX_FORCE_INLINE Bp::BoundsArray& getBoundsArray() const { return *mBoundsArray; }
586 PX_FORCE_INLINE void updateContactDistance(PxU32 idx, PxReal distance) { (*mContactDistance)[idx] = distance; mHasContactDistanceChanged = true; }
587 PX_FORCE_INLINE SqBoundsManager& getSqBoundsManager() const { return *mSqBoundsManager; }
588
589 PX_FORCE_INLINE PxReal getVisualizationScale() const { return mVisualizationScale; } // This is actually redundant but makes checks whether debug visualization is enabled faster
590
591 PX_FORCE_INLINE BodyCore* const* getSleepBodiesArray(PxU32& count) { count = mSleepBodies.size(); return mSleepBodies.getEntries(); }
592
593 PX_FORCE_INLINE PxTaskManager& getTaskManager() const { PX_ASSERT(mTaskManager); return *mTaskManager; }
594
595 Cm::FlushPool* getFlushPool();
596
597 PX_FORCE_INLINE bool getStabilizationEnabled() const { return mEnableStabilization; }
598
599 PX_FORCE_INLINE void setPostSolverVelocityNeeded() { mContactReportsNeedPostSolverVelocity = true; }
600
601 ObjectIDTracker& getConstraintIDTracker() { return *mConstraintIDTracker; }
602
603
604 void* allocateConstraintBlock(PxU32 size);
605 void deallocateConstraintBlock(void* addr, PxU32 size);
606
607 PX_INLINE ObjectIDTracker& getElementIDPool() { return *mElementIDPool; }
608
609 PX_FORCE_INLINE Cm::BitMap& getVelocityModifyMap() { return mVelocityModifyMap; }
610
611 void stepSetupCollide(PxBaseTask* continuation);//This is very important to guarantee thread safty in the collide
612 PX_FORCE_INLINE void addToPosePreviewList(BodySim& b) { PX_ASSERT(!mPosePreviewBodies.contains(&b)); mPosePreviewBodies.insert(k: &b); }
613 PX_FORCE_INLINE void removeFromPosePreviewList(BodySim& b) { PX_ASSERT(mPosePreviewBodies.contains(&b)); mPosePreviewBodies.erase(k: &b); }
614#if PX_DEBUG
615 PX_FORCE_INLINE bool isInPosePreviewList(BodySim& b) const { return mPosePreviewBodies.contains(&b); }
616#endif
617
618 PX_FORCE_INLINE void setSpeculativeCCDRigidBody(const PxU32 index) { mSpeculativeCCDRigidBodyBitMap.growAndSet(index); }
619 PX_FORCE_INLINE void resetSpeculativeCCDRigidBody(const PxU32 index) { if(index < mSpeculativeCCDRigidBodyBitMap.size()) mSpeculativeCCDRigidBodyBitMap.reset(index); }
620
621 PX_FORCE_INLINE void setSpeculativeCCDArticulationLink(const PxU32 index) { mSpeculativeCDDArticulationBitMap.growAndSet(index); }
622 PX_FORCE_INLINE void resetSpeculativeCCDArticulationLink(const PxU32 index) { if(index < mSpeculativeCDDArticulationBitMap.size()) mSpeculativeCDDArticulationBitMap.reset(index); }
623
624 PX_FORCE_INLINE PxU64 getContextId() const { return mContextId; }
625 PX_FORCE_INLINE bool isUsingGpuRigidBodies() const { return mUseGpuRigidBodies; }
626
627 // statistics counters increase/decrease
628 PX_FORCE_INLINE void increaseNumKinematicsCounter() { mNbRigidKinematic++; }
629 PX_FORCE_INLINE void decreaseNumKinematicsCounter() { mNbRigidKinematic--; }
630 PX_FORCE_INLINE void increaseNumDynamicsCounter() { mNbRigidDynamics++; }
631 PX_FORCE_INLINE void decreaseNumDynamicsCounter() { mNbRigidDynamics--; }
632
633 //internal private methods:
634 private:
635 void releaseConstraints(bool endOfScene);
636 PX_INLINE void clearBrokenConstraintBuffer();
637
638 /////////////////////////////////////////////////////////////
639
640 void prepareCollide();
641
642 void collideStep(PxBaseTask* continuation);
643 void advanceStep(PxBaseTask* continuation);
644
645 // subroutines of collideStep/solveStep:
646 void kinematicsSetup(PxBaseTask* continuation);
647 void stepSetupSolve(PxBaseTask* continuation);
648 //void stepSetupSimulate();
649
650 void fetchPatchEvents(PxBaseTask*);
651 void processNarrowPhaseTouchEvents();
652 void processNarrowPhaseTouchEventsStage2(PxBaseTask*);
653 void setEdgesConnected(PxBaseTask*);
654 void processNarrowPhaseLostTouchEvents(PxBaseTask*);
655 void processNarrowPhaseLostTouchEventsIslands(PxBaseTask*);
656 void processLostTouchPairs();
657 void integrateKinematicPose();
658 void updateKinematicCached(PxBaseTask* task);
659
660 void beforeSolver(PxBaseTask* continuation);
661 void checkForceThresholdContactEvents(const PxU32 ccdPass);
662 void processCallbacks(bool pendingReportsOnly = false);
663 void endStep();
664 private:
665 PX_FORCE_INLINE void putObjectsToSleep(PxU32 infoFlag);
666 PX_FORCE_INLINE void putInteractionsToSleep();
667 PX_FORCE_INLINE void wakeObjectsUp(PxU32 infoFlag);
668
669 void collectPostSolverVelocitiesBeforeCCD();
670
671 void clearSleepWakeBodies(void);
672 PX_INLINE void cleanUpSleepBodies();
673 PX_INLINE void cleanUpWokenBodies();
674 PX_INLINE void cleanUpSleepOrWokenBodies(Ps::CoalescedHashSet<BodyCore*>& bodyList, PxU32 removeFlag, bool& validMarker);
675
676 //internal variables:
677 private:
678 // Material manager
679 PX_ALIGN(16, PxsMaterialManager mMaterialManager);
680
681 PxU64 mContextId;
682
683 Ps::Array<BodyCore*> mActiveBodies; // Sorted: kinematic before dynamic
684 PxU32 mActiveKinematicBodyCount; // Number of active kinematics. This is also the index in mActiveBodies where the active dynamic bodies start.
685 Ps::Array<BodyCore*> mActiveCompoundBodies;
686
687 Ps::Array<Interaction*> mInteractions[InteractionType::eTRACKED_IN_SCENE_COUNT];
688 PxU32 mActiveInteractionCount[InteractionType::eTRACKED_IN_SCENE_COUNT]; // Interactions with id < activeInteractionCount are active
689
690 template <typename T, PxU32 size>
691 struct Block
692 {
693 PxU8 mem[sizeof(T)*size];
694 Block() {} // get around VS warning C4345, otherwise useless
695 };
696
697 typedef Block<void*, 8> PointerBlock8;
698 typedef Block<void*, 16> PointerBlock16;
699 typedef Block<void*, 32> PointerBlock32;
700
701 Ps::Pool<PointerBlock8> mPointerBlock8Pool;
702 Ps::Pool<PointerBlock16> mPointerBlock16Pool;
703 Ps::Pool<PointerBlock32> mPointerBlock32Pool;
704
705 PxsContext* mLLContext;
706
707 Bp::AABBManager* mAABBManager;
708 Bp::BroadPhase* mBP;
709 PxsCCDContext* mCCDContext;
710 PxI32 mNumFastMovingShapes;
711 PxU32 mCCDPass;
712
713 //PxsIslandManager* mIslandManager;
714
715 IG::SimpleIslandManager* mSimpleIslandManager;
716
717 Dy::Context* mDynamicsContext;
718
719
720 PxsMemoryManager* mMemoryManager;
721
722#if PX_SUPPORT_GPU_PHYSX
723 PxsKernelWranglerManager* mGpuWranglerManagers;
724 PxsHeapMemoryAllocatorManager* mHeapMemoryAllocationManager;
725#endif
726
727 PxsSimulationController* mSimulationController;
728
729 PxsSimulationControllerCallback* mSimulationControllerCallback;
730
731 PxSceneLimits mLimits;
732
733 PxVec3 mGravity; //!< Gravity vector
734 PxU32 mBodyGravityDirty; // Set to true before body->updateForces() when the mGravity has changed
735
736 Ps::Array<PxContactPairHeader>
737 mQueuedContactPairHeaders;
738 //time:
739 //constants set with setTiming():
740 PxReal mDt; //delta time for current step.
741 PxReal mOneOverDt; //inverse of dt.
742 //stepping / counters:
743 PxU32 mTimeStamp; //Counts number of steps.
744 PxU32 mReportShapePairTimeStamp; //Timestamp for refreshing the shape pair report structure. Updated before delayed shape/actor deletion and before CCD passes.
745 //containers:
746 // Those ones contain shape ptrs from Actor, i.e. compound level, not subparts
747
748 Ps::CoalescedHashSet<Sc::ConstraintCore*>
749 mConstraints;
750
751 Sc::ConstraintProjectionManager* mProjectionManager;
752 Bp::BoundsArray* mBoundsArray;
753 Ps::Array<PxReal, Ps::VirtualAllocator>* mContactDistance;
754 bool mHasContactDistanceChanged;
755 SqBoundsManager* mSqBoundsManager;
756
757 Ps::Array<BodySim*> mCcdBodies;
758 Ps::Array<BodySim*> mProjectedBodies;
759 Ps::Array<PxTriggerPair> mTriggerBufferAPI;
760 Ps::Array<TriggerPairExtraData>*
761 mTriggerBufferExtraData;
762
763 PxU32 mRemovedShapeCountAtSimStart; // counter used to detect whether there have been buffered shape removals
764
765 Ps::CoalescedHashSet<ArticulationCore*> mArticulations;
766
767 Ps::Array<Sc::ConstraintCore*> mBrokenConstraints;
768 Ps::CoalescedHashSet<Sc::ConstraintSim*> mActiveBreakableConstraints;
769
770 // pools for joint buffers
771 // Fixed joint is 92 bytes, D6 is 364 bytes right now. So these three pools cover all the internal cases
772 typedef Block<PxU8, 128> MemBlock128;
773 typedef Block<PxU8, 256> MemBlock256;
774 typedef Block<PxU8, 384> MemBlock384;
775
776 Ps::Pool2<MemBlock128, 8192> mMemBlock128Pool;
777 Ps::Pool2<MemBlock256, 8192> mMemBlock256Pool;
778 Ps::Pool2<MemBlock384, 8192> mMemBlock384Pool;
779
780
781 // broad phase data:
782 NPhaseCore* mNPhaseCore;
783
784 // Collision filtering
785 void* mFilterShaderData;
786 PxU32 mFilterShaderDataSize;
787 PxU32 mFilterShaderDataCapacity;
788 PxSimulationFilterShader mFilterShader;
789 PxSimulationFilterCallback* mFilterCallback;
790
791 const PxPairFilteringMode::Enum mKineKineFilteringMode;
792 const PxPairFilteringMode::Enum mStaticKineFilteringMode;
793
794 Ps::CoalescedHashSet<BodyCore*> mSleepBodies;
795 Ps::CoalescedHashSet<BodyCore*> mWokeBodies;
796 bool mWokeBodyListValid;
797 bool mSleepBodyListValid;
798 const bool mEnableStabilization;
799 Ps::Array<Client*> mClients; //an array of transform arrays, one for each client.
800
801 Ps::Array<PxActor*> mActiveActors;
802 Ps::Array<PxActor*> mFrozenActors;
803
804 Ps::Array<const PxRigidBody*> mClientPosePreviewBodies; // buffer for bodies that requested early report of the integrated pose (eENABLE_POSE_INTEGRATION_PREVIEW).
805 // This buffer gets exposed to users. Is officially accessible from PxSimulationEventCallback::onAdvance()
806 // until the next simulate()/advance().
807 Ps::Array<PxTransform> mClientPosePreviewBuffer; // buffer of newly integrated poses for the bodies that requested a preview. This buffer gets exposed
808 // to users.
809
810 PxSimulationEventCallback* mSimulationEventCallback;
811 PxBroadPhaseCallback* mBroadPhaseCallback;
812
813 SimStats* mStats;
814 PxU32 mInternalFlags; //!< Combination of ::SceneFlag
815 PxSceneFlags mPublicFlags; //copy of PxSceneDesc::flags, of type PxSceneFlag
816
817 ObjectIDTracker* mConstraintIDTracker;
818 ObjectIDTracker* mShapeIDTracker;
819 ObjectIDTracker* mRigidIDTracker;
820 ObjectIDTracker* mElementIDPool;
821
822 StaticSim* mStaticAnchor;
823
824 Cm::PreallocatingPool<ShapeSim>* mShapeSimPool;
825 Cm::PreallocatingPool<StaticSim>* mStaticSimPool;
826 Cm::PreallocatingPool<BodySim>* mBodySimPool;
827 Ps::Pool<ConstraintSim>* mConstraintSimPool;
828 LLArticulationPool* mLLArticulationPool;
829 LLArticulationRCPool* mLLArticulationRCPool;
830
831 Ps::Pool<ConstraintInteraction>*
832 mConstraintInteractionPool;
833
834 Ps::Pool<SimStateData>* mSimStateDataPool;
835
836 BatchRemoveState* mBatchRemoveState;
837
838 Ps::Array<SimpleBodyPair> mLostTouchPairs;
839 Cm::BitMap mLostTouchPairsDeletedBodyIDs; // Need to know which bodies have been deleted when processing the lost touch pair list.
840 // Can't use the existing rigid object ID tracker class since this map needs to be cleared at
841 // another point in time.
842
843 Cm::BitMap mVelocityModifyMap;
844
845 Ps::Array<PxvContactManagerTouchEvent> mTouchFoundEvents;
846 Ps::Array<PxvContactManagerTouchEvent> mTouchLostEvents;
847
848 Ps::Array<PxsContactManager*> mFoundPatchManagers;
849 Ps::Array<PxsContactManager*> mLostPatchManagers;
850
851 Ps::Array<PxU32> mOutOfBoundsIDs;
852
853 Cm::BitMap mDirtyShapeSimMap;
854
855 PxU32 mDominanceBitMatrix[PX_MAX_DOMINANCE_GROUP];
856
857 PxReal mVisualizationScale; // Redundant but makes checks whether debug visualization is enabled faster
858
859 bool mVisualizationParameterChanged;
860
861 // statics:
862 PxU32 mNbRigidStatics;
863 PxU32 mNbRigidDynamics;
864 PxU32 mNbRigidKinematic;
865 PxU32 mNbGeometries[PxGeometryType::eGEOMETRY_COUNT];
866
867 PxU32 mNumDeactivatingNodes[2];
868
869 // task decomposition
870 void preBroadPhase(PxBaseTask* continuation);
871 void broadPhase(PxBaseTask* continuation);
872 void postBroadPhase(PxBaseTask* continuation);
873 void postBroadPhaseContinuation(PxBaseTask* continuation);
874 void preRigidBodyNarrowPhase(PxBaseTask* continuation);
875 void postBroadPhaseStage2(PxBaseTask* continuation);
876 void postBroadPhaseStage3(PxBaseTask* continuation);
877 void rigidBodyNarrowPhase(PxBaseTask* continuation);
878 void unblockNarrowPhase(PxBaseTask* continuation);
879 void islandGen(PxBaseTask* continuation);
880 void processLostSolverPatches(PxBaseTask* continuation);
881 void postIslandGen(PxBaseTask* continuation);
882 void processTriggerInteractions(PxBaseTask* continuation);
883 void solver(PxBaseTask* continuation);
884 void updateBodiesAndShapes(PxBaseTask* continuation);
885 void updateSimulationController(PxBaseTask* continuation);
886 void updateDynamics(PxBaseTask* continuation);
887 void processLostContacts(PxBaseTask*);
888 void processLostContacts2(PxBaseTask*);
889 void processLostContacts3(PxBaseTask*);
890 void destroyManagers(PxBaseTask*);
891 void lostTouchReports(PxBaseTask*);
892 void unregisterInteractions(PxBaseTask*);
893 void postThirdPassIslandGen(PxBaseTask*);
894 void postSolver(PxBaseTask* continuation);
895 void constraintProjection(PxBaseTask* continuation);
896 void afterIntegration(PxBaseTask* continuation); // performs sleep check, for instance
897 void postCCDPass(PxBaseTask* continuation);
898 void ccdBroadPhaseAABB(PxBaseTask* continuation);
899 void ccdBroadPhase(PxBaseTask* continuation);
900 void updateCCDMultiPass(PxBaseTask* continuation);
901 void updateCCDSinglePass(PxBaseTask* continuation);
902 void updateCCDSinglePassStage2(PxBaseTask* continuation);
903 void updateCCDSinglePassStage3(PxBaseTask* continuation);
904 void finalizationPhase(PxBaseTask* continuation);
905
906 void postNarrowPhase(PxBaseTask* continuation);
907
908 void addShapes(void *const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& sim, PxBounds3* outBounds);
909 void removeShapes(RigidSim& , Ps::InlineArray<Sc::ShapeSim*, 64>& , Ps::InlineArray<const Sc::ShapeCore*, 64>&, bool wakeOnLostTouch);
910
911
912 private:
913
914 void addShapes(void *const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& sim, ShapeSim*& prefetchedShapeSim, PxBounds3* outBounds);
915
916 Cm::DelegateTask<Sc::Scene, &Sc::Scene::secondPassNarrowPhase> mSecondPassNarrowPhase;
917 Cm::DelegateFanoutTask<Sc::Scene, &Sc::Scene::postNarrowPhase> mPostNarrowPhase;
918 Cm::DelegateFanoutTask<Sc::Scene, &Sc::Scene::finalizationPhase> mFinalizationPhase;
919 Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateCCDMultiPass> mUpdateCCDMultiPass;
920
921 //multi-pass ccd stuff
922 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateCCDSinglePass> > mUpdateCCDSinglePass;
923 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateCCDSinglePassStage2> > mUpdateCCDSinglePass2;
924 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateCCDSinglePassStage3> > mUpdateCCDSinglePass3;
925 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::ccdBroadPhaseAABB> > mCCDBroadPhaseAABB;
926 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::ccdBroadPhase> > mCCDBroadPhase;
927 Ps::Array<Cm::DelegateTask<Sc::Scene, &Sc::Scene::postCCDPass> > mPostCCDPass;
928
929 Cm::DelegateTask<Sc::Scene, &Sc::Scene::afterIntegration> mAfterIntegration;
930 Cm::DelegateTask<Sc::Scene, &Sc::Scene::constraintProjection> mConstraintProjection;
931 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postSolver> mPostSolver;
932 Cm::DelegateTask<Sc::Scene, &Sc::Scene::solver> mSolver;
933 Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateBodiesAndShapes> mUpdateBodiesAndShapes;
934 Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateSimulationController> mUpdateSimulationController;
935 Cm::DelegateTask<Sc::Scene, &Sc::Scene::updateDynamics> mUpdateDynamics;
936 Cm::DelegateTask<Sc::Scene, &Sc::Scene::processLostContacts> mProcessLostContactsTask;
937 Cm::DelegateTask<Sc::Scene, &Sc::Scene::processLostContacts2> mProcessLostContactsTask2;
938 Cm::DelegateTask<Sc::Scene, &Sc::Scene::processLostContacts3> mProcessLostContactsTask3;
939 Cm::DelegateTask<Sc::Scene, &Sc::Scene::destroyManagers> mDestroyManagersTask;
940 Cm::DelegateTask<Sc::Scene, &Sc::Scene::lostTouchReports> mLostTouchReportsTask;
941 Cm::DelegateTask<Sc::Scene, &Sc::Scene::unregisterInteractions> mUnregisterInteractionsTask;
942 Cm::DelegateTask<Sc::Scene,
943 &Sc::Scene::processNarrowPhaseLostTouchEventsIslands> mProcessNarrowPhaseLostTouchTasks;
944 Cm::DelegateTask<Sc::Scene,
945 &Sc::Scene::processNarrowPhaseLostTouchEvents> mProcessNPLostTouchEvents;
946 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postThirdPassIslandGen> mPostThirdPassIslandGenTask;
947 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postIslandGen> mPostIslandGen;
948 Cm::DelegateTask<Sc::Scene, &Sc::Scene::islandGen> mIslandGen;
949 Cm::DelegateTask<Sc::Scene, &Sc::Scene::preRigidBodyNarrowPhase> mPreRigidBodyNarrowPhase;
950 Cm::DelegateTask<Sc::Scene, &Sc::Scene::setEdgesConnected> mSetEdgesConnectedTask;
951 Cm::DelegateTask<Sc::Scene, &Sc::Scene::fetchPatchEvents> mFetchPatchEventsTask;
952 Cm::DelegateTask<Sc::Scene, &Sc::Scene::processLostSolverPatches> mProcessLostPatchesTask;
953 Cm::DelegateTask<Sc::Scene, &Sc::Scene::rigidBodyNarrowPhase> mRigidBodyNarrowPhase;
954 Cm::DelegateTask<Sc::Scene, &Sc::Scene::unblockNarrowPhase> mRigidBodyNPhaseUnlock;
955 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postBroadPhase> mPostBroadPhase;
956 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postBroadPhaseContinuation> mPostBroadPhaseCont;
957 Cm::DelegateTask<Sc::Scene, &Sc::Scene::postBroadPhaseStage2> mPostBroadPhase2;
958 Cm::DelegateFanoutTask<Sc::Scene, &Sc::Scene::postBroadPhaseStage3> mPostBroadPhase3;
959 Cm::DelegateTask<Sc::Scene, &Sc::Scene::preallocateContactManagers> mPreallocateContactManagers;
960 Cm::DelegateTask<Sc::Scene, &Sc::Scene::islandInsertion> mIslandInsertion;
961 Cm::DelegateTask<Sc::Scene, &Sc::Scene::registerContactManagers> mRegisterContactManagers;
962 Cm::DelegateTask<Sc::Scene, &Sc::Scene::registerInteractions> mRegisterInteractions;
963 Cm::DelegateTask<Sc::Scene, &Sc::Scene::registerSceneInteractions> mRegisterSceneInteractions;
964 Cm::DelegateTask<Sc::Scene, &Sc::Scene::broadPhase> mBroadPhase;
965 Cm::DelegateTask<Sc::Scene, &Sc::Scene::advanceStep> mAdvanceStep;
966 Cm::DelegateTask<Sc::Scene, &Sc::Scene::collideStep> mCollideStep;
967
968 Cm::FlushPool mTaskPool;
969 PxTaskManager* mTaskManager;
970 PxCudaContextManager* mCudaContextManager;
971
972 bool mContactReportsNeedPostSolverVelocity;
973 bool mUseGpuRigidBodies;
974
975 SimulationStage::Enum mSimulationStage;
976
977 ConstraintGroupNode** mTmpConstraintGroupRootBuffer; // temporary list of constraint group roots, used for constraint projection
978
979 Ps::CoalescedHashSet<const BodySim*> mPosePreviewBodies; // list of bodies that requested early report of the integrated pose (eENABLE_POSE_INTEGRATION_PREVIEW).
980
981 Ps::Array<PxsContactManager*> mPreallocatedContactManagers;
982 Ps::Array<ShapeInteraction*> mPreallocatedShapeInteractions;
983 Ps::Array<ElementInteractionMarker*> mPreallocatedInteractionMarkers;
984
985 OverlapFilterTask* mOverlapFilterTaskHead;
986 Ps::Array<PxFilterInfo> mFilterInfo;
987 Cm::BitMap mSpeculativeCCDRigidBodyBitMap;
988 Cm::BitMap mSpeculativeCDDArticulationBitMap;
989 };
990
991 bool activateInteraction(Sc::Interaction* interaction, void* data);
992 bool deactivateInteraction(Sc::Interaction* interaction);
993
994} // namespace Sc
995
996}
997
998#endif
999

source code of qtquick3dphysics/src/3rdparty/PhysX/source/simulationcontroller/include/ScScene.h