Panda3D
odeCollisionEntry.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file odeCollisionEntry.h
10  * @author rdb
11  * @date 2009-03-05
12  */
13 
14 #ifndef ODECOLLISIONENTRY_H
15 #define ODECOLLISIONENTRY_H
16 
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19 
20 #include "odeContactGeom.h"
21 
22 class OdeUtil;
23 
24 /**
25  * A class used to hold information about a collision that has occurred.
26  */
27 class EXPCL_PANDAODE OdeCollisionEntry : public TypedReferenceCount {
28 PUBLISHED:
29  virtual ~OdeCollisionEntry();
30 
31  INLINE OdeGeom get_geom1() const;
32  INLINE OdeGeom get_geom2() const;
33  INLINE OdeBody get_body1() const;
34  INLINE OdeBody get_body2() const;
35 
36  INLINE size_t get_num_contacts() const;
37  INLINE LPoint3f get_contact_point(size_t n) const;
38  INLINE OdeContactGeom get_contact_geom(size_t n) const;
39  INLINE OdeContactGeom operator [] (size_t n) const;
40  MAKE_SEQ(get_contact_points, get_num_contacts, get_contact_point);
41  MAKE_SEQ(get_contact_geoms, get_num_contacts, get_contact_geom);
42 
43  INLINE operator bool () const;
44  INLINE bool is_empty() const;
45 
46 private:
47  INLINE OdeCollisionEntry();
48  dGeomID _geom1, _geom2;
49  dBodyID _body1, _body2;
50  size_t _num_contacts;
51  OdeContactGeom *_contact_geoms;
52 
53 public:
54  static TypeHandle get_class_type() {
55  return _type_handle;
56  }
57  static void init_type() {
58  TypedReferenceCount::init_type();
59  register_type(_type_handle, "OdeCollisionEntry",
60  TypedReferenceCount::get_class_type());
61  }
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66 
67 private:
68 
69  static TypeHandle _type_handle;
70 
71  friend class OdeSpace;
72  friend class OdeUtil;
73 };
74 
75 #include "odeCollisionEntry.I"
76 
77 #endif
odeContactGeom.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
OdeSpace
Definition: odeSpace.h:37
TypedReferenceCount
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
Definition: typedReferenceCount.h:31
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
OdeContactGeom
Definition: odeContactGeom.h:30
OdeCollisionEntry
A class used to hold information about a collision that has occurred.
Definition: odeCollisionEntry.h:27
OdeUtil
Definition: odeUtil.h:32
OdeBody
Definition: odeBody.h:32
typedReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
odeCollisionEntry.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
OdeGeom
Definition: odeGeom.h:45