// SotN Widescreenfix 
// only crop SotN to widescreen
// This shuld only a template for other SotN-Shaders
// The Fragmentshader doe  no changes
// Only Vertexshader (this file) changes the hight of the output 

uniform vec4 OGL2Param;


void main()
{

 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex ;
 gl_TexCoord[0] = gl_MultiTexCoord0;
 
//Shaderlevel 1:
//Use at Widescreen and OGL2 Strechingmode :0 (Stretch to full windowsize)
//strech the hight and shifted slightly upwards the Picture 
//the black bars at top and bottom are croped
//the width is scaled to games 5:4 aspectratio (an relict of the NES)
 
 if(OGL2Param.z==0.0)
  {

   gl_Position.y = gl_Position.y*  1.155 +0.04;
   gl_Position.x = gl_Position.x/ (1.155* 5/4) ;
  }

//Shaderlevel 2:
//Use at Widescreen and OGL2 Strechingmode :0 (Stretch to full windowsize)
//strech the hight and shifted slightly upwards the Picture 
//the black bars at top and bottom are croped
//the width is stupid scaled to 4:3 

 if(OGL2Param.z==1.0)
  {
   gl_Position.y = gl_Position.y* 1.155 +0.04;
   gl_Position.x = gl_Position.x/1.333 ;
  }

 //Shaderlevel 1:
 //Use at Widescreen and OGL2 Strechingmode :0 (Stretch to full windowsize)
 //strech the hight and shifted slightly upwards the Picture 
 //only the black bars at top and bottom are croped
 // the width is untouched
 
 if(OGL2Param.z==2.0)
  {
   gl_Position.y = gl_Position.y*1.155+0.04;
  }

 //Shaderlevel 3:
 //Use at Widescreen and OGL2 Strechingmode :1 (Scale to windowsize, keep aspect ratio)
 //don't use at Widescreen and OGL2 Strechingmode :0 (Sretch to full windowsize),
 //it will overstrech the output width!
 //
 //strech the hight and shifted slightly upwards the Picture 
 //only the black bars at top and bottom are croped
 // the width is streched by the same factor as the hight to keep the aspectratio
  if(OGL2Param.z==3.0)
  {
   gl_Position.y = gl_Position.y*1.155+ 0.04;
   gl_Position.x = gl_Position*1.155 ;
  }



}   
  


