uniform sampler2D t1;
uniform float xCenter;
uniform float yCenter;
uniform float xScale;
uniform float yScale;
uniform float radius;
uniform float origPercent; 
uniform float newAddPercent; 
uniform float r,g,b,a;
uniform int samples;
void main()
{
	vec2 uv = gl_TexCoord[0].xy;
	vec4 col = texture2D(t1,uv);
	int i=0;
	//int samples = 16;
	vec2 uv2 = uv;
	vec4 c = vec4(0);
	vec2 sc = vec2(1.0+xScale,1.0+yScale);
	vec2 tvec = vec2(xCenter - uv.x + 0.5f,yCenter-uv.y + 0.5f)*vec2(radius);
	vec4 newCol = vec4(0);
	float len = 0.0f;
	float olen = length(col.rgb* vec3(origPercent));

	vec4 newc = vec4(0);
	for( i=0; i < 24; i++)
	{
		if(i <= samples) {
			
			uv2 = uv+vec2(float(i)/28.0)*tvec*sc;
			newc *= vec4(1.0-a);
			newc +=  texture2D(t1,uv2).rgba*vec4(a);
			c += newc*vec4(r,g,b,1);
		}
	}
	c = c/ vec4(i);

	
	vec4 finalCol = col * vec4(origPercent) + c*vec4(newAddPercent);
	gl_FragColor = finalCol;

}

