Added love.graphics.clearStencil, which only clears the stencil buffer.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2015-02-27 03:58:40 -04:00
parent 3efcf3901b
commit 1326ae9a5d
4 changed files with 18 additions and 0 deletions
+5
View File
@@ -575,6 +575,11 @@ void Graphics::getStencilTest(bool &enable, bool &invert)
invert = state.stencilInvert;
}
void Graphics::clearStencil()
{
glClear(GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
Image *Graphics::newImage(love::image::ImageData *data, const Image::Flags &flags)
{
// Create the image.
+5
View File
@@ -138,6 +138,11 @@ public:
void setStencilTest(bool enable, bool invert);
void getStencilTest(bool &enable, bool &invert);
/**
* Clear the stencil buffer in the active Canvas(es.)
**/
void clearStencil();
/**
* Creates an Image object with padding and/or optimization.
**/
@@ -166,6 +166,12 @@ int w_getStencilTest(lua_State *L)
return 2;
}
int w_clearStencil(lua_State* /*L*/)
{
instance()->clearStencil();
return 0;
}
static const char *imageFlagName(Image::FlagType flagtype)
{
const char *name = nullptr;
@@ -1531,6 +1537,7 @@ static const luaL_Reg functions[] =
{ "stencil", w_stencil },
{ "setStencilTest", w_setStencilTest },
{ "getStencilTest", w_getStencilTest },
{ "clearStencil", w_clearStencil },
{ "point", w_point },
{ "line", w_line },
@@ -53,6 +53,7 @@ int w_getScissor(lua_State *L);
int w_stencil(lua_State *L);
int w_setStencilTest(lua_State *L);
int w_getStencilTest(lua_State *L);
int w_clearStencil(lua_State *L);
int w_newImage(lua_State *L);
int w_newQuad(lua_State *L);
int w_newFont(lua_State *L);