| 996 | } |
| 997 | |
| 998 | void NpScene::removeArticulationInternal(PxArticulationBase& npa, bool wakeOnLostTouch, bool removeFromAggregate) |
| 999 | { |
| 1000 | PxU32 nbLinks = npa.getNbLinks(); |
| 1001 | PX_ASSERT(nbLinks > 0); |
| 1002 | |
| 1003 | if(removeFromAggregate && npa.getAggregate()) |
| 1004 | { |
| 1005 | static_cast<NpAggregate*>(npa.getAggregate())->removeArticulationAndReinsert(npa, false); |
| 1006 | PX_ASSERT(!npa.getAggregate()); |
| 1007 | } |
| 1008 | |
| 1009 | //!!!AL |
| 1010 | // Inefficient. We might want to introduce a LL method to kill the whole LL articulation together with all joints in one go, then |
| 1011 | // the order of removing the links/joints does not matter anymore. |
| 1012 | |
| 1013 | // Remove links & joints |
| 1014 | PX_ALLOCA(linkStack, NpArticulationLink*, nbLinks); |
| 1015 | linkStack[0] = reinterpret_cast<PxArticulationImpl*>(npa.getImpl())->getLinks()[0]; |
| 1016 | PxU32 curLink = 0, stackSize = 1; |
| 1017 | |
| 1018 | while(curLink < (nbLinks-1)) |
| 1019 | { |
| 1020 | PX_ASSERT(curLink < stackSize); |
| 1021 | NpArticulationLink* l = linkStack[curLink]; |
| 1022 | NpArticulationLink*const* children = l->getChildren(); |
| 1023 | |
| 1024 | for(PxU32 i=0; i < l->getNbChildren(); i++) |
| 1025 | { |
| 1026 | linkStack[stackSize] = children[i]; |
| 1027 | stackSize++; |
| 1028 | } |
| 1029 | |
| 1030 | curLink++; |
| 1031 | } |
| 1032 | |
| 1033 | PxRigidBodyFlags flag; |
| 1034 | for(PxI32 j=PxI32(nbLinks); j-- > 0; ) |
| 1035 | { |
| 1036 | flag |=linkStack[j]->getScbBodyFast().getScBody().getCore().mFlags; |
| 1037 | removeArticulationLink(*linkStack[j], wakeOnLostTouch); |
| 1038 | } |
| 1039 | |
| 1040 | if (flag & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) |
| 1041 | { |
| 1042 | PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(npa.getImpl()); |
| 1043 | IG::NodeIndex index = impl->getScbArticulation().getScArticulation().getIslandNodeIndex(); |
| 1044 | if (index.isValid()) |
| 1045 | mScene.getScScene().resetSpeculativeCCDArticulationLink(index.index()); |
| 1046 | } |
| 1047 | // Remove articulation |
| 1048 | mScene.removeArticulation(reinterpret_cast<PxArticulationImpl*>(npa.getImpl())->getArticulation()); |
| 1049 | |
| 1050 | |
| 1051 | removeFromArticulationList(npa); |
| 1052 | } |
| 1053 | |
| 1054 | /////////////////////////////////////////////////////////////////////////////// |
| 1055 |
nothing calls this directly
no test coverage detected