added joint parameter functions for the joints that support them

This commit is contained in:
Josh Wilson 2007-02-11 06:50:46 +00:00
parent 1dddb03b95
commit 6bbea6261c
13 changed files with 1103 additions and 109 deletions

View File

@ -31,11 +31,6 @@ set_angle(int anum, dReal angle) {
dJointSetAMotorAngle(_id, anum, angle);
}
INLINE void OdeAMotorJoint::
set_param(int parameter, dReal value) {
dJointSetAMotorParam(_id, parameter, value);
}
INLINE void OdeAMotorJoint::
set_mode(int mode) {
dJointSetAMotorMode(_id, mode);
@ -51,9 +46,11 @@ get_num_axes() const {
return dJointGetAMotorNumAxes(_id);
}
INLINE void OdeAMotorJoint::
get_axis(int anum, dVector3 result) const {
return dJointGetAMotorAxis(_id, anum, result);
INLINE LVecBase3f OdeAMotorJoint::
get_axis(int anum) const {
dVector3 result;
dJointGetAMotorAxis(_id, anum, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE int OdeAMotorJoint::
@ -71,12 +68,251 @@ get_angle_rate(int anum) const {
return dJointGetAMotorAngleRate(_id, anum);
}
INLINE dReal OdeAMotorJoint::
get_param(int parameter) const {
return dJointGetAMotorParam(_id, parameter);
}
INLINE int OdeAMotorJoint::
get_mode() const {
return dJointGetAMotorMode(_id);
}
INLINE void OdeAMotorJoint::
set_param_lo_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamLoStop, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamLoStop, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamLoStop, val);
}
}
INLINE void OdeAMotorJoint::
set_param_hi_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamHiStop, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamHiStop, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamHiStop, val);
}
}
INLINE void OdeAMotorJoint::
set_param_vel(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamVel, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamVel, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamVel, val);
}
}
INLINE void OdeAMotorJoint::
set_param_f_max(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamFMax, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamFMax, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamFMax, val);
}
}
INLINE void OdeAMotorJoint::
set_param_fudge_factor(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamFudgeFactor, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamFudgeFactor, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamFudgeFactor, val);
}
}
INLINE void OdeAMotorJoint::
set_param_bounce(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamBounce, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamBounce, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamBounce, val);
}
}
INLINE void OdeAMotorJoint::
set_param_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamCFM, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamCFM, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamCFM, val);
}
}
INLINE void OdeAMotorJoint::
set_param_stop_ERP(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamStopERP, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamStopERP, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamStopERP, val);
}
}
INLINE void OdeAMotorJoint::
set_param_stop_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 2 );
if ( axis == 0 ) {
dJointSetAMotorParam(_id, dParamStopCFM, val);
} else if ( axis == 1 ) {
dJointSetAMotorParam(_id, dParamStopCFM, val);
} else if ( axis == 2 ) {
dJointSetAMotorParam(_id, dParamStopCFM, val);
}
}
INLINE dReal OdeAMotorJoint::
get_param_lo_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamLoStop);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamLoStop);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamLoStop);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_hi_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamHiStop);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamHiStop);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamHiStop);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_vel(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamVel);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamVel);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamVel);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_f_max(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamFMax);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamFMax);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamFMax);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_fudge_factor(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamFudgeFactor);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamFudgeFactor);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamFudgeFactor);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_bounce(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamBounce);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamBounce);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamBounce);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamCFM);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamCFM);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamCFM);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_stop_ERP(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamStopERP);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamStopERP);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamStopERP);
}
return 0;
}
INLINE dReal OdeAMotorJoint::
get_param_stop_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 2, 0 );
if ( axis == 0 ) {
return dJointGetAMotorParam(_id, dParamStopCFM);
} else if ( axis == 1 ) {
return dJointGetAMotorParam(_id, dParamStopCFM);
} else if ( axis == 2 ) {
return dJointGetAMotorParam(_id, dParamStopCFM);
}
return 0;
}

