mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Added love.graphics.clearStencil, which only clears the stencil buffer.
--HG-- branch : minor
This commit is contained in:
@@ -575,6 +575,11 @@ void Graphics::getStencilTest(bool &enable, bool &invert)
|
|||||||
invert = state.stencilInvert;
|
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)
|
Image *Graphics::newImage(love::image::ImageData *data, const Image::Flags &flags)
|
||||||
{
|
{
|
||||||
// Create the image.
|
// Create the image.
|
||||||
|
|||||||
@@ -138,6 +138,11 @@ public:
|
|||||||
void setStencilTest(bool enable, bool invert);
|
void setStencilTest(bool enable, bool invert);
|
||||||
void getStencilTest(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.
|
* Creates an Image object with padding and/or optimization.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -166,6 +166,12 @@ int w_getStencilTest(lua_State *L)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_clearStencil(lua_State* /*L*/)
|
||||||
|
{
|
||||||
|
instance()->clearStencil();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *imageFlagName(Image::FlagType flagtype)
|
static const char *imageFlagName(Image::FlagType flagtype)
|
||||||
{
|
{
|
||||||
const char *name = nullptr;
|
const char *name = nullptr;
|
||||||
@@ -1531,6 +1537,7 @@ static const luaL_Reg functions[] =
|
|||||||
{ "stencil", w_stencil },
|
{ "stencil", w_stencil },
|
||||||
{ "setStencilTest", w_setStencilTest },
|
{ "setStencilTest", w_setStencilTest },
|
||||||
{ "getStencilTest", w_getStencilTest },
|
{ "getStencilTest", w_getStencilTest },
|
||||||
|
{ "clearStencil", w_clearStencil },
|
||||||
|
|
||||||
{ "point", w_point },
|
{ "point", w_point },
|
||||||
{ "line", w_line },
|
{ "line", w_line },
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ int w_getScissor(lua_State *L);
|
|||||||
int w_stencil(lua_State *L);
|
int w_stencil(lua_State *L);
|
||||||
int w_setStencilTest(lua_State *L);
|
int w_setStencilTest(lua_State *L);
|
||||||
int w_getStencilTest(lua_State *L);
|
int w_getStencilTest(lua_State *L);
|
||||||
|
int w_clearStencil(lua_State *L);
|
||||||
int w_newImage(lua_State *L);
|
int w_newImage(lua_State *L);
|
||||||
int w_newQuad(lua_State *L);
|
int w_newQuad(lua_State *L);
|
||||||
int w_newFont(lua_State *L);
|
int w_newFont(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user