diff options
| author | Alexander <alex@cogarr.net> | 2019-10-27 17:25:16 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2019-10-27 17:25:16 -0400 |
| commit | 0d2de2ba9c616862d7881f089382db772d034f89 (patch) | |
| tree | 5fc58b63c593e2ac17f3353b50318c299f643390 /src/client/lua_api/scene/ilight.cpp | |
| parent | c9db55cdc2f69c3dc7aefabe0cc828a64e377024 (diff) | |
| download | brokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.gz brokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.bz2 brokengine-0d2de2ba9c616862d7881f089382db772d034f89.zip | |
Various updates
Diffstat (limited to 'src/client/lua_api/scene/ilight.cpp')
| -rw-r--r-- | src/client/lua_api/scene/ilight.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/client/lua_api/scene/ilight.cpp b/src/client/lua_api/scene/ilight.cpp index 972de83..1e292ee 100644 --- a/src/client/lua_api/scene/ilight.cpp +++ b/src/client/lua_api/scene/ilight.cpp @@ -17,6 +17,7 @@ extern "C" { #include <shared/lua_api/common.hpp> using namespace irr; +using namespace video; using namespace scene; using namespace core; @@ -27,9 +28,9 @@ static int newiscenelight(lua_State* L){ printf("Createing light!\n"); double x,y,z; popvector3d(L,&x,&y,&z);//radius - double radius = lua_tonumber(L,-1); + double radius = lua_tonumber(L,-1); lua_pop(L,1);// - + //Create the mesh ISceneManager* smgr = device->getSceneManager(); ILightSceneNode* light = smgr->addLightSceneNode(0,vector3df(x,y,z),video::SColor(1.0f,1.0f,1.0f,1.0f),(f32)radius,(s32)-1); @@ -45,11 +46,23 @@ static int newiscenelight(lua_State* L){ return 1; - } +} + +//settype(self,const) +int settype(lua_State *L){ + video::E_LIGHT_TYPE type = (video::E_LIGHT_TYPE)lua_tonumber(L,-1);//self,type + lua_pop(L,1);//self + lua_getfield(L,-1,"node");//self,ud_ILightSceneNode + ILightSceneNode *light = (ILightSceneNode*)lua_touserdata(L,-1); + lua_pop(L,2);// + light->setLightType(type); + return 0; +} static const luaL_reg ilight_m[] = { {"getpos", iscenegetpos}, {"setpos", iscenesetpos}, + {"settype", settype}, {0, 0}, }; @@ -59,6 +72,10 @@ void ilight_register(lua_State* L){ lua_pushcfunction(L,newiscenelight);//{scene},newiscenelight() lua_setfield(L,-2,"newlight");//{scene} + set_const(L,ELT_POINT); + set_const(L,ELT_SPOT); + set_const(L,ELT_DIRECTIONAL); + lua_pop(L,1);// luaL_newmetatable(L,"scene.ilight");//scene.ilight |
