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/video/smaterial.cpp | 53 ++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) (limited to 'src/client/lua_api/video/smaterial.cpp') diff --git a/src/client/lua_api/video/smaterial.cpp b/src/client/lua_api/video/smaterial.cpp index 510748c..4ed6a46 100644 --- a/src/client/lua_api/video/smaterial.cpp +++ b/src/client/lua_api/video/smaterial.cpp @@ -9,7 +9,15 @@ extern "C" { using namespace irr::video; -/*This probably needs a _gc metamethod*/ +/*** +Creates a new material. +Creates a new material that can then be used on an @{iscenenode} +WARNING: this item is not currently garbage collected, be careful not to make +more smaterials than you need. +@function video.newsmaterial() +@treturn smaterial The new material +*/ +/*TODO: This probably needs a _gc metamethod*/ //newsmaterial() int newsmaterial(lua_State* L){ @@ -24,6 +32,14 @@ int newsmaterial(lua_State* L){ return 1; } +/*** +Sets a texture for this material. +Sets a texture for the material on the given index. For more information on +what each texture of a material does, see the irrlicht documentation. +@function smaterial:settexture(index,texture) +@tparam number index The index of the texture in the material +@tparam itexture texture The texture to use +*/ //setTexture(self,int_num,{ITexture texture}) int setTexture(lua_State* L){ lua_getfield(L,-1,"texture"); @@ -38,6 +54,13 @@ int setTexture(lua_State* L){ return 0; } +/*** +Sets a flag on this material. +Sets the given flag on the material +@function smaterial:setflag(flag,state) +@tparam number flag The flag to set, see @{video} for flags. +@tparam boolean state The state to set the flag in +*/ //{Material},flag,state int setFlag(lua_State* L){ int b = lua_toboolean(L,-1);//{material},flag,state @@ -52,8 +75,8 @@ int setFlag(lua_State* L){ } static const luaL_reg smaterial_m[] = { - {"setTexture", setTexture}, - {"setFlag", setFlag}, + {"settexture", setTexture}, + {"setflag", setFlag}, {0,0}, }; @@ -73,6 +96,30 @@ void smaterial_register(lua_State* L){ lua_getglobal(L,"video");//{} + /*** + A table of constants for the material class. + @field EMF_WIREFRAME - enable wireframe + @field EMF_POINTCLOUD - displays the texture as a pointcloud instead of a solid face + @field EMF_GOURAUD_SHADING + @field EMF_LIGHTING + @field EMF_ZBUFFER + @field EMF_ZWRITE_ENABLE + @field EMF_BACK_FACE_CULLING + @field EMF_FRONT_FACE_CULLING + @field EMF_BILINEAR_FILTER + @field EMF_TRILINEAR_FILTER + @field EMF_ANISOTROPIC_FILTER + @field EMF_FOG_ENABLE + @field EMF_NORMALIZE_NORMALS + @field EMF_TEXTURE_WRAP + @field EMF_ANTI_ALIASING + @field EMF_COLOR_MASK + @field EMF_COLOR_MATERIAL + @field EMF_USE_MIP_MAPS + @field EMF_BLEND_OPERATION + @field EMF_POLYGON_OFFSET + @table .video. + */ set_const(L,EMF_WIREFRAME); set_const(L,EMF_POINTCLOUD); set_const(L,EMF_GOURAUD_SHADING); -- cgit v1.2.3-70-g09d2