View File

@ -27,18 +27,37 @@ 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_angle(int anum, dReal angle);
INLINE void set_param(int parameter, dReal value);
INLINE void set_mode(int mode);
INLINE void add_torques(dReal torque1, dReal torque2, dReal torque3);
INLINE int get_num_axes() const;
INLINE void get_axis(int anum, dVector3 result) const;
INLINE LVecBase3f get_axis(int anum) const;
INLINE int get_axis_rel(int anum) const;
INLINE dReal get_angle(int anum) const;
INLINE dReal get_angle_rate(int anum) const;
INLINE dReal get_param(int parameter) const;
INLINE int get_mode() const;
INLINE void set_param_lo_stop(int axis, dReal val);
INLINE void set_param_hi_stop(int axis, dReal val);
INLINE void set_param_vel(int axis, dReal val);
INLINE void set_param_f_max(int axis, dReal val);
INLINE void set_param_fudge_factor(int axis, dReal val);
INLINE void set_param_bounce(int axis, dReal val);
INLINE void set_param_CFM(int axis, dReal val);
INLINE void set_param_stop_ERP(int axis, dReal val);
INLINE void set_param_stop_CFM(int axis, dReal val);
INLINE dReal get_param_lo_stop(int axis) const;
INLINE dReal get_param_hi_stop(int axis) const;
INLINE dReal get_param_vel(int axis) const;
INLINE dReal get_param_f_max(int axis) const;
INLINE dReal get_param_fudge_factor(int axis) const;
INLINE dReal get_param_bounce(int axis) const;
INLINE dReal get_param_CFM(int axis) const;
INLINE dReal get_param_stop_ERP(int axis) const;
INLINE dReal get_param_stop_CFM(int axis) const;
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -32,39 +32,37 @@ set_axis2(dReal x, dReal y, dReal z) {
dJointSetHinge2Axis2(_id, x, y, z);
}
INLINE void OdeHinge2Joint::
set_param(int parameter, dReal value) {
dJointSetHinge2Param(_id, parameter, value);
}
INLINE void OdeHinge2Joint::
add_torques(dReal torque1, dReal torque2) {
dJointAddHinge2Torques(_id, torque1, torque2);
}
INLINE void OdeHinge2Joint::
get_anchor(dVector3 result) const {
return dJointGetHinge2Anchor(_id, result);
INLINE LVecBase3f OdeHinge2Joint::
get_anchor() const {
dVector3 result;
dJointGetHinge2Anchor(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeHinge2Joint::
get_anchor2(dVector3 result) const {
return dJointGetHinge2Anchor2(_id, result);
INLINE LVecBase3f OdeHinge2Joint::
get_anchor2() const {
dVector3 result;
dJointGetHinge2Anchor2(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeHinge2Joint::
get_axis1(dVector3 result) const {
return dJointGetHinge2Axis1(_id, result);
INLINE LVecBase3f OdeHinge2Joint::
get_axis1() const {
dVector3 result;
dJointGetHinge2Axis1(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeHinge2Joint::
get_axis2(dVector3 result) const {
return dJointGetHinge2Axis2(_id, result);
}
INLINE dReal OdeHinge2Joint::
get_param(int parameter) const {
return dJointGetHinge2Param(_id, parameter);
INLINE LVecBase3f OdeHinge2Joint::
get_axis2() const {
dVector3 result;
dJointGetHinge2Axis2(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE dReal OdeHinge2Joint::
@ -81,3 +79,257 @@ INLINE dReal OdeHinge2Joint::
get_angle2_rate() const {
return dJointGetHinge2Angle2Rate(_id);
}
INLINE void OdeHinge2Joint::
set_param_lo_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamLoStop, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamLoStop2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_hi_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamHiStop, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamHiStop2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_vel(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamVel, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamVel2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_f_max(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamFMax, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamFMax2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_fudge_factor(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamFudgeFactor, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamFudgeFactor2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_bounce(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamBounce, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamBounce2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamCFM, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamCFM2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_stop_ERP(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamStopERP, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamStopERP2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_stop_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamStopCFM, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamStopCFM2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_suspension_ERP(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamSuspensionERP, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamSuspensionERP2, val);
}
}
INLINE void OdeHinge2Joint::
set_param_suspension_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetHinge2Param(_id, dParamSuspensionCFM, val);
} else if ( axis == 1 ) {
dJointSetHinge2Param(_id, dParamSuspensionCFM2, val);
}
}
INLINE dReal OdeHinge2Joint::
get_param_lo_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamLoStop);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamLoStop2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_hi_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamHiStop);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamHiStop2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_vel(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamVel);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamVel2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_f_max(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamFMax);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamFMax2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_fudge_factor(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamFudgeFactor);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamFudgeFactor2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_bounce(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamBounce);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamBounce2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamCFM);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamCFM2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_stop_ERP(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamStopERP);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamStopERP2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_stop_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamStopCFM);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamStopCFM2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_suspension_ERP(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamSuspensionERP);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamSuspensionERP2);
}
return 0;
}
INLINE dReal OdeHinge2Joint::
get_param_suspension_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetHinge2Param(_id, dParamSuspensionCFM);
} else if ( axis == 1 ) {
return dJointGetHinge2Param(_id, dParamSuspensionCFM2);
}
return 0;
}

View File

@ -27,18 +27,40 @@ PUBLISHED:
INLINE void set_anchor(dReal x, dReal y, dReal z);
INLINE void set_axis1(dReal x, dReal y, dReal z);
INLINE void set_axis2(dReal x, dReal y, dReal z);
INLINE void set_param(int parameter, dReal value);
INLINE void add_torques(dReal torque1, dReal torque2);
INLINE void get_anchor(dVector3 result) const;
INLINE void get_anchor2(dVector3 result) const;
INLINE void get_axis1(dVector3 result) const;
INLINE void get_axis2(dVector3 result) const;
INLINE dReal get_param(int parameter) const;
INLINE LVecBase3f get_anchor() const;
INLINE LVecBase3f get_anchor2() const;
INLINE LVecBase3f get_axis1() const;
INLINE LVecBase3f get_axis2() const;
INLINE dReal get_angle1() const;
INLINE dReal get_angle1_rate() const;
INLINE dReal get_angle2_rate() const;
INLINE void set_param_lo_stop(int axis, dReal val);
INLINE void set_param_hi_stop(int axis, dReal val);
INLINE void set_param_vel(int axis, dReal val);
INLINE void set_param_f_max(int axis, dReal val);
INLINE void set_param_fudge_factor(int axis, dReal val);
INLINE void set_param_bounce(int axis, dReal val);
INLINE void set_param_CFM(int axis, dReal val);
INLINE void set_param_stop_ERP(int axis, dReal val);
INLINE void set_param_stop_CFM(int axis, dReal val);
INLINE void set_param_suspension_ERP(int axis, dReal val);
INLINE void set_param_suspension_CFM(int axis, dReal val);
INLINE dReal get_param_lo_stop(int axis) const;
INLINE dReal get_param_hi_stop(int axis) const;
INLINE dReal get_param_vel(int axis) const;
INLINE dReal get_param_f_max(int axis) const;
INLINE dReal get_param_fudge_factor(int axis) const;
INLINE dReal get_param_bounce(int axis) const;
INLINE dReal get_param_CFM(int axis) const;
INLINE dReal get_param_stop_ERP(int axis) const;
INLINE dReal get_param_stop_CFM(int axis) const;
INLINE dReal get_param_suspension_ERP(int axis) const;
INLINE dReal get_param_suspension_CFM(int axis) const;
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -31,34 +31,30 @@ set_axis(dReal x, dReal y, dReal z) {
dJointSetHingeAxis(_id, x, y, z);
}
INLINE void OdeHingeJoint::
set_param(int parameter, dReal value) {
dJointSetHingeParam(_id, parameter, value);
}
INLINE void OdeHingeJoint::
add_torque(dReal torque) {
dJointAddHingeTorque(_id, torque);
}
INLINE void OdeHingeJoint::
get_anchor(dVector3 result) const {
return dJointGetHingeAnchor(_id, result);
INLINE LVecBase3f OdeHingeJoint::
get_anchor() const {
dVector3 result;
dJointGetHingeAnchor(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeHingeJoint::
get_anchor2(dVector3 result) const {
return dJointGetHingeAnchor2(_id, result);
INLINE LVecBase3f OdeHingeJoint::
get_anchor2() const {
dVector3 result;
dJointGetHingeAnchor2(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeHingeJoint::
get_axis(dVector3 result) const {
return dJointGetHingeAxis(_id, result);
}
INLINE dReal OdeHingeJoint::
get_param(int parameter) const {
return dJointGetHingeParam(_id, parameter);
INLINE LVecBase3f OdeHingeJoint::
get_axis() const {
dVector3 result;
dJointGetHingeAxis(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE dReal OdeHingeJoint::
@ -71,3 +67,111 @@ get_angle_rate() const {
return dJointGetHingeAngleRate(_id);
}
INLINE void OdeHingeJoint::
set_param_lo_stop(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamLoStop, val);
}
INLINE void OdeHingeJoint::
set_param_hi_stop(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamHiStop, val);
}
INLINE void OdeHingeJoint::
set_param_vel(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamVel, val);
}
INLINE void OdeHingeJoint::
set_param_f_max(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamFMax, val);
}
INLINE void OdeHingeJoint::
set_param_fudge_factor(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamFudgeFactor, val);
}
INLINE void OdeHingeJoint::
set_param_bounce(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamBounce, val);
}
INLINE void OdeHingeJoint::
set_param_CFM(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamCFM, val);
}
INLINE void OdeHingeJoint::
set_param_stop_ERP(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamStopERP, val);
}
INLINE void OdeHingeJoint::
set_param_stop_CFM(dReal val) {
nassertv( _id != 0 );
dJointSetHingeParam(_id, dParamStopCFM, val);
}
INLINE dReal OdeHingeJoint::
get_param_lo_stop() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamLoStop);
}
INLINE dReal OdeHingeJoint::
get_param_hi_stop() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamHiStop);
}
INLINE dReal OdeHingeJoint::
get_param_vel() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamVel);
}
INLINE dReal OdeHingeJoint::
get_param_f_max() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamFMax);
}
INLINE dReal OdeHingeJoint::
get_param_fudge_factor() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamFudgeFactor);
}
INLINE dReal OdeHingeJoint::
get_param_bounce() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamBounce);
}
INLINE dReal OdeHingeJoint::
get_param_CFM() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamCFM);
}
INLINE dReal OdeHingeJoint::
get_param_stop_ERP() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamStopERP);
}
INLINE dReal OdeHingeJoint::
get_param_stop_CFM() const {
nassertr( _id != 0, 0 );
return dJointGetHingeParam(_id, dParamStopCFM);
}

