Panda3D

odeCollisionEntry.h

00001 // Filename: odeCollisionEntry.h
00002 // Created by:  pro-rsoft (05Mar09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef ODECOLLISIONENTRY_H
00016 #define ODECOLLISIONENTRY_H
00017 
00018 #include "pandabase.h"
00019 #include "typedReferenceCount.h"
00020 
00021 #include "odeContactGeom.h"
00022 
00023 class OdeUtil;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : OdeCollisionEntry
00027 // Description : A class used to hold information about a collision
00028 //               that has occurred.
00029 ////////////////////////////////////////////////////////////////////
00030 class EXPCL_PANDAODE OdeCollisionEntry : public TypedReferenceCount {
00031 PUBLISHED:
00032   virtual ~OdeCollisionEntry();
00033   
00034   INLINE OdeGeom get_geom1() const;
00035   INLINE OdeGeom get_geom2() const;
00036   INLINE OdeBody get_body1() const;
00037   INLINE OdeBody get_body2() const;
00038   
00039   INLINE size_t get_num_contacts() const;
00040   INLINE LPoint3f get_contact_point(size_t n) const;
00041   INLINE OdeContactGeom get_contact_geom(size_t n) const;
00042   INLINE OdeContactGeom operator [] (size_t n) const;
00043   MAKE_SEQ(get_contact_points, get_num_contacts, get_contact_point);
00044   MAKE_SEQ(get_contact_geoms, get_num_contacts, get_contact_geom);
00045   
00046   INLINE operator bool () const;
00047   INLINE bool is_empty() const;
00048 
00049 private:
00050   INLINE OdeCollisionEntry();
00051   dGeomID _geom1, _geom2;
00052   dBodyID _body1, _body2;
00053   size_t _num_contacts;
00054   OdeContactGeom *_contact_geoms;
00055 
00056 public:
00057   static TypeHandle get_class_type() {
00058     return _type_handle;
00059   }
00060   static void init_type() {
00061     TypedReferenceCount::init_type();
00062     register_type(_type_handle, "OdeCollisionEntry",
00063                   TypedReferenceCount::get_class_type());
00064   }
00065   virtual TypeHandle get_type() const {
00066     return get_class_type();
00067   }
00068   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00069 
00070 private:
00071 
00072   static TypeHandle _type_handle;
00073 
00074   friend class OdeSpace;
00075   friend class OdeUtil;
00076 };
00077 
00078 #include "odeCollisionEntry.I"
00079 
00080 #endif
00081 
 All Classes Functions Variables Enumerations