aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/video
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2020-06-29 15:29:03 -0400
committerAlexander <alex@cogarr.net>2020-06-29 15:29:03 -0400
commit80789508b9655d25629223b9dcc84b4cfb77ce45 (patch)
tree37e140e532af61c1ca4699c8b6254cf2cb07ed02 /src/client/lua_api/video
parent44a1421c393632978d59c0698a93ae22243b97e9 (diff)
downloadbrokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.tar.gz
brokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.tar.bz2
brokengine-80789508b9655d25629223b9dcc84b4cfb77ce45.zip
Updates for mdoc
Also more tests
Diffstat (limited to 'src/client/lua_api/video')
-rw-r--r--src/client/lua_api/video/iimage.cpp29
-rw-r--r--src/client/lua_api/video/smaterial.cpp53
2 files changed, 72 insertions, 10 deletions
diff --git a/src/client/lua_api/video/iimage.cpp b/src/client/lua_api/video/iimage.cpp
index 4c7795d..3655b64 100644
--- a/src/client/lua_api/video/iimage.cpp
+++ b/src/client/lua_api/video/iimage.cpp
@@ -4,10 +4,6 @@
#include <shared/lua_api/common.hpp>
-/***
-@module video
-*/
-
using namespace irr;
using namespace video;
@@ -17,7 +13,7 @@ extern IVideoDriver* driver;
/***
Creates a new irrlicht image.
A newly created image will be fully white by default.
-@function newiimage(format, size)
+@function video.newiimage(format, size)
@tparam enum_color_format format The format for the image
@tparam vec2d size The size of the image
@treturn iimage The image
@@ -44,7 +40,7 @@ int newiimage(lua_State* L){
Creates a new irrlicht image.
Creates a new irrlicht image from a file. The format and width/height will be
taken from the image file.
-@function newiimagefromfile(path)
+@function video.newiimagefromfile(path)
@tparam string path The file path of the image file
@treturn iimage The loaded image
*/
@@ -138,7 +134,7 @@ int getiimagepixel(lua_State* L){
/***
Returns the dimensions of the image
@function iimage:getDimensions()
-@treturn vec2i dimensions The dimensions of the image
+@treturn vec2i The dimensions of the image
*/
//getdimensions({self})
int getiimagedimensions(lua_State *L){
@@ -162,10 +158,29 @@ void iimage_register(lua_State* L){
driver = device->getVideoDriver();
lua_getglobal(L,"video");//{}
+/***
+1 bit alpha, 5 bits red, blue, and green (16 bit)
+@field video.ECF_A1R5G5B5
+*/
set_const(L,ECF_A1R5G5B5);
+/***
+5 bit red, 6 bit green, 5 bit blue
+@field video.ECF_R5G6B5
+*/
set_const(L,ECF_R5G6B5);
+/***
+8 bit red, blue, green, and alpha
+@field video.ECF_A8R8G8B8
+*/
set_const(L,ECF_A8R8G8B8);
+/***
+1 channel with 16 bit floating point.
+1 channel 16 bit floating point. Uses the red channel. Floating point images may only be used for render targets.
+@field video.ECF_R16F
+@see @{render_targets}
+*/
set_const(L,ECF_R16F);
+//TODO: finish documenting these
set_const(L,ECF_G16R16F);
set_const(L,ECF_A16B16G16R16F);
set_const(L,ECF_R32F);
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);