#include "version.sh"

////in mediump float unit_max_f;	// half_width / transition_area
////in mediump float dis_f;
////in float acc_dis_f;
//in vec3  umf_df_adf;
//// in lowpvec4 color_f;
//uniform lowp vec4 color;
//
//uniform highp float period_rev;
//uniform highp float space_ratio; // space length / (dash length + dash space);
//
//void main()
//{
//    highp float acc_period = umf_df_adf.z * period_rev;
//    acc_period = fract(acc_period);
//    
//    gl_FragColor = color;
//    gl_FragColor.a *= clamp(umf_df_adf.x - abs(umf_df_adf.y), 0.0, 1.0);
//    gl_FragColor.a *= step(space_ratio, acc_period);
//}

in vec3  umf_df_adf;
uniform highp float space_ratio;
uniform lowp vec4 color0;
uniform lowp vec4 color1;
out lowp vec4 fragColor;

void main()
{
    highp float acc_period = umf_df_adf.z;
    acc_period = fract(acc_period);
    lowp float ratio = step(space_ratio, acc_period);
    fragColor = mix(color1, color0, ratio);
    fragColor.a *= clamp(umf_df_adf.x - abs(umf_df_adf.y), 0.0, 1.0);
}
