mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-04 13:33:34 +00:00
Joints API accepts both vec3 and number coords
This commit is contained in:
parent
f2fcc4e5c4
commit
2d6f7802f1
|
@ -116,10 +116,9 @@ static int l_lovrBallJointGetAnchors(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrBallJointSetAnchor(lua_State* L) {
|
static int l_lovrBallJointSetAnchor(lua_State* L) {
|
||||||
BallJoint* joint = luax_checktype(L, 1, BallJoint);
|
BallJoint* joint = luax_checktype(L, 1, BallJoint);
|
||||||
float x = luax_checkfloat(L, 2);
|
float anchor[4];
|
||||||
float y = luax_checkfloat(L, 3);
|
luax_readvec3(L, 2, anchor, NULL);
|
||||||
float z = luax_checkfloat(L, 4);
|
lovrBallJointSetAnchor(joint, anchor[0], anchor[1], anchor[2]);
|
||||||
lovrBallJointSetAnchor(joint, x, y, z);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,13 +144,10 @@ static int l_lovrDistanceJointGetAnchors(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrDistanceJointSetAnchors(lua_State* L) {
|
static int l_lovrDistanceJointSetAnchors(lua_State* L) {
|
||||||
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
|
DistanceJoint* joint = luax_checktype(L, 1, DistanceJoint);
|
||||||
float x1 = luax_checkfloat(L, 2);
|
float anchor1[4], anchor2[4];
|
||||||
float y1 = luax_checkfloat(L, 3);
|
int index = luax_readvec3(L, 2, anchor1, NULL);
|
||||||
float z1 = luax_checkfloat(L, 4);
|
luax_readvec3(L, index, anchor2, NULL);
|
||||||
float x2 = luax_checkfloat(L, 5);
|
lovrDistanceJointSetAnchors(joint, anchor1[0], anchor1[1], anchor1[2], anchor2[0], anchor2[1], anchor2[2]);
|
||||||
float y2 = luax_checkfloat(L, 6);
|
|
||||||
float z2 = luax_checkfloat(L, 7);
|
|
||||||
lovrDistanceJointSetAnchors(joint, x1, y1, z1, x2, y2, z2);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,10 +188,9 @@ static int l_lovrHingeJointGetAnchors(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrHingeJointSetAnchor(lua_State* L) {
|
static int l_lovrHingeJointSetAnchor(lua_State* L) {
|
||||||
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
|
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
|
||||||
float x = luax_checkfloat(L, 2);
|
float anchor[4];
|
||||||
float y = luax_checkfloat(L, 3);
|
luax_readvec3(L, 2, anchor, NULL);
|
||||||
float z = luax_checkfloat(L, 4);
|
lovrHingeJointSetAnchor(joint, anchor[0], anchor[1], anchor[2]);
|
||||||
lovrHingeJointSetAnchor(joint, x, y, z);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,10 +206,9 @@ static int l_lovrHingeJointGetAxis(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrHingeJointSetAxis(lua_State* L) {
|
static int l_lovrHingeJointSetAxis(lua_State* L) {
|
||||||
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
|
HingeJoint* joint = luax_checktype(L, 1, HingeJoint);
|
||||||
float x = luax_checkfloat(L, 2);
|
float axis[4];
|
||||||
float y = luax_checkfloat(L, 3);
|
luax_readvec3(L, 2, axis, NULL);
|
||||||
float z = luax_checkfloat(L, 4);
|
lovrHingeJointSetAxis(joint, axis[0], axis[1], axis[2]);
|
||||||
lovrHingeJointSetAxis(joint, x, y, z);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,10 +288,9 @@ static int l_lovrSliderJointGetAxis(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrSliderJointSetAxis(lua_State* L) {
|
static int l_lovrSliderJointSetAxis(lua_State* L) {
|
||||||
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
|
SliderJoint* joint = luax_checktype(L, 1, SliderJoint);
|
||||||
float x = luax_checkfloat(L, 2);
|
float axis[4];
|
||||||
float y = luax_checkfloat(L, 3);
|
luax_readvec3(L, 2, axis, NULL);
|
||||||
float z = luax_checkfloat(L, 4);
|
lovrSliderJointSetAxis(joint, axis[0], axis[1], axis[2]);
|
||||||
lovrSliderJointSetAxis(joint, x, y, z);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue