
in vec2 uv;
in vec2 uvn;

out vec4 C;

uniform int input_tex;
uniform vec2* blur_coeffs;
uniform int pass;
uniform int iters;

void main() {
    vec2 u = uvn;
    
    vec3 col = vec3(0);
    
    vec2 size = textureSize(textures[input_tex], 0);
    vec2 blurDirection = vec2(0);
    blurDirection[pass] = 1;
    
    for (int i = 0; i < iters; i++) {
        vec2 offs_weight = blur_coeffs[i];
        vec2 offset = blurDirection * offs_weight.x / size;
        float weight = offs_weight.y;
        col += texture(textures[input_tex], u + offset).rgb * weight;
    }
//    return result;

//    col = u.xyx;
    col = max(col,0.);
//    col = min(col, 0.4);
//    vec2 targetRes = textureSize(textures[input_tex], 0).xy;
    C.rgb = col;
    C.w = 1.0;
}