View File

@ -26,16 +26,34 @@ PUBLISHED:
INLINE void set_anchor(dReal x, dReal y, dReal z);
INLINE void set_anchor_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
INLINE void set_axis(dReal x, dReal y, dReal z);
INLINE void set_param(int parameter, dReal value);
INLINE void add_torque(dReal torque);
INLINE void get_anchor(dVector3 result) const;
INLINE void get_anchor2(dVector3 result) const;
INLINE void get_axis(dVector3 result) const;
INLINE dReal get_param(int parameter) const;
INLINE LVecBase3f get_anchor() const;
INLINE LVecBase3f get_anchor2() const;
INLINE LVecBase3f get_axis() const;
INLINE dReal get_angle() const;
INLINE dReal get_angle_rate() const;
INLINE void set_param_lo_stop(dReal val);
INLINE void set_param_hi_stop(dReal val);
INLINE void set_param_vel(dReal val);
INLINE void set_param_f_max(dReal val);
INLINE void set_param_fudge_factor(dReal val);
INLINE void set_param_bounce(dReal val);
INLINE void set_param_CFM(dReal val);
INLINE void set_param_stop_ERP(dReal val);
INLINE void set_param_stop_CFM(dReal val);
INLINE dReal get_param_lo_stop() const;
INLINE dReal get_param_hi_stop() const;
INLINE dReal get_param_vel() const;
INLINE dReal get_param_f_max() const;
INLINE dReal get_param_fudge_factor() const;
INLINE dReal get_param_bounce() const;
INLINE dReal get_param_CFM() const;
INLINE dReal get_param_stop_ERP() const;
INLINE dReal get_param_stop_CFM() const;
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -26,11 +26,6 @@ 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_param(int parameter, dReal value) {
dJointSetSliderParam(_id, parameter, value);
}
INLINE void OdeSliderJoint::
add_force(dReal force) {
dJointAddSliderForce(_id, force);
@ -51,7 +46,111 @@ get_axis(dVector3 result) const {
return dJointGetSliderAxis(_id, result);
}
INLINE dReal OdeSliderJoint::
get_param(int parameter) const {
return dJointGetSliderParam(_id, parameter);
INLINE void OdeSliderJoint::
set_param_lo_stop(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamLoStop, val);
}
INLINE void OdeSliderJoint::
set_param_hi_stop(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamHiStop, val);
}
INLINE void OdeSliderJoint::
set_param_vel(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamVel, val);
}
INLINE void OdeSliderJoint::
set_param_f_max(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamFMax, val);
}
INLINE void OdeSliderJoint::
set_param_fudge_factor(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamFudgeFactor, val);
}
INLINE void OdeSliderJoint::
set_param_bounce(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamBounce, val);
}
INLINE void OdeSliderJoint::
set_param_CFM(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamCFM, val);
}
INLINE void OdeSliderJoint::
set_param_stop_ERP(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamStopERP, val);
}
INLINE void OdeSliderJoint::
set_param_stop_CFM(dReal val) {
nassertv( _id != 0 );
dJointSetSliderParam(_id, dParamStopCFM, val);
}
INLINE dReal OdeSliderJoint::
get_param_lo_stop() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamLoStop);
}
INLINE dReal OdeSliderJoint::
get_param_hi_stop() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamHiStop);
}
INLINE dReal OdeSliderJoint::
get_param_vel() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamVel);
}
INLINE dReal OdeSliderJoint::
get_param_f_max() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamFMax);
}
INLINE dReal OdeSliderJoint::
get_param_fudge_factor() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamFudgeFactor);
}
INLINE dReal OdeSliderJoint::
get_param_bounce() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamBounce);
}
INLINE dReal OdeSliderJoint::
get_param_CFM() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamCFM);
}
INLINE dReal OdeSliderJoint::
get_param_stop_ERP() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamStopERP);
}
INLINE dReal OdeSliderJoint::
get_param_stop_CFM() const {
nassertr( _id != 0, 0 );
return dJointGetSliderParam(_id, dParamStopCFM);
}

