// linear sampling gaussian blur (kernel size : 9)
// from http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling

uniform sampler2DRect colorSampler;

layout(location = 0)out vec4 outColor;

uniform int width;
uniform int height;

void main(void)
{
    vec3 color = texelFetch(colorSampler, ivec2(gl_FragCoord.xy)).xyz * 0.2270270270;
#ifdef HORIZONTAL_BLUR
    color += texture(colorSampler, vec2((gl_FragCoord.x + 1.3846153846), gl_FragCoord.y)).xyz  * 0.3162162162;
    color += texture(colorSampler, vec2((gl_FragCoord.x - 1.3846153846), gl_FragCoord.y)).xyz  * 0.3162162162;
    color += texture(colorSampler, vec2((gl_FragCoord.x + 3.2307692308), gl_FragCoord.y)).xyz  * 0.0702702703;
    color += texture(colorSampler, vec2((gl_FragCoord.x - 3.2307692308), gl_FragCoord.y)).xyz  * 0.0702702703;
#else
    color += texture(colorSampler, vec2(gl_FragCoord.x, (gl_FragCoord.y + 1.3846153846))).xyz * 0.3162162162;
    color += texture(colorSampler, vec2(gl_FragCoord.x, (gl_FragCoord.y - 1.3846153846))).xyz * 0.3162162162;
    color += texture(colorSampler, vec2(gl_FragCoord.x, (gl_FragCoord.y + 3.2307692308))).xyz * 0.0702702703;
    color += texture(colorSampler, vec2(gl_FragCoord.x, (gl_FragCoord.y - 3.2307692308))).xyz * 0.0702702703;
#endif
    outColor = vec4(color, 1.0);
}