diff --git a/panda/src/ode/Sources.pp b/panda/src/ode/Sources.pp index 3e4f92df6a..78791c00bc 100755 --- a/panda/src/ode/Sources.pp +++ b/panda/src/ode/Sources.pp @@ -51,7 +51,7 @@ odeRayGeom.I odeRayGeom.h \ odeTriMeshData.I odeTriMeshData.h \ odeTriMeshGeom.I odeTriMeshGeom.h \ - odeCollisionEntry.h \ + odeCollisionEntry.I odeCollisionEntry.h \ odeHelperStructs.h #define INCLUDED_SOURCES \ @@ -116,7 +116,7 @@ odeRayGeom.I odeRayGeom.h \ odeTriMeshData.I odeTriMeshData.h \ odeTriMeshGeom.I odeTriMeshGeom.h \ - odeCollisionEntry.h + odeCollisionEntry.I odeCollisionEntry.h #define IGATESCAN all diff --git a/panda/src/ode/odeCollisionEntry.I b/panda/src/ode/odeCollisionEntry.I new file mode 100644 index 0000000000..b062500513 --- /dev/null +++ b/panda/src/ode/odeCollisionEntry.I @@ -0,0 +1,84 @@ +// Filename: odeCollisionEntry.cxx +// Created by: pro-rsoft (13Mar09) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::Constructor +// Access: Private +// Description: +//////////////////////////////////////////////////////////////////// +INLINE OdeCollisionEntry:: +OdeCollisionEntry() { +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_geom1 +// Access: Published +// Description: Returns the first geom in the collision. +//////////////////////////////////////////////////////////////////// +INLINE const OdeGeom OdeCollisionEntry:: +get_geom1() { + return OdeGeom(_geom1); +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_geom2 +// Access: Published +// Description: Returns the second geom in the collision. +//////////////////////////////////////////////////////////////////// +INLINE const OdeGeom OdeCollisionEntry:: +get_geom2() { + return OdeGeom(_geom2); +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_body1 +// Access: Published +// Description: Returns the first body in the collision. +//////////////////////////////////////////////////////////////////// +INLINE const OdeBody OdeCollisionEntry:: +get_body1() { + return OdeBody(_body1); +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_body2 +// Access: Published +// Description: Returns the second body in the collision. +//////////////////////////////////////////////////////////////////// +INLINE const OdeBody OdeCollisionEntry:: +get_body2() { + return OdeBody(_body2); +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_num_contact_points +// Access: Published +// Description: Returns the number of contact points. +//////////////////////////////////////////////////////////////////// +INLINE const size_t OdeCollisionEntry:: +get_num_contact_points() { + return _num_points; +} + +//////////////////////////////////////////////////////////////////// +// Function: OdeCollisionEntry::get_contact_point +// Access: Published +// Description: Returns the nth contact point in the collision. +//////////////////////////////////////////////////////////////////// +INLINE const LPoint3f OdeCollisionEntry:: +get_contact_point(size_t n) { + nassertr(n >= 0 && n < _num_points, LPoint3f::zero()); + return _points[n]; +} + diff --git a/panda/src/ode/odeCollisionEntry.cxx b/panda/src/ode/odeCollisionEntry.cxx index cefec03c64..28f9393931 100644 --- a/panda/src/ode/odeCollisionEntry.cxx +++ b/panda/src/ode/odeCollisionEntry.cxx @@ -16,52 +16,3 @@ TypeHandle OdeCollisionEntry::_type_handle; -//////////////////////////////////////////////////////////////////// -// Function: OdeCollisionEntry::Constructor -// Access: Private -// Description: -//////////////////////////////////////////////////////////////////// -OdeCollisionEntry:: -OdeCollisionEntry() { -} - -//////////////////////////////////////////////////////////////////// -// Function: OdeCollisionEntry::get_geom1 -// Access: Published -// Description: Returns the first geom in the collision. -//////////////////////////////////////////////////////////////////// -const OdeGeom OdeCollisionEntry:: -get_geom1() { - return OdeGeom(_geom1); -} - -//////////////////////////////////////////////////////////////////// -// Function: OdeCollisionEntry::get_geom2 -// Access: Published -// Description: Returns the second geom in the collision. -//////////////////////////////////////////////////////////////////// -const OdeGeom OdeCollisionEntry:: -get_geom2() { - return OdeGeom(_geom2); -} - -//////////////////////////////////////////////////////////////////// -// Function: OdeCollisionEntry::get_body1 -// Access: Published -// Description: Returns the first body in the collision. -//////////////////////////////////////////////////////////////////// -const OdeBody OdeCollisionEntry:: -get_body1() { - return OdeBody(_body1); -} - -//////////////////////////////////////////////////////////////////// -// Function: OdeCollisionEntry::get_body2 -// Access: Published -// Description: Returns the second body in the collision. -//////////////////////////////////////////////////////////////////// -const OdeBody OdeCollisionEntry:: -get_body2() { - return OdeBody(_body2); -} - diff --git a/panda/src/ode/odeCollisionEntry.h b/panda/src/ode/odeCollisionEntry.h index 092fd255eb..d82f8f860c 100644 --- a/panda/src/ode/odeCollisionEntry.h +++ b/panda/src/ode/odeCollisionEntry.h @@ -29,15 +29,20 @@ class EXPCL_PANDASKEL OdeCollisionEntry : public TypedReferenceCount { PUBLISHED: virtual ~OdeCollisionEntry() {}; - const OdeGeom get_geom1(); - const OdeGeom get_geom2(); - const OdeBody get_body1(); - const OdeBody get_body2(); + INLINE const OdeGeom get_geom1(); + INLINE const OdeGeom get_geom2(); + INLINE const OdeBody get_body1(); + INLINE const OdeBody get_body2(); + + INLINE const LPoint3f get_contact_point(size_t n); + INLINE const size_t get_num_contact_points(); + MAKE_SEQ(get_contact_points, get_num_contact_points, get_contact_point); private: - OdeCollisionEntry(); + INLINE OdeCollisionEntry(); dGeomID _geom1, _geom2; dBodyID _body1, _body2; + size_t _num_points; LPoint3f *_points; public: @@ -61,6 +66,7 @@ private: friend class OdeSpace; }; +#include "odeCollisionEntry.I" #endif diff --git a/panda/src/ode/odeSpace.cxx b/panda/src/ode/odeSpace.cxx index 4562593b6e..3c590617ab 100755 --- a/panda/src/ode/odeSpace.cxx +++ b/panda/src/ode/odeSpace.cxx @@ -203,6 +203,7 @@ auto_callback(void *data, dGeomID o1, dGeomID o2) entry->_geom2 = o2; entry->_body1 = b1; entry->_body2 = b2; + entry->_num_points = numc; entry->_points = new LPoint3f[numc]; }