From 80789508b9655d25629223b9dcc84b4cfb77ce45 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 29 Jun 2020 15:29:03 -0400 Subject: Updates for mdoc Also more tests --- src/client/lua_api/scene/ilight.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'src/client/lua_api/scene/ilight.cpp') diff --git a/src/client/lua_api/scene/ilight.cpp b/src/client/lua_api/scene/ilight.cpp index 1e292ee..e405443 100644 --- a/src/client/lua_api/scene/ilight.cpp +++ b/src/client/lua_api/scene/ilight.cpp @@ -23,6 +23,21 @@ using namespace core; extern IrrlichtDevice* device; +/*** +Create a light +Creates a light that illuminates the surrounding objects dynamically. +@function scene.newlight(number radius, vector3d position) +@tparam number radius The radius that the light should shine +@tparam vector3d position The position to create the light at +@treturn iscenelight The created light +*/ +/*** +A light. +Lights illuminate the scene nodes arounded them based on mesh vertexes. You +probably want to bake the lightmap instead of using light nodes. +@class iscenelight +@inherits iscenenode +*/ //{} :: scene.newlight(radius, {v3 position}) static int newiscenelight(lua_State* L){ printf("Createing light!\n"); @@ -48,6 +63,12 @@ static int newiscenelight(lua_State* L){ } +/*** +Sets the light type +Different light types illuminate the surrounding meshes in different ways. +@function iscenelight:settype(number type) +@tparam number type The type the light should be +*/ //settype(self,const) int settype(lua_State *L){ video::E_LIGHT_TYPE type = (video::E_LIGHT_TYPE)lua_tonumber(L,-1);//self,type @@ -60,8 +81,6 @@ int settype(lua_State *L){ } static const luaL_reg ilight_m[] = { - {"getpos", iscenegetpos}, - {"setpos", iscenesetpos}, {"settype", settype}, {0, 0}, }; @@ -72,8 +91,20 @@ void ilight_register(lua_State* L){ lua_pushcfunction(L,newiscenelight);//{scene},newiscenelight() lua_setfield(L,-2,"newlight");//{scene} +/*** +A point light +@field scene.ELT_POINT +*/ set_const(L,ELT_POINT); +/*** +A spot light +@field scene.ELT_SPOT +*/ set_const(L,ELT_SPOT); +/*** +A sun light +@field scene.ELT_DIRECTIONAL +*/ set_const(L,ELT_DIRECTIONAL); lua_pop(L,1);// @@ -81,6 +112,7 @@ void ilight_register(lua_State* L){ luaL_newmetatable(L,"scene.ilight");//scene.ilight lua_newtable(L);//scene.ilight,{} luaL_register(L, NULL, ilight_m);//scene.ilight,{} + luaL_register(L, NULL, igeneric_m); lua_setfield(L,-2,"__index");//scene.ilight lua_pop(L,1); -- cgit v1.2.3-70-g09d2