From f205de7847da7ae1c10212d82e7042d0100b4ce0 Mon Sep 17 00:00:00 2001 From: dan miller Date: Fri, 19 Oct 2007 05:24:38 +0000 Subject: from the start... checking in ode-0.9 --- .../contrib/BreakableJoints/diff/joint.cpp.diff | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 libraries/ode-0.9/contrib/BreakableJoints/diff/joint.cpp.diff (limited to 'libraries/ode-0.9/contrib/BreakableJoints/diff/joint.cpp.diff') diff --git a/libraries/ode-0.9/contrib/BreakableJoints/diff/joint.cpp.diff b/libraries/ode-0.9/contrib/BreakableJoints/diff/joint.cpp.diff new file mode 100644 index 0000000..80397f0 --- /dev/null +++ b/libraries/ode-0.9/contrib/BreakableJoints/diff/joint.cpp.diff @@ -0,0 +1,148 @@ +2659,2804d2658 +< +< /******************** breakable joint contribution ***********************/ +< extern "C" void dJointSetBreakable (dxJoint *joint, int b) { +< dAASSERT(joint); +< if (b) { +< // we want this joint to be breakable but we must first check if it +< // was already breakable +< if (!joint->breakInfo) { +< // allocate a dxJointBreakInfo struct +< joint->breakInfo = new dxJointBreakInfo; +< joint->breakInfo->flags = 0; +< for (int i = 0; i < 3; i++) { +< joint->breakInfo->b1MaxF[0] = 0; +< joint->breakInfo->b1MaxT[0] = 0; +< joint->breakInfo->b2MaxF[0] = 0; +< joint->breakInfo->b2MaxT[0] = 0; +< } +< joint->breakInfo->callback = 0; +< } +< else { +< // the joint was already breakable +< return; +< } +< } +< else { +< // we want this joint to be unbreakable mut we must first check if +< // it is alreay unbreakable +< if (joint->breakInfo) { +< // deallocate the dxJointBreakInfo struct +< delete joint->breakInfo; +< joint->breakInfo = 0; +< } +< else { +< // the joint was already unbreakable +< return; +< } +< } +< } +< +< extern "C" void dJointSetBreakCallback (dxJoint *joint, dJointBreakCallback *callbackFunc) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointSetBreakCallback called on unbreakable joint"); +< } +< # endif +< joint->breakInfo->callback = callbackFunc; +< } +< +< extern "C" void dJointSetBreakMode (dxJoint *joint, int mode) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointSetBreakMode called on unbreakable joint"); +< } +< # endif +< joint->breakInfo->flags = mode; +< } +< +< extern "C" int dJointGetBreakMode (dxJoint *joint) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointGetBreakMode called on unbreakable joint"); +< } +< # endif +< return joint->breakInfo->flags; +< } +< +< extern "C" void dJointSetBreakForce (dxJoint *joint, int body, dReal x, dReal y, dReal z) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointSetBreakForce called on unbreakable joint"); +< } +< # endif +< if (body) { +< joint->breakInfo->b2MaxF[0] = x; +< joint->breakInfo->b2MaxF[1] = y; +< joint->breakInfo->b2MaxF[2] = z; +< } +< else { +< joint->breakInfo->b1MaxF[0] = x; +< joint->breakInfo->b1MaxF[1] = y; +< joint->breakInfo->b1MaxF[2] = z; +< } +< } +< +< extern "C" void dJointSetBreakTorque (dxJoint *joint, int body, dReal x, dReal y, dReal z) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointSetBreakTorque called on unbreakable joint"); +< } +< # endif +< if (body) { +< joint->breakInfo->b2MaxT[0] = x; +< joint->breakInfo->b2MaxT[1] = y; +< joint->breakInfo->b2MaxT[2] = z; +< } +< else { +< joint->breakInfo->b1MaxT[0] = x; +< joint->breakInfo->b1MaxT[1] = y; +< joint->breakInfo->b1MaxT[2] = z; +< } +< } +< +< extern "C" int dJointIsBreakable (dxJoint *joint) { +< dAASSERT(joint); +< return joint->breakInfo != 0; +< } +< +< extern "C" void dJointGetBreakForce (dxJoint *joint, int body, dReal *force) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointGetBreakForce called on unbreakable joint"); +< } +< # endif +< if (body) +< for (int i=0; i<3; i++) force[i]=joint->breakInfo->b2MaxF[i]; +< else +< for (int i=0; i<3; i++) force[i]=joint->breakInfo->b1MaxF[i]; +< } +< +< extern "C" void dJointGetBreakTorque (dxJoint *joint, int body, dReal *torque) { +< dAASSERT(joint); +< # ifndef dNODEBUG +< // only works for a breakable joint +< if (!joint->breakInfo) { +< dDebug (0, "dJointGetBreakTorque called on unbreakable joint"); +< } +< # endif +< if (body) +< for (int i=0; i<3; i++) torque[i]=joint->breakInfo->b2MaxT[i]; +< else +< for (int i=0; i<3; i++) torque[i]=joint->breakInfo->b1MaxT[i]; +< } +< /*************************************************************************/ +< +\ No newline at end of file -- cgit v1.1