-
Notifications
You must be signed in to change notification settings - Fork 0
/
shaders.lua
53 lines (42 loc) · 1.54 KB
/
shaders.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- GLSL shaders
-- http://blogs.love2d.org/content/beginners-guide-shaders
shaders = {}
--This is an obstacle warning
red_shader = love.graphics.newShader[[
// Makes screen red between y_min and y_max
extern number y_min;
extern number y_max;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
vec4 pixel = Texel(texture, texture_coords );//This is the current pixel color
if (texture_coords.y > y_min && texture_coords.y < y_max) {
pixel.r = pixel.r + 0.60;
}
return pixel;
}
]]
-- Add this to ufos when they die
death_shader = love.graphics.newShader[[
extern float saturation;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
vec4 pixel = Texel(texture, texture_coords ); //This is the current pixel color
pixel.r = pixel.r + saturation;
return pixel;
}
]]
-- Adjust transparency
fade_shader = love.graphics.newShader[[
extern float saturation;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
vec4 pixel = Texel(texture, texture_coords );//This is the current pixel color
pixel.a = pixel.a - saturation;
return pixel;
}
]]
melee_shader = love.graphics.newShader[[
extern float saturation;
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
vec4 pixel = Texel(texture, texture_coords ); //This is the current pixel color
pixel.r = 255;
return pixel;
}
]]