no longer pass-by-reference to get LVecBase3f values, also add parallel LVecBase3f functionality

This commit is contained in:
Josh Wilson 2007-02-11 07:18:48 +00:00
parent 6bbea6261c
commit 2844614e24
14 changed files with 113 additions and 15 deletions

View File

@ -26,6 +26,11 @@ set_axis(int anum, int rel, dReal x, dReal y, dReal z) {
dJointSetAMotorAxis(_id, anum, rel, x, y, 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:: INLINE void OdeAMotorJoint::
set_angle(int anum, dReal angle) { set_angle(int anum, dReal angle) {
dJointSetAMotorAngle(_id, anum, angle); dJointSetAMotorAngle(_id, anum, angle);

View File

@ -26,6 +26,7 @@ PUBLISHED:
INLINE void set_num_axes(int num); 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, 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_angle(int anum, dReal angle);
INLINE void set_mode(int mode); INLINE void set_mode(int mode);
INLINE void add_torques(dReal torque1, dReal torque2, dReal torque3); INLINE void add_torques(dReal torque1, dReal torque2, dReal torque3);

View File

@ -21,17 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) {
dJointSetBallAnchor(_id, x, y, 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:: INLINE void OdeBallJoint::
set_anchor2(dReal x, dReal y, dReal z) { set_anchor2(dReal x, dReal y, dReal z) {
dJointSetBallAnchor2(_id, x, y, z); dJointSetBallAnchor2(_id, x, y, z);
} }
INLINE void OdeBallJoint:: INLINE void OdeBallJoint::
get_anchor(dVector3 result) const { set_anchor2(const LVecBase3f &anchor) {
return dJointGetBallAnchor(_id, result); dJointSetBallAnchor2(_id, anchor[0], anchor[1], anchor[2]);
} }
INLINE void OdeBallJoint:: INLINE LVecBase3f OdeBallJoint::
get_anchor2(dVector3 result) const { get_anchor() const {
return dJointGetBallAnchor2(_id, result); 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]);
} }

View File

@ -25,10 +25,12 @@ PUBLISHED:
virtual ~OdeBallJoint(); virtual ~OdeBallJoint();
INLINE void set_anchor(dReal x, dReal y, dReal z); 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(dReal x, dReal y, dReal z);
INLINE void set_anchor2(const LVecBase3f &anchor);
INLINE void get_anchor(dVector3 result) const; INLINE LVecBase3f get_anchor() const;
INLINE void get_anchor2(dVector3 result) const; INLINE LVecBase3f get_anchor2() const;
public: public:
static TypeHandle get_class_type() { static TypeHandle get_class_type() {

View File

@ -22,16 +22,31 @@ set_anchor(dReal x, dReal y, dReal z) {
dJointSetHinge2Anchor(_id, x, y, 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:: INLINE void OdeHinge2Joint::
set_axis1(dReal x, dReal y, dReal z) { set_axis1(dReal x, dReal y, dReal z) {
dJointSetHinge2Axis1(_id, x, y, 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:: INLINE void OdeHinge2Joint::
set_axis2(dReal x, dReal y, dReal z) { set_axis2(dReal x, dReal y, dReal z) {
dJointSetHinge2Axis2(_id, x, y, 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:: INLINE void OdeHinge2Joint::
add_torques(dReal torque1, dReal torque2) { add_torques(dReal torque1, dReal torque2) {
dJointAddHinge2Torques(_id, torque1, torque2); dJointAddHinge2Torques(_id, torque1, torque2);

View File

@ -25,8 +25,11 @@ PUBLISHED:
virtual ~OdeHinge2Joint(); virtual ~OdeHinge2Joint();
INLINE void set_anchor(dReal x, dReal y, dReal z); 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(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(dReal x, dReal y, dReal z);
INLINE void set_axis2(const LVecBase3f &axis);
INLINE void add_torques(dReal torque1, dReal torque2); INLINE void add_torques(dReal torque1, dReal torque2);
INLINE LVecBase3f get_anchor() const; INLINE LVecBase3f get_anchor() const;

View File

@ -21,16 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) {
dJointSetHingeAnchor(_id, x, y, 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:: INLINE void OdeHingeJoint::
set_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) { set_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) {
dJointSetHingeAnchorDelta(_id, x, y, z, ax, ay, 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:: INLINE void OdeHingeJoint::
set_axis(dReal x, dReal y, dReal z) { set_axis(dReal x, dReal y, dReal z) {
dJointSetHingeAxis(_id, x, y, 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:: INLINE void OdeHingeJoint::
add_torque(dReal torque) { add_torque(dReal torque) {
dJointAddHingeTorque(_id, torque); dJointAddHingeTorque(_id, torque);

View File

@ -24,8 +24,11 @@ PUBLISHED:
virtual ~OdeHingeJoint(); virtual ~OdeHingeJoint();
INLINE void set_anchor(dReal x, dReal y, dReal z); 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(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(dReal x, dReal y, dReal z);
INLINE void set_axis(const LVecBase3f &axis);
INLINE void add_torque(dReal torque); INLINE void add_torque(dReal torque);
INLINE LVecBase3f get_anchor() const; INLINE LVecBase3f get_anchor() const;

View File

@ -27,6 +27,11 @@ set_axis(int anum, int rel, dReal x, dReal y, dReal z) {
dJointSetLMotorAxis(_id, anum, rel, x, y, 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:: INLINE void OdeLMotorJoint::
set_param(int parameter, dReal value) { set_param(int parameter, dReal value) {
dJointSetLMotorParam(_id, parameter, value); dJointSetLMotorParam(_id, parameter, value);
@ -37,9 +42,11 @@ get_num_axes() const {
return dJointGetLMotorNumAxes(_id); return dJointGetLMotorNumAxes(_id);
} }
INLINE void OdeLMotorJoint:: INLINE LVecBase3f OdeLMotorJoint::
get_axis(int anum, dVector3 result) const { get_axis(int anum) const {
return dJointGetLMotorAxis(_id, anum, result); dVector3 result;
dJointGetLMotorAxis(_id, anum, result);
return LVecBase3f(result[0], result[1], result[2]);
} }
INLINE dReal OdeLMotorJoint:: INLINE dReal OdeLMotorJoint::

View File

@ -25,10 +25,11 @@ PUBLISHED:
INLINE void set_num_axes(int num); 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, 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 void set_param(int parameter, dReal value);
INLINE int get_num_axes() const; 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; INLINE dReal get_param(int parameter) const;
public: public:

View File

@ -21,11 +21,21 @@ set_axis(dReal x, dReal y, dReal z) {
dJointSetSliderAxis(_id, x, y, 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:: INLINE void OdeSliderJoint::
set_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) { set_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az) {
dJointSetSliderAxisDelta(_id, x, y, z, ax, ay, 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:: INLINE void OdeSliderJoint::
add_force(dReal force) { add_force(dReal force) {
dJointAddSliderForce(_id, force); dJointAddSliderForce(_id, force);
@ -41,9 +51,11 @@ get_position_rate() const {
return dJointGetSliderPositionRate(_id); return dJointGetSliderPositionRate(_id);
} }
INLINE void OdeSliderJoint:: INLINE LVecBase3f OdeSliderJoint::
get_axis(dVector3 result) const { get_axis() const {
return dJointGetSliderAxis(_id, result); dVector3 result;
dJointGetSliderAxis(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
} }
INLINE void OdeSliderJoint:: INLINE void OdeSliderJoint::

View File

@ -24,12 +24,14 @@ PUBLISHED:
virtual ~OdeSliderJoint(); virtual ~OdeSliderJoint();
INLINE void set_axis(dReal x, dReal y, dReal z); 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(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 void add_force(dReal force);
INLINE dReal get_position() const; INLINE dReal get_position() const;
INLINE dReal get_position_rate() 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_lo_stop(dReal val);
INLINE void set_param_hi_stop(dReal val); INLINE void set_param_hi_stop(dReal val);

View File

@ -21,16 +21,31 @@ set_anchor(dReal x, dReal y, dReal z) {
dJointSetUniversalAnchor(_id, x, y, 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:: INLINE void OdeUniversalJoint::
set_axis1(dReal x, dReal y, dReal z) { set_axis1(dReal x, dReal y, dReal z) {
dJointSetUniversalAxis1(_id, x, y, 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:: INLINE void OdeUniversalJoint::
set_axis2(dReal x, dReal y, dReal z) { set_axis2(dReal x, dReal y, dReal z) {
dJointSetUniversalAxis2(_id, x, y, 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:: INLINE void OdeUniversalJoint::
add_torques(dReal torque1, dReal torque2) { add_torques(dReal torque1, dReal torque2) {
dJointAddUniversalTorques(_id, torque1, torque2); dJointAddUniversalTorques(_id, torque1, torque2);

View File

@ -25,8 +25,11 @@ PUBLISHED:
virtual ~OdeUniversalJoint(); virtual ~OdeUniversalJoint();
INLINE void set_anchor(dReal x, dReal y, dReal z); 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(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(dReal x, dReal y, dReal z);
INLINE void set_axis2(const LVecBase3f &axis);
INLINE void add_torques(dReal torque1, dReal torque2); INLINE void add_torques(dReal torque1, dReal torque2);
INLINE LVecBase3f get_anchor() const; INLINE LVecBase3f get_anchor() const;