View File

@ -25,13 +25,31 @@ PUBLISHED:
INLINE void set_axis(dReal x, dReal y, dReal z);
INLINE void set_axis_delta(dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
INLINE void set_param(int parameter, dReal value);
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 dReal get_param(int parameter) const;
INLINE void set_param_lo_stop(dReal val);
INLINE void set_param_hi_stop(dReal val);
INLINE void set_param_vel(dReal val);
INLINE void set_param_f_max(dReal val);
INLINE void set_param_fudge_factor(dReal val);
INLINE void set_param_bounce(dReal val);
INLINE void set_param_CFM(dReal val);
INLINE void set_param_stop_ERP(dReal val);
INLINE void set_param_stop_CFM(dReal val);
INLINE dReal get_param_lo_stop() const;
INLINE dReal get_param_hi_stop() const;
INLINE dReal get_param_vel() const;
INLINE dReal get_param_f_max() const;
INLINE dReal get_param_fudge_factor() const;
INLINE dReal get_param_bounce() const;
INLINE dReal get_param_CFM() const;
INLINE dReal get_param_stop_ERP() const;
INLINE dReal get_param_stop_CFM() const;
public:
static TypeHandle get_class_type() {

View File

@ -59,9 +59,7 @@ remove_data(OdeTriMeshData *data) {
odetrimeshdata_cat.debug() << get_class_type() << "::remove_data(" << data->get_id() << ")" << "\n";
TriMeshDataMap::iterator iter = _tri_mesh_data_map.begin();
for (;iter != _tri_mesh_data_map.end(); ++iter) {
cout << iter->second << "\t" << data << "\n";
if ( iter->second == data ) {
cout << "ERASING\n";
_tri_mesh_data_map.erase(iter);
iter = _tri_mesh_data_map.end();
}

View File

@ -31,39 +31,37 @@ set_axis2(dReal x, dReal y, dReal z) {
dJointSetUniversalAxis2(_id, x, y, z);
}
INLINE void OdeUniversalJoint::
set_param(int parameter, dReal value) {
dJointSetUniversalParam(_id, parameter, value);
}
INLINE void OdeUniversalJoint::
add_torques(dReal torque1, dReal torque2) {
dJointAddUniversalTorques(_id, torque1, torque2);
}
INLINE void OdeUniversalJoint::
get_anchor(dVector3 result) const {
return dJointGetUniversalAnchor(_id, result);
INLINE LVecBase3f OdeUniversalJoint::
get_anchor() const {
dVector3 result;
dJointGetUniversalAnchor(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeUniversalJoint::
get_anchor2(dVector3 result) const {
return dJointGetUniversalAnchor2(_id, result);
INLINE LVecBase3f OdeUniversalJoint::
get_anchor2() const {
dVector3 result;
dJointGetUniversalAnchor2(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeUniversalJoint::
get_axis1(dVector3 result) const {
return dJointGetUniversalAxis1(_id, result);
INLINE LVecBase3f OdeUniversalJoint::
get_axis1() const {
dVector3 result;
dJointGetUniversalAxis1(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE void OdeUniversalJoint::
get_axis2(dVector3 result) const {
return dJointGetUniversalAxis2(_id, result);
}
INLINE dReal OdeUniversalJoint::
get_param(int parameter) const {
return dJointGetUniversalParam(_id, parameter);
INLINE LVecBase3f OdeUniversalJoint::
get_axis2() const {
dVector3 result;
dJointGetUniversalAxis2(_id, result);
return LVecBase3f(result[0], result[1], result[2]);
}
INLINE dReal OdeUniversalJoint::
@ -85,3 +83,212 @@ INLINE dReal OdeUniversalJoint::
get_angle2_rate() const {
return dJointGetUniversalAngle2Rate(_id);
}
INLINE void OdeUniversalJoint::
set_param_lo_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamLoStop, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamLoStop, val);
}
}
INLINE void OdeUniversalJoint::
set_param_hi_stop(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamHiStop, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamHiStop, val);
}
}
INLINE void OdeUniversalJoint::
set_param_vel(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamVel, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamVel, val);
}
}
INLINE void OdeUniversalJoint::
set_param_f_max(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamFMax, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamFMax, val);
}
}
INLINE void OdeUniversalJoint::
set_param_fudge_factor(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamFudgeFactor, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamFudgeFactor, val);
}
}
INLINE void OdeUniversalJoint::
set_param_bounce(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamBounce, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamBounce, val);
}
}
INLINE void OdeUniversalJoint::
set_param_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamCFM, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamCFM, val);
}
}
INLINE void OdeUniversalJoint::
set_param_stop_ERP(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamStopERP, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamStopERP, val);
}
}
INLINE void OdeUniversalJoint::
set_param_stop_CFM(int axis, dReal val) {
nassertv( _id != 0 );
nassertv( 0 <= axis && axis <= 1 );
if ( axis == 0 ) {
dJointSetUniversalParam(_id, dParamStopCFM, val);
} else if ( axis == 1 ) {
dJointSetUniversalParam(_id, dParamStopCFM, val);
}
}
INLINE dReal OdeUniversalJoint::
get_param_lo_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamLoStop);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamLoStop);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_hi_stop(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamHiStop);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamHiStop);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_vel(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamVel);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamVel);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_f_max(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamFMax);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamFMax);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_fudge_factor(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamFudgeFactor);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamFudgeFactor);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_bounce(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamBounce);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamBounce);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamCFM);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamCFM);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_stop_ERP(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamStopERP);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamStopERP);
}
return 0;
}
INLINE dReal OdeUniversalJoint::
get_param_stop_CFM(int axis) const {
nassertr( _id != 0, 0 );
nassertr( 0 <= axis && axis <= 1, 0 );
if ( axis == 0 ) {
return dJointGetUniversalParam(_id, dParamStopCFM);
} else if ( axis == 1 ) {
return dJointGetUniversalParam(_id, dParamStopCFM);
}
return 0;
}

