varying vec2 		texcoord;

uniform vec4		ofs1;
uniform vec4		ofs2;
uniform sampler2D 	tex;

uniform float 		scale;
vec4 				color5=vec4(0.0,0.0,0.0,0.0),
					color6=vec4(0.0,0.0,0.0,0.0);
vec4 				one=vec4(1.0,1.0,1.0,1.0);
//vec4 				zero=vec4(0.0,0.0,0.0,0.0);
vec4 				colorMul;
void main()
{
	int i;
	float t=scale*2.0;
	
	vec4 	sample1;
	sample1.xy=texcoord.xy;
	sample1.zw=texcoord.xy;	
	
	vec4 ofs;
	ofs.xy=ofs1.zw;
	ofs.zw=ofs2.zw;
	
	for(i=0; i<25; i++)
	{
		colorMul=step(0.0,sample1)*(one-step(1.0,sample1));
		color5 += texture2D(tex, sample1.xy)*t*colorMul.x;
		color6 += texture2D(tex, sample1.zw)*t*colorMul.z;
		sample1+=ofs;
		t*=0.95;
	}

	vec4 res=color5+color6;
	gl_FragColor.xyz = max(vec3(0.0),res.xyz*scale);
}
