#include "version.sh"

in mediump vec2 uv_f;

uniform sampler2D texUnit_ColorGradient;
uniform sampler2D texUnit;

uniform mediump float heatLowToHigh;
uniform mediump float oneMinusHeatLowToHighInv;
uniform mediump float opacity;

void main ()
{
	mediump float alpha = texture(texUnit, uv_f).r;
    alpha -= heatLowToHigh;
    alpha *= oneMinusHeatLowToHighInv;
    alpha = clamp(alpha, 0.0, 1.0);

    gl_FragColor = texture(texUnit_ColorGradient, vec2(0.5, alpha)) * smoothstep(0.0, 0.5, alpha);
    gl_FragColor.a *= opacity;
}
