// Basic HLSL shader
// Author : BlooV
// Date : 15.08.2011
//

float4x4 VPM    : register(c0);

// Vertex shader code
struct appdata {
       float4 Position : POSITION;
       float2 UV       : TEXCOORD0;
       float3 Normal   : NORMAL;
       float3 Tangent  : TANGENT;
       float3 Binormal : BINORMAL;
};

struct vertexOutput {
  float4	Position : POSITION;
  float2	TexCoord : TEXCOORD0;
};

vertexOutput std_VS(appdata Input){
  vertexOutput Output = (vertexOutput)0;
  Output.Position = mul(VPM, Input.Position);
  Output.TexCoord = Input.UV;
  return Output;
}

// Pixel shader code
sampler2D DiffuseMap  : register( s0 );
float4x4  pixelOffset : register( c1 );

float4 std_PS(vertexOutput Input) : COLOR {
	float4 blurSample = 0.0;
	float2 offPix;
	
	offPix.y    = Input.TexCoord.y;
	offPix.x    = Input.TexCoord.x + pixelOffset._11;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.002216;
	offPix.x    = Input.TexCoord.x + pixelOffset._12;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.008764;
	offPix.x    = Input.TexCoord.x + pixelOffset._13;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.026995;
	offPix.x    = Input.TexCoord.x + pixelOffset._14;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.064759;
	offPix.x    = Input.TexCoord.x + pixelOffset._21;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.120985;
	offPix.x    = Input.TexCoord.x + pixelOffset._22;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.176033;
	blurSample += tex2D( DiffuseMap, Input.TexCoord ) * 0.199471;
	offPix.x    = Input.TexCoord.x + pixelOffset._23;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.176033;
	offPix.x    = Input.TexCoord.x + pixelOffset._24;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.120985;
	offPix.x    = Input.TexCoord.x + pixelOffset._31;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.064759;
	offPix.x    = Input.TexCoord.x + pixelOffset._32;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.026995;
	offPix.x    = Input.TexCoord.x + pixelOffset._33;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.008764;
	offPix.x    = Input.TexCoord.x + pixelOffset._34;
	blurSample += tex2D( DiffuseMap, offPix ) * 0.002216;

	return blurSample;
}

// Compiler directives
technique main
{
  pass Pass0
  {
    VertexShader = compile vs_2_0 std_VS();
    PixelShader = compile ps_2_0 std_PS();
  }
};
