aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/scene/ilight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/lua_api/scene/ilight.cpp')
-rw-r--r--src/client/lua_api/scene/ilight.cpp36
1 files changed, 34 insertions, 2 deletions
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);