From 2844614e242f0bd948cfc33f34eba72d5d6cc111 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 11 Feb 2007 07:18:48 +0000 Subject: [PATCH] no longer pass-by-reference to get LVecBase3f values, also add parallel LVecBase3f functionality --- panda/src/ode/odeAMotorJoint.I | 5 +++++ panda/src/ode/odeAMotorJoint.h | 1 + panda/src/ode/odeBallJoint.I | 24 +++++++++++++++++++----- panda/src/ode/odeBallJoint.h | 6 ++++-- panda/src/ode/odeHinge2Joint.I | 15 +++++++++++++++ panda/src/ode/odeHinge2Joint.h | 3 +++ panda/src/ode/odeHingeJoint.I | 15 +++++++++++++++ panda/src/ode/odeHingeJoint.h | 3 +++ panda/src/ode/odeLMotorJoint.I | 13 ++++++++++--- panda/src/ode/odeLMotorJoint.h | 3 ++- panda/src/ode/odeSliderJoint.I | 18 +++++++++++++++--- panda/src/ode/odeSliderJoint.h | 4 +++- panda/src/ode/odeUniversalJoint.I | 15 +++++++++++++++ panda/src/ode/odeUniversalJoint.h | 3 +++ 14 files changed, 113 insertions(+), 15 deletions(-) diff --git a/panda/src/ode/odeAMotorJoint.I b/panda/src/ode/odeAMotorJoint.I index 5fef72da50..7593d9b19e 100755 --- a/panda/src/ode/odeAMotorJoint.I +++ b/panda/src/ode/odeAMotorJoint.I @@ -26,6 +26,11 @@ set_axis(int anum, int rel, dReal x, dReal y, dReal z) { dJointSetAMotorAxis(_id, anum, rel, x, y, z); } +INLINE void OdeAMotorJoint:: +set_axis(int anum, int rel, const LVecBase3f &axis) { + dJointSetAMotorAxis(_id, anum, rel, axis[0], axis[1], axis[2]); +} + INLINE void OdeAMotorJoint:: set_angle(int anum, dReal angle) { dJointSetAMotorAngle(_id, anum, angle); diff --git a/panda/src/ode/odeAMotorJoint.h b/panda/src/ode/odeAMotorJoint.h index 6178de0bd5..fb339c59d8 100644 --- a/panda/src/ode/odeAMotorJoint.h +++ b/panda/src/ode/odeAMotorJoint.h @@ -26,6 +26,7 @@ PUBLISHED: INLINE void set_num_axes(int num); INLINE void set_axis(int anum, int rel, dReal x, dReal y, dReal z); + INLINE void set_axis(int anum, int rel, const LVecBase3f &axis); INLINE void set_angle(int anum, dReal angle); INLINE void set_mode(int mode); INLINE void add_torques(dReal torque1, dReal torque2, dReal torque3); diff --git a/panda/src/ode/odeBallJoint.I b/panda/src/ode/odeBallJoint.I index e5795dd4f1..841261dc24 100755 --- a/panda/src/ode/odeBallJoint.I +++ b/panda/src/ode/odeBallJoint.I @@ -21,17 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) { dJointSetBallAnchor(_id, x, y, z); } +INLINE void OdeBallJoint:: +set_anchor(const LVecBase3f &anchor) { + dJointSetBallAnchor(_id, anchor[0], anchor[1], anchor[2]); +} + INLINE void OdeBallJoint:: set_anchor2(dReal x, dReal y, dReal z) { dJointSetBallAnchor2(_id, x, y, z); } INLINE void OdeBallJoint:: -get_anchor(dVector3 result) const { - return dJointGetBallAnchor(_id, result); +set_anchor2(const LVecBase3f &anchor) { + dJointSetBallAnchor2(_id, anchor[0], anchor[1], anchor[2]); } -INLINE void OdeBallJoint:: -get_anchor2(dVector3 result) const { - return dJointGetBallAnchor2(_id, result); +INLINE LVecBase3f OdeBallJoint:: +get_anchor() const { + dVector3 result; + dJointGetBallAnchor(_id, result); + return LVecBase3f(result[0], result[1], result[2]); +} + +INLINE LVecBase3f OdeBallJoint:: +get_anchor2() const { + dVector3 result; + dJointGetBallAnchor2(_id, result); + return LVecBase3f(result[0], result[1], result[2]); } diff --git a/panda/src/ode/odeBallJoint.h b/panda/src/ode/odeBallJoint.h index 2f00bf922b..957a68df2e 100644 --- a/panda/src/ode/odeBallJoint.h +++ b/panda/src/ode/odeBallJoint.h @@ -25,10 +25,12 @@ PUBLISHED: virtual ~OdeBallJoint(); INLINE void set_anchor(dReal x, dReal y, dReal z); + INLINE void set_anchor(const LVecBase3f &anchor); INLINE void set_anchor2(dReal x, dReal y, dReal z); + INLINE void set_anchor2(const LVecBase3f &anchor); - INLINE void get_anchor(dVector3 result) const; - INLINE void get_anchor2(dVector3 result) const; + INLINE LVecBase3f get_anchor() const; + INLINE LVecBase3f get_anchor2() const; public: static TypeHandle get_class_type() { diff --git a/panda/src/ode/odeHinge2Joint.I b/panda/src/ode/odeHinge2Joint.I index d5bb5cc7c1..2293a0ce82 100755 --- a/panda/src/ode/odeHinge2Joint.I +++ b/panda/src/ode/odeHinge2Joint.I @@ -22,16 +22,31 @@ set_anchor(dReal x, dReal y, dReal z) { dJointSetHinge2Anchor(_id, x, y, z); } +INLINE void OdeHinge2Joint:: +set_anchor(const LVecBase3f &anchor) { + dJointSetHinge2Anchor(_id, anchor[0], anchor[1], anchor[2]); +} + INLINE void OdeHinge2Joint:: set_axis1(dReal x, dReal y, dReal z) { dJointSetHinge2Axis1(_id, x, y, z); } +INLINE void OdeHinge2Joint:: +set_axis1(const LVecBase3f &axis) { + dJointSetHinge2Axis1(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeHinge2Joint:: set_axis2(dReal x, dReal y, dReal z) { dJointSetHinge2Axis2(_id, x, y, z); } +INLINE void OdeHinge2Joint:: +set_axis2(const LVecBase3f &axis) { + dJointSetHinge2Axis2(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeHinge2Joint:: add_torques(dReal torque1, dReal torque2) { dJointAddHinge2Torques(_id, torque1, torque2); diff --git a/panda/src/ode/odeHinge2Joint.h b/panda/src/ode/odeHinge2Joint.h index 62ef7bb57e..7211d94dc8 100644 --- a/panda/src/ode/odeHinge2Joint.h +++ b/panda/src/ode/odeHinge2Joint.h @@ -25,8 +25,11 @@ PUBLISHED: virtual ~OdeHinge2Joint(); INLINE void set_anchor(dReal x, dReal y, dReal z); + INLINE void set_anchor(const LVecBase3f &anchor); INLINE void set_axis1(dReal x, dReal y, dReal z); + INLINE void set_axis1(const LVecBase3f &axis); INLINE void set_axis2(dReal x, dReal y, dReal z); + INLINE void set_axis2(const LVecBase3f &axis); INLINE void add_torques(dReal torque1, dReal torque2); INLINE LVecBase3f get_anchor() const; diff --git a/panda/src/ode/odeHingeJoint.I b/panda/src/ode/odeHingeJoint.I index 1a9da0270d..784c43c8eb 100755 --- a/panda/src/ode/odeHingeJoint.I +++ b/panda/src/ode/odeHingeJoint.I @@ -21,16 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) { dJointSetHingeAnchor(_id, x, y, z); } +INLINE void OdeHingeJoint:: +set_anchor(const LVecBase3f &anchor) { + dJointSetHingeAnchor(_id, anchor[0], anchor[1], anchor[2]); +} + INLINE void OdeHingeJoint:: set_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) { dJointSetHingeAnchorDelta(_id, x, y, z, ax, ay, az); } +INLINE void OdeHingeJoint:: +set_anchor_delta(const LVecBase3f &anchor, const LVecBase3f &vec) { + dJointSetHingeAnchorDelta(_id, anchor[0], anchor[1], anchor[2], vec[0], vec[1], vec[2]); +} + INLINE void OdeHingeJoint:: set_axis(dReal x, dReal y, dReal z) { dJointSetHingeAxis(_id, x, y, z); } +INLINE void OdeHingeJoint:: +set_axis(const LVecBase3f &axis) { + dJointSetHingeAxis(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeHingeJoint:: add_torque(dReal torque) { dJointAddHingeTorque(_id, torque); diff --git a/panda/src/ode/odeHingeJoint.h b/panda/src/ode/odeHingeJoint.h index 7efc277cb4..4b748efaa3 100755 --- a/panda/src/ode/odeHingeJoint.h +++ b/panda/src/ode/odeHingeJoint.h @@ -24,8 +24,11 @@ PUBLISHED: virtual ~OdeHingeJoint(); INLINE void set_anchor(dReal x, dReal y, dReal z); + INLINE void set_anchor(const LVecBase3f &anchor); INLINE void set_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); + INLINE void set_anchor_delta(const LVecBase3f &anchor, const LVecBase3f &vec); INLINE void set_axis(dReal x, dReal y, dReal z); + INLINE void set_axis(const LVecBase3f &axis); INLINE void add_torque(dReal torque); INLINE LVecBase3f get_anchor() const; diff --git a/panda/src/ode/odeLMotorJoint.I b/panda/src/ode/odeLMotorJoint.I index d2ad12075d..21b8c8381a 100755 --- a/panda/src/ode/odeLMotorJoint.I +++ b/panda/src/ode/odeLMotorJoint.I @@ -27,6 +27,11 @@ set_axis(int anum, int rel, dReal x, dReal y, dReal z) { dJointSetLMotorAxis(_id, anum, rel, x, y, z); } +INLINE void OdeLMotorJoint:: +set_axis(int anum, int rel, const LVecBase3f &axis) { + dJointSetLMotorAxis(_id, anum, rel, axis[0], axis[1], axis[2]); +} + INLINE void OdeLMotorJoint:: set_param(int parameter, dReal value) { dJointSetLMotorParam(_id, parameter, value); @@ -37,9 +42,11 @@ get_num_axes() const { return dJointGetLMotorNumAxes(_id); } -INLINE void OdeLMotorJoint:: -get_axis(int anum, dVector3 result) const { - return dJointGetLMotorAxis(_id, anum, result); +INLINE LVecBase3f OdeLMotorJoint:: +get_axis(int anum) const { + dVector3 result; + dJointGetLMotorAxis(_id, anum, result); + return LVecBase3f(result[0], result[1], result[2]); } INLINE dReal OdeLMotorJoint:: diff --git a/panda/src/ode/odeLMotorJoint.h b/panda/src/ode/odeLMotorJoint.h index 175c938ae3..ffcedda723 100755 --- a/panda/src/ode/odeLMotorJoint.h +++ b/panda/src/ode/odeLMotorJoint.h @@ -25,10 +25,11 @@ PUBLISHED: INLINE void set_num_axes(int num); INLINE void set_axis(int anum, int rel, dReal x, dReal y, dReal z); + INLINE void set_axis(int anum, int rel, const LVecBase3f &axis); INLINE void set_param(int parameter, dReal value); INLINE int get_num_axes() const; - INLINE void get_axis(int anum, dVector3 result) const; + INLINE LVecBase3f get_axis(int anum) const; INLINE dReal get_param(int parameter) const; public: diff --git a/panda/src/ode/odeSliderJoint.I b/panda/src/ode/odeSliderJoint.I index 681b4c7c09..fbdfa4370d 100755 --- a/panda/src/ode/odeSliderJoint.I +++ b/panda/src/ode/odeSliderJoint.I @@ -21,11 +21,21 @@ set_axis(dReal x, dReal y, dReal z) { dJointSetSliderAxis(_id, x, y, z); } +INLINE void OdeSliderJoint:: +set_axis(const LVecBase3f &axis) { + dJointSetSliderAxis(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeSliderJoint:: set_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) { dJointSetSliderAxisDelta(_id, x, y, z, ax, ay, az); } +INLINE void OdeSliderJoint:: +set_axis_delta(const LVecBase3f &axis, const LVecBase3f &vec) { + dJointSetSliderAxisDelta(_id, axis[0], axis[1], axis[2], vec[0], vec[1], vec[2]); +} + INLINE void OdeSliderJoint:: add_force(dReal force) { dJointAddSliderForce(_id, force); @@ -41,9 +51,11 @@ get_position_rate() const { return dJointGetSliderPositionRate(_id); } -INLINE void OdeSliderJoint:: -get_axis(dVector3 result) const { - return dJointGetSliderAxis(_id, result); +INLINE LVecBase3f OdeSliderJoint:: +get_axis() const { + dVector3 result; + dJointGetSliderAxis(_id, result); + return LVecBase3f(result[0], result[1], result[2]); } INLINE void OdeSliderJoint:: diff --git a/panda/src/ode/odeSliderJoint.h b/panda/src/ode/odeSliderJoint.h index aae4a90119..3ddd7ab3d7 100755 --- a/panda/src/ode/odeSliderJoint.h +++ b/panda/src/ode/odeSliderJoint.h @@ -24,12 +24,14 @@ PUBLISHED: virtual ~OdeSliderJoint(); INLINE void set_axis(dReal x, dReal y, dReal z); + INLINE void set_axis(const LVecBase3f &axis); INLINE void set_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); + INLINE void set_axis_delta(const LVecBase3f &axis, const LVecBase3f &vec); INLINE void add_force(dReal force); INLINE dReal get_position() const; INLINE dReal get_position_rate() const; - INLINE void get_axis(dVector3 result) const; + INLINE LVecBase3f get_axis() const; INLINE void set_param_lo_stop(dReal val); INLINE void set_param_hi_stop(dReal val); diff --git a/panda/src/ode/odeUniversalJoint.I b/panda/src/ode/odeUniversalJoint.I index 1a36c32772..a67b151dde 100755 --- a/panda/src/ode/odeUniversalJoint.I +++ b/panda/src/ode/odeUniversalJoint.I @@ -21,16 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) { dJointSetUniversalAnchor(_id, x, y, z); } +INLINE void OdeUniversalJoint:: +set_anchor(const LVecBase3f &anchor) { + dJointSetUniversalAnchor(_id, anchor[0], anchor[1], anchor[2]); +} + INLINE void OdeUniversalJoint:: set_axis1(dReal x, dReal y, dReal z) { dJointSetUniversalAxis1(_id, x, y, z); } +INLINE void OdeUniversalJoint:: +set_axis1(const LVecBase3f &axis) { + dJointSetUniversalAxis1(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeUniversalJoint:: set_axis2(dReal x, dReal y, dReal z) { dJointSetUniversalAxis2(_id, x, y, z); } +INLINE void OdeUniversalJoint:: +set_axis2(const LVecBase3f &axis) { + dJointSetUniversalAxis2(_id, axis[0], axis[1], axis[2]); +} + INLINE void OdeUniversalJoint:: add_torques(dReal torque1, dReal torque2) { dJointAddUniversalTorques(_id, torque1, torque2); diff --git a/panda/src/ode/odeUniversalJoint.h b/panda/src/ode/odeUniversalJoint.h index 37900b22bc..fc1870c1af 100644 --- a/panda/src/ode/odeUniversalJoint.h +++ b/panda/src/ode/odeUniversalJoint.h @@ -25,8 +25,11 @@ PUBLISHED: virtual ~OdeUniversalJoint(); INLINE void set_anchor(dReal x, dReal y, dReal z); + INLINE void set_anchor(const LVecBase3f &anchor); INLINE void set_axis1(dReal x, dReal y, dReal z); + INLINE void set_axis1(const LVecBase3f &axis); INLINE void set_axis2(dReal x, dReal y, dReal z); + INLINE void set_axis2(const LVecBase3f &axis); INLINE void add_torques(dReal torque1, dReal torque2); INLINE LVecBase3f get_anchor() const;