player done, old way

This commit is contained in:
0x81c 2015-03-15 15:34:17 -04:00
parent 687939b269
commit 1156564fa2
4 changed files with 184 additions and 103 deletions

View file

@ -29,3 +29,32 @@ wiggle = love.graphics.newShader[[
*/
}
]]
glow = love.graphics.newShader[[
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
vec4 pixel_me = Texel(texture, texture_coords );
if (pixel_me.rgb != vec3(0,0,0))
return pixel_me;
int samples = 5;
float intensity = 60;
float radius = .1;
for (int i = 1; i < samples; i++ ) {
vec4 pixel_left = Texel(texture, texture_coords + vec2(-radius * i, 0));
vec4 pixel_right = Texel(texture, texture_coords + vec2(radius * i, 0));
vec4 pixel_top = Texel(texture, texture_coords + vec2(0, radius * i));
vec4 pixel_bottom = Texel(texture, texture_coords + vec2(0, -radius * i));
vec4 pixel_top_left = Texel(texture, texture_coords + vec2(-radius * i, radius * i));
vec4 pixel_top_right = Texel(texture, texture_coords + vec2(radius * i, radius * i));
vec4 pixel_bottom_left = Texel(texture, texture_coords + vec2(-radius * i, -radius * i));
vec4 pixel_bottom_right = Texel(texture, texture_coords + vec2(radius * i, -radius * i));
pixel_me += (pixel_left + pixel_right + pixel_top + pixel_bottom + pixel_bottom_right + pixel_bottom_left + pixel_top_right + pixel_top_left) / (intensity * i);
intensity -= 2.5;
}
return pixel_me;
}
]]