Panda3D
 All Classes Functions Variables Enumerations
odeWorld.h
1 // Filename: odeWorld.h
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 #ifndef ODEWORLD_H
16 #define ODEWORLD_H
17 
18 #include "pandabase.h"
19 #include "typedObject.h"
20 #include "luse.h"
21 #include "ode_includes.h"
22 #include "pmap.h"
23 #include "numeric_types.h"
24 
25 #include "ode_includes.h"
26 #include "odeHelperStructs.h"
27 
28 class OdeBody;
29 class OdeJoint;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : OdeWorld
33 // Description :
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDAODE OdeWorld : public TypedObject {
36 PUBLISHED:
37  OdeWorld();
38  OdeWorld(const OdeWorld &copy);
39  virtual ~OdeWorld();
40  void destroy();
41  INLINE bool is_empty() const;
42  INLINE dWorldID get_id() const;
43 
44  INLINE void set_gravity(dReal x, dReal y, dReal z);
45  INLINE void set_gravity(const LVecBase3f &vec);
46  INLINE void set_erp(dReal erp);
47  INLINE void set_cfm(dReal cfm);
48  INLINE void set_quick_step_num_iterations(int num);
49 
50  INLINE void set_quick_step_w(dReal over_relaxation);
51  INLINE void set_contact_max_correcting_vel(dReal vel);
52  INLINE void set_contact_surface_layer(dReal depth);
53  INLINE void set_auto_disable_linear_threshold(dReal linear_threshold);
54  INLINE void set_auto_disable_angular_threshold(dReal angular_threshold);
55  INLINE void set_auto_disable_steps(int steps);
56  INLINE void set_auto_disable_time(dReal time);
57  INLINE void set_auto_disable_flag(int do_auto_disable);
58 
59  INLINE LVecBase3f get_gravity() const;
60  INLINE dReal get_erp() const;
61  INLINE dReal get_cfm() const;
62  INLINE int get_quick_step_num_iterations() const;
63  INLINE dReal get_quick_step_w() const;
64  INLINE dReal get_contact_max_correcting_vel() const;
65  INLINE dReal get_contact_surface_layer() const;
66  INLINE dReal get_auto_disable_linear_threshold() const;
67  INLINE dReal get_auto_disable_angular_threshold() const;
68  INLINE int get_auto_disable_steps() const;
69  INLINE dReal get_auto_disable_time() const;
70  INLINE int get_auto_disable_flag() const;
71 
72  INLINE LVecBase3f impulse_to_force(dReal stepsize, \
73  dReal ix, dReal iy, dReal iz);
74  INLINE LVecBase3f impulse_to_force(dReal stepsize, \
75  const LVecBase3f &impulse);
76 
77  INLINE void step(dReal stepsize);
78  INLINE void quick_step(dReal stepsize);
79 
80  INLINE int compare_to(const OdeWorld &other) const;
81 
82  void init_surface_table(PN_uint8 num_surfaces);
83  //void assign_surface_body(OdeBody& body, int surface);
84  void add_body_dampening(OdeBody& body, int surface);
85  void set_surface_entry(PN_uint8 pos1, PN_uint8 pos2,
86  dReal mu,
87  dReal bounce,
88  dReal bounce_vel,
89  dReal soft_erp,
90  dReal soft_cfm,
91  dReal slip,
92  dReal dampen);
93  float apply_dampening(float dt, OdeBody& body);
94 
95  operator bool () const;
96 
97 public:
98  sSurfaceParams& get_surface(PN_uint8 surface1, PN_uint8 surface2);
99  void set_surface(int pos1, int pos2, sSurfaceParams& entry);
100  sBodyParams get_surface_body(dBodyID id);
101  void set_dampen_on_bodies(dBodyID id1, dBodyID id2,dReal damp);
102 
103 
104 private:
105  dWorldID _id;
106  sSurfaceParams *_surface_table;
107  PN_uint8 _num_surfaces;
109  BodyDampenMap _body_dampen_map;
110 
111 
112 
113 
114 public:
115  static TypeHandle get_class_type() {
116  return _type_handle;
117  }
118  static void init_type() {
120  register_type(_type_handle, "OdeWorld",
121  TypedObject::get_class_type());
122  }
123  virtual TypeHandle get_type() const {
124  return get_class_type();
125  }
126  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
127 
128 private:
129  static TypeHandle _type_handle;
130 };
131 
132 #include "odeWorld.I"
133 
134 #endif
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:79
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85