diff options
| author | Alexander <alex@cogarr.net> | 2020-06-29 15:29:03 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2020-06-29 15:29:03 -0400 |
| commit | 80789508b9655d25629223b9dcc84b4cfb77ce45 (patch) | |
| tree | 37e140e532af61c1ca4699c8b6254cf2cb07ed02 /src/client/lua_api/video/smaterial.cpp | |
| parent | 44a1421c393632978d59c0698a93ae22243b97e9 (diff) | |
| download | brokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.tar.gz brokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.tar.bz2 brokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.zip | |
Updates for mdoc
Also more tests
Diffstat (limited to 'src/client/lua_api/video/smaterial.cpp')
| -rw-r--r-- | src/client/lua_api/video/smaterial.cpp | 53 |
1 files changed, 50 insertions, 3 deletions
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); |
