/** * Copyright (c) 2019-2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author Gianluca Tomasello */ export declare const text_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nvoid main(){\n #include fade_lod\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n\n // determine if this is a background or glyph fragment\n bool isBackground = vTexCoord.x > 1.0;\n\n // discard background for non-visual variants (depth, pick, marking, emissive)\n #if !defined(dRenderVariant_color) && !defined(dRenderVariant_tracing)\n if (isBackground) discard;\n #endif\n\n // SDF test for glyph fragments \u2014 discard pixels outside glyph+border\n float rawSdf = 0.0;\n if (!isBackground) {\n rawSdf = texture2D(tFont, vTexCoord).a;\n float sdf = rawSdf + min(uBorderWidth, 0.49); // clamp to avoid exceeding max SDF range\n if (sdf < 0.5) discard;\n }\n\n #ifdef enabledFragDepth\n gl_FragDepthEXT = fragmentDepth;\n #endif\n\n #include assign_material_color\n\n if (isBackground) {\n #if defined(dRenderVariant_color) || defined(dRenderVariant_tracing)\n material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n #endif\n } else {\n #if defined(dRenderVariant_color) || defined(dRenderVariant_tracing)\n if (uBorderWidth > 0.0 && rawSdf < 0.5) {\n material.xyz = uBorderColor;\n } else {\n // push text fragments forward in depth so they render in front of border\n #ifdef enabledFragDepth\n gl_FragDepthEXT = fragmentDepth - 0.0001;\n #endif\n }\n #endif\n }\n\n #include check_transparency\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_emissive)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color) || defined(dRenderVariant_tracing)\n gl_FragColor = material;\n #include apply_marker_color\n\n #if defined(dRenderVariant_color)\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #elif defined(dRenderVariant_tracing)\n gl_FragData[1] = vec4(-normalize(vViewPosition), emissive);\n gl_FragData[2] = vec4(material.rgb, uDensity);\n #endif\n #endif\n}\n";