precision highp int;
precision highp float;
 #include<OgreUnifiedShader.h>;
uniform sampler2D tex;
vec3 grad0 = vec3(238.0 / 255.0, 175.0 / 255.0, 11.0 / 255.0);
vec3 grad1 = vec3(252.0 / 255.0, 82.0 / 255.0, 0.0);
vec3 grad2 = vec3(77.0 / 255.0, 0.0, 0.0);
uniform vec4 animatedGradientColorMask;
float _getScreenGradientInterpolationT(vec2 pixelSize, float pixelRatio)
{
    vec2 screenCoords = gl_FragCoord.xy * pixelSize / pixelRatio;
    float gradientT = length(vec2(screenCoords.x, 1.0 - screenCoords.y)) / sqrt(2.0);
    return gradientT;
}
vec3 _gradientColor(float gradientT)
{
    return gradientT < 0.5 ? mix(grad0, grad1, gradientT * 2.0)
                           : mix(grad1, grad2, gradientT * 2.0 - 1.0);
}
vec3 animatedRouteGradientColor(vec3 originalColor, float gradientT)
{
    float maskDist = length(originalColor - animatedGradientColorMask.rgb);
    if (animatedGradientColorMask.a == 0.0 || maskDist > 0.2)
    {
        return originalColor;
    }
    float blend = animatedGradientColorMask.a * (1.0 - maskDist / 0.2);
    return mix(originalColor, _gradientColor(gradientT), blend);
}
varying float vGradientT;
uniform float opacityMultiplier;
uniform float opacity;
varying vec4 vHazeColor;
varying vec2 vUv;
void main()
{
    vec4 c = texture2D(tex, vUv);
    c.rgb = animatedRouteGradientColor(c.rgb, vGradientT);
    c.rgb = mix(c.rgb, vHazeColor.rgb, vHazeColor.a);
    gl_FragColor = vec4(c.rgb, c.a * opacity * opacityMultiplier);
}
