molstar
Version:
A comprehensive macromolecular library.
86 lines (73 loc) • 2.46 kB
JavaScript
"use strict";
/**
* Copyright (c) 2019-2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.text_frag = void 0;
exports.text_frag = `
precision highp float;
precision highp int;
uniform sampler2D tFont;
uniform vec3 uBorderColor;
uniform float uBorderWidth;
uniform vec3 uBackgroundColor;
uniform float uBackgroundOpacity;
varying vec2 vTexCoord;
void main(){
float fragmentDepth = gl_FragCoord.z;
if (vTexCoord.x > 1.0) {
material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);
} else {
// retrieve signed distance
float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;
if (sdf < 0.5) discard;
// add border
float t = 0.5 + uBorderWidth;
if (uBorderWidth > 0.0 && sdf < t) {
material.xyz = uBorderColor;
}
}
gl_FragColor = vObject;
gl_FragData[1] = vInstance;
gl_FragData[2] = vGroup;
gl_FragData[3] = packDepthToRGBA(fragmentDepth);
gl_FragColor = vColor;
gl_FragColor = material;
gl_FragColor = material;
gl_FragColor = material;
gl_FragColor = material;
gl_FragData[1] = vec4(-normalize(vViewPosition), emissive);
gl_FragData[2] = vec4(material.rgb, uDensity);
}
`;