// force vc7 to group all shader related stuff into the Shader namespace
#ifdef WIN32
namespace Shader {
#endif

  // define inputs from vertex program
  struct in_fragment
  {
    float4 texCoord0 : TEXCOORD0;
  };

  // define outputs from fragment program
  struct out_fragment
  {
    float4 color : COLOR0;
  };

  // fragment program
  out_fragment main(
		    // varying parameters
		    in_fragment f_in,

		    // uniform samplers (textures)
		    uniform sampler2D   diffuseMap  : TEXUNIT0
		    )
  {
    out_fragment f_out;

#define PIXEL_SIZE 1.0/192.0
#define _3OFF PIXEL_SIZE*3
#define _2OFF PIXEL_SIZE*2
#define _1OFF PIXEL_SIZE

#define _3OFF_CONTRIB 0.075
#define _2OFF_CONTRIB 0.125
#define _1OFF_CONTRIB 0.175
#define _0OFF_CONTRIB 0.25

    float2 usedTexCoords = f_in.texCoord0.xy;

    f_out.color  = tex2D(diffuseMap, f_in.texCoord0.xy) * _0OFF_CONTRIB;
    
    // 3 pixels left
    usedTexCoords.x = f_in.texCoord0.x - _3OFF;
    f_out.color += tex2D(diffuseMap, usedTexCoords) * _3OFF_CONTRIB;

    // 2 pixels left
    usedTexCoords.x = f_in.texCoord0.x - _2OFF;
    f_out.color += tex2D(diffuseMap, usedTexCoords) * _2OFF_CONTRIB;

    // 1 pixels left
    usedTexCoords.x = f_in.texCoord0.x - _1OFF;
    f_out.color += tex2D(diffuseMap, usedTexCoords) * _1OFF_CONTRIB;

    // 1 pixels right
    usedTexCoords.x = f_in.texCoord0.x + _1OFF;
    f_out.color += tex2D(diffuseMap, usedTexCoords) * _1OFF_CONTRIB;

    // 2 pixels right
    usedTexCoords.x = f_in.texCoord0.x + _2OFF;
    f_out.color += tex2D(diffuseMap, usedTexCoords) * _2OFF_CONTRIB;

    // 3 pixels right
    //usedTexCoords.x = f_in.texCoord0.x + _3OFF;
    //f_out.color += tex2D(diffuseMap, usedTexCoords) * _3OFF_CONTRIB;
    
    //f_out.color.r = 1.0;
    return f_out;
  }
#ifdef WIN32
}
#endif

