[Opal-commits] opal/src/ODE ODESolid.cpp,1.89,1.90 ODESolid.h,1.70,1.71
Status: Inactive
Brought to you by:
tylerstreeter
|
From: tylerstreeter <tyl...@us...> - 2005-07-21 15:59:45
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21343/src/ODE Modified Files: ODESolid.cpp ODESolid.h Log Message: Added 'getLocalAABB' function to ShapeData. Added 'getLocalAABB' and 'getGlobalAABB' functions to Solid. Index: ODESolid.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.h,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ODESolid.h 24 Jun 2005 19:04:22 -0000 1.70 --- ODESolid.h 21 Jul 2005 15:59:01 -0000 1.71 *************** *** 83,87 **** virtual void OPAL_CALL clearShapes(); ! virtual void OPAL_CALL addShape(const ShapeData& data); virtual void OPAL_CALL setLocalLinearVel(const Vec3r& vel); --- 83,87 ---- virtual void OPAL_CALL clearShapes(); ! virtual void OPAL_CALL addShape(ShapeData& data); virtual void OPAL_CALL setLocalLinearVel(const Vec3r& vel); Index: ODESolid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESolid.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** ODESolid.cpp 19 Jul 2005 17:53:29 -0000 1.89 --- ODESolid.cpp 21 Jul 2005 15:59:01 -0000 1.90 *************** *** 74,77 **** --- 74,78 ---- { destroyGeoms(); + resetAABB(); } *************** *** 492,496 **** } ! void ODESolid::addShape(const ShapeData& data) { assert(data.material.density >= 0); --- 493,497 ---- } ! void ODESolid::addShape(ShapeData& data) { assert(data.material.density >= 0); *************** *** 498,504 **** dGeomID newGeomID = NULL; dGeomID newTransformID = NULL; - dTriMeshDataID newTrimeshDataID = NULL; - dSpaceID spaceID = NULL; dMass newMass; --- 499,503 ---- *************** *** 656,659 **** --- 655,674 ---- mData.addShape(data); + // Update the Solid's local AABB. The new shape's local AABB + // must be transformed using the shape's offset from the Solid. + real shapeAABB[6] = {0, 0, 0, 0, 0, 0}; + data.getLocalAABB(shapeAABB); + Point3r minExtents(shapeAABB[0], shapeAABB[2], shapeAABB[4]); + Point3r maxExtents(shapeAABB[1], shapeAABB[3], shapeAABB[5]); + minExtents = data.offset * minExtents; + maxExtents = data.offset * maxExtents; + shapeAABB[0] = minExtents[0]; + shapeAABB[1] = maxExtents[0]; + shapeAABB[2] = minExtents[1]; + shapeAABB[3] = maxExtents[1]; + shapeAABB[4] = minExtents[2]; + shapeAABB[5] = maxExtents[2]; + addToLocalAABB(shapeAABB); + // Setup GeomData. newGeomData->solid = this; |