From: Markus R. <rol...@us...> - 2007-02-15 20:59:45
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23290 Modified Files: Tag: WIN32 odeobject.cpp odeobject.h Log Message: - make GetWorldID and GetWorldID public - add DestroyODEObject() that destructs the managed ODE handle. This method is required as the sequence in which UnlinkChildren destroys nodes (bottom up) is not sufficient for the ODE library. Rather all objects registered to an ODE space should be destroyed before the space is destroyed. Otherwise the ODE handles of bodies and joints within that space become stale and at ODE throws a segfault. Index: odeobject.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/odeobject.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** odeobject.cpp 5 Dec 2005 21:16:49 -0000 1.1 --- odeobject.cpp 15 Feb 2007 20:59:41 -0000 1.1.2.1 *************** *** 29,33 **** using namespace boost; ! /** returns the world node */ shared_ptr<World> ODEObject::GetWorld() { --- 29,45 ---- using namespace boost; ! ODEObject::ODEObject() : BaseNode() ! { ! } ! ! ODEObject::~ODEObject() ! { ! } ! ! void ODEObject::OnUnlink() ! { ! DestroyODEObject(); ! } ! shared_ptr<World> ODEObject::GetWorld() { *************** *** 120,123 **** matrix[11] = 0; } - - --- 132,133 ---- Index: odeobject.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/odeobject.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** odeobject.h 13 Feb 2007 19:52:34 -0000 1.1.2.1 --- odeobject.h 15 Feb 2007 20:59:41 -0000 1.1.2.2 *************** *** 39,51 **** // Functions // ! ODEObject() : BaseNode() {}; ! virtual ~ODEObject() {}; ! ! protected: ! /** returns the world node */ ! boost::shared_ptr<World> GetWorld(); ! /** returns the space node */ ! boost::shared_ptr<Space> GetSpace(); /** returns the ODE world handle */ --- 39,50 ---- // Functions // ! ODEObject(); ! virtual ~ODEObject(); ! /** This rountine is called, before the hierarchy object is ! removed from the parent. It can be overridden to support ! custom 'unlink' behavior. ! */ ! virtual void OnUnlink(); /** returns the ODE world handle */ *************** *** 55,58 **** --- 54,67 ---- dSpaceID GetSpaceID(); + /** destroy the managed ODE object */ + virtual void DestroyODEObject() = 0; + + protected: + /** returns the world node */ + boost::shared_ptr<World> GetWorld(); + + /** returns the space node */ + boost::shared_ptr<Space> GetSpace(); + /** converts the rotation part of a salt::Matrix to an ODE dMatrix3 */ |