
uniform sampler2D t1;
uniform sampler2D t2;
uniform float angle;
uniform float amount;
uniform float mix;
uniform float addOut;

void main()
{
	vec2 uv = gl_TexCoord[0].xy;
	if(amount>0.0)
	{

		vec4 c=vec4(0.0);
		float a = amount/200.0;
		float ang = angle / 3.141592654/2.0;
		float i=0.0;
		float u=0.0;
		float s = sin(angle)*a;
		float cs = cos(angle)*a;
		vec2 uv2;
		
		float count=0.0;
		for(i=-5.0;i<5.0;i++)
		{
			uv2 = uv+vec2(s*i,cs*i);
			if(uv2.x > 0.001 && uv2.x < 0.999 && uv2.y > 0.001 && uv2.y < 0.999) {
				c=c+texture2D(t1, uv2);
				count++;
			}
		}
		c=c/vec4(count);
		gl_FragColor = c*vec4(mix+addOut) +texture2D(t2,uv)*vec4(1.0-mix);
	}
	else
		gl_FragColor = texture2D(t1,uv);
}
