varying vec2 texCoord;

uniform sampler2D colorMap1;
uniform sampler2D colorMap2;

uniform vec4 glColor;
uniform float testvalue;
uniform int pass;


void main (void)
{




	vec4 blur=vec4(0,0,0,0);
	const float bxsize=1.0/1920.0*5.0*4;
	const float bxstep=1.0/1920.0*1.0*4;
	const float bysize=1.0/1080.0*5.0*4;
	const float bystep=1.0/1080.0*1.0*4;
	float divider=5.0*2.0*5.0*2.0/(1.0*1.0);
	
	for (float x=-bxsize; x<bxsize; x+=bxstep){
		for (float y=-bysize; y<bysize; y+=bystep){
		
			blur+=texture2D(colorMap2, clamp(texCoord+vec2(x,y),1.0/1080.0,1.0-1.0/1080.0));
			
		}
	}
	blur/=divider*0.9;
	float b1=pow(blur.x,1.015+(1.0-0.985));
	float b2=pow(blur.y,1.015+(1.0-0.980));
	float b3=pow(blur.z,1.015+(1.0-0.975));
	blur=vec4(b1,b2,b3,1);

	if (false)
	if (pass!=0)
	{
		float dim=0.66*(1.0-0.05)*1.33;
		if (blur.r>dim) blur=vec4(dim,dim,dim,1);
	}

	if (pass==0)
		gl_FragColor = blur;
	else
		gl_FragColor = texture2D(colorMap1, texCoord)+blur*0.5;
	
	
}
