Panda3D
Loading...
Searching...
No Matches
odeJoint.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file odeJoint.I
10 * @author joswilso
11 * @date 2006-12-27
12 */
13
14/**
15 * Returns true if the ID is 0, meaning the OdeJoint does not point to a valid
16 * joint. It is an error to call a method on an empty joint. Note that an
17 * empty OdeJoint also evaluates to False.
18 */
19INLINE bool OdeJoint::
20is_empty() const {
21 return (_id == 0);
22}
23
24/**
25 * Returns the underlying dJointID.
26 */
27INLINE dJointID OdeJoint::
28get_id() const {
29 return _id;
30}
31
32/*
33INLINE void OdeJoint::
34set_data(void *data) {
35 dJointSetData(_id, data);
36}
37
38INLINE void *OdeJoint::
39get_data() {
40 return dJointGetData(_id);
41}
42*/
43
44INLINE int OdeJoint::
45get_joint_type() const {
46 return dJointGetType(_id);
47}
48
49INLINE void OdeJoint::
50set_feedback(bool flag) {
51 if (flag) {
52 if (dJointGetFeedback(_id) != nullptr) {
53 return;
54 }
55 OdeJointFeedback* feedback = new OdeJointFeedback;
56 dJointSetFeedback(_id, (dJointFeedback*) feedback);
57 } else if (dJointFeedback* feedback = dJointGetFeedback(_id)) {
58 dJointSetFeedback(_id, nullptr);
59 delete feedback;
60 }
61}
62
63INLINE void OdeJoint::
64set_feedback(OdeJointFeedback *feedback) {
65 dJointSetFeedback(_id, feedback);
66}
67
68INLINE OdeJointFeedback *OdeJoint::
69get_feedback() {
70 return (OdeJointFeedback*) dJointGetFeedback(_id);
71}
72
73INLINE int OdeJoint::
74compare_to(const OdeJoint &other) const {
75 if (_id != other._id) {
76 return _id < other._id ? -1 : 1;
77 }
78 return 0;
79}
80
81INLINE bool OdeJoint::
82operator == (const OdeJoint &other) const {
83 return _id == other._id;
84}
bool is_empty() const
Returns true if the ID is 0, meaning the OdeJoint does not point to a valid joint.
Definition odeJoint.I:20
dJointID get_id() const
Returns the underlying dJointID.
Definition odeJoint.I:28