diff options
| author | Alexander <alex@cogarr.net> | 2020-06-10 20:39:54 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2020-06-10 20:39:54 -0400 |
| commit | 44a1421c393632978d59c0698a93ae22243b97e9 (patch) | |
| tree | ea5d48412339b0ee6792c01414660639d19cfec6 /src/shared/lua_api/phys/bshape.cpp | |
| parent | ececf2c8624f4d95d9413686839f7fa6e5bb5044 (diff) | |
| download | brokengine-44a1421c393632978d59c0698a93ae22243b97e9.tar.gz brokengine-44a1421c393632978d59c0698a93ae22243b97e9.tar.bz2 brokengine-44a1421c393632978d59c0698a93ae22243b97e9.zip | |
Various progress for 1klutz
Added convext shape casts, still a little broken, but it might be
just broken bullet side.
Diffstat (limited to 'src/shared/lua_api/phys/bshape.cpp')
| -rw-r--r-- | src/shared/lua_api/phys/bshape.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/shared/lua_api/phys/bshape.cpp b/src/shared/lua_api/phys/bshape.cpp index 5533b42..f7d73d3 100644 --- a/src/shared/lua_api/phys/bshape.cpp +++ b/src/shared/lua_api/phys/bshape.cpp @@ -1,52 +1,52 @@ -extern "C" { - #include <lua.h> - #include <lauxlib.h> - #include <lualib.h> -} -#include <btBulletDynamicsCommon.h> -#include <btBulletCollisionCommon.h> -#include <shared/lua_api/common.hpp> - -extern btDiscreteDynamicsWorld* World; - -//phys.newboxshape({ax,ay,az}) -static int newboxshape(lua_State* L){ - double ax,ay,az; - popvector3d(L,&ax,&ay,&az); - ax *= 0.5; - ay *= 0.5; - az *= 0.5; - btBoxShape *bs = new btBoxShape(btVector3(ax,ay,az)); - printf("Created shape: %p\n",(void*)bs); - lua_newtable(L);//{} - lua_pushlightuserdata(L,bs);//{},ud_bs - lua_setfield(L,-2,"shape");//{} - luaL_getmetatable(L,"phys.shape");//{},{m_shape} - lua_setmetatable(L,-2);//{} - - return 1; -} - -static const luaL_reg bshape_f[] = { - {"newboxshape", newboxshape}, - {0,0}, -}; - -static const luaL_reg bshape_m[] = { - {0,0}, -}; - -int bshape_register(lua_State* L){ - - luaL_newmetatable(L, "phys.shape");//{m_physshape} - lua_newtable(L);//{m_physshape},{} - luaL_register(L,NULL,bshape_m); - lua_setfield(L,-2,"__index");//{m_physshape} - lua_pop(L,1);// - - lua_getglobal(L,"phys");//{} - luaL_register(L,NULL,bshape_f);//{} - lua_pop(L,1);// - - return 0; -} +extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+#include <btBulletDynamicsCommon.h>
+#include <btBulletCollisionCommon.h>
+#include <shared/lua_api/common.hpp>
+
+extern btDiscreteDynamicsWorld* World;
+
+//phys.newboxshape({ax,ay,az})
+static int newboxshape(lua_State* L){
+ double ax,ay,az;
+ popvector3d(L,&ax,&ay,&az);
+ ax *= 0.5;
+ ay *= 0.5;
+ az *= 0.5;
+ btBoxShape *bs = new btBoxShape(btVector3(ax,ay,az));
+ printf("Created shape: %p\n",(void*)bs);
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,bs);//{},ud_bs
+ lua_setfield(L,-2,"shape");//{}
+ luaL_getmetatable(L,"phys.shape");//{},{m_shape}
+ lua_setmetatable(L,-2);//{}
+
+ return 1;
+}
+
+static const luaL_reg bshape_f[] = {
+ {"newboxshape", newboxshape},
+ {0,0},
+};
+
+static const luaL_reg bshape_m[] = {
+ {0,0},
+};
+
+int bshape_register(lua_State* L){
+
+ luaL_newmetatable(L, "phys.shape");//{m_physshape}
+ lua_newtable(L);//{m_physshape},{}
+ luaL_register(L,NULL,bshape_m);
+ lua_setfield(L,-2,"__index");//{m_physshape}
+ lua_pop(L,1);//
+
+ lua_getglobal(L,"phys");//{}
+ luaL_register(L,NULL,bshape_f);//{}
+ lua_pop(L,1);//
+
+ return 0;
+}
|
