mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Move current love.graphics.setStencilMode functionality to setStencilState.
Add new higher level love.graphics.setStencilMode function.
- Add love.graphics.setStencilMode(mode [, value = 1])
- Add love.graphics.setStencilMode().
- Add mode, value = love.graphics.getStencilMode().
The possible modes are "off" (same as no parameters), "draw", and "test".
The "draw" mode disables color writes and sets the stencil state to ("replace", "always") using the given value.
The "test" mode enables color writes and sets the stencil state to ("keep", "equal") using the given value to compare to.
This commit is contained in:
@@ -1434,7 +1434,7 @@ void Graphics::setScissor()
|
||||
gl.setEnableState(OpenGL::ENABLE_SCISSOR_TEST, false);
|
||||
}
|
||||
|
||||
void Graphics::setStencilMode(StencilAction action, CompareMode compare, int value, uint32 readmask, uint32 writemask)
|
||||
void Graphics::setStencilState(StencilAction action, CompareMode compare, int value, uint32 readmask, uint32 writemask)
|
||||
{
|
||||
DisplayState &state = states.back();
|
||||
|
||||
@@ -1493,7 +1493,7 @@ void Graphics::setStencilMode(StencilAction action, CompareMode compare, int val
|
||||
* example, if the compare function is GREATER then the stencil test will
|
||||
* pass if the reference value is greater than the value in the stencil
|
||||
* buffer. With our API it's more intuitive to assume that
|
||||
* setStencilMode(STENCIL_KEEP, COMPARE_GREATER, 4) will make it pass if the
|
||||
* setStencilState(STENCIL_KEEP, COMPARE_GREATER, 4) will make it pass if the
|
||||
* stencil buffer has a value greater than 4.
|
||||
**/
|
||||
GLenum glcompare = OpenGL::getGLCompareMode(getReversedCompareMode(compare));
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
void setScissor(const Rect &rect) override;
|
||||
void setScissor() override;
|
||||
|
||||
void setStencilMode(StencilAction action, CompareMode compare, int value, uint32 readmask, uint32 writemask) override;
|
||||
void setStencilState(StencilAction action, CompareMode compare, int value, uint32 readmask, uint32 writemask) override;
|
||||
|
||||
void setDepthMode(CompareMode compare, bool write) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user