//-----------------------------------------------------------------------------
// Add a constant to every pixel
//-----------------------------------------------------------------------------


float4x4 TotalMatrix;
float4 VectorFromObject; // z=value added (can be negative)
float4 TextureFactor; // object rgba
float4 VectorFromShader;

texture g_Texture0;
texture g_Texture1;

sampler2D g_Sampler0 : register(s0) =
sampler_state
{
    Texture = <g_Texture0>;
    AddressU = Clamp;
    AddressV = Clamp;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
};

sampler2D g_Sampler1 : register(s1) =
sampler_state
{
    Texture = <g_Texture1>;
    AddressU = Clamp;
    AddressV = Clamp;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
};



float4 PostProcessPS(float2 tex0 : TEXCOORD0, float2 tex1 : TEXCOORD1) : COLOR0
{
	float4 color0 = tex2D(g_Sampler0, tex0);
	float4 color1 = tex2D(g_Sampler1, tex1);
	
	color0.r += VectorFromObject.z;
	color0.g += VectorFromObject.z;
	color0.b += VectorFromObject.z;
	color0.a = 1.0;

	color0 *= TextureFactor;

	return float4(color0.r, color0.g, color0.b, 1-color1.a); // RGBA
}



technique PostProcess
{
    pass p0
    {
        VertexShader = null;
        PixelShader = compile ps_2_0 PostProcessPS();
        ZEnable = false;
    }
}
