//
// You are free to use this code in part or whole in any way you seem fit!
// If you find this code useful we would to know how,
// you can find us at www.spellofplay.com feel free to drop by!
//

float g_resolutionX : editable;
float g_resolutionY : editable;



struct PERPIXEL_VS_OUTPUT { 
	float4 m_pos   : POSITION;
	float4 m_color	: COLOR0;
};

PERPIXEL_VS_OUTPUT PerPixel_VS_Main(float4 a_pos  : POSITION,  float2 a_trans : TEXCOORD0, float3 a_scaleRot : TEXCOORD1, float2 a_uv : TEXCOORD2, float4 a_color : COLOR0) {
   PERPIXEL_VS_OUTPUT Out = (PERPIXEL_VS_OUTPUT) 0; 
   
    // transform to normalized space
    Out.m_pos.x = a_pos.x / (g_resolutionX * 0.5f) - 1.0f;
    Out.m_pos.y = 1.0 - (a_pos.y / (g_resolutionY * 0.5f));
    
    Out.m_pos.z = 0.0f;
    Out.m_pos.w = 1.0f;
    Out.m_color.r = a_color.b;
    Out.m_color.g = a_color.g;
    Out.m_color.b = a_color.r;
    Out.m_color.a = a_color.a;
    
    return Out;
}

float4 PerPixel_PS_Main(float4 a_color : COLOR0) : COLOR {
   return a_color;
}

technique PerPixel {

   pass Single_Pass {
   	ZFunc = ALWAYS;
   	ZEnable = FALSE;
   	ZWriteEnable = FALSE;
      SrcBlend = ONE;
      DestBlend = ZERO;
      FogEnable = FALSE;
      Lighting = FALSE;
      AlphaBlendEnable = TRUE;
      CullMode = NONE;
      VertexShader = NULL;
      VertexShader = compile vs_1_1 PerPixel_VS_Main();
      PixelShader = compile ps_2_0 PerPixel_PS_Main();
   }
}


