mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +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:
@@ -83,6 +83,15 @@ enum BlendOperation
|
||||
BLENDOP_MAX_ENUM
|
||||
};
|
||||
|
||||
enum StencilMode // High level wrappers.
|
||||
{
|
||||
STENCIL_MODE_OFF,
|
||||
STENCIL_MODE_DRAW,
|
||||
STENCIL_MODE_TEST,
|
||||
STENCIL_MODE_CUSTOM,
|
||||
STENCIL_MODE_MAX_ENUM
|
||||
};
|
||||
|
||||
enum StencilAction
|
||||
{
|
||||
STENCIL_KEEP,
|
||||
@@ -194,6 +203,9 @@ BlendState computeBlendState(BlendMode mode, BlendAlpha alphamode);
|
||||
BlendMode computeBlendMode(BlendState s, BlendAlpha &alphamode);
|
||||
bool isAlphaMultiplyBlendSupported(BlendMode mode);
|
||||
|
||||
StencilState computeStencilState(StencilMode mode, int value);
|
||||
StencilMode computeStencilMode(const StencilState &s);
|
||||
|
||||
/**
|
||||
* GPU APIs do the comparison in the opposite way of what makes sense for some
|
||||
* of love's APIs. For example in OpenGL if the compare function is GL_GREATER,
|
||||
@@ -208,6 +220,7 @@ STRINGMAP_DECLARE(BlendMode);
|
||||
STRINGMAP_DECLARE(BlendAlpha);
|
||||
STRINGMAP_DECLARE(BlendFactor);
|
||||
STRINGMAP_DECLARE(BlendOperation);
|
||||
STRINGMAP_DECLARE(StencilMode);
|
||||
STRINGMAP_DECLARE(StencilAction);
|
||||
STRINGMAP_DECLARE(CompareMode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user