Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/shaders/line_sdf.fragment.glsl from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/shaders/line_sdf.fragment.glsl
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/shaders/line_sdf.fragment.glsl
-
curl -L -o line_sdf.fragment.glsl https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/shaders/line_sdf.fragment.glsl
1.54 kB
| uniform lowp float u_device_pixel_ratio; | |
| uniform sampler2D u_image; | |
| uniform float u_sdfgamma; | |
| uniform float u_mix; | |
| varying vec2 v_normal; | |
| varying vec2 v_width2; | |
| varying vec2 v_tex_a; | |
| varying vec2 v_tex_b; | |
| varying float v_gamma_scale; | |
| void main() { | |
| // Calculate the distance of the pixel from the line in pixels. | |
| float dist = length(v_normal) * v_width2.s; | |
| // Calculate the antialiasing fade factor. This is either when fading in | |
| // the line in case of an offset line (v_width2.t) or when fading out | |
| // (v_width2.s) | |
| float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale; | |
| float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); | |
| float sdfdist_a = texture2D(u_image, v_tex_a).a; | |
| float sdfdist_b = texture2D(u_image, v_tex_b).a; | |
| float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix); | |
| alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist); | |
| gl_FragColor = color * (alpha * opacity); | |
| gl_FragColor = vec4(1.0); | |
| } | |