mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
fixed the scanlines shader
This commit is contained in:
parent
f2b9d62efe
commit
d56b4ca660
@ -290,7 +290,6 @@ function light_world:update()
|
|||||||
love.graphics.setBlendMode("alpha")
|
love.graphics.setBlendMode("alpha")
|
||||||
end
|
end
|
||||||
|
|
||||||
print(self.optionGlow, self.isGlow)
|
|
||||||
if self.optionGlow and self.isGlow then
|
if self.optionGlow and self.isGlow then
|
||||||
-- create glow map
|
-- create glow map
|
||||||
self.glowMap:clear(0, 0, 0)
|
self.glowMap:clear(0, 0, 0)
|
||||||
|
@ -121,14 +121,13 @@ love.postshader.addEffect = function(shader, ...)
|
|||||||
love.graphics.draw(LOVE_POSTSHADER_BUFFER_RENDER)
|
love.graphics.draw(LOVE_POSTSHADER_BUFFER_RENDER)
|
||||||
elseif shader == "scanlines" then
|
elseif shader == "scanlines" then
|
||||||
-- Scanlines Shader
|
-- Scanlines Shader
|
||||||
--LOVE_POSTSHADER_SCANLINES:send("screen", {love.window.getWidth(), love.window.getHeight()})
|
LOVE_POSTSHADER_SCANLINES:send("screen", {love.window.getWidth(), love.window.getHeight()})
|
||||||
LOVE_POSTSHADER_SCANLINES:send("strength", args[1] or 2.0)
|
LOVE_POSTSHADER_SCANLINES:send("strength", args[1] or 2.0)
|
||||||
LOVE_POSTSHADER_SCANLINES:send("time", args[2] or love.timer.getTime())
|
LOVE_POSTSHADER_SCANLINES:send("time", args[2] or love.timer.getTime())
|
||||||
love.graphics.setShader(LOVE_POSTSHADER_SCANLINES)
|
love.graphics.setShader(LOVE_POSTSHADER_SCANLINES)
|
||||||
love.graphics.draw(LOVE_POSTSHADER_BUFFER_RENDER)
|
love.graphics.draw(LOVE_POSTSHADER_BUFFER_RENDER)
|
||||||
elseif shader == "tiltshift" then
|
elseif shader == "tiltshift" then
|
||||||
-- Blur Shader
|
-- Blur Shader
|
||||||
LOVE_POSTSHADER_BLURV:send("screen", {love.window.getWidth(), love.window.getHeight()})
|
|
||||||
LOVE_POSTSHADER_BLURH:send("screen", {love.window.getWidth(), love.window.getHeight()})
|
LOVE_POSTSHADER_BLURH:send("screen", {love.window.getWidth(), love.window.getHeight()})
|
||||||
LOVE_POSTSHADER_BLURV:send("steps", args[1] or 2.0)
|
LOVE_POSTSHADER_BLURV:send("steps", args[1] or 2.0)
|
||||||
LOVE_POSTSHADER_BLURH:send("steps", args[1] or 2.0)
|
LOVE_POSTSHADER_BLURH:send("steps", args[1] or 2.0)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
extern vec2 screenHeight = vec2(800.0, 600.0);
|
extern vec2 screen = vec2(800.0, 600.0);
|
||||||
extern float strength = 2.0;
|
extern float strength = 2.0;
|
||||||
extern float time = 0.0;
|
extern float time = 0.0;
|
||||||
|
|
||||||
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
|
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
|
||||||
vec2 pSize = 1.0 / screenHeight;
|
vec2 pSize = 1.0 / screen;
|
||||||
float brightness = 1.0;
|
float brightness = 1.0;
|
||||||
float offsetX = sin(texture_coords.y * 10.0 + time * strength) * pSize.x;
|
float offsetX = sin(texture_coords.y * 10.0 + time * strength) * pSize.x;
|
||||||
float corner = 500.0;
|
float corner = 500.0;
|
||||||
@ -25,9 +25,9 @@ vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 pixel_coords){
|
|||||||
float green = Texel(texture, vec2(texture_coords.x + offsetX, texture_coords.y - pSize.y * 0.5)).g;
|
float green = Texel(texture, vec2(texture_coords.x + offsetX, texture_coords.y - pSize.y * 0.5)).g;
|
||||||
float blue = Texel(texture, vec2(texture_coords.x + offsetX, texture_coords.y)).b;
|
float blue = Texel(texture, vec2(texture_coords.x + offsetX, texture_coords.y)).b;
|
||||||
|
|
||||||
if(mod(texture_coords.y * screenHeight.y, 2.0) > 0.5) {
|
if(mod(texture_coords.y * screen.y, 2.0) > 0.5) {
|
||||||
return vec4(vec3(red, green, blue) * brightness, 1.0);
|
return vec4(vec3(red, green, blue) * brightness, 1.0);
|
||||||
} else {
|
} else {
|
||||||
return vec4(vec3(red * 0.75, green * 0.75, blue * 0.75) * brightness, 1.0);
|
return vec4(vec3(red * 0.75, green * 0.75, blue * 0.75) * brightness, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user