MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / switchRigidToNoSim

Method switchRigidToNoSim

physx/source/physx/src/buffering/ScbScene.cpp:464–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462
463
464void Scb::Scene::switchRigidToNoSim(Scb::RigidObject& r, bool isDynamic)
465{
466 PX_ASSERT(!mIsBuffering);
467
468 // when a simulation objects has a pending remove and then gets switched to a non-simulation object,
469 // we must not process the code below. On sync the object will get removed before this call.
470 if (r.getControlState() == ControlState::eIN_SCENE)
471 {
472 size_t ptrOffset = -Scb::Shape::getScOffset();
473 Ps::InlineArray<const Sc::ShapeCore*, 64> scShapes;
474
475 if (isDynamic)
476 mScene.removeBody(static_cast<Sc::BodyCore&>(r.getScRigidCore()), scShapes, true);
477 else
478 mScene.removeStatic(static_cast<Sc::StaticCore&>(r.getScRigidCore()), scShapes, true);
479
480 // not in simulation anymore -> decrement shape ref-counts
481 void* const* shapes = reinterpret_cast<void*const*>(const_cast<Sc::ShapeCore*const*>(scShapes.begin()));
482 for(PxU32 i=0; i < scShapes.size(); i++)
483 {
484 Scb::Shape& scbShape = *Ps::pointerOffset<Scb::Shape*>(shapes[i], ptrdiff_t(ptrOffset));
485 NpShapeDecRefCount(scbShape);
486 }
487 }
488}
489
490
491void Scb::Scene::switchRigidFromNoSim(Scb::RigidObject& r, bool isDynamic)

Callers 2

switchToNoSimMethod · 0.80
syncNoSimSwitchMethod · 0.80

Calls 6

getScOffsetFunction · 0.85
NpShapeDecRefCountFunction · 0.85
removeStaticMethod · 0.80
removeBodyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected