Panda3D
|
00001 // Filename: odeJoint.I 00002 // Created by: joswilso (27Dec06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: OdeJoint::is_empty 00017 // Access: Published 00018 // Description: Returns true if the ID is 0, meaning the OdeJoint 00019 // does not point to a valid joint. It is an error to 00020 // call a method on an empty joint. 00021 // Note that an empty OdeJoint also evaluates to False. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE bool OdeJoint:: 00024 is_empty() const { 00025 return (_id == 0); 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: OdeJoint::get_id 00030 // Access: Published 00031 // Description: Returns the underlying dJointID. 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE dJointID OdeJoint:: 00034 get_id() const { 00035 return _id; 00036 } 00037 00038 /* 00039 INLINE void OdeJoint:: 00040 set_data(void *data) { 00041 dJointSetData(_id, data); 00042 } 00043 00044 INLINE void *OdeJoint:: 00045 get_data() { 00046 return dJointGetData(_id); 00047 } 00048 */ 00049 00050 INLINE int OdeJoint:: 00051 get_joint_type() const { 00052 return dJointGetType(_id); 00053 } 00054 00055 INLINE void OdeJoint:: 00056 set_feedback(bool flag) { 00057 if (flag) { 00058 if (dJointGetFeedback(_id) != NULL) { 00059 return; 00060 } 00061 OdeJointFeedback* feedback = new OdeJointFeedback; 00062 dJointSetFeedback(_id, (dJointFeedback*) feedback); 00063 } else if (dJointFeedback* feedback = dJointGetFeedback(_id)) { 00064 dJointSetFeedback(_id, NULL); 00065 delete feedback; 00066 } 00067 } 00068 00069 INLINE void OdeJoint:: 00070 set_feedback(OdeJointFeedback *feedback) { 00071 dJointSetFeedback(_id, feedback); 00072 } 00073 00074 INLINE OdeJointFeedback *OdeJoint:: 00075 get_feedback() { 00076 return (OdeJointFeedback*) dJointGetFeedback(_id); 00077 } 00078 00079 INLINE int OdeJoint:: 00080 compare_to(const OdeJoint &other) const { 00081 if (_id != other._id) { 00082 return _id < other._id ? -1 : 1; 00083 } 00084 return 0; 00085 } 00086 00087 INLINE bool OdeJoint:: 00088 operator == (const OdeJoint &other) const { 00089 return _id == other._id; 00090 }