mirror of https://github.com/bjornbytes/lovr.git
Rename CompoundShape 'shape' to 'child';
Maybe slightly less ambiguous/confusing?
This commit is contained in:
parent
47dec01772
commit
060e72c525
|
@ -389,18 +389,18 @@ static int l_lovrCompoundShapeIsFrozen(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeAddShape(lua_State* L) {
|
static int l_lovrCompoundShapeAddChild(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
Shape* child = luax_checkshape(L, 2);
|
Shape* child = luax_checkshape(L, 2);
|
||||||
float position[3], orientation[4];
|
float position[3], orientation[4];
|
||||||
int index = 3;
|
int index = 3;
|
||||||
index = luax_readvec3(L, index, position, NULL);
|
index = luax_readvec3(L, index, position, NULL);
|
||||||
index = luax_readquat(L, index, orientation, NULL);
|
index = luax_readquat(L, index, orientation, NULL);
|
||||||
lovrCompoundShapeAddShape(shape, child, position, orientation);
|
lovrCompoundShapeAddChild(shape, child, position, orientation);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeReplaceShape(lua_State* L) {
|
static int l_lovrCompoundShapeReplaceChild(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t index = luax_checku32(L, 2) - 1;
|
uint32_t index = luax_checku32(L, 2) - 1;
|
||||||
Shape* child = luax_checkshape(L, 3);
|
Shape* child = luax_checkshape(L, 3);
|
||||||
|
@ -408,49 +408,49 @@ static int l_lovrCompoundShapeReplaceShape(lua_State* L) {
|
||||||
int i = 4;
|
int i = 4;
|
||||||
i = luax_readvec3(L, i, position, NULL);
|
i = luax_readvec3(L, i, position, NULL);
|
||||||
i = luax_readquat(L, i, orientation, NULL);
|
i = luax_readquat(L, i, orientation, NULL);
|
||||||
lovrCompoundShapeReplaceShape(shape, index, child, position, orientation);
|
lovrCompoundShapeReplaceChild(shape, index, child, position, orientation);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeRemoveShape(lua_State* L) {
|
static int l_lovrCompoundShapeRemoveChild(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t index = luax_checku32(L, 2) - 1;
|
uint32_t index = luax_checku32(L, 2) - 1;
|
||||||
lovrCompoundShapeRemoveShape(shape, index);
|
lovrCompoundShapeRemoveChild(shape, index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeGetShape(lua_State* L) {
|
static int l_lovrCompoundShapeGetChild(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t index = luax_checku32(L, 2) - 1;
|
uint32_t index = luax_checku32(L, 2) - 1;
|
||||||
Shape* child = lovrCompoundShapeGetShape(shape, index);
|
Shape* child = lovrCompoundShapeGetChild(shape, index);
|
||||||
luax_pushshape(L, child);
|
luax_pushshape(L, child);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeGetShapes(lua_State* L) {
|
static int l_lovrCompoundShapeGetChildren(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
int count = (int) lovrCompoundShapeGetShapeCount(shape);
|
int count = (int) lovrCompoundShapeGetChildCount(shape);
|
||||||
lua_createtable(L, count, 0);
|
lua_createtable(L, count, 0);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Shape* child = lovrCompoundShapeGetShape(shape, (uint32_t) i);
|
Shape* child = lovrCompoundShapeGetChild(shape, (uint32_t) i);
|
||||||
luax_pushshape(L, child);
|
luax_pushshape(L, child);
|
||||||
lua_rawseti(L, -2, i + 1);
|
lua_rawseti(L, -2, i + 1);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeGetShapeCount(lua_State* L) {
|
static int l_lovrCompoundShapeGetChildCount(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t count = lovrCompoundShapeGetShapeCount(shape);
|
uint32_t count = lovrCompoundShapeGetChildCount(shape);
|
||||||
lua_pushinteger(L, count);
|
lua_pushinteger(L, count);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeGetShapeOffset(lua_State* L) {
|
static int l_lovrCompoundShapeGetChildOffset(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t index = luax_checku32(L, 2) - 1;
|
uint32_t index = luax_checku32(L, 2) - 1;
|
||||||
float position[3], orientation[4], angle, ax, ay, az;
|
float position[3], orientation[4], angle, ax, ay, az;
|
||||||
lovrCompoundShapeGetShapeOffset(shape, index, position, orientation);
|
lovrCompoundShapeGetChildOffset(shape, index, position, orientation);
|
||||||
quat_getAngleAxis(orientation, &angle, &ax, &ay, &az);
|
quat_getAngleAxis(orientation, &angle, &ax, &ay, &az);
|
||||||
lua_pushnumber(L, position[0]);
|
lua_pushnumber(L, position[0]);
|
||||||
lua_pushnumber(L, position[1]);
|
lua_pushnumber(L, position[1]);
|
||||||
|
@ -462,28 +462,28 @@ static int l_lovrCompoundShapeGetShapeOffset(lua_State* L) {
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_lovrCompoundShapeSetShapeOffset(lua_State* L) {
|
static int l_lovrCompoundShapeSetChildOffset(lua_State* L) {
|
||||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||||
uint32_t index = luax_checku32(L, 2) - 1;
|
uint32_t index = luax_checku32(L, 2) - 1;
|
||||||
float position[3], orientation[4];
|
float position[3], orientation[4];
|
||||||
int i = 3;
|
int i = 3;
|
||||||
i = luax_readvec3(L, i, position, NULL);
|
i = luax_readvec3(L, i, position, NULL);
|
||||||
i = luax_readquat(L, i, orientation, NULL);
|
i = luax_readquat(L, i, orientation, NULL);
|
||||||
lovrCompoundShapeSetShapeOffset(shape, index, position, orientation);
|
lovrCompoundShapeSetChildOffset(shape, index, position, orientation);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const luaL_Reg lovrCompoundShape[] = {
|
const luaL_Reg lovrCompoundShape[] = {
|
||||||
lovrShape,
|
lovrShape,
|
||||||
{ "isFrozen", l_lovrCompoundShapeIsFrozen },
|
{ "isFrozen", l_lovrCompoundShapeIsFrozen },
|
||||||
{ "addShape", l_lovrCompoundShapeAddShape },
|
{ "addChild", l_lovrCompoundShapeAddChild },
|
||||||
{ "replaceShape", l_lovrCompoundShapeReplaceShape },
|
{ "replaceChild", l_lovrCompoundShapeReplaceChild },
|
||||||
{ "removeShape", l_lovrCompoundShapeRemoveShape },
|
{ "removeChild", l_lovrCompoundShapeRemoveChild },
|
||||||
{ "getShape", l_lovrCompoundShapeGetShape },
|
{ "getChild", l_lovrCompoundShapeGetChild },
|
||||||
{ "getShapes", l_lovrCompoundShapeGetShapes },
|
{ "getChildren", l_lovrCompoundShapeGetChildren },
|
||||||
{ "getShapeCount", l_lovrCompoundShapeGetShapeCount },
|
{ "getChildCount", l_lovrCompoundShapeGetChildCount },
|
||||||
{ "getShapeOffset", l_lovrCompoundShapeGetShapeOffset },
|
{ "getChildOffset", l_lovrCompoundShapeGetChildOffset },
|
||||||
{ "setShapeOffset", l_lovrCompoundShapeSetShapeOffset },
|
{ "setChildOffset", l_lovrCompoundShapeSetChildOffset },
|
||||||
{ "__len", l_lovrCompoundShapeGetShapeCount }, // :)
|
{ "__len", l_lovrCompoundShapeGetChildCount }, // :)
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -187,13 +187,13 @@ TerrainShape* lovrTerrainShapeCreate(float* vertices, uint32_t n, float scaleXZ,
|
||||||
|
|
||||||
CompoundShape* lovrCompoundShapeCreate(Shape** shapes, float* positions, float* orientations, uint32_t count, bool freeze);
|
CompoundShape* lovrCompoundShapeCreate(Shape** shapes, float* positions, float* orientations, uint32_t count, bool freeze);
|
||||||
bool lovrCompoundShapeIsFrozen(CompoundShape* shape);
|
bool lovrCompoundShapeIsFrozen(CompoundShape* shape);
|
||||||
void lovrCompoundShapeAddShape(CompoundShape* shape, Shape* child, float* position, float* orientation);
|
void lovrCompoundShapeAddChild(CompoundShape* shape, Shape* child, float* position, float* orientation);
|
||||||
void lovrCompoundShapeReplaceShape(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation);
|
void lovrCompoundShapeReplaceChild(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation);
|
||||||
void lovrCompoundShapeRemoveShape(CompoundShape* shape, uint32_t index);
|
void lovrCompoundShapeRemoveChild(CompoundShape* shape, uint32_t index);
|
||||||
Shape* lovrCompoundShapeGetShape(CompoundShape* shape, uint32_t index);
|
Shape* lovrCompoundShapeGetChild(CompoundShape* shape, uint32_t index);
|
||||||
uint32_t lovrCompoundShapeGetShapeCount(CompoundShape* shape);
|
uint32_t lovrCompoundShapeGetChildCount(CompoundShape* shape);
|
||||||
void lovrCompoundShapeGetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation);
|
void lovrCompoundShapeGetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation);
|
||||||
void lovrCompoundShapeSetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation);
|
void lovrCompoundShapeSetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation);
|
||||||
|
|
||||||
// These tokens need to exist for Lua bindings
|
// These tokens need to exist for Lua bindings
|
||||||
#define lovrSphereShapeDestroy lovrShapeDestroy
|
#define lovrSphereShapeDestroy lovrShapeDestroy
|
||||||
|
|
|
@ -430,7 +430,7 @@ Shape* lovrColliderGetShape(Collider* collider, uint32_t child) {
|
||||||
return collider->shape;
|
return collider->shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lovrCompoundShapeGetShape(collider->shape, child);
|
return lovrCompoundShapeGetChild(collider->shape, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrColliderSetShape(Collider* collider, Shape* shape) {
|
void lovrColliderSetShape(Collider* collider, Shape* shape) {
|
||||||
|
@ -835,9 +835,9 @@ void lovrShapeDestroy(void* ref) {
|
||||||
void lovrShapeDestroyData(Shape* shape) {
|
void lovrShapeDestroyData(Shape* shape) {
|
||||||
if (shape->shape) {
|
if (shape->shape) {
|
||||||
if (shape->type == SHAPE_COMPOUND) {
|
if (shape->type == SHAPE_COMPOUND) {
|
||||||
uint32_t count = lovrCompoundShapeGetShapeCount(shape);
|
uint32_t count = lovrCompoundShapeGetChildCount(shape);
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
Shape* child = lovrCompoundShapeGetShape(shape, i);
|
Shape* child = lovrCompoundShapeGetChild(shape, i);
|
||||||
lovrRelease(child, lovrShapeDestroy);
|
lovrRelease(child, lovrShapeDestroy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -994,9 +994,9 @@ TerrainShape* lovrTerrainShapeCreate(float* vertices, uint32_t n, float scaleXZ,
|
||||||
CompoundShape* lovrCompoundShapeCreate(Shape** shapes, vec3 positions, quat orientations, uint32_t count, bool freeze) {
|
CompoundShape* lovrCompoundShapeCreate(Shape** shapes, vec3 positions, quat orientations, uint32_t count, bool freeze) {
|
||||||
lovrCheck(!freeze || count >= 2, "A frozen CompoundShape must contain at least two shapes");
|
lovrCheck(!freeze || count >= 2, "A frozen CompoundShape must contain at least two shapes");
|
||||||
|
|
||||||
CompoundShape* parent = lovrCalloc(sizeof(CompoundShape));
|
CompoundShape* shape = lovrCalloc(sizeof(CompoundShape));
|
||||||
parent->ref = 1;
|
shape->ref = 1;
|
||||||
parent->type = SHAPE_COMPOUND;
|
shape->type = SHAPE_COMPOUND;
|
||||||
|
|
||||||
JPH_CompoundShapeSettings* settings = freeze ?
|
JPH_CompoundShapeSettings* settings = freeze ?
|
||||||
(JPH_CompoundShapeSettings*) JPH_StaticCompoundShapeSettings_Create() :
|
(JPH_CompoundShapeSettings*) JPH_StaticCompoundShapeSettings_Create() :
|
||||||
|
@ -1011,20 +1011,20 @@ CompoundShape* lovrCompoundShapeCreate(Shape** shapes, vec3 positions, quat orie
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeze) {
|
if (freeze) {
|
||||||
parent->shape = (JPH_Shape*) JPH_StaticCompoundShape_Create((JPH_StaticCompoundShapeSettings*) settings);
|
shape->shape = (JPH_Shape*) JPH_StaticCompoundShape_Create((JPH_StaticCompoundShapeSettings*) settings);
|
||||||
} else {
|
} else {
|
||||||
parent->shape = (JPH_Shape*) JPH_MutableCompoundShape_Create((JPH_MutableCompoundShapeSettings*) settings);
|
shape->shape = (JPH_Shape*) JPH_MutableCompoundShape_Create((JPH_MutableCompoundShapeSettings*) settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
JPH_ShapeSettings_Destroy((JPH_ShapeSettings*) settings);
|
JPH_ShapeSettings_Destroy((JPH_ShapeSettings*) settings);
|
||||||
return parent;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lovrCompoundShapeIsFrozen(CompoundShape* shape) {
|
bool lovrCompoundShapeIsFrozen(CompoundShape* shape) {
|
||||||
return JPH_Shape_GetSubType(shape->shape) == JPH_ShapeSubType_StaticCompound;
|
return JPH_Shape_GetSubType(shape->shape) == JPH_ShapeSubType_StaticCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeAddShape(CompoundShape* shape, Shape* child, float* position, float* orientation) {
|
void lovrCompoundShapeAddChild(CompoundShape* shape, Shape* child, float* position, float* orientation) {
|
||||||
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
||||||
lovrCheck(child->type != SHAPE_COMPOUND, "Currently, nesting compound shapes is not supported");
|
lovrCheck(child->type != SHAPE_COMPOUND, "Currently, nesting compound shapes is not supported");
|
||||||
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
||||||
|
@ -1033,27 +1033,27 @@ void lovrCompoundShapeAddShape(CompoundShape* shape, Shape* child, float* positi
|
||||||
lovrRetain(child);
|
lovrRetain(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeReplaceShape(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation) {
|
void lovrCompoundShapeReplaceChild(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation) {
|
||||||
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
||||||
lovrCheck(child->type != SHAPE_COMPOUND, "Currently, nesting compound shapes is not supported");
|
lovrCheck(child->type != SHAPE_COMPOUND, "Currently, nesting compound shapes is not supported");
|
||||||
lovrCheck(index < lovrCompoundShapeGetShapeCount(shape), "CompoundShape has no shape at index %d", index + 1);
|
lovrCheck(index < lovrCompoundShapeGetChildCount(shape), "CompoundShape has no child at index %d", index + 1);
|
||||||
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
||||||
JPH_Quat rot = { orientation[0], orientation[1], orientation[2], orientation[3] };
|
JPH_Quat rot = { orientation[0], orientation[1], orientation[2], orientation[3] };
|
||||||
lovrRelease(lovrCompoundShapeGetShape(shape, index), lovrShapeDestroy);
|
lovrRelease(lovrCompoundShapeGetChild(shape, index), lovrShapeDestroy);
|
||||||
JPH_MutableCompoundShape_ModifyShape2((JPH_MutableCompoundShape*) shape->shape, index, &pos, &rot, child->shape);
|
JPH_MutableCompoundShape_ModifyShape2((JPH_MutableCompoundShape*) shape->shape, index, &pos, &rot, child->shape);
|
||||||
lovrRetain(child);
|
lovrRetain(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeRemoveShape(CompoundShape* shape, uint32_t index) {
|
void lovrCompoundShapeRemoveChild(CompoundShape* shape, uint32_t index) {
|
||||||
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
||||||
lovrCheck(index < lovrCompoundShapeGetShapeCount(shape), "CompoundShape has no shape at index %d", index + 1);
|
lovrCheck(index < lovrCompoundShapeGetChildCount(shape), "CompoundShape has no child at index %d", index + 1);
|
||||||
Shape* child = lovrCompoundShapeGetShape(shape, index);
|
Shape* child = lovrCompoundShapeGetChild(shape, index);
|
||||||
JPH_MutableCompoundShape_RemoveShape((JPH_MutableCompoundShape*) shape->shape, index);
|
JPH_MutableCompoundShape_RemoveShape((JPH_MutableCompoundShape*) shape->shape, index);
|
||||||
lovrRelease(child, lovrShapeDestroy);
|
lovrRelease(child, lovrShapeDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape* lovrCompoundShapeGetShape(CompoundShape* shape, uint32_t index) {
|
Shape* lovrCompoundShapeGetChild(CompoundShape* shape, uint32_t index) {
|
||||||
if (index < lovrCompoundShapeGetShapeCount(shape)) {
|
if (index < lovrCompoundShapeGetChildCount(shape)) {
|
||||||
const JPH_Shape* child;
|
const JPH_Shape* child;
|
||||||
JPH_CompoundShape_GetSubShape((JPH_CompoundShape*) shape->shape, index, &child, NULL, NULL, NULL);
|
JPH_CompoundShape_GetSubShape((JPH_CompoundShape*) shape->shape, index, &child, NULL, NULL, NULL);
|
||||||
return (Shape*) (uintptr_t) JPH_Shape_GetUserData(child);
|
return (Shape*) (uintptr_t) JPH_Shape_GetUserData(child);
|
||||||
|
@ -1062,12 +1062,12 @@ Shape* lovrCompoundShapeGetShape(CompoundShape* shape, uint32_t index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lovrCompoundShapeGetShapeCount(CompoundShape* shape) {
|
uint32_t lovrCompoundShapeGetChildCount(CompoundShape* shape) {
|
||||||
return JPH_CompoundShape_GetNumSubShapes((JPH_CompoundShape*) shape->shape);
|
return JPH_CompoundShape_GetNumSubShapes((JPH_CompoundShape*) shape->shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeGetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
void lovrCompoundShapeGetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
||||||
lovrCheck(index < lovrCompoundShapeGetShapeCount(shape), "CompoundShape has no shape at index %d", index + 1);
|
lovrCheck(index < lovrCompoundShapeGetChildCount(shape), "CompoundShape has no child at index %d", index + 1);
|
||||||
const JPH_Shape* child;
|
const JPH_Shape* child;
|
||||||
JPH_Vec3 pos;
|
JPH_Vec3 pos;
|
||||||
JPH_Quat rot;
|
JPH_Quat rot;
|
||||||
|
@ -1077,9 +1077,9 @@ void lovrCompoundShapeGetShapeOffset(CompoundShape* shape, uint32_t index, float
|
||||||
quat_init(orientation, &rot.x);
|
quat_init(orientation, &rot.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeSetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
void lovrCompoundShapeSetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
||||||
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
lovrCheck(!lovrCompoundShapeIsFrozen(shape), "CompoundShape is frozen and can not be changed");
|
||||||
lovrCheck(index < lovrCompoundShapeGetShapeCount(shape), "CompoundShape has no shape at index %d", index + 1);
|
lovrCheck(index < lovrCompoundShapeGetChildCount(shape), "CompoundShape has no child at index %d", index + 1);
|
||||||
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
||||||
JPH_Quat rot = { orientation[0], orientation[1], orientation[2], orientation[3] };
|
JPH_Quat rot = { orientation[0], orientation[1], orientation[2], orientation[3] };
|
||||||
JPH_MutableCompoundShape_ModifyShape((JPH_MutableCompoundShape*) shape->shape, index, &pos, &rot);
|
JPH_MutableCompoundShape_ModifyShape((JPH_MutableCompoundShape*) shape->shape, index, &pos, &rot);
|
||||||
|
|
|
@ -1119,31 +1119,31 @@ bool lovrCompoundShapeIsFrozen(CompoundShape* shape) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeAddShape(CompoundShape* shape, Shape* child, float* position, float* orientation) {
|
void lovrCompoundShapeAddChild(CompoundShape* shape, Shape* child, float* position, float* orientation) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeReplaceShape(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation) {
|
void lovrCompoundShapeReplaceChild(CompoundShape* shape, uint32_t index, Shape* child, float* position, float* orientation) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeRemoveShape(CompoundShape* shape, uint32_t index) {
|
void lovrCompoundShapeRemoveChild(CompoundShape* shape, uint32_t index) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape* lovrCompoundShapeGetShape(CompoundShape* shape, uint32_t index) {
|
Shape* lovrCompoundShapeGetChild(CompoundShape* shape, uint32_t index) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t lovrCompoundShapeGetShapeCount(CompoundShape* shape) {
|
uint32_t lovrCompoundShapeGetChildCount(CompoundShape* shape) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeGetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
void lovrCompoundShapeGetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void lovrCompoundShapeSetShapeOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
void lovrCompoundShapeSetChildOffset(CompoundShape* shape, uint32_t index, float* position, float* orientation) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue