mirror of https://github.com/bjornbytes/lovr.git
Rename box shape dimensions to be more clear;
This commit is contained in:
parent
5210d474b8
commit
9bf2def86d
|
@ -313,11 +313,11 @@ const luaL_Reg lovrSphereShape[] = {
|
||||||
|
|
||||||
static int l_lovrBoxShapeGetDimensions(lua_State* L) {
|
static int l_lovrBoxShapeGetDimensions(lua_State* L) {
|
||||||
BoxShape* box = luax_checktype(L, 1, BoxShape);
|
BoxShape* box = luax_checktype(L, 1, BoxShape);
|
||||||
float x, y, z;
|
float w, h, d;
|
||||||
lovrBoxShapeGetDimensions(box, &x, &y, &z);
|
lovrBoxShapeGetDimensions(box, &w, &h, &d);
|
||||||
lua_pushnumber(L, x);
|
lua_pushnumber(L, w);
|
||||||
lua_pushnumber(L, y);
|
lua_pushnumber(L, h);
|
||||||
lua_pushnumber(L, z);
|
lua_pushnumber(L, d);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -956,27 +956,27 @@ void lovrSphereShapeSetRadius(SphereShape* sphere, float radius) {
|
||||||
dGeomSphereSetRadius(sphere->id, radius);
|
dGeomSphereSetRadius(sphere->id, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
BoxShape* lovrBoxShapeCreate(float x, float y, float z) {
|
BoxShape* lovrBoxShapeCreate(float w, float h, float d) {
|
||||||
BoxShape* box = calloc(1, sizeof(BoxShape));
|
BoxShape* box = calloc(1, sizeof(BoxShape));
|
||||||
lovrAssert(box, "Out of memory");
|
lovrAssert(box, "Out of memory");
|
||||||
box->ref = 1;
|
box->ref = 1;
|
||||||
box->type = SHAPE_BOX;
|
box->type = SHAPE_BOX;
|
||||||
box->id = dCreateBox(0, x, y, z);
|
box->id = dCreateBox(0, w, h, d);
|
||||||
dGeomSetData(box->id, box);
|
dGeomSetData(box->id, box);
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrBoxShapeGetDimensions(BoxShape* box, float* x, float* y, float* z) {
|
void lovrBoxShapeGetDimensions(BoxShape* box, float* w, float* h, float* d) {
|
||||||
dReal dimensions[4];
|
dReal dimensions[4];
|
||||||
dGeomBoxGetLengths(box->id, dimensions);
|
dGeomBoxGetLengths(box->id, dimensions);
|
||||||
*x = dimensions[0];
|
*w = dimensions[0];
|
||||||
*y = dimensions[1];
|
*h = dimensions[1];
|
||||||
*z = dimensions[2];
|
*d = dimensions[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrBoxShapeSetDimensions(BoxShape* box, float x, float y, float z) {
|
void lovrBoxShapeSetDimensions(BoxShape* box, float w, float h, float d) {
|
||||||
lovrCheck(x > 0.f && y > 0.f && z > 0.f, "BoxShape dimensions must be positive");
|
lovrCheck(w > 0.f && h > 0.f && d > 0.f, "BoxShape dimensions must be positive");
|
||||||
dGeomBoxSetLengths(box->id, x, y, z);
|
dGeomBoxSetLengths(box->id, w, h, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
CapsuleShape* lovrCapsuleShapeCreate(float radius, float length) {
|
CapsuleShape* lovrCapsuleShapeCreate(float radius, float length) {
|
||||||
|
|
|
@ -157,9 +157,9 @@ SphereShape* lovrSphereShapeCreate(float radius);
|
||||||
float lovrSphereShapeGetRadius(SphereShape* sphere);
|
float lovrSphereShapeGetRadius(SphereShape* sphere);
|
||||||
void lovrSphereShapeSetRadius(SphereShape* sphere, float radius);
|
void lovrSphereShapeSetRadius(SphereShape* sphere, float radius);
|
||||||
|
|
||||||
BoxShape* lovrBoxShapeCreate(float x, float y, float z);
|
BoxShape* lovrBoxShapeCreate(float w, float h, float d);
|
||||||
void lovrBoxShapeGetDimensions(BoxShape* box, float* x, float* y, float* z);
|
void lovrBoxShapeGetDimensions(BoxShape* box, float* w, float* h, float* d);
|
||||||
void lovrBoxShapeSetDimensions(BoxShape* box, float x, float y, float z);
|
void lovrBoxShapeSetDimensions(BoxShape* box, float w, float h, float d);
|
||||||
|
|
||||||
CapsuleShape* lovrCapsuleShapeCreate(float radius, float length);
|
CapsuleShape* lovrCapsuleShapeCreate(float radius, float length);
|
||||||
float lovrCapsuleShapeGetRadius(CapsuleShape* capsule);
|
float lovrCapsuleShapeGetRadius(CapsuleShape* capsule);
|
||||||
|
|
Loading…
Reference in New Issue