diff options
| author | sschirm <[email protected]> | 2016-12-23 14:20:36 +0100 |
|---|---|---|
| committer | sschirm <[email protected]> | 2016-12-23 14:56:17 +0100 |
| commit | ef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch) | |
| tree | 710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/SimulationController/src/ScScene.cpp | |
| parent | Initial commit: (diff) | |
| download | physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip | |
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src/ScScene.cpp')
| -rw-r--r-- | PhysX_3.4/Source/SimulationController/src/ScScene.cpp | 173 |
1 files changed, 13 insertions, 160 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp index afa02401..28945a12 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScScene.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScScene.cpp @@ -27,7 +27,6 @@ // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - #define NOMINMAX #include "foundation/PxProfiler.h" @@ -120,8 +119,7 @@ PX_PHYSX_GPU_API Bp::BPMemoryAllocator* createGpuMemoryAllocator(); #endif extern bool gUnifiedHeightfieldCollision; - - + namespace Sc { class LLArticulationPool: public Ps::Pool<Articulation, Ps::AlignedAllocator<DY_ARTICULATION_MAX_SIZE> > @@ -130,7 +128,6 @@ public: LLArticulationPool() {} }; - static const char* sFilterShaderDataMemAllocId = "SceneDesc filterShaderData"; }} @@ -287,10 +284,8 @@ private: ScAfterIntegrationTask& operator = (const ScAfterIntegrationTask&); }; - class ScSimulationControllerCallback : public PxsSimulationControllerCallback { - Sc::Scene* mScene; public: @@ -359,7 +354,6 @@ public: task->setContinuation(continuation); task->removeReference(); } - } } @@ -367,7 +361,6 @@ public: { return mScene->getCcdBodies().size(); } - }; class PxgUpdateBodyAndShapeStatusTask : public Cm::Task @@ -383,7 +376,6 @@ private: PxU32* mDeactivatedBodies; PxI32& mCCDBodyWriteIndex; - public: PxgUpdateBodyAndShapeStatusTask(const IG::NodeIndex* const indices, PxU32 numBodies, PxsBodySim* bodySimsLL, PxU32* activatedBodies, PxU32* deactivatedBodies, @@ -469,7 +461,6 @@ public: virtual void updateScBodyAndShapeSim(PxBaseTask* continuation) { - IG::SimpleIslandManager* islandManager = mScene->getSimpleIslandManager(); PxsSimulationController* simulationController = mScene->getSimulationController(); PxsContext* contextLL = mScene->getLowLevelContext(); @@ -499,8 +490,6 @@ public: task->removeReference(); } - - PxU32* unfrozenShapeIndices = simulationController->getUnfrozenShapes(); PxU32* frozenShapeIndices = simulationController->getFrozenShapes(); const PxU32 nbFrozenShapes = simulationController->getNbFrozenShapes(); @@ -525,18 +514,14 @@ public: Sc::ShapeSim* shape = reinterpret_cast<Sc::ShapeSim*>(reinterpret_cast<PxU8*>(shapeLL) - shapeOffset); shape->createSqBounds(); } - - } virtual PxU32 getNbCcdBodies() { return PxU32(mCcdBodyWriteIndex); } - }; - Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) : mContextId (contextID), mActiveBodies (PX_DEBUG_EXP("sceneActiveBodies")), @@ -577,7 +562,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) : mBatchRemoveState (NULL), mLostTouchPairs (PX_DEBUG_EXP("sceneLostTouchPairs")), mOutOfBoundsIDs (PX_DEBUG_EXP("sceneOutOfBoundsIds")), - mErrorState (0), mVisualizationScale (0.0f), mVisualizationParameterChanged (false), mNbRigidStatics (0), @@ -909,11 +893,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) : mFilterShader = desc.filterShader; mFilterCallback = desc.filterCallback; -#if EXTRA_PROFILING - mExtraProfileFile = fopen("extraProfile.txt", "w"); - mLineNum = 0; -#endif - #if PX_USE_CLOTH_API createClothSolver(); #endif // PX_USE_CLOTH_API @@ -927,7 +906,6 @@ Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) : void Sc::Scene::release() { - #if PX_USE_PARTICLE_SYSTEM_API if (mParticleContext) { @@ -965,10 +943,6 @@ void Sc::Scene::release() delete &core; } -#if EXTRA_PROFILING - fclose(mExtraProfileFile); -#endif - // Free object IDs and the deleted object id map postReportsCleanup(); @@ -992,7 +966,6 @@ void Sc::Scene::release() PX_DELETE_AND_RESET(mSqBoundsManager); PX_DELETE_AND_RESET(mBoundsArray); - for(PxU32 i=0;i<mClients.size(); i++) PX_DELETE_AND_RESET(mClients[i]); @@ -1035,17 +1008,12 @@ void Sc::Scene::release() mDynamicsContext->destroy(); - mCCDContext->destroy(); - - mSimpleIslandManager->~SimpleIslandManager(); PX_FREE(mSimpleIslandManager); #if PX_SUPPORT_GPU_PHYSX - - if (mGpuWranglerManagers) { mGpuWranglerManagers->~PxsKernelWranglerManager(); @@ -1080,7 +1048,6 @@ void Sc::Scene::release() PX_FREE(mMemoryManager); mMemoryManager = NULL; } - } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1460,7 +1427,6 @@ void Sc::Scene::prepareCollide() PxcClearContactCacheStats(); } - void Sc::Scene::simulate(PxReal timeStep, PxBaseTask* continuation) { @@ -1554,7 +1520,6 @@ void Sc::Scene::endSimulation() PxcDisplayContactCacheStats(); } - void Sc::Scene::flush(bool sendPendingReports) { if (sendPendingReports) @@ -1606,7 +1571,6 @@ void Sc::Scene::flush(bool sendPendingReports) mLLContext->getNpMemBlockPool().releaseUnusedBlocks(); } - // User callbacks void Sc::Scene::setSimulationEventCallback(PxSimulationEventCallback* callback, PxClientID client) @@ -1660,7 +1624,6 @@ PxU32 Sc::Scene::getCCDMaxPasses() const return mCCDContext->getCCDMaxPasses(); } - void Sc::Scene::setBroadPhaseCallback(PxBroadPhaseCallback* callback, PxClientID client) { PX_ASSERT(client < mClients.size()); @@ -1701,7 +1664,6 @@ void Sc::Scene::removeBody(BodySim& body) //this also notifies any connected joi markReleasedBodyIDForLostTouch(body.getID()); } - void Sc::Scene::addConstraint(ConstraintCore& constraint, RigidCore* body0, RigidCore* body1) { ConstraintSim* sim = mConstraintSimPool->construct(constraint, body0, body1, *this); @@ -1710,7 +1672,6 @@ void Sc::Scene::addConstraint(ConstraintCore& constraint, RigidCore* body0, Rigi mConstraints.insert(&constraint); } - void Sc::Scene::removeConstraint(ConstraintCore& constraint) { ConstraintSim* cSim = constraint.getSim(); @@ -1728,7 +1689,6 @@ void Sc::Scene::removeConstraint(ConstraintCore& constraint) mConstraints.erase(&constraint); } - void Sc::Scene::addArticulation(ArticulationCore& articulation, BodyCore& root) { ArticulationSim* sim = PX_NEW(ArticulationSim)(articulation, *this, root); @@ -1741,7 +1701,6 @@ void Sc::Scene::addArticulation(ArticulationCore& articulation, BodyCore& root) mArticulations.insert(&articulation); } - void Sc::Scene::removeArticulation(ArticulationCore& articulation) { ArticulationSim* a = articulation.getSim(); @@ -1750,21 +1709,18 @@ void Sc::Scene::removeArticulation(ArticulationCore& articulation) mArticulations.erase(&articulation); } - void Sc::Scene::addArticulationJoint(ArticulationJointCore& joint, BodyCore& parent, BodyCore& child) { ArticulationJointSim* sim = PX_NEW(ArticulationJointSim)(joint, *parent.getSim(), *child.getSim()); PX_UNUSED(sim); } - void Sc::Scene::removeArticulationJoint(ArticulationJointCore& joint) { if (joint.getSim()) PX_DELETE(joint.getSim()); } - void Sc::Scene::addBrokenConstraint(Sc::ConstraintCore* c) { PX_ASSERT(mBrokenConstraints.find(c) == mBrokenConstraints.end()); @@ -2038,7 +1994,6 @@ void Sc::Scene::advanceStep(PxBaseTask* continuation) } } - //void Sc::Scene::advanceStep(PxBaseTask* continuation) //{ // PX_PROFILE_ZONE("Sim.solveQueueTasks", getContextId()); @@ -2119,7 +2074,6 @@ void Sc::Scene::collideStep(PxBaseTask* continuation) mPreRigidBodyNarrowPhase.removeReference(); } - void Sc::Scene::clothPreprocessing(PxBaseTask* /*continuation*/) { #if PX_USE_CLOTH_API @@ -2226,7 +2180,6 @@ public: virtual const char* getName() const { return "DirtyShapeUpdatesTask"; } - private: PX_NOCOPY(DirtyShapeUpdatesTask) }; @@ -2356,11 +2309,13 @@ void Sc::Scene::preRigidBodyNarrowPhase(PxBaseTask* continuation) DirtyShapeUpdatesTask* task = PX_PLACEMENT_NEW(pool.allocate(sizeof(DirtyShapeUpdatesTask)), DirtyShapeUpdatesTask)(cache, boundsArray); + bool hasDirtyShapes = false; while ((index = dirtyShapeIter.getNext()) != Cm::BitMap::Iterator::DONE) { Sc::ShapeSim* shapeSim = reinterpret_cast<Sc::ShapeSim*>(mAABBManager->getUserData(index)); if (shapeSim) { + hasDirtyShapes = true; changedMap.growAndSet(index); task->mShapes[task->mNbShapes++] = shapeSim; if (task->mNbShapes == DirtyShapeUpdatesTask::MaxShapes) @@ -2372,6 +2327,14 @@ void Sc::Scene::preRigidBodyNarrowPhase(PxBaseTask* continuation) } } + if (hasDirtyShapes) + { + //Setting the boundsArray and transform cache as dirty so that they get DMAd to GPU if GPU dynamics and BP are being used respectively. + //These bits are no longer set when we update the cached state for actors due to an optimization avoiding setting these dirty bits multiple times. + getBoundsArray().setChangedState(); + getLowLevelContext()->getTransformCache().setChangedState(); + } + if (task->mNbShapes != 0) { task->setContinuation(continuation); @@ -2517,9 +2480,8 @@ void Sc::Scene::processNarrowPhaseTouchEvents() } } - - getLowLevelContext()->getSimStats().mNbNewTouches = newTouchCount; - getLowLevelContext()->getSimStats().mNbLostTouches = lostTouchCount; + context->getSimStats().mNbNewTouches = newTouchCount; + context->getSimStats().mNbLostTouches = lostTouchCount; } } @@ -2673,8 +2635,6 @@ void Sc::Scene::processNarrowPhaseLostTouchEvents(PxBaseTask*) addToLostTouchList(si->getShape0().getBodySim(), si->getShape1().getBodySim()); } } - - } void Sc::Scene::processLostSolverPatches(PxBaseTask* /*continuation*/) @@ -2683,7 +2643,6 @@ void Sc::Scene::processLostSolverPatches(PxBaseTask* /*continuation*/) mDynamicsContext->processLostPatches(*mSimpleIslandManager, mLostPatchManagers.begin(), mLostPatchManagers.size(), outputs); } - void Sc::Scene::islandGen(PxBaseTask* continuation) { PX_PROFILE_START_CROSSTHREAD("Basic.rigidBodySolver", getContextId()); @@ -2704,7 +2663,6 @@ void Sc::Scene::islandGen(PxBaseTask* continuation) PX_FORCE_INLINE void Sc::Scene::putObjectsToSleep(PxU32 infoFlag) { - const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); //Set to sleep all bodies that were in awake islands that have just been put to sleep. @@ -2730,9 +2688,6 @@ PX_FORCE_INLINE void Sc::Scene::putObjectsToSleep(PxU32 infoFlag) if (articSim && !islandSim.getNode(articIndices[i]).isActive()) articSim->setActive(false, infoFlag); } - - - } PX_FORCE_INLINE void Sc::Scene::putInteractionsToSleep(PxU32 infoFlag) @@ -2945,7 +2900,6 @@ void Sc::Scene::unregisterInteractions(PxBaseTask*) void Sc::Scene::destroyManagers(PxBaseTask*) { { - PX_PROFILE_ZONE("Sim.destroyManagers", getContextId()); mPostThirdPassIslandGenTask.setContinuation(mProcessLostContactsTask3.getContinuation()); @@ -2982,8 +2936,6 @@ void Sc::Scene::processLostContacts2(PxBaseTask* continuation) mUnregisterInteractionsTask.setContinuation(continuation); mUnregisterInteractionsTask.removeReference(); - - { PX_PROFILE_ZONE("Sim.clearIslandData", getContextId()); // PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); @@ -3053,8 +3005,6 @@ void Sc::Scene::processLostContacts3(PxBaseTask* /*continuation*/) mPostThirdPassIslandGenTask.removeReference(); } - - //This is called after solver finish void Sc::Scene::updateSimulationController(PxBaseTask* continuation) { @@ -3073,7 +3023,6 @@ void Sc::Scene::updateSimulationController(PxBaseTask* continuation) } void Sc::Scene::updateDynamics(PxBaseTask* continuation) - { mProcessLostContactsTask3.setContinuation(continuation); mProcessLostContactsTask2.setContinuation(&mProcessLostContactsTask3); @@ -3103,10 +3052,8 @@ void Sc::Scene::updateDynamics(PxBaseTask* continuation) mProcessLostContactsTask3.removeReference(); mProcessLostContactsTask2.removeReference(); mProcessLostContactsTask.removeReference(); - } - void Sc::Scene::updateCCDMultiPass(PxBaseTask* parentContinuation) { getCcdBodies().forceSize_Unsafe(mSimulationControllerCallback->getNbCcdBodies()); @@ -3155,18 +3102,15 @@ void Sc::Scene::updateCCDMultiPass(PxBaseTask* parentContinuation) } } - //reset thread context in a place we know all tasks possibly accessing it, are in sync with. (see US6664) mLLContext->resetThreadContexts(); mCCDContext->updateCCDBegin(); - mCCDBroadPhase[0].setContinuation(parentContinuation); mCCDBroadPhaseAABB[0].setContinuation(&mCCDBroadPhase[0]); mCCDBroadPhase[0].removeReference(); mCCDBroadPhaseAABB[0].removeReference(); - } } @@ -3213,7 +3157,6 @@ public: Ps::atomicAdd(mNumFastMovingShapes, PxI32(activeShapes)); } - }; void Sc::Scene::ccdBroadPhaseAABB(PxBaseTask* continuation) @@ -3239,10 +3182,8 @@ void Sc::Scene::ccdBroadPhaseAABB(PxBaseTask* continuation) task->removeReference(); } } - } - void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation) { PX_PROFILE_ZONE("Sim.ccdBroadPhase", getContextId()); @@ -3267,7 +3208,6 @@ void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation) mUpdateCCDSinglePass2[currIndex].setContinuation(&mUpdateCCDSinglePass3[currIndex]); mUpdateCCDSinglePass[currIndex].setContinuation(&mUpdateCCDSinglePass2[currIndex]); - //Do the actual broad phase PxBaseTask* continuationTask = &mUpdateCCDSinglePass[currIndex]; const PxU32 numCpuTasks = continuationTask->getTaskManager()->getCpuDispatcher()->getWorkerCount(); @@ -3292,7 +3232,6 @@ void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation) } } - void Sc::Scene::updateCCDSinglePass(PxBaseTask* continuation) { PX_PROFILE_ZONE("Sim.updateCCDSinglePass", getContextId()); @@ -3301,7 +3240,6 @@ void Sc::Scene::updateCCDSinglePass(PxBaseTask* continuation) const PxU32 currentPass = mCCDContext->getCurrentCCDPass() + 1; // 0 is reserved for discrete collision phase finishBroadPhase(currentPass, continuation); - if (currentPass == 1) // reset the handle map so we only update CCD objects from here on { Cm::BitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); @@ -3339,7 +3277,6 @@ void Sc::Scene::updateCCDSinglePassStage3(PxBaseTask* continuation) mCCDContext->updateCCD(mDt, continuation, (mPublicFlags & PxSceneFlag::eDISABLE_CCD_RESWEEP), mNumFastMovingShapes); } - void Sc::Scene::integrateKinematicPose() { PX_PROFILE_ZONE("Sim.integrateKinematicPose", getContextId()); @@ -3394,7 +3331,6 @@ void Sc::Scene::updateKinematicCached() } } - class ConstraintProjectionTask : public Cm::Task { private: @@ -3438,7 +3374,6 @@ public: return "ScScene.constraintProjectionWork"; } - public: static const PxU32 sProjectingConstraintsPerTask = 256; // just a guideline, will not match exactly most of the time @@ -3554,7 +3489,6 @@ void Sc::Scene::postSolver(PxBaseTask* continuation) } //afterIntegration(continuation); - } void Sc::Scene::postCCDPass(PxBaseTask* /*continuation*/) @@ -3688,10 +3622,8 @@ void Sc::Scene::postReportsCleanup() mRigidIDTracker->processPendingReleases(); mRigidIDTracker->clearDeletedIDMap(); - mConstraintIDTracker->processPendingReleases(); mConstraintIDTracker->clearDeletedIDMap(); - } void Sc::Scene::syncSceneQueryBounds(SqBoundsSync& sync, SqRefFinder& finder) @@ -3771,8 +3703,6 @@ void Sc::Scene::stepSetupCollide() mInternalFlags &= ~(SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE | SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_VISUALIZATION); } - - void Sc::Scene::processLostTouchPairs() { PX_PROFILE_ZONE("Sc::Scene::processLostTouchPairs", getContextId()); @@ -3807,7 +3737,6 @@ void Sc::Scene::processLostTouchPairs() } } - mLostTouchPairs.clear(); mLostTouchPairsDeletedBodyIDs.clear(); } @@ -3872,7 +3801,6 @@ private: ScBeforeSolverTask& operator = (const ScBeforeSolverTask&); }; - void Sc::Scene::beforeSolver(PxBaseTask* continuation) { PX_PROFILE_ZONE("Sim.updateForces", getContextId()); @@ -3934,7 +3862,6 @@ void Sc::Scene::beforeSolver(PxBaseTask* continuation) mBodyGravityDirty = false; } - #if PX_DEBUG bool DEBUG_solverlock = false; #endif @@ -3965,7 +3892,6 @@ public: } }; - void Sc::Scene::afterIntegration(PxBaseTask* continuation) { mLLContext->getTransformCache().resetChangedState(); //Reset the changed state. If anything outside of the GPU kernels updates any shape's transforms, this will be raised again @@ -3976,8 +3902,6 @@ void Sc::Scene::afterIntegration(PxBaseTask* continuation) mSimulationController->udpateScBodyAndShapeSim(cache, boundArray, continuation); - - { PX_PROFILE_ZONE("AfterIntegration::lockStage", getContextId()); mLLContext->getLock().lock(); @@ -4144,7 +4068,6 @@ void Sc::Scene::checkForceThresholdContactEvents(const PxU32 ccdPass) const PxU32 nbThresholdElements = thresholdStream.size(); - for (PxU32 i = 0; i< nbThresholdElements; ++i) { ThresholdStreamElement& elem = thresholdStream[i]; @@ -4268,7 +4191,6 @@ void Sc::Scene::visualizeEndStep() #endif } - void Sc::Scene::collectPostSolverVelocitiesBeforeCCD() { if (mContactReportsNeedPostSolverVelocity) @@ -4301,7 +4223,6 @@ void Sc::Scene::collectPostSolverVelocitiesBeforeCCD() } } - void Sc::Scene::finalizeContactStreamAndCreateHeader(PxContactPairHeader& header, const ActorPairReport& aPair, ContactStreamManager& cs, PxU32 removedShapeTestMask) { PxU8* stream = mNPhaseCore->getContactReportPairData(cs.bufferIndex); @@ -4347,10 +4268,8 @@ void Sc::Scene::finalizeContactStreamAndCreateHeader(PxContactPairHeader& header } } header.extraDataStreamSize = extraDataSize; - } - const Ps::Array<PxContactPairHeader>& Sc::Scene::getQueuedContactPairHeaders() { // if buffered shape removals occured, then the criteria for testing the contact stream for events with removed shape pointers needs to be more strict. @@ -4448,7 +4367,6 @@ void Sc::Scene::fireQueuedContactCallbacks(bool asPartOfFlush) } } - PX_FORCE_INLINE void markDeletedShapes(Sc::ObjectIDTracker& idTracker, Sc::TriggerPairExtraData& tped, PxTriggerPair& pair) { PxTriggerPairFlags::InternalType flags = 0; @@ -4460,7 +4378,6 @@ PX_FORCE_INLINE void markDeletedShapes(Sc::ObjectIDTracker& idTracker, Sc::Trigg pair.flags = PxTriggerPairFlags(flags); } - void Sc::Scene::fireTriggerCallbacks() { // triggers @@ -4576,7 +4493,6 @@ void Sc::Scene::fireTriggerCallbacks() mTriggerBufferExtraData->clear(); } - namespace { struct BrokenConstraintReportData @@ -4600,7 +4516,6 @@ void Sc::Scene::fireBrokenConstraintCallbacks() PxU32 activeClients[(PX_MAX_CLIENTS+7)/8]; PxMemSet(activeClients, 0, (PX_MAX_CLIENTS+7)/8); - PxU16 activeClientLimit = 0; for(PxU32 i=0;i<count;i++) @@ -4665,7 +4580,6 @@ void Sc::Scene::fireBrokenConstraintCallbacks() } } - /* Threading: called in the context of the user thread, but only after the physics thread has finished its run */ @@ -4789,7 +4703,6 @@ void Sc::Scene::prepareOutOfBoundsCallbacks() } } - bool Sc::Scene::fireOutOfBoundsCallbacks() { bool outputWarning = false; @@ -4937,23 +4850,6 @@ void Sc::Scene::postCallbacksPreSync() releaseConstraints(true); //release constraint blocks at the end of the frame, so user can retrieve the blocks } -PxU32 Sc::Scene::getErrorState() -{ - return mErrorState; // we only signal critical errors from the HW core -} - - -void Sc::Scene::setLimits(const PxSceneLimits & limits) -{ - mLimits = limits; -} - - -const PxSceneLimits& Sc::Scene::getLimits() const -{ - return mLimits; -} - void Sc::Scene::setNbContactDataBlocks(PxU32 numBlocks) { mLLContext->getNpMemBlockPool().setBlockCount(numBlocks); @@ -5042,7 +4938,6 @@ void Sc::Scene::removeShapes(Sc::RigidSim& sim, Ps::InlineArray<Sc::ShapeSim*, 6 removeShape(*shapesBuffer[i], wakeOnLostTouch); } - void Sc::Scene::addStatic(StaticCore& ro, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds) { PX_ASSERT(ro.getActorCoreType() == PxActorType::eRIGID_STATIC); @@ -5097,7 +4992,6 @@ void Sc::Scene::removeStatic(StaticCore& ro, Ps::InlineArray<const Sc::ShapeCore } } - void Sc::Scene::addBody(BodyCore& body, void*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* outBounds) { // sim objects do all the necessary work of adding themselves to broad phase, @@ -5142,7 +5036,6 @@ void Sc::Scene::removeBody(BodyCore& body, Ps::InlineArray<const Sc::ShapeCore*, } } - void Sc::Scene::addShape(RigidSim& owner, ShapeCore& shapeCore, PxBounds3* uninflatedBounds) { ShapeSim* sim = mShapeSimPool->construct(owner, shapeCore); @@ -5192,7 +5085,6 @@ void Sc::Scene::startBatchInsertion(BatchInsertionState&state) state.bodySim = mBodySimPool->allocateAndPrefetch(); } - void Sc::Scene::addShapes(void *const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& rigidSim, ShapeSim*& prefetchedShapeSim, PxBounds3* outBounds) { for(PxU32 i=0;i<nbShapes;i++) @@ -5293,7 +5185,6 @@ void Sc::Scene::setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup mInternalFlags |= SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE; //force an update on all interactions on matrix change -- very expensive but we have no choice!! } - PxDominanceGroupPair Sc::Scene::getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const { PxU8 dom0 = PxU8((mDominanceBitMatrix[group1]>>group2) & 0x1 ? 1u : 0u); @@ -5312,13 +5203,11 @@ void Sc::Scene::setSolverBatchSize(PxU32 solverBatchSize) mDynamicsContext->setSolverBatchSize(solverBatchSize); } - PxU32 Sc::Scene::getSolverBatchSize() const { return mDynamicsContext->getSolverBatchSize(); } - void Sc::Scene::setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) { mVisualizationParameterChanged = true; @@ -5331,7 +5220,6 @@ void Sc::Scene::setVisualizationParameter(PxVisualizationParameter::Enum param, mVisualizationScale = value; } - PxReal Sc::Scene::getVisualizationParameter(PxVisualizationParameter::Enum param) const { PX_ASSERT(mLLContext->getVisualizationParameter(PxVisualizationParameter::eSCALE) == mVisualizationScale); // Safety check because the scale is duplicated for performance reasons @@ -5339,7 +5227,6 @@ PxReal Sc::Scene::getVisualizationParameter(PxVisualizationParameter::Enum param return mLLContext->getVisualizationParameter(param); } - void Sc::Scene::setVisualizationCullingBox(const PxBounds3& box) { mLLContext->setVisualizationCullingBox(box); @@ -5618,7 +5505,6 @@ void Sc::Scene::clearSleepWakeBodies(void) mSleepBodyListValid = true; } - void Sc::Scene::onBodySleep(BodySim* body) { //temp: TODO: Add support for other clients @@ -5657,7 +5543,6 @@ void Sc::Scene::onBodySleep(BodySim* body) } } - void Sc::Scene::onBodyWakeUp(BodySim* body) { //temp: TODO: Add support for other clients @@ -5687,7 +5572,6 @@ void Sc::Scene::onBodyWakeUp(BodySim* body) } } - PX_INLINE void Sc::Scene::cleanUpSleepBodies() { BodyCore* const* bodyArray = mSleepBodies.getEntries(); @@ -5714,16 +5598,13 @@ PX_INLINE void Sc::Scene::cleanUpSleepBodies() } mSleepBodyListValid = true; - } - PX_INLINE void Sc::Scene::cleanUpWokenBodies() { cleanUpSleepOrWokenBodies(mWokeBodies, BodySim::BF_SLEEP_NOTIFY, mWokeBodyListValid); } - PX_INLINE void Sc::Scene::cleanUpSleepOrWokenBodies(Ps::CoalescedHashSet<BodyCore*>& bodyList, PxU32 removeFlag, bool& validMarker) { // With our current logic it can happen that a body is added to the sleep as well as the woken body list in the @@ -5749,7 +5630,6 @@ PX_INLINE void Sc::Scene::cleanUpSleepOrWokenBodies(Ps::CoalescedHashSet<BodyCor validMarker = true; } - void Sc::Scene::releaseConstraints(bool endOfScene) { PX_ASSERT(mLLContext); @@ -5775,13 +5655,11 @@ void Sc::Scene::releaseConstraints(bool endOfScene) } } - PX_INLINE void Sc::Scene::clearBrokenConstraintBuffer() { mBrokenConstraints.clear(); } - void Sc::Scene::updateFromVisualizationParameters() { if (!mVisualizationParameterChanged) // All up to date @@ -5795,13 +5673,6 @@ void Sc::Scene::updateFromVisualizationParameters() mVisualizationParameterChanged = false; } - -bool Sc::Scene::isValid() const -{ - return (mLLContext != NULL); -} - - void Sc::Scene::addToLostTouchList(BodySim* body1, BodySim* body2) { PX_ASSERT(body1 != 0); @@ -5810,7 +5681,6 @@ void Sc::Scene::addToLostTouchList(BodySim* body1, BodySim* body2) mLostTouchPairs.pushBack(p); } - void Sc::Scene::initDominanceMatrix() { //init all dominance pairs such that: @@ -5828,13 +5698,11 @@ Articulation* Sc::Scene::createLLArticulation(Sc::ArticulationSim* sim) return mLLArticulationPool->construct(sim); } - void Sc::Scene::destroyLLArticulation(Articulation& articulation) { mLLArticulationPool->destroy(&articulation); } - #if PX_USE_PARTICLE_SYSTEM_API void Sc::Scene::addParticleSystem(ParticleSystemCore& ps) @@ -5855,7 +5723,6 @@ void Sc::Scene::addParticleSystem(ParticleSystemCore& ps) mParticleSystems.insert(&ps); } - void Sc::Scene::removeParticleSystem(ParticleSystemCore& ps, bool isRelease) { const bool exists = mParticleSystems.erase(&ps); @@ -5864,13 +5731,11 @@ void Sc::Scene::removeParticleSystem(ParticleSystemCore& ps, bool isRelease) ps.getSim()->release(isRelease); } - PxU32 Sc::Scene::getNbParticleSystems() const { return mParticleSystems.size(); } - Sc::ParticleSystemCore* const* Sc::Scene::getParticleSystems() { return mParticleSystems.getEntries(); @@ -6019,9 +5884,6 @@ Sc::ConstraintCore*const * Sc::Scene::getConstraints() return mConstraints.getEntries(); } - - - // PX_AGGREGATE PxU32 Sc::Scene::createAggregate(void* userData, bool selfCollisions) { @@ -6328,7 +6190,6 @@ public: virtual const char* getName() const { return "OverlapFilterTask"; } }; - class OnOverlapCreatedTask : public Cm::Task { public: @@ -6393,11 +6254,8 @@ public: } virtual const char* getName() const { return "OnOverlapCreatedTask"; } - }; -#include <stdio.h> - void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation) { //Iterate over all filter tasks and work out how many pairs we need... @@ -6416,7 +6274,6 @@ void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation) { OverlapFilterTask* task = mOverlapFilterTasks[a]; - if (task->mNbToCallback) { //Iterate and process callbacks. Refilter then increment the results, setting the appropriate settings @@ -6470,12 +6327,8 @@ void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation) Bp::BroadPhasePair* bpPairs = mAABBManager->getBroadPhase()->getBroadPhasePairs(); - - Cm::FlushPool& flushPool = mLLContext->getTaskPool(); - - OnOverlapCreatedTask* createTask = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(OnOverlapCreatedTask)), OnOverlapCreatedTask)(mNPhaseCore, p, fInfo, cms, shapeInter, markerIter, bpPairs, 0); |