forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathodeBody.h
More file actions
175 lines (151 loc) · 6.17 KB
/
odeBody.h
File metadata and controls
175 lines (151 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file odeBody.h
* @author joswilso
* @date 2006-12-27
*/
#ifndef ODEBODY_H
#define ODEBODY_H
#include "pandabase.h"
#include "typedObject.h"
#include "luse.h"
#include "ode_includes.h"
#include "odeWorld.h"
#include "odeMass.h"
class OdeJoint;
class OdeGeom;
class OdeCollisionEntry;
/**
*
*/
class EXPCL_PANDAODE OdeBody : public TypedObject {
friend class OdeJoint;
friend class OdeGeom;
friend class OdeCollisionEntry;
public:
OdeBody(dBodyID id);
PUBLISHED:
OdeBody(OdeWorld &world);
virtual ~OdeBody();
void destroy();
INLINE bool is_empty() const;
INLINE dBodyID get_id() const;
INLINE void set_auto_disable_linear_threshold(dReal linear_threshold);
INLINE void set_auto_disable_angular_threshold(dReal angular_threshold);
INLINE void set_auto_disable_steps(int steps);
INLINE void set_auto_disable_time(dReal time);
INLINE void set_auto_disable_flag(int do_auto_disable);
INLINE void set_auto_disable_defaults();
INLINE void set_data(void *data);
EXTENSION(void set_data(PyObject *data));
INLINE void set_position(dReal x, dReal y, dReal z);
INLINE void set_position(const LVecBase3f &pos);
INLINE void set_rotation(const LMatrix3f &r);
INLINE void set_quaternion(const LQuaternionf &q);
INLINE void set_linear_vel(dReal x, dReal y, dReal z);
INLINE void set_linear_vel(const LVecBase3f &vel);
INLINE void set_angular_vel(dReal x, dReal y, dReal z);
INLINE void set_angular_vel(const LVecBase3f &vel);
INLINE void set_mass(OdeMass &mass);
INLINE dReal get_auto_disable_linear_threshold() const;
INLINE dReal get_auto_disable_angular_threshold() const;
INLINE int get_auto_disable_steps() const;
INLINE dReal get_auto_disable_time() const;
INLINE int get_auto_disable_flag() const;
#ifndef CPPPARSER
INLINE void *get_data() const;
#endif
EXTENSION(PyObject *get_data() const);
INLINE LVecBase3f get_position() const;
INLINE LMatrix3f get_rotation() const;
INLINE LVecBase4f get_quaternion() const;
INLINE LVecBase3f get_linear_vel() const;
INLINE LVecBase3f get_angular_vel() const;
INLINE OdeMass get_mass() const;
INLINE void add_force(dReal fx, dReal fy, dReal fz);
INLINE void add_force(const LVecBase3f &f);
INLINE void add_torque(dReal fx, dReal fy, dReal fz);
INLINE void add_torque(const LVecBase3f &f);
INLINE void add_rel_force(dReal fx, dReal fy, dReal fz);
INLINE void add_rel_force(const LVecBase3f &f);
INLINE void add_rel_torque(dReal fx, dReal fy, dReal fz);
INLINE void add_rel_torque(const LVecBase3f &f);
INLINE void add_force_at_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_force_at_pos(const LVecBase3f &f,
const LVecBase3f &pos);
INLINE void add_force_at_rel_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_force_at_rel_pos(const LVecBase3f &f,
const LVecBase3f &pos);
INLINE void add_rel_force_at_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_rel_force_at_pos(const LVecBase3f &f,
const LVecBase3f &pos);
INLINE void add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz,
dReal px, dReal py, dReal pz);
INLINE void add_rel_force_at_rel_pos(const LVecBase3f &f,
const LVecBase3f &pos);
INLINE void set_force(dReal x, dReal y, dReal z);
INLINE void set_force(const LVecBase3f &f);
INLINE void set_torque(dReal x, dReal y, dReal z);
INLINE void set_torque(const LVecBase3f &f);
INLINE LPoint3f get_rel_point_pos(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_rel_point_pos(const LVecBase3f &pos) const;
INLINE LPoint3f get_rel_point_vel(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_rel_point_vel(const LVecBase3f &pos) const;
INLINE LPoint3f get_point_vel(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_point_vel(const LVecBase3f &pos) const;
INLINE LPoint3f get_pos_rel_point(dReal px, dReal py, dReal pz) const;
INLINE LPoint3f get_pos_rel_point(const LVecBase3f &pos) const;
INLINE LVecBase3f vector_to_world(dReal px, dReal py, dReal pz) const;
INLINE LVecBase3f vector_to_world(const LVecBase3f &pos) const;
INLINE LVecBase3f vector_from_world(dReal px, dReal py, dReal pz) const;
INLINE LVecBase3f vector_from_world(const LVecBase3f &pos) const;
INLINE void set_finite_rotation_mode(int mode);
INLINE void set_finite_rotation_axis(dReal x, dReal y, dReal z);
INLINE void set_finite_rotation_axis(const LVecBase3f &axis);
INLINE int get_finite_rotation_mode() const;
INLINE LVecBase3f get_finite_rotation_axis() const;
INLINE int get_num_joints() const;
OdeJoint get_joint(int index) const;
MAKE_SEQ(get_joints, get_num_joints, get_joint);
EXTENSION(INLINE PyObject *get_converted_joint(int i) const);
MAKE_SEQ_PROPERTY(joints, get_num_joints, get_converted_joint);
INLINE void enable();
INLINE void disable();
INLINE int is_enabled() const;
INLINE void set_gravity_mode(int mode);
INLINE int get_gravity_mode() const;
virtual void write(std::ostream &out = std::cout, unsigned int indent=0) const;
operator bool () const;
INLINE int compare_to(const OdeBody &other) const;
private:
dBodyID _id;
public:
typedef void (*DestroyCallback)(OdeBody &body);
DestroyCallback _destroy_callback = nullptr;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedObject::init_type();
register_type(_type_handle, "OdeBody",
TypedObject::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#include "odeBody.I"
#endif