/*
 * This file copies our node.border.frag.glsl.ts, but with changes to support dashed borders
 */
import { toPaleGrayscale } from './utils';
export var fragmentShaderSource = "\nprecision mediump float;\n\nvarying vec4 v_color;           // base color of node\nvarying float v_border;\nvarying float v_borderRadius;   // inner border radius\nvarying float v_inactive;\n\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);  // transparent color\nconst float radius = 0.5;\nconst float dashGapRatio = 5.5;  // adjust this to change the ratio of dash size to gap size\nconst float totalLength = 2.0 * 3.14159 * radius;\nconst float dashSize = totalLength / (dashGapRatio + 1.0);\nconst float gapSize = dashSize / dashGapRatio;\n\n".concat(toPaleGrayscale, "\n\nvoid main(void) {\n    vec4 color;\n\n    // convert color to gray\n    if (v_inactive > 0.0) {\n        color = toPaleGrayscale(v_color, 0.5);\n    } else {\n        color = v_color;\n    }\n\n    float distToCenter = length(gl_PointCoord - vec2(0.5, 0.5)); // distance from current point to center of node\n    float distAlongBorder = atan(gl_PointCoord.y - 0.5, gl_PointCoord.x - 0.5); // distance along the border\n    float dashGapRatio = mod(distAlongBorder, dashSize + gapSize) / dashSize; // ratio of dash to gap\n\n    // our change - added if statement to check if within a dash\n    if (dashGapRatio < 1.0) {// if within a dash\n        if (distToCenter < v_borderRadius - v_border)   // distance to inner border radius\n            gl_FragColor = transparent;\n        else if (distToCenter < v_borderRadius)\n            gl_FragColor = mix(color, transparent, (v_borderRadius - distToCenter) / v_border);\n        else if (distToCenter < radius - v_border)      // distance to outer border radius\n            gl_FragColor = color;\n        else if (distToCenter < radius)\n            gl_FragColor = mix(transparent, color, (radius - distToCenter) / v_border);\n        else                                            // points outside the button\n            gl_FragColor = transparent;\n    } else {\n        gl_FragColor = transparent;\n    }\n}\n");
