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

Method setConstraintFunctions

physx/source/physx/src/NpConstraint.cpp:42–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40using namespace physx;
41
42void NpConstraint::setConstraintFunctions(PxConstraintConnector& n, const PxConstraintShaderTable& shaders)
43{
44 mConstraint.getScConstraint().setConstraintFunctions(n, shaders);
45
46 //update mConnectorArray, since mActor0 or mActor1 should be in external reference
47 bool bNeedUpdate = false;
48 if(mActor0)
49 {
50 NpActor& npActor = NpActor::getFromPxActor(*mActor0);
51 if(npActor.findConnector(NpConnectorType::eConstraint, this) == 0xffffffff)
52 {
53 bNeedUpdate = true;
54 npActor.addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 0: Constraint already added");
55 }
56 }
57
58 if(mActor1)
59 {
60 NpActor& npActor = NpActor::getFromPxActor(*mActor1);
61 if(npActor.findConnector(NpConnectorType::eConstraint, this) == 0xffffffff)
62 {
63 bNeedUpdate = true;
64 npActor.addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 1: Constraint already added");
65 }
66 }
67
68 if(bNeedUpdate)
69 {
70 NpScene* newScene = getSceneFromActors(mActor0, mActor1);
71 NpScene* oldScene = getNpScene();
72
73 if (oldScene != newScene)
74 {
75 if (oldScene)
76 {
77 oldScene->removeFromConstraintList(*this);
78 oldScene->getScene().removeConstraint(getScbConstraint());
79 }
80 if (newScene)
81 {
82 newScene->addToConstraintList(*this);
83 newScene->getScene().addConstraint(getScbConstraint());
84 }
85 }
86 }
87}
88
89NpConstraint::NpConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize)
90: PxConstraint(PxConcreteType::eCONSTRAINT, PxBaseFlag::eOWNS_MEMORY)

Callers 2

resolveConstraintPtrMethod · 0.45
resolveConstraintPtrFunction · 0.45

Calls 8

getNpSceneFunction · 0.85
findConnectorMethod · 0.80
addConnectorMethod · 0.80
addToConstraintListMethod · 0.80
removeConstraintMethod · 0.45
getSceneMethod · 0.45
addConstraintMethod · 0.45

Tested by

no test coverage detected