#ifndef _POSTCC_FXH_
#define _POSTCC_FXH_
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  PostCC effect11 by kingeric1992
//                                  Nov.4.2017
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

struct PostCCStruct {
    bool  State;
    float Weight;
    float4 Tint;
    float3 inBlack, inWhite, outBlack, outWhite;
};

//perform basic tint/leveling
float3 PostCC( float3 col, PostCCStruct IN ) {
    if(!IN.State) return col;
    col = lerp(col, dot(col, LUM_COEFF) * IN.Tint.rgb, IN.Tint.a);
    col = lerp(IN.outBlack, IN.outWhite, saturate((col - IN.inBlack) / max(IN.inWhite - IN.inBlack, DELTA)));
    return col;
}

#endif //_POSTCC_FXH_