From 6cf098e3450ba99c238cf0499c6cecaa246f4d50 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 27 Mar 2018 22:42:57 -0400 Subject: Fixed the procedural textures Procedural textures are now completely working. --- src/client/lua_api/phys/cbphysbox.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/client/lua_api/phys/cbphysbox.cpp') 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}, }; -- cgit v1.2.3-70-g09d2