[Opal-commits] opal/src/ODE ODEJoint.cpp,1.26,1.27 ODESimulator.cpp,1.80,1.81 ODESimulator.h,1.56,1.
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-01 05:04:35
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21242/src/ODE Modified Files: ODEJoint.cpp ODESimulator.cpp ODESimulator.h ODESolid.cpp Log Message: fixed bugs in xml blueprint loading; added ragdoll xml file to sample app Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** ODESimulator.h 25 Feb 2005 06:40:26 -0000 1.56 --- ODESimulator.h 1 Mar 2005 05:04:23 -0000 1.57 *************** *** 135,139 **** namespace ode_hidden { ! // They don't use the OPAL_CALL calling convention // because they are functors passed to ODE which expects a different // calling convention. --- 135,139 ---- namespace ode_hidden { ! // These function don't use the OPAL_CALL calling convention // because they are functors passed to ODE which expects a different // calling convention. *************** *** 144,152 **** /// Special collision callback functor for volume collision /// checking. ! void internal_pickingCollisionCallback(void* data, dGeomID o0, dGeomID o1); /// Collision callback functor for ray casting. ! void internal_rayCastingCollisionCallback(void* data, dGeomID o0, dGeomID o1); --- 144,152 ---- /// Special collision callback functor for volume collision /// checking. ! void internal_volumeCollisionCallback(void* data, dGeomID o0, dGeomID o1); /// Collision callback functor for ray casting. ! void internal_raycastCollisionCallback(void* data, dGeomID o0, dGeomID o1); Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** ODESimulator.cpp 25 Feb 2005 06:40:26 -0000 1.80 --- ODESimulator.cpp 1 Mar 2005 05:04:23 -0000 1.81 *************** *** 255,262 **** if (dGeomIsSpace(o0) || dGeomIsSpace(o1)) { ! //colliding a space with either a geom or another space dSpaceCollide2(o0, o1, data, &internal_collisionCallback); ! //colliding all geoms internal to the space if (dGeomIsSpace(o0)) { --- 255,262 ---- if (dGeomIsSpace(o0) || dGeomIsSpace(o1)) { ! // Colliding a space with either a geom or another space. dSpaceCollide2(o0, o1, data, &internal_collisionCallback); ! // Colliding all geoms internal to the space. if (dGeomIsSpace(o0)) { *************** *** 273,279 **** else { ! //colliding two geoms ! //use category/collide bitfields here, if applicable dBodyID o0BodyID = dGeomGetBody(o0); --- 273,279 ---- else { ! // Colliding two geoms. ! // Use category/collide bitfields here? dBodyID o0BodyID = dGeomGetBody(o0); *************** *** 311,315 **** } ! //now actually test for collision between the two geoms ODESimulator* sim = (ODESimulator*)data; dWorldID theWorldID = sim->internal_getWorldID(); --- 311,315 ---- } ! // Now actually test for collision between the two geoms. ODESimulator* sim = (ODESimulator*)data; dWorldID theWorldID = sim->internal_getWorldID(); *************** *** 318,322 **** dContactGeom contactArray[defaults::ode::maxContactPoints]; int numContacts = dCollide(o0, o1, ! defaults::ode::maxContactPoints, contactArray, sizeof(dContactGeom)); if (0 == numContacts) --- 318,323 ---- dContactGeom contactArray[defaults::ode::maxContactPoints]; int numContacts = dCollide(o0, o1, ! defaults::ode::maxContactPoints, contactArray, ! sizeof(dContactGeom)); if (0 == numContacts) *************** *** 326,331 **** dContact tempContact; ! bool generateContacts0 = true; // default to true ! bool generateContacts1 = true; // default to true GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); --- 327,332 ---- dContact tempContact; ! bool generateContacts0 = true; // Default to true. ! bool generateContacts1 = true; // Default to true. GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); *************** *** 333,343 **** Solid* solid1 = geomData1->solid; ! // early check to save some time if (solid0->getEventHandler() || solid1->getEventHandler()) { ! //call the event handlers - they will return true if they ! //want contacts generated; note: we only generate two ! //events per object/object collision; just use the ! //first contact to pass data to the event handlers CollisionEvent e; --- 334,344 ---- Solid* solid1 = geomData1->solid; ! // Early check to save some time. if (solid0->getEventHandler() || solid1->getEventHandler()) { ! // Call the event handlers - they will return true if ! // they want contacts generated. Note: we only want up to ! // two events per object/object collision; just use the ! // first contact to pass data to the event handlers. CollisionEvent e; *************** *** 359,368 **** } ! e.normal *= -1; //invert normal ! e.solid0 = solid1; //swap solid pointers e.solid1 = solid0; eventHandler = solid1->getEventHandler(); ! if (solid1->getEventHandler()) { generateContacts1 = --- 360,369 ---- } ! e.normal *= -1; // Invert normal. ! e.solid0 = solid1; // Swap solid pointers. e.solid1 = solid0; eventHandler = solid1->getEventHandler(); ! if (eventHandler) { generateContacts1 = *************** *** 371,375 **** } ! // handle one-sided contacts for two cases: 1) only one of // the above event handlers actually wants contacts generated, // 2) if the mass ratio is above some threshold, treat it as --- 372,376 ---- } ! // Handle one-sided contacts for two cases: 1) only one of // the above event handlers actually wants contacts generated, // 2) if the mass ratio is above some threshold, treat it as *************** *** 378,382 **** // (with the massive one being static), then also add the // massive object's velocity to the smaller one (velocity ! // calculated at the point of collision) if (true == generateContacts0 || true == generateContacts1) --- 379,383 ---- // (with the massive one being static), then also add the // massive object's velocity to the smaller one (velocity ! // calculated at the point of collision). if (true == generateContacts0 || true == generateContacts1) *************** *** 545,549 **** // Note: o0 should always be the main object (the geom to check against // everything else). ! void internal_pickingCollisionCallback(void* data, dGeomID o0, dGeomID o1) { --- 546,550 ---- // Note: o0 should always be the main object (the geom to check against // everything else). ! void internal_volumeCollisionCallback(void* data, dGeomID o0, dGeomID o1) { *************** *** 552,556 **** //colliding a space with either a geom or another space dSpaceCollide2(o0, o1, data, ! &internal_pickingCollisionCallback); } else --- 553,557 ---- //colliding a space with either a geom or another space dSpaceCollide2(o0, o1, data, ! &internal_volumeCollisionCallback); } else *************** *** 590,594 **** ODESimulator* sim = (ODESimulator*)data; ! // TODO: not sure if we can know that o1 is the picking // object, so we'll // just call this twice for now --- 591,595 ---- ODESimulator* sim = (ODESimulator*)data; ! // TODO: not sure if we can know that o1 is the volume // object, so we'll // just call this twice for now *************** *** 604,608 **** // Note: o1 is the ray geom. ! void internal_rayCastingCollisionCallback(void* data, dGeomID o0, dGeomID o1) { --- 605,609 ---- // Note: o1 is the ray geom. ! void internal_raycastCollisionCallback(void* data, dGeomID o0, dGeomID o1) { *************** *** 611,615 **** //colliding a space with either a geom or another space dSpaceCollide2(o0, o1, data, ! &internal_pickingCollisionCallback); } else --- 612,616 ---- //colliding a space with either a geom or another space dSpaceCollide2(o0, o1, data, ! &internal_volumeCollisionCallback); } else *************** *** 730,734 **** // solidIter != mCollidedSolids.end(); ++solidIter) // { ! // //we don't want the picking solid to be added // if (*solidIter != solid) // { --- 731,735 ---- // solidIter != mCollidedSolids.end(); ++solidIter) // { ! // //we don't want the volume solid to be added // if (*solidIter != solid) // { *************** *** 752,756 **** //check for collisions; this will fill mRayHit (if a collision occurs) dSpaceCollide2(rayGeomID, (dGeomID)mRootSpaceID, this, ! &ode_hidden::internal_rayCastingCollisionCallback); RayHit rayHit; --- 753,757 ---- //check for collisions; this will fill mRayHit (if a collision occurs) dSpaceCollide2(rayGeomID, (dGeomID)mRootSpaceID, this, ! &ode_hidden::internal_raycastCollisionCallback); RayHit rayHit; Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** ODESolid.cpp 26 Feb 2005 10:22:24 -0000 1.72 --- ODESolid.cpp 1 Mar 2005 05:04:23 -0000 1.73 *************** *** 138,141 **** --- 138,144 ---- setGlobalLinearVel(data.globalLinearVel); setGlobalAngularVel(data.globalAngularVel); + + // Set the Solid's name. + setName(data.name); } Index: ODEJoint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ODEJoint.cpp 26 Feb 2005 10:22:24 -0000 1.26 --- ODEJoint.cpp 1 Mar 2005 05:04:23 -0000 1.27 *************** *** 165,171 **** } ! // Allocate an ODE JointFeedback struct for this Joint. // TODO: for ball joints, should this get the joint id or the // amotor id? dJointSetFeedback(mJointID, &mJointFeedback); --- 165,183 ---- } ! // Tell ODE about the JointFeedback struct for this Joint. // TODO: for ball joints, should this get the joint id or the // amotor id? + mJointFeedback.f1[0] = 0; + mJointFeedback.f1[1] = 0; + mJointFeedback.f1[2] = 0; + mJointFeedback.t1[0] = 0; + mJointFeedback.t1[1] = 0; + mJointFeedback.t1[2] = 0; + mJointFeedback.f2[0] = 0; + mJointFeedback.f2[1] = 0; + mJointFeedback.f2[2] = 0; + mJointFeedback.t2[0] = 0; + mJointFeedback.t2[1] = 0; + mJointFeedback.t2[2] = 0; dJointSetFeedback(mJointID, &mJointFeedback); *************** *** 861,864 **** --- 873,880 ---- { dJointAttach(mJointID, 0, 0); + if (BALL_JOINT == mData.getType()) + { + dJointAttach(mAMotorID, 0, 0); + } } else *************** *** 867,874 **** --- 883,898 ---- { dJointAttach(mJointID, 0, solid1->internal_getBodyID()); + if (BALL_JOINT == mData.getType()) + { + dJointAttach(mAMotorID, 0, solid1->internal_getBodyID()); + } } else if (NULL == solid1) { dJointAttach(mJointID, solid0->internal_getBodyID(), 0); + if (BALL_JOINT == mData.getType()) + { + dJointAttach(mAMotorID, solid0->internal_getBodyID(), 0); + } } else *************** *** 876,879 **** --- 900,908 ---- dJointAttach(mJointID, solid0->internal_getBodyID(), solid1->internal_getBodyID()); + if (BALL_JOINT == mData.getType()) + { + dJointAttach(mAMotorID, solid0->internal_getBodyID(), + solid1->internal_getBodyID()); + } } |