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

Method findActorPair

physx/source/simulationcontroller/src/ScNPhaseCore.cpp:1006–1065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006Sc::ActorPair* Sc::NPhaseCore::findActorPair(ShapeSim* s0, ShapeSim* s1, Ps::IntBool isReportPair)
1007{
1008 PX_ASSERT(!(s0->getFlags() & PxShapeFlag::eTRIGGER_SHAPE)
1009 && !(s1->getFlags() & PxShapeFlag::eTRIGGER_SHAPE));
1010 // This method is only for the case where a ShapeInteraction is going to be created.
1011 // Else we might create an ActorPair that does not get referenced and causes a mem leak.
1012
1013 BodyPairKey key;
1014
1015 RigidSim* aLess = &s0->getRbSim();
1016 RigidSim* aMore = &s1->getRbSim();
1017
1018 if(aLess->getRigidID() > aMore->getRigidID())
1019 Ps::swap(aLess, aMore);
1020
1021 key.mSim0 = aLess->getRigidID();
1022 key.mSim1 = aMore->getRigidID();
1023
1024 Sc::ActorPair*& actorPair = mActorPairMap[key];
1025
1026 //PX_ASSERT(actorPair == NULL || actorPair->getRefCount() > 0);
1027 if(actorPair == NULL)
1028 {
1029 if(!isReportPair)
1030 actorPair = mActorPairPool.construct();
1031 else
1032 actorPair = mActorPairReportPool.construct(s0->getRbSim(), s1->getRbSim());
1033 }
1034
1035 Ps::IntBool actorPairHasReports = actorPair->isReportPair();
1036
1037 if(!isReportPair || actorPairHasReports)
1038 return actorPair;
1039 else
1040 {
1041 PxU32 size = aLess->getActorInteractionCount();
1042 Interaction** interactions = aLess->getActorInteractions();
1043
1044 ActorPairReport* actorPairReport = mActorPairReportPool.construct(s0->getRbSim(), s1->getRbSim());
1045 actorPairReport->convert(*actorPair);
1046
1047 while(size--)
1048 {
1049 Interaction* interaction = *interactions++;
1050 if((&interaction->getActorSim0() == aMore) || (&interaction->getActorSim1() == aMore))
1051 {
1052 PX_ASSERT(((&interaction->getActorSim0() == aLess) || (&interaction->getActorSim1() == aLess)));
1053
1054 if(interaction->getType() == InteractionType::eOVERLAP)
1055 {
1056 ShapeInteraction* si = static_cast<ShapeInteraction*>(interaction);
1057 if(si->getActorPair() != NULL)
1058 si->setActorPair(*actorPairReport);
1059 }
1060 }
1061 }
1062 actorPair = actorPairReport;
1063 }

Callers

nothing calls this directly

Calls 10

getActorInteractionsMethod · 0.80
getActorPairMethod · 0.80
setActorPairMethod · 0.80
swapFunction · 0.50
getFlagsMethod · 0.45
getRigidIDMethod · 0.45
constructMethod · 0.45
convertMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected