#include "version.sh"

in highp vec3  umf_df_adf;
uniform lowp vec4 color0;
uniform lowp vec4 color1;
uniform highp float period_rev;
uniform highp float space_ratio;
uniform lowp float dash[64];
uniform lowp float dashCount;
out lowp vec4 fragColor;

void main()
{
    highp float acc_period = umf_df_adf.z * period_rev;
    acc_period = fract(acc_period);
    int index = int(min(dashCount-1.0, acc_period * dashCount));
    lowp float ratio = dash[index];
    fragColor = mix(color1, color0, ratio);
    fragColor.a *= clamp(umf_df_adf.x - abs(umf_df_adf.y), 0.0, 1.0);
}
