| 240 | } |
| 241 | |
| 242 | bool NpAggregate::addArticulation(PxArticulationBase& art) |
| 243 | { |
| 244 | NP_WRITE_CHECK(getOwnerScene()); |
| 245 | PX_SIMD_GUARD; |
| 246 | |
| 247 | if((mNbActors+art.getNbLinks()) > mAggregate.getMaxActorCount()) |
| 248 | { |
| 249 | Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxAggregate: can't add articulation links, max number of actors reached"); |
| 250 | return false; |
| 251 | } |
| 252 | |
| 253 | if(art.getAggregate()) |
| 254 | { |
| 255 | Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxAggregate: can't add articulation to aggregate, articulation already belongs to an aggregate"); |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | if(art.getScene()) |
| 260 | { |
| 261 | Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxAggregate: can't add articulation to aggregate, articulation already belongs to a scene"); |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(art.getImpl()); |
| 266 | impl->setAggregate(this); |
| 267 | NpArticulationLink* const* links = impl->getLinks(); |
| 268 | for(PxU32 i=0; i < impl->getNbLinks(); i++) |
| 269 | { |
| 270 | NpArticulationLink& l = *links[i]; |
| 271 | |
| 272 | setAggregate(this, l); |
| 273 | |
| 274 | mActors[mNbActors++] = &l; |
| 275 | |
| 276 | mAggregate.addActor(l.getScbActorFast()); |
| 277 | } |
| 278 | |
| 279 | // PT: when an object is added to a aggregate at runtime, i.e. when the aggregate has already been added to the scene, |
| 280 | // we need to immediately add the newcomer to the scene as well. |
| 281 | NpScene* s = getAPIScene(); |
| 282 | if(s) |
| 283 | { |
| 284 | s->addArticulationInternal(art); |
| 285 | } |
| 286 | |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | bool NpAggregate::removeArticulationAndReinsert(PxArticulationBase& art, bool reinsert) |
| 291 | { |
nothing calls this directly
no test coverage detected