odeSpace.I 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. // Function: OdeSpace::is_empty
  16. // Access: Published
  17. // Description: Returns true if the ID is 0, meaning the OdeSpace
  18. // does not point to a valid space. It is an error to
  19. // call a method on an empty space.
  20. // Note that an empty OdeSpace also evaluates to False.
  21. ////////////////////////////////////////////////////////////////////
  22. INLINE bool OdeSpace::
  23. is_empty() const {
  24. return (_id == 0);
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: OdeSpace::get_id
  28. // Access: Published
  29. // Description: Returns the underlying dSpaceID.
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE dSpaceID OdeSpace::
  32. get_id() const {
  33. return _id;
  34. }
  35. INLINE void OdeSpace::
  36. set_cleanup(int mode) {
  37. dSpaceSetCleanup(_id, mode);
  38. }
  39. INLINE int OdeSpace::
  40. get_cleanup() const {
  41. return dSpaceGetCleanup(_id);
  42. }
  43. INLINE int OdeSpace::
  44. get_num_geoms() const {
  45. return dSpaceGetNumGeoms(_id);
  46. }
  47. INLINE OdeSpace OdeSpace::
  48. get_space() const {
  49. return OdeSpace(dGeomGetSpace((dGeomID)_id));
  50. }
  51. INLINE void OdeSpace::
  52. get_AABB(LVecBase3f &min, LVecBase3f &max) const {
  53. dReal result[6];
  54. dGeomGetAABB((dGeomID)_id, result);
  55. min.set(result[0], result[2], result[4]);
  56. max.set(result[1], result[3], result[5]);
  57. }
  58. INLINE int OdeSpace::
  59. is_space() {
  60. return dGeomIsSpace((dGeomID)_id);
  61. }
  62. INLINE int OdeSpace::
  63. get_class() const {
  64. return dGeomGetClass((dGeomID)_id);
  65. }
  66. INLINE void OdeSpace::
  67. set_category_bits(const BitMask32 &bits) {
  68. dGeomSetCategoryBits((dGeomID)_id, bits.get_word());
  69. }
  70. INLINE void OdeSpace::
  71. set_collide_bits(const BitMask32 &bits) {
  72. dGeomSetCollideBits((dGeomID)_id, bits.get_word());
  73. }
  74. INLINE BitMask32 OdeSpace::
  75. get_category_bits() {
  76. return BitMask32(dGeomGetCategoryBits((dGeomID)_id));
  77. }
  78. INLINE BitMask32 OdeSpace::
  79. get_collide_bits() {
  80. return BitMask32(dGeomGetCollideBits((dGeomID)_id));
  81. }
  82. INLINE void OdeSpace::
  83. enable() {
  84. dGeomEnable((dGeomID)_id);
  85. }
  86. INLINE void OdeSpace::
  87. disable() {
  88. dGeomDisable((dGeomID)_id);
  89. }
  90. INLINE int OdeSpace::
  91. is_enabled() {
  92. return dGeomIsEnabled((dGeomID)_id);
  93. }
  94. INLINE void OdeSpace::
  95. set_collision_event(const string &event_name) {
  96. _collision_event = event_name;
  97. }
  98. INLINE string OdeSpace::
  99. get_collision_event() {
  100. return _collision_event;
  101. }