Panda3D
Loading...
Searching...
No Matches
odeSpace.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 odeSpace.h
10 * @author joswilso
11 * @date 2006-12-27
12 */
13
14#ifndef ODESPACE_H
15#define ODESPACE_H
16
17#include "pandabase.h"
18#include "typedObject.h"
19#include "luse.h"
20#include "bitMask.h"
21
22// included for collision tests
23#include "odeWorld.h"
24#include "odeJointGroup.h"
25
26#include "ode_includes.h"
27
28class OdeGeom;
29class OdeTriMeshGeom;
30class OdeSimpleSpace;
31class OdeHashSpace;
33
34/**
35 *
36 */
37class EXPCL_PANDAODE OdeSpace : public TypedObject {
38 friend class OdeGeom;
39 static const int MAX_CONTACTS;
40
41public:
42 OdeSpace(dSpaceID id);
43
44PUBLISHED:
45 virtual ~OdeSpace();
46 void destroy();
47 INLINE bool is_empty() const;
48
49 INLINE void set_cleanup(int mode);
50 INLINE int get_cleanup() const;
51 int query(const OdeGeom& geom) const;
52 int query(const OdeSpace& space) const;
53 INLINE int get_num_geoms() const;
54 INLINE void get_AABB(LVecBase3f &min, LVecBase3f &max) const;
55 EXTENSION(INLINE PyObject *get_AA_bounds() const);
56 INLINE int is_space();
57 INLINE int get_class() const;
58 INLINE void set_category_bits(const BitMask32 &bits);
59 INLINE void set_collide_bits(const BitMask32 &bits);
60 INLINE BitMask32 get_category_bits();
61 INLINE BitMask32 get_collide_bits();
62 INLINE void enable();
63 INLINE void disable();
64 INLINE int is_enabled();
65 void set_auto_collide_world(OdeWorld&);
66 void set_auto_collide_joint_group(OdeJointGroup&);
67
68 void add(OdeGeom& geom);
69 void add(OdeSpace& space);
70 void remove(OdeGeom& geom);
71 void remove(OdeSpace& space);
72 void clean();
73 OdeGeom get_geom(int i); // Not INLINE because of forward declaration
74 // static int get_surface_type(OdeSpace * self, dGeomID o1);
75
76 INLINE OdeSpace get_space() const;
77
78 virtual void write(std::ostream &out = std::cout, unsigned int indent=0) const;
79 operator bool () const;
80
81 OdeSimpleSpace convert_to_simple_space() const;
82 OdeHashSpace convert_to_hash_space() const;
83 OdeQuadTreeSpace convert_to_quad_tree_space() const;
84
85 EXTENSION(PyObject *convert() const);
86 EXTENSION(INLINE PyObject *get_converted_geom(int i) const);
87 EXTENSION(INLINE PyObject *get_converted_space() const);
88
89 void auto_collide();
90 EXTENSION(int collide(PyObject* arg, PyObject* near_callback));
91 int set_collide_id(int collide_id, dGeomID id);
92 int set_collide_id(OdeGeom& geom, int collide_id);
93 void set_surface_type( int surface_type, dGeomID id);
94 void set_surface_type(OdeGeom& geom, int surface_type);
95 int get_surface_type(dGeomID o1);
96 int get_surface_type(OdeGeom& geom);
97 int get_collide_id(dGeomID o1);
98 int get_collide_id(OdeGeom& geom);
99
100 INLINE void set_collision_event(const std::string &event_name);
101 INLINE std::string get_collision_event();
102
103public:
104 static void auto_callback(void*, dGeomID, dGeomID);
105
106 INLINE dSpaceID get_id() const;
107 static OdeWorld* _static_auto_collide_world;
108 static OdeSpace* _static_auto_collide_space;
109 static dJointGroupID _static_auto_collide_joint_group;
110 static int contactCount;
111 std::string _collision_event;
112
113protected:
114 dSpaceID _id;
115 OdeWorld* _auto_collide_world;
116 dJointGroupID _auto_collide_joint_group;
117
118public:
119 static TypeHandle get_class_type() {
120 return _type_handle;
121 }
122 static void init_type() {
124 register_type(_type_handle, "OdeSpace",
125 TypedObject::get_class_type());
126 }
127 virtual TypeHandle get_type() const {
128 return get_class_type();
129 }
130 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
131
132private:
133 static TypeHandle _type_handle;
134
136 GeomSurfaceMap _geom_surface_map;
137
139 GeomCollideIdMap _geom_collide_id_map;
140
141};
142
143#include "odeSpace.I"
144
145#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition typedObject.h:88
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
This is our own Panda specialization on the default STL map.
Definition pmap.h:49
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.