| 1148 | } |
| 1149 | |
| 1150 | void NpScene::removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch) |
| 1151 | { |
| 1152 | PX_PROFILE_ZONE("API.removeAggregate", getContextId()); |
| 1153 | NP_WRITE_CHECK(this); |
| 1154 | if(!removeFromSceneCheck(this, aggregate.getScene(), "PxScene::removeAggregate(): Aggregate")) |
| 1155 | return; |
| 1156 | |
| 1157 | NpAggregate& np = static_cast<NpAggregate&>(aggregate); |
| 1158 | if(np.getScene()!=this) |
| 1159 | return; |
| 1160 | |
| 1161 | const PxU32 nb = np.getCurrentSizeFast(); |
| 1162 | for(PxU32 j=0;j<nb;j++) |
| 1163 | { |
| 1164 | PxActor* a = np.getActorFast(j); |
| 1165 | PX_ASSERT(a); |
| 1166 | |
| 1167 | if (a->getType() != PxActorType::eARTICULATION_LINK) |
| 1168 | { |
| 1169 | Scb::Actor& scb = NpActor::getScbFromPxActor(*a); |
| 1170 | |
| 1171 | np.getScbAggregate().removeActor(scb, false); // This is only here to make sure the aggregateID gets set to invalid on sync |
| 1172 | |
| 1173 | removeActorInternal(*a, wakeOnLostTouch, false); |
| 1174 | } |
| 1175 | else if (a->getScene()) |
| 1176 | { |
| 1177 | NpArticulationLink& al = static_cast<NpArticulationLink&>(*a); |
| 1178 | PxArticulationBase& npArt = al.getRoot(); |
| 1179 | PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(npArt.getImpl()); |
| 1180 | NpArticulationLink* const* links = impl->getLinks(); |
| 1181 | for(PxU32 i=0; i < npArt.getNbLinks(); i++) |
| 1182 | { |
| 1183 | np.getScbAggregate().removeActor(links[i]->getScbActorFast(), false); // This is only here to make sure the aggregateID gets set to invalid on sync |
| 1184 | } |
| 1185 | |
| 1186 | removeArticulationInternal(npArt, wakeOnLostTouch, false); |
| 1187 | } |
| 1188 | } |
| 1189 | |
| 1190 | mScene.removeAggregate(np.getScbAggregate()); |
| 1191 | |
| 1192 | removeFromAggregateList(aggregate); |
| 1193 | } |
| 1194 | |
| 1195 | PxU32 NpScene::getNbAggregates() const |
| 1196 | { |
no test coverage detected