export declare enum Location { BARYCENTRIC = 0, FRAG_COORD = 1, ABCD = 2, TXTY = 3, POSITION = 4, SIZE = 5, FILL_COLOR = 6, STROKE_COLOR = 7, ZINDEX_STROKE_WIDTH = 8, OPACITY = 9, INNER_SHADOW_COLOR = 10, INNER_SHADOW = 11 } export declare const vert = "\n#define SHIFT_RIGHT23 1.0 / 8388608.0\n#define SHIFT_LEFT23 8388608.0\n#define SHIFT_RIGHT22 1.0 / 4194304.0\n#define SHIFT_LEFT22 4194304.0\n\nlayout(std140) uniform SceneUniforms {\n mat3 u_ProjectionMatrix;\n mat3 u_ViewMatrix;\n mat3 u_ViewProjectionInvMatrix;\n vec4 u_BackgroundColor;\n vec4 u_GridColor;\n float u_ZoomScale;\n float u_CheckboardStyle;\n};\n\n\n#ifdef USE_WIREFRAME\n layout(location = 0) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nlayout(location = 1) in vec2 a_FragCoord;\n\n#ifdef USE_INSTANCES\n layout(location = 2) in vec4 a_Abcd;\n layout(location = 3) in vec2 a_Txty;\n layout(location = 4) in vec4 a_Position;\n layout(location = 5) in vec4 a_Size;\n layout(location = 6) in vec4 a_FillColor;\n layout(location = 7) in vec4 a_StrokeColor;\n layout(location = 8) in vec4 a_ZIndexStrokeWidth;\n layout(location = 9) in vec4 a_Opacity;\n layout(location = 10) in vec4 a_InnerShadowColor;\n layout(location = 11) in vec4 a_InnerShadow;\n#else\n layout(std140) uniform ShapeUniforms {\n mat3 u_ModelMatrix;\n vec4 u_Position;\n vec4 u_Size;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n vec4 u_ZIndexStrokeWidth;\n vec4 u_Opacity;\n vec4 u_InnerShadowColor;\n vec4 u_InnerShadow;\n };\n#endif\n\nout vec2 v_FragCoord;\n#ifdef USE_INSTANCES\n out vec4 v_FillColor;\n out vec4 v_StrokeColor;\n out float v_StrokeWidth;\n out vec4 v_Opacity;\n out float v_CornerRadius;\n out float v_StrokeAlignment;\n out vec4 v_InnerShadowColor;\n out vec4 v_InnerShadow;\n#else\n#endif\nout vec2 v_Radius;\n\n#ifdef USE_FILLIMAGE\n out vec2 v_Uv;\n#endif\n\nvoid main() {\n \n#ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n\n mat3 model;\n vec3 position;\n vec2 size;\n vec4 fillColor;\n vec4 strokeColor;\n float zIndex;\n float strokeWidth;\n float strokeAlignment;\n float shapeSizeAttenuation;\n\n #ifdef USE_INSTANCES\n model = mat3(a_Abcd.x, a_Abcd.y, 0, a_Abcd.z, a_Abcd.w, 0, a_Txty.x, a_Txty.y, 1);\n position = a_Position.xyz;\n size = a_Size.xy;\n fillColor = a_FillColor;\n strokeColor = a_StrokeColor;\n zIndex = a_ZIndexStrokeWidth.x;\n strokeWidth = a_ZIndexStrokeWidth.y;\n strokeAlignment = a_ZIndexStrokeWidth.w;\n shapeSizeAttenuation = a_Opacity.w;\n\n v_FillColor = fillColor;\n v_StrokeColor = strokeColor;\n v_StrokeWidth = strokeWidth;\n v_Opacity = a_Opacity;\n v_CornerRadius = a_ZIndexStrokeWidth.z;\n v_StrokeAlignment = a_ZIndexStrokeWidth.w;\n v_InnerShadowColor = a_InnerShadowColor;\n v_InnerShadow = a_InnerShadow;\n #else\n model = u_ModelMatrix;\n position = u_Position.xyz;\n size = u_Size.xy;\n fillColor = u_FillColor;\n strokeColor = u_StrokeColor;\n zIndex = u_ZIndexStrokeWidth.x;\n strokeWidth = u_ZIndexStrokeWidth.y;\n strokeAlignment = u_ZIndexStrokeWidth.w;\n shapeSizeAttenuation = u_Opacity.w;\n #endif\n \n float compressed = shapeSizeAttenuation;\n float sizeAttenuation = floor(compressed * SHIFT_RIGHT23);\n compressed -= sizeAttenuation * SHIFT_LEFT23;\n float strokeAttenuation = floor(compressed * SHIFT_RIGHT22);\n\n float scale = 1.0;\n if (sizeAttenuation > 0.5) {\n scale = 1.0 / u_ZoomScale;\n }\n if (strokeAttenuation > 0.5) {\n strokeWidth = strokeWidth / u_ZoomScale;\n }\n\n float strokeOffset;\n if (strokeAlignment < 0.5) {\n strokeOffset = strokeWidth / 2.0;\n } else if (strokeAlignment < 1.5) {\n strokeOffset = 0.0;\n } else if (strokeAlignment < 2.5) {\n strokeOffset = strokeWidth;\n }\n\n vec2 radius = size + vec2(strokeOffset);\n v_FragCoord = vec2(a_FragCoord * radius);\n v_Radius = abs(radius);\n\n #ifdef USE_FILLIMAGE\n v_Uv = (a_FragCoord * radius / size + 1.0) / 2.0;\n #endif\n\n gl_Position = vec4((u_ProjectionMatrix \n * u_ViewMatrix\n * model \n * vec3(position.xy + v_FragCoord * scale, 1)).xy, zIndex, 1);\n}\n"; export declare const frag = "\n#define SHIFT_RIGHT23 1.0 / 8388608.0\n#define SHIFT_LEFT23 8388608.0\n#define SHIFT_RIGHT22 1.0 / 4194304.0\n#define SHIFT_LEFT22 4194304.0\n\nlayout(std140) uniform SceneUniforms {\n mat3 u_ProjectionMatrix;\n mat3 u_ViewMatrix;\n mat3 u_ViewProjectionInvMatrix;\n vec4 u_BackgroundColor;\n vec4 u_GridColor;\n float u_ZoomScale;\n float u_CheckboardStyle;\n};\n\n#ifdef USE_INSTANCES\n#else\n layout(std140) uniform ShapeUniforms {\n mat3 u_ModelMatrix;\n vec4 u_Position;\n vec4 u_Size;\n vec4 u_FillColor;\n vec4 u_StrokeColor;\n vec4 u_ZIndexStrokeWidth;\n vec4 u_Opacity;\n vec4 u_InnerShadowColor;\n vec4 u_InnerShadow;\n };\n#endif\n\nout vec4 outputColor;\n\n\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n float u_WireframeLineWidth = 1.0;\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\nin vec2 v_FragCoord;\n\n#ifdef USE_INSTANCES\n in vec4 v_FillColor;\n in vec4 v_StrokeColor;\n in float v_StrokeWidth;\n in vec4 v_Opacity;\n in float v_CornerRadius;\n in float v_StrokeAlignment;\n in vec4 v_InnerShadowColor;\n in vec4 v_InnerShadow;\n#else\n#endif\nin vec2 v_Radius;\n\n#ifdef USE_FILLIMAGE\n in vec2 v_Uv;\n uniform sampler2D u_Texture;\n#endif\n\nfloat epsilon = 0.000001;\n\nfloat sdf_circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat sdf_ellipse(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n\n // V1\n // float k1 = length(p/r);\n // return (k1-1.0)*min(r.x,r.y);\n\n // V3\n // float k1 = length(p/r);\n // return length(p)*(1.0-1.0/k1);\n}\n\nfloat sdf_rounded_box(vec2 p, vec2 b, float r) {\n vec2 q = abs(p) - b + r;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;\n}\n\nvec4 over(vec4 below, vec4 above) {\n vec4 result;\n float alpha = above.a + below.a * (1.0 - above.a);\n result.rgb =\n (above.rgb * above.a + below.rgb * below.a * (1.0 - above.a)) / alpha;\n result.a = alpha;\n return result;\n}\n\nfloat antialias(float distance) {\n return clamp(distance / -fwidth(distance), 0.0, 1.0);\n}\n\nvec4 mix_border_inside(vec4 border, vec4 inside, float distance) {\n // Blend the border on top of the background and then linearly interpolate\n // between the two as we slide inside the background.\n return mix(border, inside, clamp(1.0 - distance, 0.0, 1.0) * antialias(distance));\n}\n\nfloat sigmoid(float t) {\n return 1.0 / (1.0 + exp(-t));\n}\n\nfloat make_shadow(vec2 pos, vec2 halfSize, float cornerRd, float blurRd, float distMul, float shape) {\n float distance;\n if (shape < 0.5) {\n distance = sdf_circle(pos, halfSize.x);\n } else if (shape < 1.5) {\n distance = sdf_ellipse(pos, halfSize);\n } else if (shape < 2.5) {\n distance = sdf_rounded_box(pos, halfSize, cornerRd + blurRd);\n }\n float dist = sigmoid(distMul * distance / blurRd);\n return clamp(dist, 0.0, 1.0);\n}\n\nvoid main() {\n float strokeWidth;\n vec4 fillColor;\n vec4 strokeColor;\n float opacity;\n float fillOpacity;\n float strokeOpacity;\n float shapeSizeAttenuation;\n float cornerRadius;\n vec4 innerShadowColor;\n vec4 innerShadow;\n float strokeAlignment;\n \n #ifdef USE_INSTANCES\n fillColor = v_FillColor;\n strokeColor = v_StrokeColor;\n strokeWidth = v_StrokeWidth;\n opacity = v_Opacity.x;\n fillOpacity = v_Opacity.y;\n strokeOpacity = v_Opacity.z;\n shapeSizeAttenuation = v_Opacity.w;\n cornerRadius = v_CornerRadius;\n strokeAlignment = v_StrokeAlignment;\n innerShadowColor = v_InnerShadowColor;\n innerShadow = v_InnerShadow;\n #else\n fillColor = u_FillColor;\n strokeColor = u_StrokeColor;\n strokeWidth = u_ZIndexStrokeWidth.y;\n opacity = u_Opacity.x;\n fillOpacity = u_Opacity.y;\n strokeOpacity = u_Opacity.z;\n shapeSizeAttenuation = u_Opacity.w;\n cornerRadius = u_ZIndexStrokeWidth.z;\n strokeAlignment = u_ZIndexStrokeWidth.w;\n innerShadowColor = u_InnerShadowColor;\n innerShadow = u_InnerShadow;\n #endif\n\n #ifdef USE_FILLIMAGE\n fillColor = texture(SAMPLER_2D(u_Texture), v_Uv);\n #endif\n\n float compressed = shapeSizeAttenuation;\n float sizeAttenuation = floor(compressed * SHIFT_RIGHT23);\n compressed -= sizeAttenuation * SHIFT_LEFT23;\n float strokeAttenuation = floor(compressed * SHIFT_RIGHT22);\n compressed -= strokeAttenuation * SHIFT_LEFT22;\n float shape = compressed;\n\n if (strokeAttenuation > 0.5) {\n strokeWidth = strokeWidth / u_ZoomScale;\n }\n\n float distance;\n // 'circle', 'ellipse', 'rect'\n if (shape < 0.5) {\n distance = sdf_circle(v_FragCoord, v_Radius.x);\n } else if (shape < 1.5) {\n distance = sdf_ellipse(v_FragCoord, v_Radius);\n } else if (shape < 2.5) {\n distance = sdf_rounded_box(v_FragCoord, v_Radius, cornerRadius);\n // TODO: Fast path when the quad is not rounded and doesn't have any border.\n }\n\n // based on the target alpha compositing mode.\n fillColor.a *= fillOpacity;\n strokeColor.a *= strokeOpacity;\n\n vec4 color = fillColor;\n float d1;\n float d2;\n if (strokeWidth > 0.0) {\n if (strokeAlignment < 0.5) {\n d1 = distance + strokeWidth;\n d2 = distance + strokeWidth / 2.0;\n color = mix_border_inside(over(fillColor, strokeColor), fillColor, d1);\n color = mix_border_inside(strokeColor, color, d2);\n } else if (strokeAlignment < 1.5) {\n d1 = distance + strokeWidth;\n d2 = distance;\n color = mix_border_inside(over(fillColor, strokeColor), fillColor, d1);\n color = mix_border_inside(strokeColor, color, d2);\n } else if (strokeAlignment < 2.5) {\n d2 = distance + strokeWidth;\n color = mix_border_inside(strokeColor, color, d2);\n }\n }\n outputColor = color;\n\n float innerShadowBlurRadius = innerShadow.z / 2.0;\n if (innerShadowBlurRadius > 0.0) {\n vec2 shadowOffset = -innerShadow.xy;\n float blurRadius = innerShadow.z;\n float distMul = -1.0;\n float lowerShadow = make_shadow(v_FragCoord + shadowOffset, v_Radius, cornerRadius, blurRadius, distMul, shape);\n\n vec3 lowerShadowColor = innerShadowColor.rgb * innerShadowColor.a;\n outputColor = over(vec4(color.xyz, 1.0), vec4(lowerShadowColor, 1.0 - lowerShadow));\n outputColor = over(outputColor, vec4(color.xyz, clamp(distance, 0.0, 1.0)));\n }\n\n float antialiasedBlur = -fwidth(length(v_FragCoord));\n float opacity_t = clamp(distance / antialiasedBlur, 0.0, 1.0);\n outputColor.a *= clamp(1.0 - distance, 0.0, 1.0) * opacity * opacity_t;\n\n \n#ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor = vec3(0.0, 0.0, 0.0);\n\n outputColor.xyz = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n if (any(lessThan(v_Barycentric, vec3(0.01)))) {\n outputColor.a = 0.95;\n }\n#endif\n\n\n#ifdef USE_STENCIL\n // Stencil pass: discard by geometry (SDF distance), not alpha. Include the same\n // anti-alias band as the normal pass (fwidth(distance)) so the stencil boundary\n // matches the visible shape and avoids edge holes.\n float outerBoundary = (strokeAlignment < 1.5) ? 0.0 : strokeWidth;\n if (distance > outerBoundary)\n discard;\n#else\n if (outputColor.a < epsilon)\n discard;\n#endif\n\n#ifdef USE_SOFT_CLIP_OUTSIDE\n outputColor *= 0.15;\n#endif\n}\n";