From 6bbea6261c2b0240e64163c4c5f53dfecb0daaeb Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 11 Feb 2007 06:50:46 +0000 Subject: [PATCH] added joint parameter functions for the joints that support them --- panda/src/ode/odeAMotorJoint.I | 262 ++++++++++++++++++++++++-- panda/src/ode/odeAMotorJoint.h | 25 ++- panda/src/ode/odeHinge2Joint.I | 296 +++++++++++++++++++++++++++--- panda/src/ode/odeHinge2Joint.h | 34 +++- panda/src/ode/odeHingeJoint.I | 142 ++++++++++++-- panda/src/ode/odeHingeJoint.h | 28 ++- panda/src/ode/odeSliderJoint.I | 115 +++++++++++- panda/src/ode/odeSliderJoint.h | 22 ++- panda/src/ode/odeTriMeshData.cxx | 2 - panda/src/ode/odeUniversalJoint.I | 251 ++++++++++++++++++++++--- panda/src/ode/odeUniversalJoint.h | 30 ++- panda/src/ode/odeUtil.cxx | 2 + panda/src/ode/odeUtil.h | 3 +- 13 files changed, 1103 insertions(+), 109 deletions(-) diff --git a/panda/src/ode/odeAMotorJoint.I b/panda/src/ode/odeAMotorJoint.I index 986cd48e7a..5fef72da50 100755 --- a/panda/src/ode/odeAMotorJoint.I +++ b/panda/src/ode/odeAMotorJoint.I @@ -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; +} + diff --git a/panda/src/ode/odeAMotorJoint.h b/panda/src/ode/odeAMotorJoint.h index b360778487..6178de0bd5 100644 --- a/panda/src/ode/odeAMotorJoint.h +++ b/panda/src/ode/odeAMotorJoint.h @@ -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; diff --git a/panda/src/ode/odeHinge2Joint.I b/panda/src/ode/odeHinge2Joint.I index c135300fda..d5bb5cc7c1 100755 --- a/panda/src/ode/odeHinge2Joint.I +++ b/panda/src/ode/odeHinge2Joint.I @@ -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; +} + diff --git a/panda/src/ode/odeHinge2Joint.h b/panda/src/ode/odeHinge2Joint.h index c8a910eb31..62ef7bb57e 100644 --- a/panda/src/ode/odeHinge2Joint.h +++ b/panda/src/ode/odeHinge2Joint.h @@ -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; diff --git a/panda/src/ode/odeHingeJoint.I b/panda/src/ode/odeHingeJoint.I index 98085762df..1a9da0270d 100755 --- a/panda/src/ode/odeHingeJoint.I +++ b/panda/src/ode/odeHingeJoint.I @@ -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); +} + diff --git a/panda/src/ode/odeHingeJoint.h b/panda/src/ode/odeHingeJoint.h index 5ee4581e6d..7efc277cb4 100755 --- a/panda/src/ode/odeHingeJoint.h +++ b/panda/src/ode/odeHingeJoint.h @@ -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; diff --git a/panda/src/ode/odeSliderJoint.I b/panda/src/ode/odeSliderJoint.I index 4470415e3a..681b4c7c09 100755 --- a/panda/src/ode/odeSliderJoint.I +++ b/panda/src/ode/odeSliderJoint.I @@ -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); +} + diff --git a/panda/src/ode/odeSliderJoint.h b/panda/src/ode/odeSliderJoint.h index 0ef2d2aeba..aae4a90119 100755 --- a/panda/src/ode/odeSliderJoint.h +++ b/panda/src/ode/odeSliderJoint.h @@ -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() { diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index 69b706b7d0..39a638c208 100755 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -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(); } diff --git a/panda/src/ode/odeUniversalJoint.I b/panda/src/ode/odeUniversalJoint.I index adce8c05b3..1a36c32772 100755 --- a/panda/src/ode/odeUniversalJoint.I +++ b/panda/src/ode/odeUniversalJoint.I @@ -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; +} + diff --git a/panda/src/ode/odeUniversalJoint.h b/panda/src/ode/odeUniversalJoint.h index 88b338f592..37900b22bc 100644 --- a/panda/src/ode/odeUniversalJoint.h +++ b/panda/src/ode/odeUniversalJoint.h @@ -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; diff --git a/panda/src/ode/odeUtil.cxx b/panda/src/ode/odeUtil.cxx index 140e6f5091..7445a3a908 100755 --- a/panda/src/ode/odeUtil.cxx +++ b/panda/src/ode/odeUtil.cxx @@ -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())); diff --git a/panda/src/ode/odeUtil.h b/panda/src/ode/odeUtil.h index 4e63f9bb05..8b3fdb929e 100755 --- a/panda/src/ode/odeUtil.h +++ b/panda/src/ode/odeUtil.h @@ -44,7 +44,8 @@ PUBLISHED: static int are_connected_excluding(const OdeBody &body1, const OdeBody &body2, const int joint_type); - + + static dReal OC_infinity; }; #endif