-
Notifications
You must be signed in to change notification settings - Fork 0
chainshaders.lua
chainshaders.lua lets you use two or more shaders at once. Can also be used to apply shaders as post processing effect.
chain = require "grove.chainshaders"
otherChain = nil
image = love.graphics.newImage("image.png")
--Shaders
ctr = love.graphics.newShader("shaders/ctr.shader")
dessaturate = love.graphics.newShader("shaders/dessaturate.shader")
boxblur = love.graphics.newShader("shaders/boxblur.shader")
filmgrain = love.graphics.newShader("shaders/filmgrain.shader")
function love.load()
chain.append(crt)
--Creating other instances
otherChain = chain()
end
function love.draw()
chain.start(dessaturate)
love.graphics.setColor(1,0,0)
love.graphics.circle("fill", 100, 100, 50, 5)
--Nested chain
otherChain:start(boxblur, filmgrain)
love.graphics.setColor(1,1,1)
love.graphics.draw(image, 200, 100)
otherChain:stop()
chain.stop()
end
Start applying shaders.
...
(shaders): Shaders to be applied.
Stop applying shaders and draw the results to screen.
Appends one or more shaders. These will aways be applied before the shaders passed to chain.start().
...
(shaders): Shaders to be appended.
Remove specified appended shaders.
...
(shaders): Shaders to be removed.
Remove all appended shaders.
Resize the effective area.
width
(number): The width of the area. Defaults to love.graphics.getWidth().
heigh
(number): The height of the area. Defaults to love.graphics.getHeight().
Create another chain instance. Remember to call the functions with the
:
operator. Ex:instance:start()
.
width
(number): The width of the area. Defaults to love.graphics.getWidth().
heigh
(number): The height of the area. Defaults to love.graphics.getHeight().