/** * Stores the GLSL program sources. Nodes render as instanced quads with * signed distance circles, atlas images and state rings. Edges render as * instanced quads bent along a quadratic bezier defined by per link * curvature, with dashes measured along the true curve arc length. */ export declare const NODE_VERTEX = "#version 300 es\nprecision highp float;\nlayout(location=0) in vec2 aCorner;\nlayout(location=1) in vec4 aNode;\nlayout(location=2) in vec4 aFill;\nlayout(location=3) in vec4 aBorder;\nlayout(location=4) in vec4 aStyle;\nlayout(location=5) in vec4 aImage;\nuniform mat3 uCamera;\nout vec2 vLocal;\nout vec2 vAtlasUv;\nout vec4 vFill;\nout vec4 vBorder;\nout vec4 vStyle;\nflat out float vImageActive;\nvoid main() {\n vec2 world = aNode.xy + aCorner * aNode.w;\n gl_Position = vec4((uCamera * vec3(world, 1.0)).xy, 0.0, 1.0);\n vLocal = aCorner;\n vAtlasUv = (aCorner * 0.5 + 0.5 + vec2(mod(aImage.x, 8.0), floor(aImage.x / 8.0))) / 8.0;\n vFill = aFill;\n vBorder = aBorder;\n vStyle = aStyle;\n vImageActive = aImage.y;\n}"; export declare const NODE_FRAGMENT = "#version 300 es\nprecision highp float;\nin vec2 vLocal;\nin vec2 vAtlasUv;\nin vec4 vFill;\nin vec4 vBorder;\nin vec4 vStyle;\nflat in float vImageActive;\nuniform sampler2D uAtlas;\nuniform float uZoom;\nuniform vec4 uHoverRing;\nuniform vec4 uSelectedRing;\nuniform vec4 uFixedRing;\nuniform float uHoverRingWidth;\nuniform float uSelectedRingWidth;\nuniform float uFixedRingWidth;\nuniform float uDisabledOpacity;\nout vec4 outColor;\nfloat band(float d, float inner, float outer, float aa) {\n return smoothstep(inner - aa, inner + aa, d) * (1.0 - smoothstep(outer - aa, outer + aa, d));\n}\nvoid main() {\n float d = length(vLocal);\n float aa = max(fwidth(d), 0.0008);\n float discRadius = vStyle.x / max(vStyle.w, 0.0001);\n float discAlpha = 1.0 - smoothstep(discRadius - aa, discRadius + aa, d);\n int state = int(vStyle.z + 0.5);\n vec4 ringColor = vec4(0.0);\n float ringWidth = 0.0;\n if (state == 1) { ringColor = uHoverRing; ringWidth = uHoverRingWidth; }\n else if (state == 2 || state == 3) { ringColor = uSelectedRing; ringWidth = uSelectedRingWidth; }\n else if (state == 4) { ringColor = uFixedRing; ringWidth = uFixedRingWidth; }\n float ringOuter = discRadius + ringWidth / max(uZoom * vStyle.w, 0.0001);\n float ring = ringWidth > 0.0 ? band(d, discRadius, ringOuter, aa) : 0.0;\n if (discAlpha <= 0.0 && ring <= 0.0) discard;\n vec4 fill = vFill;\n if (vImageActive > 0.5) {\n vec4 image = texture(uAtlas, vAtlasUv);\n fill.rgb = mix(fill.rgb, image.rgb, image.a);\n }\n float borderSize = vStyle.y / max(uZoom * vStyle.w, 0.0001);\n float border = vStyle.y > 0.0 ? band(d, max(0.0, discRadius - borderSize), discRadius, aa) : 0.0;\n vec4 core = mix(fill, vec4(vBorder.rgb, vBorder.a * vStyle.y), border);\n core.a *= discAlpha * (state == 5 ? uDisabledOpacity : 1.0);\n vec4 halo = vec4(ringColor.rgb, ringColor.a * ring);\n outColor = vec4(mix(halo.rgb, core.rgb, core.a), core.a + halo.a * (1.0 - core.a));\n}"; export declare const EDGE_VERTEX = "#version 300 es\nprecision highp float;\nlayout(location=0) in vec2 aCorner;\nlayout(location=1) in vec4 aSegment;\nlayout(location=2) in vec4 aColor;\nlayout(location=3) in vec4 aStyle;\nlayout(location=4) in vec4 aMeta;\nuniform mat3 uCamera;\nuniform float uZoom;\nout float vSide;\nout float vDashPosition;\nout vec4 vColor;\nout vec2 vDashPattern;\nflat out float vDashed;\nvoid main() {\n vec2 p0 = aSegment.xy;\n vec2 p1 = aSegment.zw;\n vec2 chord = p1 - p0;\n float chordLength = max(length(chord), 0.00001);\n float curvature = aMeta.x;\n vec2 mid = (p0 + p1) * 0.5;\n vec2 control = mid + vec2(-chord.y, chord.x) / chordLength * (curvature * chordLength * 0.35);\n float t = (aCorner.x + 1.0) * 0.5;\n float u = 1.0 - t;\n vec2 point = u * u * p0 + 2.0 * u * t * control + t * t * p1;\n vec2 tangent = 2.0 * u * (control - p0) + 2.0 * t * (p1 - control);\n float tangentLength = max(length(tangent), 0.00001);\n vec2 normal = vec2(-tangent.y, tangent.x) / tangentLength;\n float widthWorld = aStyle.x / max(uZoom, 0.0001);\n vec2 world = point + normal * aCorner.y * widthWorld * 0.5;\n gl_Position = vec4((uCamera * vec3(world, 1.0)).xy, 0.0, 1.0);\n vSide = aCorner.y;\n float dashScale = aMeta.z > 0.5 ? 1.0 : uZoom;\n vDashPosition = (t * aMeta.w) * dashScale + aStyle.w;\n vColor = aColor;\n vDashPattern = aStyle.yz;\n vDashed = aMeta.y;\n}"; export declare const EDGE_FRAGMENT = "#version 300 es\nprecision highp float;\nin float vSide;\nin float vDashPosition;\nin vec4 vColor;\nin vec2 vDashPattern;\nflat in float vDashed;\nout vec4 outColor;\nvoid main() {\n float edgeAA = max(fwidth(vSide), 0.002);\n float alpha = 1.0 - smoothstep(1.0 - edgeAA, 1.0 + edgeAA, abs(vSide));\n if (vDashed > 0.5) {\n float cycle = max(0.5, vDashPattern.x + vDashPattern.y);\n float phase = mod(vDashPosition, cycle);\n float dashAA = max(fwidth(vDashPosition), 0.3);\n alpha *= 1.0 - smoothstep(vDashPattern.x - dashAA, vDashPattern.x + dashAA, phase);\n }\n if (alpha <= 0.0) discard;\n outColor = vec4(vColor.rgb, vColor.a * alpha);\n}"; export declare const ARROW_VERTEX = "#version 300 es\nprecision highp float;\nlayout(location=0) in vec2 aCorner;\nlayout(location=1) in vec4 aArrow;\nlayout(location=2) in vec4 aColor;\nlayout(location=3) in float aHalfWidth;\nuniform mat3 uCamera;\nout vec2 vLocal;\nflat out float vLength;\nflat out float vHalfWidth;\nout vec4 vColor;\nvoid main() {\n vec2 base = aArrow.xy;\n vec2 tip = aArrow.zw;\n vec2 direction = tip - base;\n float worldLength = max(length(direction), 0.00001);\n vec2 dirNorm = direction / worldLength;\n vec2 normal = vec2(-dirNorm.y, dirNorm.x);\n float t = (aCorner.x + 1.0) * 0.5;\n vec2 world = base + dirNorm * (t * worldLength) + normal * aCorner.y * aHalfWidth * (1.0 - t);\n gl_Position = vec4((uCamera * vec3(world, 1.0)).xy, 0.0, 1.0);\n vLocal = vec2(t * worldLength, aCorner.y * aHalfWidth * (1.0 - t));\n vLength = worldLength;\n vHalfWidth = aHalfWidth;\n vColor = aColor;\n}"; export declare const ARROW_FRAGMENT = "#version 300 es\nprecision highp float;\nin vec2 vLocal;\nflat in float vLength;\nflat in float vHalfWidth;\nin vec4 vColor;\nout vec4 outColor;\nvoid main() {\n float u = vLocal.x;\n float v = vLocal.y;\n float L = vLength;\n float W = vHalfWidth;\n if (L <= 0.00001) discard;\n float dEdges = (W * L - W * u - abs(v) * L) / length(vec2(L, W));\n float d = min(u, dEdges);\n float aa = max(fwidth(d), 0.002);\n float alpha = smoothstep(-aa, aa, d);\n if (alpha <= 0.0) discard;\n outColor = vec4(vColor.rgb, vColor.a * alpha);\n}"; //# sourceMappingURL=shaders.d.ts.map