aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/phys
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-27 22:42:57 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-27 22:42:57 -0400
commit6cf098e3450ba99c238cf0499c6cecaa246f4d50 (patch)
tree175b84e32a3cf24f3fb7356825827f6611bab1ed /src/client/lua_api/phys
parent2831e232b886c5e3b0791ea5192f9e5194e6abf3 (diff)
downloadbrokengine-6cf098e3450ba99c238cf0499c6cecaa246f4d50.tar.gz
brokengine-6cf098e3450ba99c238cf0499c6cecaa246f4d50.tar.bz2
brokengine-6cf098e3450ba99c238cf0499c6cecaa246f4d50.zip
Fixed the procedural textures
Procedural textures are now completely working.
Diffstat (limited to 'src/client/lua_api/phys')
-rw-r--r--src/client/lua_api/phys/cbphysbox.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/client/lua_api/phys/cbphysbox.cpp b/src/client/lua_api/phys/cbphysbox.cpp
index 6cbd749..3e72672 100644
--- a/src/client/lua_api/phys/cbphysbox.cpp
+++ b/src/client/lua_api/phys/cbphysbox.cpp
@@ -13,6 +13,7 @@ extern "C" {
#include "cbphysbox.hpp"
#include "../scene/imesh.hpp"
#include "../../../shared/lua_api/phys/bphysbox.hpp"
+#include "../scene/igeneric.hpp"
using namespace irr;
using namespace scene;
@@ -134,11 +135,32 @@ int cbphysapplygravity(lua_State* L){
return 0;
}
+//setMaterial(self,material)
+int cbsetmaterial(lua_State* L){
+ printf("Call to setmaterial\n");
+ //SMaterial* mat = (SMaterial*)lua_touserdata(L,-1);//{node=ud_ISceneNode},ud_IMaterial
+ ITexture* tex = (ITexture*)lua_touserdata(L,-1);
+ lua_pop(L,1);//{node=ud_ISceneNode}
+ printf("About to get field node\n");
+ lua_getfield(L,-1,"node");//{node=ud_ISceneNode},ud_ISceneNode
+ printf("After call to field node\n");
+ ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_ISceneNode},ud_ISceneNode
+ lua_pop(L,2);//
+
+ lua_pushlightuserdata(L,i);
+ lua_pushlightuserdata(L,tex);
+ printf("Finished getting everything for setmaterial\n");
+ iscenesetmaterial(L);
+
+ return 0;
+}
+
static const luaL_reg cbphysbox_m[] = {
{"setcpos", cbphyssetpos},//overload
{"getcpos", cbphysgetpos},
{"getgravity", cbphysgetgravity},
{"applygravity",cbphysapplygravity},
+ {"setMaterial", cbsetmaterial},
// {"delete", delbphysbox},//client side delete needs to delete the visual representation
{0, 0},
};