/*
 * This file copies sigma/examples/custom-rendering/programs/node.border.frag.glsl, but with a some
 * difference: white color was changed to transparent and used border radius from v_borderRadius variable
 */
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;\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\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}\n");
