Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / map / src / main / rust / shaders / fill_globe.frag
fill_globe.frag25 lines · 769 BRaw
| 1 | #version 450 |
| 2 | |
| 3 | // Globe fill fragment: the layer colour with a limb discard and the LOD fade. |
| 4 | // |
| 5 | // `vZ` is the unit-sphere z from the vertex stage: negative (far side and the |
| 6 | // limb-straddling fragments past the edge) discards, so the disc reads as a |
| 7 | // ball rather than a filled square. Otherwise identical to `fill.frag`. |
| 8 | |
| 9 | layout(location = 0) in float inZ; |
| 10 | layout(location = 0) out vec4 outColor; |
| 11 | |
| 12 | layout(push_constant) uniform Push { |
| 13 | mat4 tileToClip; |
| 14 | vec4 color; |
| 15 | vec4 line; |
| 16 | vec4 misc; |
| 17 | vec4 morph; |
| 18 | } push; |
| 19 | |
| 20 | void main() { |
| 21 | if (inZ < 0.0) discard; |
| 22 | // Limb antialias: fade the last sliver so the edge is not a staircase. |
| 23 | float edge = clamp(inZ * 8.0, 0.0, 1.0); |
| 24 | outColor = vec4(push.color.rgb, push.color.a * push.morph.x * edge); |
| 25 | } |