[Opal-commits] opal/src/ODE ODEJoint.h,1.30,1.31 ODESolid.cpp,1.73,1.74 ODESolid.h,1.63,1.64
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-03-04 23:27:05
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21757/src/ODE Modified Files: ODEJoint.h ODESolid.cpp ODESolid.h Log Message: added a define to conditionally compile mesh support (mainly for ODE on IRIX which can't use trimeshes); removed some old commented-out code Index: ODEJoint.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODEJoint.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ODEJoint.h 26 Feb 2005 10:22:24 -0000 1.30 --- ODEJoint.h 4 Mar 2005 23:26:54 -0000 1.31 *************** *** 57,64 **** virtual void OPAL_CALL setLimitsEnabled(int axisNum, bool e); - //virtual void OPAL_CALL setLimits(int axisNum, JointLimits l); - - //virtual const JointLimits& OPAL_CALL getLimits(int axisNum)const; - virtual void OPAL_CALL setEnabled(bool e); --- 57,60 ---- *************** *** 87,94 **** void setJointParam(int parameter, dReal value); - /// Helper function to make it easier to get parameters for - /// various ODE Joint types. - //real getJointParam(int parameter)const; - /// Returns the current amount of stress on this Joint. virtual real calcStress(); --- 83,86 ---- Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** ODESolid.h 25 Feb 2005 06:40:26 -0000 1.63 --- ODESolid.h 4 Mar 2005 23:26:54 -0000 1.64 *************** *** 47,51 **** --- 47,53 ---- spaceID = 0; transformID = 0; + #ifdef OPAL_USE_MESH trimeshDataID = 0; + #endif } *************** *** 55,59 **** --- 57,63 ---- dSpaceID spaceID; dGeomID transformID; + #ifdef OPAL_USE_MESH dTriMeshDataID trimeshDataID; // only used for Solids with trimeshes + #endif }; *************** *** 83,115 **** virtual void OPAL_CALL addShape(const ShapeData& data); - //virtual void OPAL_CALL addBox(const Vec3r& dimensions, - // const Matrix44r& offset = Matrix44r(), - // const Material& m = defaults::material); - - //virtual void OPAL_CALL addSphere(real radius, - // const Matrix44r& offset = Matrix44r(), - // const Material& m = defaults::material); - - //virtual void OPAL_CALL addPlane(real abcd[4], - // const Material& m = defaults::material); - - ////note: normal cylinders are not yet part of standard ODE - ////virtual void addCylinder(real radius, real length, - //// const Matrix44r& offset = Matrix44r(), - //// const Material& m = defaults::material); - - //virtual void OPAL_CALL addCapsule(real radius, real length, - // const Matrix44r& offset = Matrix44r(), - // const Material& m = defaults::material); - - //virtual void OPAL_CALL addRay(const Point3r& origin, const Vec3r& dir, - // real length, const Matrix44r& offset = Matrix44r(), - // const Material& m = defaults::material); - // - //virtual void OPAL_CALL addMesh(const real* vertexArray[3], - // int numVertices, const int* faceArray, int numFaces, - // const Matrix44r& offset = Matrix44r(), - // const Material& m = defaults::material); - virtual void OPAL_CALL setLocalLinearVel(const Vec3r& vel); --- 87,90 ---- Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ODESolid.cpp 1 Mar 2005 05:04:23 -0000 1.73 --- ODESolid.cpp 4 Mar 2005 23:26:54 -0000 1.74 *************** *** 82,85 **** --- 82,86 ---- } + #ifdef OPAL_USE_MESH if (0 != mGeomDataList.back()->trimeshDataID) { *************** *** 89,92 **** --- 90,94 ---- dGeomTriMeshDataDestroy(mGeomDataList.back()->trimeshDataID); } + #endif // Destroy the ODE geom. *************** *** 338,342 **** // Rays have no mass. break; ! // TODO: add MESH_SHAPE type default: assert(false); --- 340,346 ---- // Rays have no mass. break; ! case MESH_SHAPE: ! // Not implemented. ! break; default: assert(false); *************** *** 480,484 **** --- 484,492 ---- dGeomID newGeomID = NULL; dGeomID newTransformID = NULL; + + #ifdef OPAL_USE_MESH dTriMeshDataID newTrimeshDataID = NULL; + #endif + dSpaceID spaceID = NULL; dMass newMass; *************** *** 487,492 **** { // No offset transform. - //newGeomID = dCreateBox(mSpaceID, dimensions[0], dimensions[1], - // dimensions[2]); spaceID = mSpaceID; newTransformID = 0; --- 495,498 ---- *************** *** 495,500 **** { // Use ODE's geom transform object. - //newGeomID = dCreateBox(0, dimensions[0], dimensions[1], - // dimensions[2]); spaceID = 0; newTransformID = dCreateGeomTransform(mSpaceID); --- 501,504 ---- *************** *** 534,542 **** (dReal)capsuleData.radius, (dReal)capsuleData.length); ! //The "direction" parameter orients the mass along one of the ! //body's local axes; x=1, y=2, z=3. TODO: This might be weird ! //if this capsule is not oriented along one of the body's axes. ! //Maybe have a default value in the Simulator that the user can ! //change. dMassSetCappedCylinder(&newMass, (dReal)data.material.density, 3, (dReal)capsuleData.radius, (dReal)capsuleData.length); --- 538,546 ---- (dReal)capsuleData.radius, (dReal)capsuleData.length); ! // The "direction" parameter orients the mass along one of the ! // body's local axes; x=1, y=2, z=3. TODO: This might be weird ! // if this capsule is not oriented along one of the body's axes. ! // Maybe have a default value in the Simulator that the user can ! // change. dMassSetCappedCylinder(&newMass, (dReal)data.material.density, 3, (dReal)capsuleData.radius, (dReal)capsuleData.length); *************** *** 548,553 **** if (!mData.isStatic) { ! // TODO: print warning: opal::ODESolid::addPlane: plane ! // Shape added to a non-static Solid. // ODE planes can't have bodies, so make it static. --- 552,558 ---- if (!mData.isStatic) { ! OPAL_LOGGER("warning") << "opal::ODESolid::addPlane: " << ! "Plane Shape added to a non-static Solid. " << ! "The Solid will be made static." << std::endl; // ODE planes can't have bodies, so make it static. *************** *** 588,591 **** --- 593,597 ---- break; } + #ifdef OPAL_USE_MESH case MESH_SHAPE: { *************** *** 607,610 **** --- 613,617 ---- break; } + #endif default: assert(false); *************** *** 623,627 **** --- 630,637 ---- newGeomData->transformID = newTransformID; newGeomData->spaceID = mSpaceID; + + #ifdef OPAL_USE_MESH newGeomData->trimeshDataID = newTrimeshDataID; + #endif // Setup the geom. *************** *** 629,915 **** } - //void ODESolid::addBox(const Vec3r& dimensions, const Matrix44r& offset, - // const Material& m) - //{ - // dGeomID newGeomID; - // dGeomID newTransformID; - - // if(Matrix44r() == offset) - // { - // //no offset transform - // newGeomID = dCreateBox(mSpaceID, dimensions[0], dimensions[1], - // dimensions[2]); - // newTransformID = 0; - // } - // else - // { - // //use ODE's geom transform object - // newGeomID = dCreateBox(0, dimensions[0], dimensions[1], - // dimensions[2]); - // newTransformID = dCreateGeomTransform(mSpaceID); - // } - - // if (!mStatic) - // { - // //setup new mass - // dMass newMass; - // dMassSetBox(&newMass, m.density, dimensions[0], dimensions[1], - // dimensions[2]); - // addMass(newMass, offset); - // } - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = newTransformID; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = BOX_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset = offset; - // newGeomData->shape.dimensions[0] = dimensions[0]; - // newGeomData->shape.dimensions[1] = dimensions[1]; - // newGeomData->shape.dimensions[2] = dimensions[2]; - - // setupNewGeom(newGeomData); - //} - - //void ODESolid::addSphere(real radius, const Matrix44r& offset, - // const Material& m) - //{ - // dGeomID newGeomID; - // dGeomID newTransformID; - - // if(Matrix44r() == offset) - // { - // //no offset transform - // newGeomID = dCreateSphere(mSpaceID, radius); - // newTransformID = 0; - // } - // else - // { - // //use ODE's geom transform object - // newGeomID = dCreateSphere(0, radius); - // newTransformID = dCreateGeomTransform(mSpaceID); - // } - - // if (!mStatic) - // { - // //setup new mass - // dMass newMass; - // dMassSetSphere(&newMass, m.density, radius); - // addMass(newMass, offset); - // } - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = newTransformID; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = SPHERE_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset = offset; - // newGeomData->shape.dimensions[0] = radius; - - // setupNewGeom(newGeomData); - //} - - //void ODESolid::addPlane(real abcd[4], const Material& m) - //{ - // //TODO: figure out what to do with ODE planes; setting their transform - // //crashes since ODE planes can't be moved - - // if (!mStatic) - // { - // std::cout << "Error in opal::ODESolid::addPlane: Plane shape \ - // added to a non-static solid" << std::endl; - - // //ODE planes can't have bodies - // assert(false); - // } - - // dGeomID newGeomID; - - // // ODE planes must have their normal vector (abc) normalized - // Vec3r normal(abcd[0], abcd[1], abcd[2]); - // normal.normalize(); - // abcd[0] = normal[0]; - // abcd[1] = normal[1]; - // abcd[2] = normal[2]; - - // //no offset transform - // newGeomID = dCreatePlane(mSpaceID, abcd[0], abcd[1], abcd[2], - // abcd[3]); - - // // note: no mass for this object since planes can't have mass - - // mIsPlaceable = false; - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = 0; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = PLANE_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset.makeIdentity(); - // newGeomData->shape.dimensions[0] = abcd[0]; - // newGeomData->shape.dimensions[1] = abcd[1]; - // newGeomData->shape.dimensions[2] = abcd[2]; - // newGeomData->shape.dimensions[3] = abcd[3]; - - // setupNewGeom(newGeomData); - //} - - //void ODESolid::addCapsule(real radius, real length, - // const Matrix44r& offset, const Material& m) - //{ - // dGeomID newGeomID; - // dGeomID newTransformID; - - // if(Matrix44r() == offset) - // { - // //no offset transform - // newGeomID = dCreateCCylinder(mSpaceID, radius, length); - // newTransformID = 0; - // } - // else - // { - // //use ODE's geom transform object - // newGeomID = dCreateCCylinder(0, radius, length); - // newTransformID = dCreateGeomTransform(mSpaceID); - // } - - // if (!mStatic) - // { - // //setup new mass - // dMass newMass; - // // The "direction" parameter orients the mass along one of the - // // body's local axes; x=1, y=2, z=3. TODO: This might be weird - // // if this capsule is not oriented along one of the body's axes. - // // Maybe have a default value in the Simulator that the user can - // // change. - // dMassSetCappedCylinder(&newMass, m.density, 3, radius, length); - // addMass(newMass, offset); - // } - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = newTransformID; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = CAPSULE_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset = offset; - // newGeomData->shape.dimensions[0] = radius; - // newGeomData->shape.dimensions[1] = length; - - // setupNewGeom(newGeomData); - //} - - //void ODESolid::addRay(const Point3r& origin, const Vec3r& dir, - // real length, const Matrix44r& offset, const Material& m) - //{ - // dGeomID newGeomID; - // dGeomID newTransformID; - - // if(Matrix44r() == offset) - // { - // //no offset transform - // newGeomID = dCreateRay(mSpaceID, length); - // dGeomRaySet(newGeomID, origin[0], origin[1], origin[2], dir[0], - // dir[1], dir[2]); - // newTransformID = 0; - // } - // else - // { - // //use ODE's geom transform object - // newGeomID = dCreateRay(0, length); - // dGeomRaySet(newGeomID, origin[0], origin[1], origin[2], dir[0], - // dir[1], dir[2]); - // newTransformID = dCreateGeomTransform(mSpaceID); - // } - - // //note: no mass for this object since rays can't have mass - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = newTransformID; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = RAY_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset = offset; - // newGeomData->shape.dimensions[0] = origin[0]; - // newGeomData->shape.dimensions[1] = origin[1]; - // newGeomData->shape.dimensions[2] = origin[2]; - // newGeomData->shape.dimensions[3] = dir[3]; - // newGeomData->shape.dimensions[4] = dir[4]; - // newGeomData->shape.dimensions[5] = dir[5]; - // newGeomData->shape.dimensions[6] = length; - - // setupNewGeom(newGeomData); - //} - - //void ODESolid::addMesh(const real* vertexArray[3], int numVertices, - // const int* faceArray, int numFaces, const Matrix44r& offset, - // const Material& m) - //{ - // dGeomID newGeomID; - // dGeomID newTransformID; - // dTriMeshDataID newTrimeshDataID; - - // // Setup trimesh data pointer. It is critical that the size of OPAL - // // reals at this point match the size of ODE's dReals. - // newTrimeshDataID = dGeomTriMeshDataCreate(); - // dGeomTriMeshDataBuildSimple(newTrimeshDataID, (dReal*)vertexArray, - // numVertices, faceArray, numFaces*3); - - // if(Matrix44r() == offset) - // { - // //no offset transform - // newGeomID = dCreateTriMesh(mSpaceID, newTrimeshDataID, NULL, - // NULL, NULL); - // newTransformID = 0; - // } - // else - // { - // //use ODE's geom transform object - // newGeomID = dCreateTriMesh(0, newTrimeshDataID, NULL, NULL, NULL); - // newTransformID = dCreateGeomTransform(mSpaceID); - // } - - // if (!mStatic) - // { - // // TODO: either do more sophisticated mass calculations, or just - // // enforce that all mesh must be static - - // // setup new mass - // dMass newMass; - // dMassSetSphere(&newMass, m.density, 1); - // addMass(newMass, offset); - // } - - // GeomData* newGeomData = new GeomData; - - // newGeomData->solid = this; - // newGeomData->geomID = newGeomID; - // newGeomData->transformID = newTransformID; - // newGeomData->spaceID = mSpaceID; - // newGeomData->shape.type = MESH_SHAPE; - // newGeomData->shape.material = m; - // newGeomData->shape.offset = offset; - // newGeomData->trimeshDataID = newTrimeshDataID; - - // // TODO: calculate trimesh dimensions (extents) and store them in the - // // geom data struct dimensions - - // setupNewGeom(newGeomData); - //} - void ODESolid::setLocalLinearVel(const Vec3r& vel) { --- 639,642 ---- |