diff options
Diffstat (limited to 'src/client/lua_api/phys/bphysbox.cpp')
| -rw-r--r-- | src/client/lua_api/phys/bphysbox.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/client/lua_api/phys/bphysbox.cpp b/src/client/lua_api/phys/bphysbox.cpp index 9a87045..80cd2eb 100644 --- a/src/client/lua_api/phys/bphysbox.cpp +++ b/src/client/lua_api/phys/bphysbox.cpp @@ -10,9 +10,11 @@ extern "C" { #include <lauxlib.h> #include <lualib.h> } +#include <btBulletDynamicsCommon.h> #include <irrlicht.h> #include "../gameparts.hpp" #include "bphysbox.hpp" +#include "../scene/igeneric.hpp" using namespace irr; using namespace scene; @@ -99,7 +101,8 @@ static int newbphysbox(lua_State* L){ //Node->setMaterialFlag(video::EMF_WIREFRAME,true) //Node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); - Node->setMaterialTexture(0, device->getVideoDriver()->getTexture("sydney.bmp")); + Node->setMaterialFlag(video::EMF_LIGHTING,true); + //Node->setMaterialTexture(0, device->getVideoDriver()->getTexture("../data/wall.jpg")); printf("Set node's lighting stuff...\n"); @@ -148,7 +151,7 @@ static int newbphysbox(lua_State* L){ lua_rawgeti(L,LUA_REGISTRYINDEX,tref);//Put it back on the stack since luaL_ref pops the object. //Set it's metatable - luaL_getmetatable(L, "physbox"); + luaL_getmetatable(L, "phys.physbox"); lua_setmetatable(L, -2); //Create the struct @@ -169,7 +172,7 @@ static int newbphysbox(lua_State* L){ static int delbphysbox(lua_State* L){ LBPhysNode* pnode = checkisbphysbox(L,-1); - delete pnode->r->getMotionState(); + //delete pnode->r->getMotionState(); delete pnode->r->getCollisionShape(); delete pnode->r; @@ -213,7 +216,7 @@ static int bphyssetpos(lua_State *L){ bt.setOrigin(to); printf("managed to set phys transform\n"); i->r->setWorldTransform(bt); - + i->r->activate(); printf("sucess! returning from call\n"); return 0; } @@ -248,7 +251,7 @@ static const luaL_reg bphysbox_f[] = { }; static const luaL_reg bphysbox_m[] = { -// {"setMaterial", setmaterial}, + {"setmaterial", iscenesetmaterial}, {"getpos", bphysgetpos}, {"setpos", bphyssetpos}, // {"settext", setiguitext}, @@ -258,29 +261,29 @@ static const luaL_reg bphysbox_m[] = { int bphysbox_register(lua_State* L, IrrlichtDevice* d){ - device = d; + device = d; - printf("bphysbox registered\n"); + printf("bphysbox registered\n"); - luaL_newmetatable(L, "phys.physbox"); + luaL_newmetatable(L, "phys.physbox"); - luaL_register(L,"physbox",bphysbox_f); + luaL_register(L,"physbox",bphysbox_f); - lua_pushstring(L,"__index"); - lua_pushstring(L,"gethandeler"); - lua_gettable(L,-3); - lua_settable(L,-4); + lua_pushstring(L,"__index"); + lua_pushstring(L,"gethandeler"); + lua_gettable(L,-3); + lua_settable(L,-4); - lua_pushstring(L,"__newindex"); - lua_pushstring(L,"sethandeler"); - lua_gettable(L,-3); - lua_settable(L,-4); - - lua_pushstring(L,"__gc"); - lua_pushcfunction(L,delbphysbox); - lua_settable(L,-4); + lua_pushstring(L,"__newindex"); + lua_pushstring(L,"sethandeler"); + lua_gettable(L,-3); + lua_settable(L,-4); - luaL_register(L, NULL, bphysbox_m); + lua_pushstring(L,"__gc"); + lua_pushcfunction(L,delbphysbox); + lua_settable(L,-4); - return 1; + luaL_register(L, NULL, bphysbox_m); + + return 1; } |
