| 5316 | } |
| 5317 | |
| 5318 | void Sc::Scene::onBodyWakeUp(BodySim* body) |
| 5319 | { |
| 5320 | if(!mSimulationEventCallback) |
| 5321 | return; |
| 5322 | |
| 5323 | if (body->readInternalFlag(BodySim::BF_SLEEP_NOTIFY)) |
| 5324 | { |
| 5325 | PX_ASSERT(!body->readInternalFlag(BodySim::BF_WAKEUP_NOTIFY)); |
| 5326 | |
| 5327 | // Body is in the list of sleeping bodies, hence, mark this list as dirty such it gets cleaned up before |
| 5328 | // being sent to the user |
| 5329 | body->clearInternalFlag(BodySim::BF_SLEEP_NOTIFY); |
| 5330 | mSleepBodyListValid = false; |
| 5331 | } |
| 5332 | |
| 5333 | body->raiseInternalFlag(BodySim::BF_WAKEUP_NOTIFY); |
| 5334 | |
| 5335 | // Avoid multiple insertion (the user can do multiple transitions between asleep and awake) |
| 5336 | if (!body->readInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST)) |
| 5337 | { |
| 5338 | PX_ASSERT(!mWokeBodies.contains(&body->getBodyCore())); |
| 5339 | mWokeBodies.insert(&body->getBodyCore()); |
| 5340 | body->raiseInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST); |
| 5341 | } |
| 5342 | } |
| 5343 | |
| 5344 | PX_INLINE void Sc::Scene::cleanUpSleepBodies() |
| 5345 | { |