UNPKG

sigma

Version:

A JavaScript library dedicated to graph drawing.

1 lines 1.36 kB
(()=>{"use strict";var o={d:(n,t)=>{for(var e in t)o.o(t,e)&&!o.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},o:(o,n)=>Object.prototype.hasOwnProperty.call(o,n),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},n={};o.r(n),o.d(n,{default:()=>t});const t="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float a_color;\nattribute vec3 a_barycentric;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec3 v_barycentric;\n\nconst float feather = 0.0;\n\nvoid main() {\n\n // Scale from [[-1 1] [-1 1]] to the container:\n float size = a_thickness * u_ratio + feather;\n vec2 delta = vec2(a_normal * size);\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_barycentric = a_barycentric;\n\n // Extract the color:\n float c = a_color;\n v_color.b = mod(c, 256.0); c = floor(c / 256.0);\n v_color.g = mod(c, 256.0); c = floor(c / 256.0);\n v_color.r = mod(c, 256.0); c = floor(c / 256.0); v_color /= 255.0;\n v_color.a = 1.0;\n}\n";module.exports=n})();