Addons updated to new doc format
[io.git] / addons / ODE / source / IoODEHinge2.c
blob33061a966121085e4c99e5a1f5e4328896d8d228
1 //metadoc ODEJoint copyright Jonathan Wright", 2006)
2 //metadoc ODEJoint license BSD revised
3 /*metadoc ODEJoint description
4 ODEJoint binding")
5 */
7 #include "IoODEJoint_internal.h"
8 #include "IoODEHinge2.h"
9 #include "IoODEBody.h"
10 #include "IoState.h"
11 #include "IoSeq.h"
12 #include "IoVector_ode.h"
13 #include "GLIncludes.h"
15 /* ----------------------------------------------------------- */
17 IoTag *IoODEHinge2_newTag(void *state)
19 IoTag *tag = IoTag_newWithName_("ODEHinge2");
20 IoTag_state_(tag, state);
21 IoTag_freeFunc_(tag, (IoTagFreeFunc *)IoODEHinge2_free);
22 IoTag_markFunc_(tag, (IoTagMarkFunc *)IoODEHinge2_mark);
23 IoTag_cloneFunc_(tag, (IoTagCloneFunc *)IoODEHinge2_rawClone);
24 return tag;
27 IoODEHinge2 *IoODEHinge2_proto(void *state)
29 IoObject *self = IoObject_new(state);
30 IoObject_tag_(self, IoODEHinge2_newTag(state));
32 IoODEJoint_protoCommon(self);
34 IoState_registerProtoWithFunc_(state, self, IoODEHinge2_proto);
37 IoMethodTable methodTable[] = {
38 ODE_COMMON_JOINT_METHODS
39 #define PARAM(X, _N, _SETN) \
40 {#_N, IoODEHinge2_##_N}, \
41 {#_SETN, IoODEHinge2_##_SETN},
42 PARAMS
43 #undef PARAM
45 {"anchor", IoODEHinge2_anchor},
46 {"setAnchor", IoODEHinge2_setAnchor},
47 {"anchor2", IoODEHinge2_anchor2},
48 {"axis1", IoODEHinge2_axis1},
49 {"setAxis1", IoODEHinge2_setAxis1},
50 {"axis2", IoODEHinge2_axis2},
51 {"setAxis2", IoODEHinge2_setAxis2},
52 {"angle1", IoODEHinge2_angle1},
53 {"angle1Rate", IoODEHinge2_angle1Rate},
54 {"angle2Rate", IoODEHinge2_angle2Rate},
55 {"addTorques", IoODEHinge2_addTorques},
57 {NULL, NULL},
59 IoObject_addMethodTable_(self, methodTable);
61 return self;
64 IoODEHinge2 *IoODEHinge2_rawClone(IoODEHinge2 *proto)
66 IoObject *self = IoODEJoint_rawClone(proto);
68 if(DATA(proto)->jointGroup)
70 IoODEJointGroup *jointGroup = DATA(proto)->jointGroup;
72 JOINTGROUP = jointGroup;
73 IoODEJointGroup_addJoint(jointGroup, self);
74 JOINTID = dJointCreateHinge2(WORLDID, JOINTGROUPID);
76 return self;
79 void IoODEHinge2_free(IoODEHinge2 *self)
81 IoODEJoint_free(self);
84 void IoODEHinge2_mark(IoODEHinge2 *self)
86 IoODEJoint_mark(self);
89 IoODEJoint *IoODEHinge2_newProto(void *state, IoODEJointGroup *jointGroup)
91 return IoODEJoint_newProtoCommon(state, IoODEHinge2_proto, jointGroup);
94 /* ----------------------------------------------------------- */
97 IoObject *IoODEHinge2_getParam(IoODEHinge2 *self, IoObject *locals, IoMessage *m, int parameter)
99 return IoODEJoint_getParam(self, locals, m, parameter, dJointGetHinge2Param);
102 IoObject *IoODEHinge2_setParam(IoODEHinge2 *self, IoObject *locals, IoMessage *m, int parameter)
104 return IoODEJoint_setParam(self, locals, m, parameter, dJointSetHinge2Param);
107 #define PARAM(X, _N, _SETN) \
108 IoObject *IoODEHinge2_##_N(IoODEHinge2 *self, IoObject *locals, IoMessage *m) \
110 return IoODEHinge2_getParam(self, locals, m, X); \
113 IoObject *IoODEHinge2_##_SETN(IoODEHinge2 *self, IoObject *locals, IoMessage *m) \
115 return IoODEHinge2_setParam(self, locals, m, X); \
117 PARAMS
118 #undef PARAM
120 IoObject *IoODEHinge2_anchor(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
122 return IoODEJoint_getVector3(self, locals, m, dJointGetHinge2Anchor);
125 IoObject *IoODEHinge2_anchor2(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
127 return IoODEJoint_getVector3(self, locals, m, dJointGetHinge2Anchor2);
130 IoObject *IoODEHinge2_axis1(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
132 return IoODEJoint_getVector3(self, locals, m, dJointGetHinge2Axis1);
135 IoObject *IoODEHinge2_axis2(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
137 return IoODEJoint_getVector3(self, locals, m, dJointGetHinge2Axis2);
140 IoObject *IoODEHinge2_angle1(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
142 return IoODEJoint_getReal(self, locals, m, dJointGetHinge2Angle1);
145 IoObject *IoODEHinge2_angle1Rate(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
147 return IoODEJoint_getReal(self, locals, m, dJointGetHinge2Angle1Rate);
150 IoObject *IoODEHinge2_angle2Rate(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
152 return IoODEJoint_getReal(self, locals, m, dJointGetHinge2Angle2Rate);
156 IoObject *IoODEHinge2_setAnchor(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
158 return IoODEJoint_setVector3(self, locals, m, dJointSetHinge2Anchor);
161 IoObject *IoODEHinge2_setAxis1(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
163 return IoODEJoint_setVector3(self, locals, m, dJointSetHinge2Axis1);
166 IoObject *IoODEHinge2_setAxis2(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
168 return IoODEJoint_setVector3(self, locals, m, dJointSetHinge2Axis2);
171 IoObject *IoODEHinge2_addTorques(IoODEHinge2 *self, IoObject *locals, IoMessage *m)
173 return IoODEJoint_setReal2(self, locals, m, dJointAddHinge2Torques);