More work on collision entries

This commit is contained in:
rdb 2009-03-13 07:46:56 +00:00
parent 83073537fb
commit ba98fbfa43
5 changed files with 98 additions and 56 deletions

View File

@ -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

View File

@ -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];
}

View File

@ -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);
}

View File

@ -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

View File

@ -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];
}