Created
November 4, 2015 22:06
-
-
Save Shell64/d6f773bdb7cc28657742 to your computer and use it in GitHub Desktop.
love 0.10.0 stencil API abstraction (like 0.9.2) for my engine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local CurrentStencil = nil | |
function Graphics.SetStencil(Stencil) | |
if Stencil then | |
Graphics.SetStencilTest(true, false) | |
Graphics.Stencil(Stencil, false) | |
CurrentStencil = Stencil | |
else | |
CurrentStencil = nil | |
Graphics.SetStencilTest(false) | |
end | |
end | |
Graphics.setStencil = Graphics.SetStencil | |
function Graphics.SetInvertedStencil(Stencil) | |
if Stencil then | |
Graphics.SetStencilTest(true, true) | |
Graphics.Stencil(Stencil, false) | |
CurrentStencil = Stencil | |
else | |
CurrentStencil = nil | |
Graphics.SetStencilTest(false) | |
end | |
end | |
Graphics.setInvertedStencil = Graphics.SetInvertedStencil | |
function Graphics.GetStencil() | |
return CurrentStencil | |
end | |
Graphics.getStencil = Graphics.GetStencil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment