//
struct VS_IN
{
    float4 position : POSITION;
    float2 tex_coord : TEXCOORD0;
};

struct VS_OUT
{
    float4 position : SV_Position;
    float2 tex_coord : TEXCOORD0;
};

VS_OUT vs_main(VS_IN IN)
{
    VS_OUT OUT;
    OUT.position = IN.position;
    OUT.tex_coord = IN.tex_coord;
    return OUT;
};

Texture2D<float4> scene_texture : register(t0);
Texture2D<float3> blured_texture : register(t1);
float3 glare_intensity : register(c0);
sampler tex_samp : register(s0);

float4 ps_main(VS_OUT IN) : SV_Target
{
    float4 color = scene_texture.Sample(tex_samp, IN.tex_coord);
    float3 glare_color = blured_texture.Sample(tex_samp, IN.tex_coord);
    float3 final_color = color.xyz + glare_color*glare_intensity;
//    if(IN.tex_coord.x > 0.5)
//        final_color = blured_texture.Sample(tex_samp, float2(IN.tex_coord.x-0.5, IN.tex_coord.y))*glare_intensity;

    return float4(saturate(final_color), color.w);
};
