mirror of https://github.com/bjornbytes/lovr.git
World:getAngularDamping; World:setAngularDamping;
This commit is contained in:
parent
b840fb0a44
commit
ca7b93e150
|
@ -37,6 +37,23 @@ int l_lovrWorldSetLinearDamping(lua_State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int l_lovrWorldGetAngularDamping(lua_State* L) {
|
||||||
|
World* world = luax_checktype(L, 1, World);
|
||||||
|
float damping, threshold;
|
||||||
|
lovrWorldGetAngularDamping(world, &damping, &threshold);
|
||||||
|
lua_pushnumber(L, damping);
|
||||||
|
lua_pushnumber(L, threshold);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int l_lovrWorldSetAngularDamping(lua_State* L) {
|
||||||
|
World* world = luax_checktype(L, 1, World);
|
||||||
|
float damping = luaL_checknumber(L, 2);
|
||||||
|
float threshold = luaL_optnumber(L, 3, .01);
|
||||||
|
lovrWorldSetAngularDamping(world, damping, threshold);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int l_lovrWorldUpdate(lua_State* L) {
|
int l_lovrWorldUpdate(lua_State* L) {
|
||||||
World* world = luax_checktype(L, 1, World);
|
World* world = luax_checktype(L, 1, World);
|
||||||
float dt = luaL_checknumber(L, 2);
|
float dt = luaL_checknumber(L, 2);
|
||||||
|
@ -49,6 +66,8 @@ const luaL_Reg lovrWorld[] = {
|
||||||
{ "setGravity", l_lovrWorldSetGravity },
|
{ "setGravity", l_lovrWorldSetGravity },
|
||||||
{ "getLinearDamping", l_lovrWorldGetLinearDamping },
|
{ "getLinearDamping", l_lovrWorldGetLinearDamping },
|
||||||
{ "setLinearDamping", l_lovrWorldSetLinearDamping },
|
{ "setLinearDamping", l_lovrWorldSetLinearDamping },
|
||||||
|
{ "getAngularDamping", l_lovrWorldGetAngularDamping },
|
||||||
|
{ "setAngularDamping", l_lovrWorldSetAngularDamping },
|
||||||
{ "update", l_lovrWorldUpdate },
|
{ "update", l_lovrWorldUpdate },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,16 @@ void lovrWorldSetLinearDamping(World* world, float damping, float threshold) {
|
||||||
dWorldSetLinearDampingThreshold(world->id, threshold);
|
dWorldSetLinearDampingThreshold(world->id, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lovrWorldGetAngularDamping(World* world, float* damping, float* threshold) {
|
||||||
|
*damping = dWorldGetAngularDamping(world->id);
|
||||||
|
*threshold = dWorldGetAngularDampingThreshold(world->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lovrWorldSetAngularDamping(World* world, float damping, float threshold) {
|
||||||
|
dWorldSetAngularDamping(world->id, damping);
|
||||||
|
dWorldSetAngularDampingThreshold(world->id, threshold);
|
||||||
|
}
|
||||||
|
|
||||||
void lovrWorldUpdate(World* world, float dt) {
|
void lovrWorldUpdate(World* world, float dt) {
|
||||||
dWorldQuickStep(world->id, dt);
|
dWorldQuickStep(world->id, dt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,6 @@ void lovrWorldGetGravity(World* world, float* x, float* y, float* z);
|
||||||
void lovrWorldSetGravity(World* world, float x, float y, float z);
|
void lovrWorldSetGravity(World* world, float x, float y, float z);
|
||||||
void lovrWorldGetLinearDamping(World* world, float* damping, float* threshold);
|
void lovrWorldGetLinearDamping(World* world, float* damping, float* threshold);
|
||||||
void lovrWorldSetLinearDamping(World* world, float damping, float threshold);
|
void lovrWorldSetLinearDamping(World* world, float damping, float threshold);
|
||||||
|
void lovrWorldGetAngularDamping(World* world, float* damping, float* threshold);
|
||||||
|
void lovrWorldSetAngularDamping(World* world, float damping, float threshold);
|
||||||
void lovrWorldUpdate(World* world, float dt);
|
void lovrWorldUpdate(World* world, float dt);
|
||||||
|
|
Loading…
Reference in New Issue