MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / addCollection

Method addCollection

physx/source/physx/src/NpFactory.cpp:610–702  ·  view source on GitHub ↗

PT: this function is here to minimize the amount of locks when deserializing a collection

Source from the content-addressed store, hash-verified

608
609// PT: this function is here to minimize the amount of locks when deserializing a collection
610void NpFactory::addCollection(const Cm::Collection& collection)
611{
612
613 PxU32 nb = collection.getNbObjects();
614 const Ps::Pair<PxBase* const, PxSerialObjectId>* entries = collection.internalGetObjects();
615 // PT: we take the lock only once, here
616 Ps::Mutex::ScopedLock lock(mTrackingMutex);
617
618 for(PxU32 i=0;i<nb;i++)
619 {
620 PxBase* s = entries[i].first;
621 const PxType serialType = s->getConcreteType();
622//////////////////////////
623 if(serialType==PxConcreteType::eHEIGHTFIELD)
624 {
625 Gu::HeightField* gu = static_cast<Gu::HeightField*>(s);
626 gu->setMeshFactory(this);
627 addHeightField(gu, false);
628 }
629 else if(serialType==PxConcreteType::eCONVEX_MESH)
630 {
631 Gu::ConvexMesh* gu = static_cast<Gu::ConvexMesh*>(s);
632 gu->setMeshFactory(this);
633 addConvexMesh(gu, false);
634 }
635 else if(serialType==PxConcreteType::eTRIANGLE_MESH_BVH33 || serialType==PxConcreteType::eTRIANGLE_MESH_BVH34)
636 {
637 Gu::TriangleMesh* gu = static_cast<Gu::TriangleMesh*>(s);
638 gu->setMeshFactory(this);
639 addTriangleMesh(gu, false);
640 }
641 else if(serialType==PxConcreteType::eRIGID_DYNAMIC)
642 {
643 NpRigidDynamic* np = static_cast<NpRigidDynamic*>(s);
644 addRigidDynamic(np, false);
645 }
646 else if(serialType==PxConcreteType::eRIGID_STATIC)
647 {
648 NpRigidStatic* np = static_cast<NpRigidStatic*>(s);
649 addRigidStatic(np, false);
650 }
651 else if(serialType==PxConcreteType::eSHAPE)
652 {
653 NpShape* np = static_cast<NpShape*>(s);
654 addShape(np, false);
655 }
656 else if(serialType==PxConcreteType::eMATERIAL)
657 {
658 }
659 else if(serialType==PxConcreteType::eCONSTRAINT)
660 {
661 NpConstraint* np = static_cast<NpConstraint*>(s);
662 addConstraint(np, false);
663 }
664 else if(serialType==PxConcreteType::eAGGREGATE)
665 {
666 NpAggregate* np = static_cast<NpAggregate*>(s);
667 addAggregate(np, false);

Callers

nothing calls this directly

Calls 5

getCurrentSizeFastMethod · 0.80
getActorFastMethod · 0.80
getNbObjectsMethod · 0.45
getConcreteTypeMethod · 0.45
setMeshFactoryMethod · 0.45

Tested by

no test coverage detected