| 854 | } |
| 855 | |
| 856 | void 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 |
no test coverage detected