| 462 | |
| 463 | |
| 464 | void 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 | |
| 491 | void Scb::Scene::switchRigidFromNoSim(Scb::RigidObject& r, bool isDynamic) |
no test coverage detected