molstar
Version:
A comprehensive macromolecular library.
7 lines (6 loc) • 2.44 kB
TypeScript
/**
* Copyright (c) 2019-2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
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 #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n #if defined(dRenderVariant_color) || defined(dRenderVariant_tracing)\n material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n #endif\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n if (sdf < 0.5) discard;\n\n #if defined(dRenderVariant_color) || defined(dRenderVariant_tracing)\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = uBorderColor;\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";