#pragma parameter height "CocktailTable Image Height" -1.145 -3.0 3.0 0.01
#pragma parameter width "CocktailTable Image Width" 2.0 1.0 5.0 0.05
#pragma parameter location "CocktailTable Image Location" 0.75 -2.0 2.0 0.005

#ifdef PARAMETER_UNIFORM
uniform float height;
uniform float width;
uniform float location;
#else
#define height -1.145
#define width 2.0
#define location 0.75
#endif

/* COMPATIBILITY 
   - HLSL compilers
   - Cg   compilers
*/

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

void main_vertex
(
   float4 position   : POSITION,
   float4 color   : COLOR,
   float2 texCoord1 : TEXCOORD0,
   float2 texCoord2 : TEXCOORD1,

    uniform float4x4 modelViewProj,
   uniform input IN,

   out float4 oPosition : POSITION,
   out float4 oColor    : COLOR,
   out float2 otexCoord1 : TEXCOORD0,
   out float2 otexCoord2 : TEXCOORD1
)
{
   float4x4 RotationMatrix = float4x4( height, 0.0, 0.0, 0.0,
         0.0, width, 0.0, 0.0,
         0.0, 0.0, 1.0, 0.0,
         0.0, 0.0, 0.0, 1.0 );

   oPosition = mul(mul(modelViewProj, position), RotationMatrix);
   oColor = color;
   otexCoord1 = mul(position.st , float2x2(0.0, 1.0, -1.0, 0.0)) + float2(location, -0.500);
   otexCoord2 = -1.0 * (mul(position.st , float2x2(0.0, 1.0, -1.0, 0.0)) + float2((1.0 - location), -0.500));
}

struct output 
{
   float4 color    : COLOR;
};

float4 main_fragment(float2 texCoord1 : TEXCOORD0, float2 texCoord2 : TEXCOORD1, in sampler2D s0 : TEXUNIT0, uniform input IN) : COLOR
{
   float4 color = float4(tex2D(s0, texCoord1) + tex2D(s0, texCoord2));
   return color;
}
