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/scene/igeneric.cpp | 17 +++++++++-------- src/client/lua_api/scene/imesh.cpp | 26 +++++++++++++------------- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/client/lua_api/scene') diff --git a/src/client/lua_api/scene/igeneric.cpp b/src/client/lua_api/scene/igeneric.cpp index 8280008..c016788 100644 --- a/src/client/lua_api/scene/igeneric.cpp +++ b/src/client/lua_api/scene/igeneric.cpp @@ -66,14 +66,15 @@ int iscenesetangle(lua_State* L){//{node=ud_ISceneNode},{x,y,z} return 0; } -/* +//iscenesetmaterial(ud_ISceneNode,ud_itexture) int iscenesetmaterial(lua_State* L){ - ISceneNode* i = toiscenenode(L,1)->n; - const char* s = luaL_optstring(L,2,"error.png"); - printf("Setting material to %s",s); - IVideoDriver* driver = device->getVideoDriver(); - i->setMaterialTexture(0, driver->getTexture(s)); + printf("Calling generic iscenesetmaterial function\n"); + ITexture* txt = (ITexture*)lua_touserdata(L,-1);//ud_ISceneNode,ud_itexture + lua_pop(L,1);//ud_ISceneNode + ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//ud_ISceneNode + lua_pop(L,2);// + + i->setMaterialTexture(0,txt); - return 0; + return 0; } -*/ diff --git a/src/client/lua_api/scene/imesh.cpp b/src/client/lua_api/scene/imesh.cpp index f391431..2760067 100644 --- a/src/client/lua_api/scene/imesh.cpp +++ b/src/client/lua_api/scene/imesh.cpp @@ -91,19 +91,19 @@ int newiscenecube(lua_State* L){//{v3 size}, {v3 origin} } // self:setMaterial("path/to/material") -int iscenesetmaterial(lua_State* L){//self,"path/to" - ISceneNode* node = (IMeshSceneNode*)lua_touserdata(L,-2); - const char* s = lua_tostring(L,-1); - //ISceneNode* i = toiscenenode(L,1)->n; - //const char* s = luaL_optstring(L,2,"error.png"); - //printf("Setting material to %s",s); - - IVideoDriver* driver = device->getVideoDriver(); - node->setMaterialTexture(0, driver->getTexture(s)); - - lua_pop(L,2); - return 0; -} +//int iscenesetmaterial(lua_State* L){//self,"path/to" + //ISceneNode* node = (IMeshSceneNode*)lua_touserdata(L,-2); + //const char* s = lua_tostring(L,-1); + ////ISceneNode* i = toiscenenode(L,1)->n; + ////const char* s = luaL_optstring(L,2,"error.png"); + ////printf("Setting material to %s",s); + + //IVideoDriver* driver = device->getVideoDriver(); + //node->setMaterialTexture(0, driver->getTexture(s)); + + //lua_pop(L,2); + //return 0; +//} static const luaL_reg imesh_m[] = { {"setMaterial", iscenesetmaterial}, -- cgit v1.2.3-70-g09d2