aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/load_phys.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-11-01 13:53:16 -0400
committerAlexander Pickering <alex@cogarr.net>2018-11-01 13:53:16 -0400
commit112517494847f0c86f58544cbf4c35c9b7712ab1 (patch)
tree115d9ae3da8028e67e498ed8c587d14972b7699b /src/client/lua_api/load_phys.cpp
parent77b26fba6e78ac4af2b28b3bbb4646dea5682ed1 (diff)
downloadbrokengine-112517494847f0c86f58544cbf4c35c9b7712ab1.tar.gz
brokengine-112517494847f0c86f58544cbf4c35c9b7712ab1.tar.bz2
brokengine-112517494847f0c86f58544cbf4c35c9b7712ab1.zip
Refactored code and added library
Physics code for models now lives in the shared directory. To get file loading without irrlicht, a single-file header library (lib/tinyobjloader-c) was added. Metatables for generics and physics generics have also been seperated out.
Diffstat (limited to 'src/client/lua_api/load_phys.cpp')
-rw-r--r--src/client/lua_api/load_phys.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/client/lua_api/load_phys.cpp b/src/client/lua_api/load_phys.cpp
deleted file mode 100644
index 0a4889b..0000000
--- a/src/client/lua_api/load_phys.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <vector>
-#include <map>
-extern "C" {
- #include <lua.h>
- #include <lauxlib.h>
- #include <lualib.h>
-}
-#include <irrlicht.h>
-#include "../callbackhandeler.hpp"
-#include "phys/cbphysbox.hpp"
-#include "phys/bphysmodel.hpp"
-#include <btBulletDynamicsCommon.h>
-#include <btBulletCollisionCommon.h>
-//#include <shared/phys/physcommon.hpp>
-#include <shared/lua_api/common.hpp>
-
-using namespace irr;
-using namespace gui;
-using namespace core;
-
-extern IrrlichtDevice* device;
-extern btDiscreteDynamicsWorld* World;
-extern btBroadphaseInterface *BroadPhase;
-
-//raytest({from},{to},{mins},{maxes}) :: hashit
-int raytest(lua_State *L){
- double fx,fy,fz;
- double tx,ty,tz;
- popvector3d(L, &fx, &fy, &fz);
- popvector3d(L, &tx, &ty, &tz);
-
- btVector3 from(fx, fy, fz);
- btVector3 to(tx, ty, tz);
- btCollisionWorld::RayResultCallback *res = new btDiscreteDynamicsWorld::ClosestRayResultCallback(from, to);
- World->rayTest(from,to,*res);
-
- lua_pushboolean(L,res->hasHit());
- return 1;
-}
-
-void load_physfuncs(lua_State* L){
- lua_newtable(L);//{}
- lua_setglobal(L,"phys");//
- //phys things
- cbphysbox_register(L);
-
- bphysmodel_register(L,device);
-
- lua_getglobal(L,"phys");//{}
- lua_pushcfunction(L,raytest);//{},raytest()
- lua_setfield(L,-2,"raytest");//{}
- lua_pop(L,1);
-}