View File

@ -27,19 +27,37 @@ PUBLISHED:
INLINE void set_anchor(dReal x, dReal y, dReal z);
INLINE void set_axis1(dReal x, dReal y, dReal z);
INLINE void set_axis2(dReal x, dReal y, dReal z);
INLINE void set_param(int parameter, dReal value);
INLINE void add_torques(dReal torque1, dReal torque2);
INLINE void get_anchor(dVector3 result) const;
INLINE void get_anchor2(dVector3 result) const;
INLINE void get_axis1(dVector3 result) const;
INLINE void get_axis2(dVector3 result) const;
INLINE dReal get_param(int parameter) const;
INLINE LVecBase3f get_anchor() const;
INLINE LVecBase3f get_anchor2() const;
INLINE LVecBase3f get_axis1() const;
INLINE LVecBase3f get_axis2() const;
INLINE dReal get_angle1() const;
INLINE dReal get_angle2() const;
INLINE dReal get_angle1_rate() const;
INLINE dReal get_angle2_rate() const;
INLINE void set_param_lo_stop(int axis, dReal val);
INLINE void set_param_hi_stop(int axis, dReal val);
INLINE void set_param_vel(int axis, dReal val);
INLINE void set_param_f_max(int axis, dReal val);
INLINE void set_param_fudge_factor(int axis, dReal val);
INLINE void set_param_bounce(int axis, dReal val);
INLINE void set_param_CFM(int axis, dReal val);
INLINE void set_param_stop_ERP(int axis, dReal val);
INLINE void set_param_stop_CFM(int axis, dReal val);
INLINE dReal get_param_lo_stop(int axis) const;
INLINE dReal get_param_hi_stop(int axis) const;
INLINE dReal get_param_vel(int axis) const;
INLINE dReal get_param_f_max(int axis) const;
INLINE dReal get_param_fudge_factor(int axis) const;
INLINE dReal get_param_bounce(int axis) const;
INLINE dReal get_param_CFM(int axis) const;
INLINE dReal get_param_stop_ERP(int axis) const;
INLINE dReal get_param_stop_CFM(int axis) const;
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -18,6 +18,8 @@
#include "odeUtil.h"
dReal OdeUtil::OC_infinity = dInfinity;
OdeJoint OdeUtil::
get_connecting_joint(const OdeBody &body1, const OdeBody &body2) {
return OdeJoint(dConnectingJoint(body1.get_id(),body2.get_id()));

View File

@ -45,6 +45,7 @@ PUBLISHED:
const OdeBody &body2,
const int joint_type);
static dReal OC_infinity;
};
#endif