varying vec2 v_texCoord;
varying vec4 v_fragmentColor;
// 露光時間比
const float exp_rate = 0.8;
// 露光遅延
const float exp_delay = 0.3;
// サンプル数
const int samples = 32;

// v 方向の n 画素の色の平均を求める
vec4 average(in vec2 v, in int n)
{
    vec4 c = vec4(0.0);
    for (int i = 0; i < n; ++i){
        c += texture2D(CC_Texture0, v_texCoord + v * (float(i) / float(n) * exp_rate - exp_delay));
    }
    return c / float(n);
}

void main()
{
    vec4 v = texture2D(CC_Texture0, v_texCoord);
    gl_FragColor = average(vec2(0.07, 0.0), samples);
}
