molstar
Version:
A comprehensive macromolecular library.
2 lines • 1.13 kB
JavaScript
export var edge_frag = "\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tMaskTexture;\nuniform vec2 uTexSizeInv;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec4 offset = vec4(float(dEdgeScale), 0.0, 0.0, float(dEdgeScale)) * vec4(uTexSizeInv, uTexSizeInv);\n vec4 c0 = texture2D(tMaskTexture, coords);\n vec4 c1 = texture2D(tMaskTexture, coords + offset.xy);\n vec4 c2 = texture2D(tMaskTexture, coords - offset.xy);\n vec4 c3 = texture2D(tMaskTexture, coords + offset.yw);\n vec4 c4 = texture2D(tMaskTexture, coords - offset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n if (d <= 0.0)\n discard;\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibility = min(a1, a2) > 0.001 ? 1.0 : 0.0;\n float mask = c0.r;\n float marker = min(c1.b, min(c2.b, min(c3.b, c4.b)));\n float fogAlpha = min(c1.a, min(c2.a, min(c3.a, c4.a)));\n gl_FragColor = vec4(visibility, mask, marker, fogAlpha);\n}\n";
//# sourceMappingURL=edge.frag.js.map