
typedef struct
{
    float notUsed;
} subFXVars;

cbuffer variableBuffer : register(b3)
{
    subFXVars subVars;
}

float4 backgroundEffectCore(float4 objectColor, float4 backgroundColor)
{
    float4 invertedBackgroundColor = float4(1.0, 1.0, 1.0, 1.0);
    invertedBackgroundColor.rgb -= backgroundColor.rgb;

    float4 outColor = mix(invertedBackgroundColor, backgroundColor, 1.0 - objectColor.a);

    outColor *= objectColor.a;

    return outColor;
}

float4 backgroundEffect(float4 objectColor,
                        Texture2D blurredBackgroundTexture,
                        Texture2D backgroundTexture,
                        float2 screenPosition,
                        const txShaderUniforms u,
                        const subFXVars vars)
{
    float4 backgroundColor = float4(backgroundTexture.Sample(linearSampler, screenPosition * u.uvScale + u.uvOffset));
    return backgroundEffectCore(objectColor, backgroundColor);
}

