sigma
Version:
A JavaScript library aimed at visualizing graphs of thousands of nodes and edges.
1 lines • 1.19 kB
JavaScript
(()=>{"use strict";var e={d:(o,r)=>{for(var n in r)e.o(r,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:r[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{default:()=>r});const r="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\nvarying vec4 v_texture;\n\nuniform sampler2D u_atlas;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec4 color;\n\n if (v_texture.w > 0.0) {\n vec4 texel = texture2D(u_atlas, v_texture.xy + gl_PointCoord * v_texture.zw, -1.0);\n color = vec4(mix(v_color, texel, texel.a).rgb, max(texel.a, v_color.a));\n } else {\n color = v_color;\n }\n\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = length(m);\n\n if (dist < radius - v_border) {\n gl_FragColor = color;\n } else if (dist < radius) {\n gl_FragColor = mix(transparent, color, (radius - dist) / v_border);\n } else {\n gl_FragColor = transparent;\n }\n}\n";module.exports=o})();