float4x4 gWorldViewProj: WORLDVIEWPROJECTION;

float gBlurStep;

struct VsInput
{
	float4 pos    	: POSITION;
	float2 texco    : TEXCOORD0;
};
 
struct VsOutput
{
	float4 pos    	: POSITION;
	float2 texco    : TEXCOORD0;
};
 
struct PixelIn
{	
	float2 texco    : TEXCOORD0;
};
 

VsOutput mainVS( VsInput input)
{
	VsOutput output = (VsOutput)0;
	output.pos = mul( gWorldViewProj, input.pos);
	output.texco = input.texco;
	return output;
}
 
float4 xBlurPS(PixelIn input,
			  uniform sampler2D image) : COLOR0
{
	
	float4 finalColor = tex2D(image, input.texco);

	for(int i = 0; i != blurTime; ++i)
	{
		finalColor += tex2D(image, input.texco + float2(gBlurStep * (i + 1) , 0));
		finalColor += tex2D(image, input.texco + float2(-gBlurStep * (i + i), 0));
	}
	return finalColor/(2 * blurTime + 1);

}

float4 yBlurPS(PixelIn input,
			  uniform sampler2D image) : COLOR0
{
	
	float4 finalColor = tex2D(image, input.texco);

	for(int i = 0; i != blurTime; ++i)
	{
		finalColor += tex2D(image, input.texco + float2(0, gBlurStep * (i + 1)));
		finalColor += tex2D(image, input.texco + float2(0, -gBlurStep * (i + i)));
	}
	return finalColor/(2 * blurTime + 1);

}

float4 xyBlurPS(PixelIn input,
			  uniform sampler2D image) : COLOR0
{
	
	float4 finalColor = tex2D(image, input.texco);

	for(int i = 0; i != blurTime; ++i)
	{
		finalColor += tex2D(image, input.texco + gBlurStep * (i + 1));
		finalColor += tex2D(image, input.texco + -gBlurStep * (i + i));
	}
	return finalColor/(2 * blurTime + 1);

}