| 40 | using namespace physx; |
| 41 | |
| 42 | void 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 | |
| 89 | NpConstraint::NpConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) |
| 90 | : PxConstraint(PxConcreteType::eCONSTRAINT, PxBaseFlag::eOWNS_MEMORY) |
no test coverage detected