| 1180 | } |
| 1181 | |
| 1182 | void NpScene::removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch) |
| 1183 | { |
| 1184 | PX_PROFILE_ZONE("API.removeAggregate", getContextId()); |
| 1185 | NP_WRITE_CHECK(this); |
| 1186 | if(!removeFromSceneCheck(this, aggregate.getScene(), "PxScene::removeAggregate(): Aggregate")) |
| 1187 | return; |
| 1188 | |
| 1189 | NpAggregate& np = static_cast<NpAggregate&>(aggregate); |
| 1190 | if(np.getScene()!=this) |
| 1191 | return; |
| 1192 | |
| 1193 | const PxU32 nb = np.getCurrentSizeFast(); |
| 1194 | for(PxU32 j=0;j<nb;j++) |
| 1195 | { |
| 1196 | PxActor* a = np.getActorFast(j); |
| 1197 | PX_ASSERT(a); |
| 1198 | |
| 1199 | if (a->getType() != PxActorType::eARTICULATION_LINK) |
| 1200 | { |
| 1201 | Scb::Actor& scb = NpActor::getScbFromPxActor(*a); |
| 1202 | |
| 1203 | np.getScbAggregate().removeActor(scb, false); // This is only here to make sure the aggregateID gets set to invalid on sync |
| 1204 | |
| 1205 | removeActorInternal(*a, wakeOnLostTouch, false); |
| 1206 | } |
| 1207 | else if (a->getScene()) |
| 1208 | { |
| 1209 | NpArticulationLink& al = static_cast<NpArticulationLink&>(*a); |
| 1210 | PxArticulationBase& npArt = al.getRoot(); |
| 1211 | PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(npArt.getImpl()); |
| 1212 | NpArticulationLink* const* links = impl->getLinks(); |
| 1213 | for(PxU32 i=0; i < npArt.getNbLinks(); i++) |
| 1214 | { |
| 1215 | np.getScbAggregate().removeActor(links[i]->getScbActorFast(), false); // This is only here to make sure the aggregateID gets set to invalid on sync |
| 1216 | } |
| 1217 | |
| 1218 | removeArticulationInternal(npArt, wakeOnLostTouch, false); |
| 1219 | } |
| 1220 | } |
| 1221 | |
| 1222 | mScene.removeAggregate(np.getScbAggregate()); |
| 1223 | |
| 1224 | removeFromAggregateList(aggregate); |
| 1225 | } |
| 1226 | |
| 1227 | PxU32 NpScene::getNbAggregates() const |
| 1228 | { |
no test coverage detected