MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / addArticulation

Method addArticulation

deps/physx/physx/source/physx/src/NpAggregate.cpp:242–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242bool 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
290bool NpAggregate::removeArticulationAndReinsert(PxArticulationBase& art, bool reinsert)
291{

Callers

nothing calls this directly

Calls 11

getMaxActorCountMethod · 0.80
setAggregateFunction · 0.70
getNbLinksMethod · 0.45
errorMethod · 0.45
getAggregateMethod · 0.45
getSceneMethod · 0.45
getImplMethod · 0.45
setAggregateMethod · 0.45
getLinksMethod · 0.45
addActorMethod · 0.45

Tested by

no test coverage detected