/* COMPATIBILITY 
   - HLSL compilers
   - Cg   compilers
*/

#pragma parameter SHARPEN_FACTOR     "Sharpen Factor"           1.0 1.0 50.0 1.0

#ifdef PARAMETER_UNIFORM
uniform float SHARPEN_FACTOR;
#else
#define SHARPEN_FACTOR 30.0
#endif

void main_vertex
(
	float4 position	: POSITION,
	float4 color	: COLOR,
	float2 texCoord : TEXCOORD0,

	uniform float4x4 modelViewProj,

	out float4 oPosition : POSITION,
	out float4 oColor    : COLOR,
	out float2 otexCoord : TEXCOORD
)
{
	oPosition = mul(modelViewProj, position);
	oColor = color;
	otexCoord = texCoord;
}

struct input
{
  float2 video_size;
  float2 texture_size;
  float2 output_size;
  float frame_count;
  float frame_direction;
  float frame_rotation;
};

#ifndef HLSL_4
struct output 
{
  float4 color : COLOR;
};
#endif

output main_fragment( in float2 Tex : TEXCOORD0, uniform input IN, uniform sampler2D s0 : TEXUNIT0 )
{
   float4 Color = tex2D( s0, Tex.xy );

   Color -= tex2D( s0, Tex.xy+0.0001) * SHARPEN_FACTOR;
   Color += tex2D( s0, Tex.xy-0.0001) * SHARPEN_FACTOR;

   Color.a = 1.0;
#ifdef HLSL_4
    return Color;
#else
	output OUT;
	OUT.color = Color;
	return OUT;
#endif
}
