uniform sampler2D tex0;
uniform float amount;
uniform vec2 size;

void main(void)
{
	float step = 1.0 / (size.x);

	vec4 texel, color = vec4(0.0);
	int i;
	float w, sum = 0.0;

	if (amount == 0)
	{
		color = texture2D(tex0, gl_TexCoord[0].st);
		sum = 1.0;
	}
	else
	{
		float iAmount = (amount) + 1.0;
		for (i = -iAmount; i <= iAmount; i++)
		{
			texel = texture2D(tex0, gl_TexCoord[0].st + vec2(i * step, 0.0));	
			w = exp(-pow(i / amount * 1.5, 2.0));
			//w = 1.0;	
			color += texel * w;	
			sum += w;
		}
	}

	gl_FragData[0] = color / sum;
	//gl_FragData[0] = vec4(1.0, 0.3, 1.0, color.a / sum);
}


