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

Method addArticulationInternal

deps/physx/physx/source/physx/src/NpScene.cpp:856–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

854}
855
856void NpScene::addArticulationInternal(PxArticulationBase& npa)
857{
858 // Add root link first
859 PxU32 nbLinks = npa.getNbLinks();
860 PX_ASSERT(nbLinks > 0);
861 PxArticulationImpl* impl = reinterpret_cast<PxArticulationImpl*>(npa.getImpl());
862 NpArticulationLink* rootLink = static_cast<NpArticulationLink*>(impl->getRoot());
863
864 checkArticulationLink(this, rootLink);
865
866 bool linkTriggersWakeUp = !rootLink->getScbBodyFast().checkSleepReadinessBesidesWakeCounter();
867
868 addArticulationLinkBody(*rootLink);
869
870 // Add articulation
871 PxArticulationImpl* npaImpl = npa.getImpl();
872 Scb::Articulation& scbArt = npaImpl->getScbArticulation();
873 mScene.addArticulation(scbArt);
874
875 Sc::ArticulationCore& scArtCore = scbArt.getScArticulation();
876 Sc::ArticulationSim* scArtSim = scArtCore.getSim();
877
878 if (scArtSim)
879 {
880 PxU32 handle = scArtSim->findBodyIndex(*rootLink->getScbBodyFast().getScBody().getSim());
881 rootLink->setLLIndex(handle);
882 }
883 rootLink->setInboundJointDof(0);
884
885 addArticulationLinkConstraint(*rootLink);
886
887 // Add links & joints
888 PX_ALLOCA(linkStack, NpArticulationLink*, nbLinks);
889 linkStack[0] = rootLink;
890 PxU32 curLink = 0;
891 PxU32 stackSize = 1;
892 while(curLink < (nbLinks-1))
893 {
894 PX_ASSERT(curLink < stackSize);
895 NpArticulationLink* l = linkStack[curLink];
896 NpArticulationLink*const* children = l->getChildren();
897
898 for(PxU32 i=0; i < l->getNbChildren(); i++)
899 {
900 NpArticulationLink* child = children[i];
901
902 checkArticulationLink(this, child);
903
904 linkTriggersWakeUp = linkTriggersWakeUp || (!child->getScbBodyFast().checkSleepReadinessBesidesWakeCounter());
905
906 addArticulationLink(*child); // Adds joint too
907
908 //child->setInboundJointDof(scArtSim->getDof(cHandle));
909
910 linkStack[stackSize] = child;
911 stackSize++;
912 }
913

Callers 2

addActorInternalMethod · 0.80
addArticulationMethod · 0.80

Calls 15

checkArticulationLinkFunction · 0.85
findBodyIndexMethod · 0.80
setLLIndexMethod · 0.80
setInboundJointDofMethod · 0.80
getLinkIndexMethod · 0.80
getInboundJointMethod · 0.80
addLoopConstraintMethod · 0.80
getNbLinksMethod · 0.45
getImplMethod · 0.45
getRootMethod · 0.45
addArticulationMethod · 0.45

Tested by

no test coverage detected