#ifndef _BORDER_FXH_
#define _BORDER_FXH_
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  Border/LetterBox effect11 by kingeric1992
//                                      Nov.4.2017
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

struct BorderStruct {
    bool   State;
    float  Weight;
    float2 TL, BR;
    float  feather; //just for fun
    float3 col;
};

float3 Border(float2 uv, float3 col,  BorderStruct IN) {
    if(!IN.State) return col;
    float2 f    = IN.feather * ScreenSize.y * 2.0;
  //         f.x *= (IN.BR.x - IN.TL.x) / (IN.BR.y - IN.TL.y) * ScreenSize.w;
    return lerp(IN.col, col, smoothstep(IN.TL.x, IN.TL.x+f.x, uv.x) *
                      (1.0 - smoothstep(IN.BR.x-f.x, IN.BR.x, uv.x))*
                             smoothstep(IN.TL.y, IN.TL.y+f.y, uv.y) *
                      (1.0 - smoothstep(IN.BR.y-f.y, IN.BR.y, uv.y)));
}

#endif //_BORDER_FXH_