//-----------------------------------------------------------------------------
// File: op_invert.fx
//
// Desc: Effect file for image post-processing sample.  This effect contains
//       a single technique with a pixel shader that inverts the colors.
//-----------------------------------------------------------------------------


float4x4 TotalMatrix;
float4 VectorFromObject; // y=pixel_height (1 / viewport_height), z=blur factor 
float4 TextureFactor; // object rgba
float4 VectorFromShader;


texture g_Texture0;

sampler2D g_samSrcColor =
sampler_state
{
    Texture = <g_Texture0>;
    AddressU = Clamp;
    AddressV = Clamp;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
};


//-----------------------------------------------------------------------------
// Pixel Shader: PostProcessPS
// Desc: Performs post-processing effect that inverts the image
//-----------------------------------------------------------------------------

float4 PostProcessPS(float2 tex : TEXCOORD0) : COLOR0
{
    float4 c = 1.0f - tex2D(g_samSrcColor, tex);
    c = c * TextureFactor;
    return float4(c.r, c.g, c.b, TextureFactor.a); // RGBA
}




//-----------------------------------------------------------------------------
// Technique: PostProcess
// Desc: Performs post-processing effect that inverts the image
//-----------------------------------------------------------------------------
technique PostProcess
{
    pass p0
    {
        VertexShader = null;
        PixelShader = compile ps_2_0 PostProcessPS();
        ZEnable = false;
    }
}
