// Mikkel Gjøl, s971661 'at' student 'dot' dtu 'dot' dk
/////////////////////////////////////////

struct v2f {
	float4 position  : POSITION;
	float2 texcoords : TEXCOORD0;
};

/*
float4 sample3( samplerRECT tex, float2 tc ) {
	static const float w1 = 6.0/16.0;
	static const float w2 = 5.0/16.0;
	static const float w3 = w2;

	static const float offset1 = 0.0;
	static const float offset2 = ( 1.0 + 1.0/5.0);
	static const float offset3 = -offset2;

	float4 sum = float4(0, 0, 0, 0);
	
	sum += w1* texRECT( tex, tc );
	sum += w2* texRECT( tex, tc + float2(offset2, 0.0f) );
	sum += w3* texRECT( tex, tc + float2(offset3, 0.0f) );

	return sum;
}
*/


float4 sample5( samplerRECT tex, float2 tc, float2 sampledir ) {
//note: blur harder... or, well, softer... or... whatever!

	static const float w1 = 70.0/256.0;
	static const float w2 = 84.0/256.0;
	static const float w3 = w2;
	static const float w4 = 9.0/256.0;
	static const float w5 = w4;

	static const float offset1 = 0.0;
	static const float offset2 = ( 1.0 + 28.0/84.0);
	static const float offset3 = -offset2;
	static const float offset4 = ( 3.0 + 1.0/9.0);
	static const float offset5 = -offset4;

	float4 sum = float4(0,0,0,0);
	sum += w1* texRECT( tex, tc + offset1 * sampledir );
	sum += w2* texRECT( tex, tc + offset2 * sampledir );
	sum += w3* texRECT( tex, tc + offset3 * sampledir );
	sum += w4* texRECT( tex, tc + offset4 * sampledir );
	sum += w5* texRECT( tex, tc + offset5 * sampledir );

	return sum;
}




void main(	in v2f IN,
						in uniform samplerRECT difftex : TEXUNIT0,
						in uniform float2 sampledir,
						out float4 colOut : COLOR0 )
{
	colOut = sample5( difftex, IN.texcoords, sampledir );
}

