mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
interface additions to be more panda-like
This commit is contained in:
parent
efea7190c2
commit
4be7630974
@ -91,6 +91,11 @@ set_position(dReal x, dReal y, dReal z) {
|
||||
dBodySetPosition(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_position(const LVecBase3f &pos) {
|
||||
set_position(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_rotation(const LMatrix3f r) {
|
||||
dMatrix3 mat3 = {r._m.data[0], r._m.data[1], r._m.data[2], 0,
|
||||
@ -114,11 +119,21 @@ set_linear_vel(dReal x, dReal y, dReal z) {
|
||||
dBodySetLinearVel(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_linear_vel(const LVecBase3f &vel) {
|
||||
set_linear_vel(vel[0], vel[1], vel[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_angular_vel(dReal x, dReal y, dReal z) {
|
||||
dBodySetAngularVel(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_angular_vel(const LVecBase3f &vel) {
|
||||
set_angular_vel(vel[0], vel[1], vel[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBody::
|
||||
get_position() const {
|
||||
const dReal *res = dBodyGetPosition(_id);
|
||||
@ -166,51 +181,101 @@ add_force(dReal fx, dReal fy, dReal fz) {
|
||||
dBodyAddForce(_id, fx, fy, fz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_force(const LVecBase3f &f) {
|
||||
add_force(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_torque(dReal fx, dReal fy, dReal fz) {
|
||||
dBodyAddTorque(_id, fx, fy, fz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_torque(const LVecBase3f &f) {
|
||||
add_torque(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force(dReal fx, dReal fy, dReal fz) {
|
||||
dBodyAddRelForce(_id, fx, fy, fz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force(const LVecBase3f &f) {
|
||||
add_rel_force(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_torque(dReal fx, dReal fy, dReal fz) {
|
||||
dBodyAddRelTorque(_id, fx, fy, fz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_torque(const LVecBase3f &f) {
|
||||
add_rel_torque(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
|
||||
dBodyAddForceAtPos(_id, fx, fy, fz, px, py, pz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_force_at_pos(const LVecBase3f &f, const LVecBase3f &pos) {
|
||||
add_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
|
||||
dBodyAddForceAtRelPos(_id, fx, fy, fz, px, py, pz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_force_at_rel_pos(const LVecBase3f &f, const LVecBase3f &pos) {
|
||||
add_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
|
||||
dBodyAddRelForceAtPos(_id, fx, fy, fz, px, py, pz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force_at_pos(const LVecBase3f &f, const LVecBase3f &pos) {
|
||||
add_rel_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
|
||||
dBodyAddRelForceAtRelPos(_id, fx, fy, fz, px, py, pz);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
add_rel_force_at_rel_pos(const LVecBase3f &f, const LVecBase3f &pos) {
|
||||
add_rel_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_force(dReal x, dReal y, dReal z) {
|
||||
dBodySetForce(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_force(const LVecBase3f &f) {
|
||||
set_force(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_torque(dReal x, dReal y, dReal z) {
|
||||
dBodySetTorque(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_torque(const LVecBase3f &f) {
|
||||
set_torque(f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_rel_point_pos(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -218,6 +283,11 @@ get_rel_point_pos(dReal px, dReal py, dReal pz) const {
|
||||
return LPoint3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_rel_point_pos(const LVecBase3f &pos) const {
|
||||
return get_rel_point_pos(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_rel_point_vel(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -225,6 +295,11 @@ get_rel_point_vel(dReal px, dReal py, dReal pz) const {
|
||||
return LPoint3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_rel_point_vel(const LVecBase3f &pos) const {
|
||||
return get_rel_point_vel(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_point_vel(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -232,6 +307,11 @@ get_point_vel(dReal px, dReal py, dReal pz) const {
|
||||
return LPoint3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_point_vel(const LVecBase3f &pos) const {
|
||||
return get_point_vel(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_pos_rel_point(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -239,6 +319,11 @@ get_pos_rel_point(dReal px, dReal py, dReal pz) const {
|
||||
return LPoint3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LPoint3f OdeBody::
|
||||
get_pos_rel_point(const LVecBase3f &pos) const {
|
||||
return get_pos_rel_point(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBody::
|
||||
vector_to_world(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -246,6 +331,11 @@ vector_to_world(dReal px, dReal py, dReal pz) const {
|
||||
return LVecBase3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBody::
|
||||
vector_to_world(const LVecBase3f &pos) const {
|
||||
return vector_to_world(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBody::
|
||||
vector_from_world(dReal px, dReal py, dReal pz) const {
|
||||
dVector3 result;
|
||||
@ -253,6 +343,11 @@ vector_from_world(dReal px, dReal py, dReal pz) const {
|
||||
return LVecBase3f(result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBody::
|
||||
vector_from_world(const LVecBase3f &pos) const {
|
||||
return vector_from_world(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_finite_rotation_mode(int mode) {
|
||||
dBodySetFiniteRotationMode(_id, mode);
|
||||
@ -263,6 +358,11 @@ set_finite_rotation_axis(dReal x, dReal y, dReal z) {
|
||||
dBodySetFiniteRotationAxis(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeBody::
|
||||
set_finite_rotation_axis(const LVecBase3f &axis) {
|
||||
set_finite_rotation_axis(axis[0], axis[1], axis[2]);
|
||||
}
|
||||
|
||||
INLINE int OdeBody::
|
||||
get_finite_rotation_mode() const {
|
||||
return dBodyGetFiniteRotationMode(_id);
|
||||
|
@ -21,11 +21,6 @@
|
||||
|
||||
TypeHandle OdeBody::_type_handle;
|
||||
|
||||
OdeBody::
|
||||
OdeBody() :
|
||||
_id(0) {
|
||||
}
|
||||
|
||||
OdeBody::
|
||||
OdeBody(dBodyID id) :
|
||||
_id(id) {
|
||||
@ -42,6 +37,7 @@ OdeBody::
|
||||
|
||||
void OdeBody::
|
||||
destroy() {
|
||||
nassertv(_id);
|
||||
dBodyDestroy(_id);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ protected:
|
||||
OdeBody(dBodyID id);
|
||||
|
||||
PUBLISHED:
|
||||
OdeBody();
|
||||
OdeBody(OdeWorld &world);
|
||||
virtual ~OdeBody();
|
||||
void destroy();
|
||||
@ -55,10 +54,13 @@ PUBLISHED:
|
||||
INLINE void set_data(void *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);
|
||||
|
||||
|
||||
@ -77,29 +79,50 @@ PUBLISHED:
|
||||
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;
|
||||
|
||||
|
@ -21,6 +21,11 @@ set_lengths(dReal lx, dReal ly, dReal lz) {
|
||||
dGeomBoxSetLengths(_id, lx, ly, lz);
|
||||
}
|
||||
|
||||
INLINE void OdeBoxGeom::
|
||||
set_lengths(const LVecBase3f &size) {
|
||||
set_lengths(size[0], size[1], size[2]);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f OdeBoxGeom::
|
||||
get_lengths() {
|
||||
dVector3 res;
|
||||
@ -33,3 +38,8 @@ get_point_depth(dReal x, dReal y, dReal z) {
|
||||
return dGeomBoxPointDepth(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE dReal OdeBoxGeom::
|
||||
get_point_depth(const LPoint3f &p) {
|
||||
return get_point_depth(p[0], p[1], p[2]);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,11 @@ OdeBoxGeom(OdeSpace &space, dReal lx, dReal ly, dReal lz) :
|
||||
OdeGeom(dCreateBox(space.get_id(), lx, ly, lz)) {
|
||||
}
|
||||
|
||||
OdeBoxGeom::
|
||||
OdeBoxGeom(OdeSpace &space, const LVecBase3f &size) :
|
||||
OdeGeom(dCreateBox(space.get_id(), size[0], size[1], size[2])) {
|
||||
}
|
||||
|
||||
OdeBoxGeom::
|
||||
~OdeBoxGeom() {
|
||||
}
|
||||
|
@ -34,11 +34,14 @@ class EXPCL_PANDAODE OdeBoxGeom : public OdeGeom {
|
||||
PUBLISHED:
|
||||
OdeBoxGeom(dReal lx, dReal ly, dReal lz);
|
||||
OdeBoxGeom(OdeSpace &space, dReal lx, dReal ly, dReal lz);
|
||||
OdeBoxGeom(OdeSpace &space, const LVecBase3f &size);
|
||||
virtual ~OdeBoxGeom();
|
||||
|
||||
INLINE void set_lengths(dReal lx, dReal ly, dReal lz);
|
||||
INLINE void set_lengths(const LVecBase3f &size);
|
||||
INLINE LVecBase3f get_lengths();
|
||||
INLINE dReal get_point_depth(dReal x, dReal y, dReal z);
|
||||
INLINE dReal get_point_depth(const LPoint3f &p);
|
||||
|
||||
public:
|
||||
INLINE static int get_geom_class() { return dBoxClass; };
|
||||
|
@ -44,3 +44,8 @@ INLINE dReal OdeCappedCylinderGeom::
|
||||
get_point_depth(dReal x, dReal y, dReal z) const {
|
||||
return dGeomCapsulePointDepth(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE dReal OdeCappedCylinderGeom::
|
||||
get_point_depth(const LPoint3f &p) const {
|
||||
return get_point_depth(p[0], p[1], p[2]);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ PUBLISHED:
|
||||
INLINE dReal get_radius() const;
|
||||
INLINE dReal get_length() const;
|
||||
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
|
||||
INLINE dReal get_point_depth(const LPoint3f &p) const;
|
||||
|
||||
public:
|
||||
INLINE static int get_geom_class() { return dCapsuleClass; };
|
||||
|
@ -29,33 +29,13 @@ OdeContactGeom() :
|
||||
OdeContactGeom::
|
||||
OdeContactGeom(const OdeContactGeom ©) :
|
||||
_contact_geom() {
|
||||
_contact_geom.pos[0] = copy._contact_geom.pos[0];
|
||||
_contact_geom.pos[1] = copy._contact_geom.pos[1];
|
||||
_contact_geom.pos[2] = copy._contact_geom.pos[2];
|
||||
_contact_geom.normal[0] = copy._contact_geom.normal[0];
|
||||
_contact_geom.normal[1] = copy._contact_geom.normal[1];
|
||||
_contact_geom.normal[2] = copy._contact_geom.normal[2];
|
||||
_contact_geom.depth = copy._contact_geom.depth;
|
||||
_contact_geom.g1 = copy._contact_geom.g1;
|
||||
_contact_geom.g2 = copy._contact_geom.g2;
|
||||
_contact_geom.side1 = copy._contact_geom.side1;
|
||||
_contact_geom.side2 = copy._contact_geom.side2;
|
||||
*this = copy._contact_geom;
|
||||
}
|
||||
|
||||
OdeContactGeom::
|
||||
OdeContactGeom(const dContactGeom &contact_geom) :
|
||||
OdeContactGeom(const dContactGeom ©) :
|
||||
_contact_geom() {
|
||||
_contact_geom.pos[0] = contact_geom.pos[0];
|
||||
_contact_geom.pos[1] = contact_geom.pos[1];
|
||||
_contact_geom.pos[2] = contact_geom.pos[2];
|
||||
_contact_geom.normal[0] = contact_geom.normal[0];
|
||||
_contact_geom.normal[1] = contact_geom.normal[1];
|
||||
_contact_geom.normal[2] = contact_geom.normal[2];
|
||||
_contact_geom.depth = contact_geom.depth;
|
||||
_contact_geom.g1 = contact_geom.g1;
|
||||
_contact_geom.g2 = contact_geom.g2;
|
||||
_contact_geom.side1 = contact_geom.side1;
|
||||
_contact_geom.side2 = contact_geom.side2;
|
||||
*this = _contact_geom;
|
||||
}
|
||||
|
||||
OdeContactGeom::
|
||||
@ -69,16 +49,21 @@ get_contact_geom_ptr() const {
|
||||
|
||||
void OdeContactGeom::
|
||||
operator = (const OdeContactGeom ©) {
|
||||
_contact_geom.pos[0] = copy._contact_geom.pos[0];
|
||||
_contact_geom.pos[1] = copy._contact_geom.pos[1];
|
||||
_contact_geom.pos[2] = copy._contact_geom.pos[2];
|
||||
_contact_geom.normal[0] = copy._contact_geom.normal[0];
|
||||
_contact_geom.normal[1] = copy._contact_geom.normal[1];
|
||||
_contact_geom.normal[2] = copy._contact_geom.normal[2];
|
||||
_contact_geom.depth = copy._contact_geom.depth;
|
||||
_contact_geom.g1 = copy._contact_geom.g1;
|
||||
_contact_geom.g2 = copy._contact_geom.g2;
|
||||
_contact_geom.side1 = copy._contact_geom.side1;
|
||||
_contact_geom.side2 = copy._contact_geom.side2;
|
||||
*this = copy._contact_geom;
|
||||
}
|
||||
|
||||
void OdeContactGeom::
|
||||
operator = (const dContactGeom &contact_geom) {
|
||||
_contact_geom.pos[0] = contact_geom.pos[0];
|
||||
_contact_geom.pos[1] = contact_geom.pos[1];
|
||||
_contact_geom.pos[2] = contact_geom.pos[2];
|
||||
_contact_geom.normal[0] = contact_geom.normal[0];
|
||||
_contact_geom.normal[1] = contact_geom.normal[1];
|
||||
_contact_geom.normal[2] = contact_geom.normal[2];
|
||||
_contact_geom.depth = contact_geom.depth;
|
||||
_contact_geom.g1 = contact_geom.g1;
|
||||
_contact_geom.g2 = contact_geom.g2;
|
||||
_contact_geom.side1 = contact_geom.side1;
|
||||
_contact_geom.side2 = contact_geom.side2;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class EXPCL_PANDAODE OdeContactGeom : public TypedReferenceCount {
|
||||
friend class OdeContact;
|
||||
|
||||
protected:
|
||||
OdeContactGeom(const dContactGeom &contact_geom);
|
||||
OdeContactGeom(const dContactGeom ©);
|
||||
|
||||
PUBLISHED:
|
||||
OdeContactGeom();
|
||||
@ -60,6 +60,7 @@ public:
|
||||
|
||||
private:
|
||||
void operator = (const OdeContactGeom ©);
|
||||
void operator = (const dContactGeom ©);
|
||||
dContactGeom _contact_geom;
|
||||
|
||||
public:
|
||||
|
@ -43,6 +43,11 @@ set_position(dReal x, dReal y, dReal z) {
|
||||
dGeomSetPosition(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_position(const LVecBase3f &pos) {
|
||||
set_position(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_rotation(const LMatrix3f &r) {
|
||||
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
|
||||
@ -96,13 +101,23 @@ get_class() const {
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_category_bits(unsigned long bits) {
|
||||
dGeomSetCategoryBits(_id, bits);
|
||||
set_category_bits(const BitMask32 &bits) {
|
||||
dGeomSetCategoryBits(_id, bits.get_word());
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_collide_bits(unsigned long bits) {
|
||||
dGeomSetCollideBits(_id, bits);
|
||||
set_collide_bits(const BitMask32 &bits) {
|
||||
dGeomSetCollideBits(_id, bits.get_word());
|
||||
}
|
||||
|
||||
INLINE BitMask32 OdeGeom::
|
||||
get_category_bits() {
|
||||
return BitMask32(dGeomGetCategoryBits(_id));
|
||||
}
|
||||
|
||||
INLINE BitMask32 OdeGeom::
|
||||
get_collide_bits() {
|
||||
return BitMask32(dGeomGetCollideBits(_id));
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
@ -125,6 +140,11 @@ set_offset_position(dReal x, dReal y, dReal z) {
|
||||
dGeomSetOffsetPosition(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_offset_position(const LVecBase3f &pos) {
|
||||
set_offset_position(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_offset_rotation(const LMatrix3f &r) {
|
||||
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
|
||||
@ -144,6 +164,11 @@ set_offset_world_position(dReal x, dReal y, dReal z) {
|
||||
dGeomSetOffsetWorldPosition(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_offset_world_position(const LVecBase3f &pos) {
|
||||
set_offset_world_position(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeGeom::
|
||||
set_offset_world_rotation(const LMatrix3f &r) {
|
||||
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
|
||||
|
@ -21,12 +21,6 @@
|
||||
|
||||
TypeHandle OdeGeom::_type_handle;
|
||||
|
||||
OdeGeom::
|
||||
OdeGeom() :
|
||||
_id(0) {
|
||||
odegeom_cat.debug() << get_type() << "(" << _id << ")\n";
|
||||
}
|
||||
|
||||
OdeGeom::
|
||||
OdeGeom(dGeomID id) :
|
||||
_id(id) {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "pandabase.h"
|
||||
#include "typedObject.h"
|
||||
#include "luse.h"
|
||||
#include "bitMask.h"
|
||||
|
||||
#include "ode_includes.h"
|
||||
#include "odeSpace.h" // Needed for derived classes
|
||||
@ -41,7 +42,6 @@ protected:
|
||||
OdeGeom(dGeomID id);
|
||||
|
||||
PUBLISHED:
|
||||
OdeGeom();
|
||||
virtual ~OdeGeom();
|
||||
void destroy();
|
||||
|
||||
@ -49,6 +49,7 @@ PUBLISHED:
|
||||
INLINE void set_body(OdeBody &body);
|
||||
INLINE OdeBody get_body() const;
|
||||
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 LPoint3f get_position() const;
|
||||
@ -57,15 +58,19 @@ PUBLISHED:
|
||||
//INLINE void get_aabb(dReal aabb[6]) const;
|
||||
INLINE int is_space();
|
||||
INLINE int get_class() const;
|
||||
INLINE void set_category_bits(unsigned long bits);
|
||||
INLINE void set_collide_bits(unsigned long bits);
|
||||
INLINE void set_category_bits(const BitMask32 &bits);
|
||||
INLINE void set_collide_bits(const BitMask32 &bits);
|
||||
INLINE BitMask32 get_category_bits();
|
||||
INLINE BitMask32 get_collide_bits();
|
||||
INLINE void enable();
|
||||
INLINE void disable();
|
||||
INLINE int is_enabled();
|
||||
INLINE void set_offset_position(dReal x, dReal y, dReal z);
|
||||
INLINE void set_offset_position(const LVecBase3f &pos);
|
||||
INLINE void set_offset_rotation(const LMatrix3f &r);
|
||||
INLINE void set_offset_quaternion(const LQuaternionf &q);
|
||||
INLINE void set_offset_world_position(dReal x, dReal y, dReal z);
|
||||
INLINE void set_offset_world_position(const LVecBase3f &pos);
|
||||
INLINE void set_offset_world_rotation(const LMatrix3f &r);
|
||||
INLINE void set_offset_world_quaternion(const LQuaternionf &q);
|
||||
INLINE void clear_offset();
|
||||
@ -75,7 +80,9 @@ PUBLISHED:
|
||||
INLINE LQuaternionf get_offset_quaternion() const;
|
||||
|
||||
void get_space(OdeSpace &space) const;
|
||||
|
||||
virtual void write(ostream &out = cout, unsigned int indent=0) const;
|
||||
|
||||
public:
|
||||
INLINE dGeomID get_id() const;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Filename: odeBoxGeom.h
|
||||
// Filename: odeHeightfieldGeom.h
|
||||
// Created by: joswilso (27Dec06)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -16,8 +16,8 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ODEBOXGEOM_H
|
||||
#define ODEBOXGEOM_H
|
||||
#ifndef ODEHEIGHTFIELDGEOM_H
|
||||
#define ODEHEIGHTFIELDGEOM_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "typedObject.h"
|
||||
@ -27,13 +27,13 @@
|
||||
#include "odeGeom.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : OdeBoxGeom
|
||||
// Class : OdeHeightfieldGeom
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDAODE OdeBoxGeom : public OdeGeom {
|
||||
class EXPCL_PANDAODE OdeHeightfieldGeom : public OdeGeom {
|
||||
PUBLISHED:
|
||||
OdeBoxGeom();
|
||||
virtual ~OdeBoxGeom();
|
||||
OdeHeightfieldGeom();
|
||||
virtual ~OdeHeightfieldGeom();
|
||||
|
||||
INLINE dHeightfieldDataID heightfield_data_create();
|
||||
INLINE void heightfield_data_destroy(dHeightfieldDataID d);
|
||||
@ -51,7 +51,7 @@ public:
|
||||
}
|
||||
static void init_type() {
|
||||
OdeGeom::init_type();
|
||||
register_type(_type_handle, "OdeBoxGeom",
|
||||
register_type(_type_handle, "OdeHeightfieldGeom",
|
||||
OdeGeom::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
@ -63,6 +63,6 @@ private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "odeBoxGeom.I"
|
||||
#include "odeHeightfieldGeom.I"
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@ get_id() const {
|
||||
return _id;
|
||||
}
|
||||
|
||||
/*
|
||||
INLINE void OdeJoint::
|
||||
set_data(void *data) {
|
||||
dJointSetData(_id, data);
|
||||
@ -30,12 +31,14 @@ INLINE void *OdeJoint::
|
||||
get_data() {
|
||||
return dJointGetData(_id);
|
||||
}
|
||||
*/
|
||||
|
||||
INLINE int OdeJoint::
|
||||
get_joint_type() const {
|
||||
return dJointGetType(_id);
|
||||
}
|
||||
|
||||
/*
|
||||
INLINE void OdeJoint::
|
||||
set_feedback(dJointFeedback *feedback) {
|
||||
dJointSetFeedback(_id, feedback);
|
||||
@ -45,3 +48,4 @@ INLINE dJointFeedback *OdeJoint::
|
||||
get_feedback() {
|
||||
return dJointGetFeedback(_id);
|
||||
}
|
||||
*/
|
@ -38,12 +38,14 @@ destroy() {
|
||||
}
|
||||
|
||||
void OdeJoint::
|
||||
attach(const OdeBody &body1, const OdeBody &body2) {
|
||||
attachBodies(const OdeBody &body1, const OdeBody &body2) {
|
||||
nassertv(body1.get_id() != 0 && body2.get_id() != 0);
|
||||
dJointAttach(_id, body1.get_id(), body2.get_id());
|
||||
}
|
||||
|
||||
void OdeJoint::
|
||||
attach(const OdeBody &body, int index) {
|
||||
attachBody(const OdeBody &body, int index) {
|
||||
nassertv(body.get_id() != 0);
|
||||
if (index == 0) {
|
||||
dJointAttach(_id, body.get_id(), 0);
|
||||
} else {
|
||||
@ -56,9 +58,10 @@ detach() {
|
||||
dJointAttach(_id, 0, 0);
|
||||
}
|
||||
|
||||
void OdeJoint::
|
||||
get_body(int index, OdeBody &body) const {
|
||||
body._id = dJointGetBody(_id, index);
|
||||
OdeBody OdeJoint::
|
||||
get_body(int index) const {
|
||||
nassertr(index == 0 || index == 1, OdeBody(0));
|
||||
return OdeBody(dJointGetBody(_id, index));
|
||||
}
|
||||
|
||||
void OdeJoint::
|
||||
@ -67,8 +70,7 @@ write(ostream &out, unsigned int indent) const {
|
||||
out.width(indent); out << "" << get_type() \
|
||||
<< "(id = " << _id \
|
||||
<< ", body1 = ";
|
||||
OdeBody body;
|
||||
get_body(0, body);
|
||||
OdeBody body = get_body(0);
|
||||
if (body.get_id() != 0) {
|
||||
body.write(out);
|
||||
}
|
||||
@ -76,7 +78,7 @@ write(ostream &out, unsigned int indent) const {
|
||||
out << "0";
|
||||
}
|
||||
out << ", body2 = ";
|
||||
get_body(1, body);
|
||||
body = get_body(1);
|
||||
if (body.get_id() != 0) {
|
||||
body.write(out);
|
||||
}
|
||||
@ -87,3 +89,8 @@ write(ostream &out, unsigned int indent) const {
|
||||
|
||||
#endif //] NDEBUG
|
||||
}
|
||||
|
||||
bool OdeJoint::
|
||||
operator==(const OdeJoint &other) {
|
||||
return _id == other._id;
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
||||
#include "odeWorld.h" // Needed for derived classes
|
||||
#include "odeJointGroup.h"
|
||||
|
||||
|
||||
class OdeBody;
|
||||
// Strange, we should be forced to include this by get_body()
|
||||
class OdeBody;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -45,19 +45,20 @@ protected:
|
||||
PUBLISHED:
|
||||
virtual ~OdeJoint();
|
||||
void destroy();
|
||||
|
||||
INLINE void set_data(void *data);
|
||||
INLINE void *get_data();
|
||||
|
||||
// INLINE void set_data(void *data);
|
||||
// INLINE void *get_data();
|
||||
INLINE int get_joint_type() const;
|
||||
void get_body(int index, OdeBody &body) const;
|
||||
INLINE void set_feedback(dJointFeedback *);
|
||||
INLINE dJointFeedback *get_feedback();
|
||||
OdeBody get_body(int index) const;
|
||||
// INLINE void set_feedback(dJointFeedback *);
|
||||
// INLINE dJointFeedback *get_feedback();
|
||||
|
||||
void attach(const OdeBody &body1, const OdeBody &body2);
|
||||
void attach(const OdeBody &body, int index);
|
||||
void attachBodies(const OdeBody &body1, const OdeBody &body2);
|
||||
void attachBody(const OdeBody &body, int index);
|
||||
void detach();
|
||||
|
||||
virtual void write(ostream &out = cout, unsigned int indent=0) const;
|
||||
bool operator==(const OdeJoint &other);
|
||||
|
||||
public:
|
||||
INLINE dJointID get_id() const;
|
||||
|
@ -37,6 +37,16 @@ set_parameters(dReal themass,
|
||||
I12, I13, I23);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
set_parameters(dReal themass,
|
||||
const LVecBase3f ¢er,
|
||||
const LMatrix3f &i) {
|
||||
set_parameters(themass,
|
||||
center[0], center[1], center[2],
|
||||
i._m.data[0], i._m.data[4], i._m.data[8],
|
||||
i._m.data[1], i._m.data[2], i._m.data[5]);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
set_sphere(dReal density, dReal radius) {
|
||||
_mass.setSphere(density, radius);
|
||||
@ -81,7 +91,22 @@ INLINE void OdeMass::
|
||||
set_box(dReal density,
|
||||
dReal lx, dReal ly, dReal lz) {
|
||||
_mass.setBox(density,
|
||||
lx, ly, lz);
|
||||
lx, ly, lz);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
set_box(dReal density,
|
||||
const LVecBase3f &size) {
|
||||
_mass.setBox(density,
|
||||
size[0], size[1], size[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
set_box_total(dReal total_mass,
|
||||
const LVecBase3f &size) {
|
||||
dMassSetBoxTotal(&_mass,
|
||||
total_mass,
|
||||
size[0], size[1], size[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
@ -103,8 +128,16 @@ translate(dReal x, dReal y, dReal z) {
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
rotate(const dMatrix3 R) {
|
||||
_mass.rotate(R);
|
||||
translate(const LVecBase3f &pos) {
|
||||
translate(pos[0], pos[1], pos[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
rotate(const LMatrix3f &r) {
|
||||
dMatrix3 rot = { r._m.data[0], r._m.data[1], r._m.data[2], 0,
|
||||
r._m.data[3], r._m.data[4], r._m.data[5], 0,
|
||||
r._m.data[6], r._m.data[7], r._m.data[8], 0 };
|
||||
_mass.rotate(rot);
|
||||
}
|
||||
|
||||
INLINE void OdeMass::
|
||||
@ -123,7 +156,7 @@ get_center() const {
|
||||
}
|
||||
|
||||
INLINE LMatrix3f OdeMass::
|
||||
get_inertia() const {
|
||||
get_inertial_tensor() const {
|
||||
return LMatrix3f(_mass.I[0], _mass.I[1], _mass.I[2] ,
|
||||
_mass.I[4], _mass.I[5], _mass.I[6] ,
|
||||
_mass.I[8], _mass.I[9], _mass.I[10]);
|
||||
|
@ -61,7 +61,7 @@ write(ostream &out, unsigned int indent) const {
|
||||
out << get_type() \
|
||||
<< "(mag = " << get_magnitude() \
|
||||
<< ", center = " << get_center() \
|
||||
<< ", inertia = " << get_inertia() \
|
||||
<< ", inertia = " << get_inertial_tensor() \
|
||||
<< ")";
|
||||
#endif //] NDEBUG
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ PUBLISHED:
|
||||
dReal cgx, dReal cgy, dReal cgz,
|
||||
dReal I11, dReal I22, dReal I33,
|
||||
dReal I12, dReal I13, dReal I23);
|
||||
INLINE void set_parameters(dReal themass,
|
||||
const LVecBase3f ¢er,
|
||||
const LMatrix3f &r);
|
||||
INLINE void set_sphere(dReal density, dReal radius);
|
||||
INLINE void set_sphere_total(dReal total_mass, dReal radius);
|
||||
INLINE void set_capsule(dReal density, int direction,
|
||||
@ -53,16 +56,21 @@ PUBLISHED:
|
||||
dReal radius, dReal length);
|
||||
INLINE void set_box(dReal density,
|
||||
dReal lx, dReal ly, dReal lz);
|
||||
INLINE void set_box(dReal density,
|
||||
const LVecBase3f &size);
|
||||
INLINE void set_box_total(dReal total_mass,
|
||||
dReal lx, dReal ly, dReal lz);
|
||||
INLINE void set_box_total(dReal total_mass,
|
||||
const LVecBase3f &size);
|
||||
INLINE void adjust(dReal newmass);
|
||||
INLINE void translate(dReal x, dReal y, dReal z);
|
||||
INLINE void rotate(const dMatrix3 R);
|
||||
INLINE void translate(const LVecBase3f &pos);
|
||||
INLINE void rotate(const LMatrix3f &r);
|
||||
INLINE void add(OdeMass &other);
|
||||
|
||||
INLINE dReal get_magnitude() const;
|
||||
INLINE LPoint3f get_center() const;
|
||||
INLINE LMatrix3f get_inertia() const;
|
||||
INLINE LMatrix3f get_inertial_tensor() const;
|
||||
|
||||
virtual void write(ostream &out = cout, unsigned int indent=0) const;
|
||||
|
||||
|
@ -21,6 +21,11 @@ set_params(dReal a, dReal b, dReal c, dReal d) {
|
||||
dGeomPlaneSetParams(_id, a, b, c, d);
|
||||
}
|
||||
|
||||
INLINE void OdePlaneGeom::
|
||||
set_params(const LVecBase4f ¶ms) {
|
||||
set_params(params[0], params[1], params[2], params[3]);
|
||||
}
|
||||
|
||||
INLINE LVecBase4f OdePlaneGeom::
|
||||
get_params() const {
|
||||
dVector4 res;
|
||||
@ -32,3 +37,8 @@ INLINE dReal OdePlaneGeom::
|
||||
get_point_depth(dReal x, dReal y, dReal z) const {
|
||||
return dGeomPlanePointDepth(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE dReal OdePlaneGeom::
|
||||
get_point_depth(const LPoint3f &p) const {
|
||||
return get_point_depth(p[0], p[1], p[2]);
|
||||
}
|
||||
|
@ -26,11 +26,21 @@ OdePlaneGeom(dReal a, dReal b, dReal c, dReal d) :
|
||||
OdeGeom(dCreatePlane(0, a, b, c, d)) {
|
||||
}
|
||||
|
||||
OdePlaneGeom::
|
||||
OdePlaneGeom(const LVecBase4f ¶ms) :
|
||||
OdeGeom(dCreatePlane(0, params[0], params[1], params[2], params[3])) {
|
||||
}
|
||||
|
||||
OdePlaneGeom::
|
||||
OdePlaneGeom(OdeSpace &space, dReal a, dReal b, dReal c, dReal d) :
|
||||
OdeGeom(dCreatePlane(space.get_id(), a, b, c, d)) {
|
||||
}
|
||||
|
||||
OdePlaneGeom::
|
||||
OdePlaneGeom(OdeSpace &space, const LVecBase4f ¶ms) :
|
||||
OdeGeom(dCreatePlane(space.get_id(), params[0], params[1], params[2], params[3])) {
|
||||
}
|
||||
|
||||
OdePlaneGeom::
|
||||
~OdePlaneGeom() {
|
||||
}
|
||||
|
@ -32,12 +32,16 @@
|
||||
class EXPCL_PANDAODE OdePlaneGeom : public OdeGeom {
|
||||
PUBLISHED:
|
||||
OdePlaneGeom(dReal a, dReal b, dReal c, dReal d);
|
||||
OdePlaneGeom(const LVecBase4f ¶ms);
|
||||
OdePlaneGeom(OdeSpace &space, dReal a, dReal b, dReal c, dReal d);
|
||||
OdePlaneGeom(OdeSpace &space, const LVecBase4f ¶ms);
|
||||
virtual ~OdePlaneGeom();
|
||||
|
||||
INLINE void set_params(dReal a, dReal b, dReal c, dReal d);
|
||||
INLINE void set_params(const LVecBase4f ¶ms);
|
||||
INLINE LVecBase4f get_params() const;
|
||||
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
|
||||
INLINE dReal get_point_depth(const LPoint3f &p) const;
|
||||
|
||||
public:
|
||||
INLINE static int get_geom_class() { return dPlaneClass; };
|
||||
|
@ -23,7 +23,7 @@ TypeHandle OdeQuadTreeSpace::_type_handle;
|
||||
|
||||
typedef struct { dVector4 vec; } sdVector4;
|
||||
|
||||
sdVector4 LVec3TodVector4(const LVecBase3f& vec) {
|
||||
sdVector4 LVec3_to_sdVector4(const LVecBase3f& vec) {
|
||||
sdVector4 sdVec4;
|
||||
|
||||
sdVec4.vec[0] = vec[0];
|
||||
@ -39,8 +39,8 @@ OdeQuadTreeSpace(const LPoint3f ¢er,
|
||||
const LVecBase3f &extents,
|
||||
const int depth) :
|
||||
OdeSpace(dQuadTreeSpaceCreate(0,
|
||||
LVec3TodVector4(center).vec,
|
||||
LVec3TodVector4(extents).vec,
|
||||
LVec3_to_sdVector4(center).vec,
|
||||
LVec3_to_sdVector4(extents).vec,
|
||||
depth)) {
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ OdeQuadTreeSpace(OdeSpace &space,
|
||||
const LVecBase3f &extents,
|
||||
const int depth) :
|
||||
OdeSpace(dQuadTreeSpaceCreate(space.get_id(),
|
||||
LVec3TodVector4(center).vec,
|
||||
LVec3TodVector4(extents).vec,
|
||||
LVec3_to_sdVector4(center).vec,
|
||||
LVec3_to_sdVector4(extents).vec,
|
||||
depth)) {
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,10 @@ set(dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz) {
|
||||
dGeomRaySet(_id, px, py, pz, dx, dy, dz);
|
||||
}
|
||||
|
||||
INLINE void OdeRayGeom::
|
||||
set(const LVecBase3f &start, const LVecBase3f &dir) {
|
||||
set(start[0], start[1], start[2], dir[0], dir[1], dir[2]);
|
||||
}
|
||||
|
||||
INLINE void OdeRayGeom::
|
||||
get(LVecBase3f &start, LVecBase3f &dir) const {
|
||||
|
@ -38,6 +38,7 @@ PUBLISHED:
|
||||
INLINE void set_length(dReal length);
|
||||
INLINE dReal get_length();
|
||||
INLINE void set(dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz);
|
||||
INLINE void set(const LVecBase3f &start, const LVecBase3f &dir);
|
||||
INLINE void get(LVecBase3f &start, LVecBase3f &dir) const;
|
||||
INLINE LVecBase3f get_start() const;
|
||||
INLINE LVecBase3f get_direction() const;
|
||||
|
@ -60,13 +60,23 @@ get_class() const {
|
||||
}
|
||||
|
||||
INLINE void OdeSpace::
|
||||
set_category_bits(unsigned long bits) {
|
||||
dGeomSetCategoryBits((dGeomID)_id, bits);
|
||||
set_category_bits(const BitMask32 &bits) {
|
||||
dGeomSetCategoryBits((dGeomID)_id, bits.get_word());
|
||||
}
|
||||
|
||||
INLINE void OdeSpace::
|
||||
set_collide_bits(unsigned long bits) {
|
||||
dGeomSetCollideBits((dGeomID)_id, bits);
|
||||
set_collide_bits(const BitMask32 &bits) {
|
||||
dGeomSetCollideBits((dGeomID)_id, bits.get_word());
|
||||
}
|
||||
|
||||
INLINE BitMask32 OdeSpace::
|
||||
get_category_bits() {
|
||||
return BitMask32(dGeomGetCategoryBits((dGeomID)_id));
|
||||
}
|
||||
|
||||
INLINE BitMask32 OdeSpace::
|
||||
get_collide_bits() {
|
||||
return BitMask32(dGeomGetCollideBits((dGeomID)_id));
|
||||
}
|
||||
|
||||
INLINE void OdeSpace::
|
||||
|
@ -33,9 +33,8 @@ OdeSpace::
|
||||
void OdeSpace::
|
||||
destroy() {
|
||||
if (get_cleanup()) {
|
||||
OdeGeom geom;
|
||||
for (int i = 0; i < get_num_geoms(); ++i) {
|
||||
get_geom(i, geom);
|
||||
OdeGeom geom(get_geom(i));
|
||||
if (geom.get_class() == OdeTriMeshGeom::get_geom_class()) {
|
||||
OdeTriMeshGeom::unlink_data(geom.get_id());
|
||||
}
|
||||
@ -79,9 +78,9 @@ clean() {
|
||||
dSpaceClean(_id);
|
||||
}
|
||||
|
||||
void OdeSpace::
|
||||
get_geom(int i, OdeGeom &geom) {
|
||||
geom._id = dSpaceGetGeom(_id, i);
|
||||
OdeGeom OdeSpace::
|
||||
get_geom(int i) {
|
||||
return OdeGeom(dSpaceGetGeom(_id, i));
|
||||
}
|
||||
|
||||
void OdeSpace::
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "pandabase.h"
|
||||
#include "typedObject.h"
|
||||
#include "luse.h"
|
||||
#include "bitMask.h"
|
||||
|
||||
#include "ode_includes.h"
|
||||
|
||||
@ -50,8 +51,10 @@ PUBLISHED:
|
||||
// INLINE void get_aabb() const;
|
||||
INLINE int is_space();
|
||||
INLINE int get_class() const;
|
||||
INLINE void set_category_bits(unsigned long bits);
|
||||
INLINE void set_collide_bits(unsigned long bits);
|
||||
INLINE void set_category_bits(const BitMask32 &bits);
|
||||
INLINE void set_collide_bits(const BitMask32 &bits);
|
||||
INLINE BitMask32 get_category_bits();
|
||||
INLINE BitMask32 get_collide_bits();
|
||||
INLINE void enable();
|
||||
INLINE void disable();
|
||||
INLINE int is_enabled();
|
||||
@ -61,7 +64,7 @@ PUBLISHED:
|
||||
void remove(OdeGeom& geom);
|
||||
void remove(OdeSpace& space);
|
||||
void clean();
|
||||
void get_geom(int i, OdeGeom &geom);
|
||||
OdeGeom get_geom(int i); // Not INLINE because of forward declaration
|
||||
|
||||
INLINE OdeSpace get_space() const;
|
||||
|
||||
|
@ -31,3 +31,8 @@ get_point_depth(dReal x, dReal y, dReal z) const {
|
||||
return dGeomSpherePointDepth(_id, x, y, z);
|
||||
}
|
||||
|
||||
INLINE dReal OdeSphereGeom::
|
||||
get_point_depth(const LPoint3f &p) const {
|
||||
return get_point_depth(p[0], p[1], p[2]);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ PUBLISHED:
|
||||
INLINE void set_radius(dReal radius);
|
||||
INLINE dReal get_radius() const;
|
||||
INLINE dReal get_point_depth(dReal x, dReal y, dReal z) const;
|
||||
INLINE dReal get_point_depth(const LPoint3f &p) const;
|
||||
|
||||
public:
|
||||
INLINE static int get_geom_class() { return dSphereClass; };
|
||||
|
Loading…
x
Reference in New Issue
Block a user