Panda3D
odeSpace.I
1 // Filename: odeSpace.I
2 // Created by: joswilso (27Dec06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: OdeSpace::is_empty
17 // Access: Published
18 // Description: Returns true if the ID is 0, meaning the OdeSpace
19 // does not point to a valid space. It is an error to
20 // call a method on an empty space.
21 // Note that an empty OdeSpace also evaluates to False.
22 ////////////////////////////////////////////////////////////////////
23 INLINE bool OdeSpace::
24 is_empty() const {
25  return (_id == 0);
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: OdeSpace::get_id
30 // Access: Published
31 // Description: Returns the underlying dSpaceID.
32 ////////////////////////////////////////////////////////////////////
33 INLINE dSpaceID OdeSpace::
34 get_id() const {
35  return _id;
36 }
37 
38 INLINE void OdeSpace::
39 set_cleanup(int mode) {
40  dSpaceSetCleanup(_id, mode);
41 }
42 
43 INLINE int OdeSpace::
44 get_cleanup() const {
45  return dSpaceGetCleanup(_id);
46 }
47 
48 INLINE int OdeSpace::
49 get_num_geoms() const {
50  return dSpaceGetNumGeoms(_id);
51 }
52 
53 INLINE OdeSpace OdeSpace::
54 get_space() const {
55  return OdeSpace(dGeomGetSpace((dGeomID)_id));
56 }
57 
58 INLINE void OdeSpace::
59 get_AABB(LVecBase3f &min, LVecBase3f &max) const {
60  dReal result[6];
61  dGeomGetAABB((dGeomID)_id, result);
62  min.set(result[0], result[2], result[4]);
63  max.set(result[1], result[3], result[5]);
64 }
65 
66 INLINE int OdeSpace::
67 is_space() {
68  return dGeomIsSpace((dGeomID)_id);
69 }
70 
71 INLINE int OdeSpace::
72 get_class() const {
73  return dGeomGetClass((dGeomID)_id);
74 }
75 
76 INLINE void OdeSpace::
77 set_category_bits(const BitMask32 &bits) {
78  dGeomSetCategoryBits((dGeomID)_id, bits.get_word());
79 }
80 
81 INLINE void OdeSpace::
82 set_collide_bits(const BitMask32 &bits) {
83  dGeomSetCollideBits((dGeomID)_id, bits.get_word());
84 }
85 
86 INLINE BitMask32 OdeSpace::
87 get_category_bits() {
88  return BitMask32(dGeomGetCategoryBits((dGeomID)_id));
89 }
90 
91 INLINE BitMask32 OdeSpace::
92 get_collide_bits() {
93  return BitMask32(dGeomGetCollideBits((dGeomID)_id));
94 }
95 
96 INLINE void OdeSpace::
97 enable() {
98  dGeomEnable((dGeomID)_id);
99 }
100 
101 INLINE void OdeSpace::
102 disable() {
103  dGeomDisable((dGeomID)_id);
104 }
105 
106 INLINE int OdeSpace::
107 is_enabled() {
108  return dGeomIsEnabled((dGeomID)_id);
109 }
110 
111 INLINE void OdeSpace::
112 set_collision_event(const string &event_name) {
113  _collision_event = event_name;
114 }
115 
116 INLINE string OdeSpace::
117 get_collision_event() {
118  return _collision_event;
119 }
120 
dSpaceID get_id() const
Returns the underlying dSpaceID.
Definition: odeSpace.I:34
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
bool is_empty() const
Returns true if the ID is 0, meaning the OdeSpace does not point to a valid space.
Definition: odeSpace.I:24
WordType get_word() const
Returns the entire BitMask as a single word.
Definition: bitMask.I:383