Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / library / map / src / main / rust / shaders / moon.vert

moon.vert28 lines · 1.0 KiBRaw
1#version 450
2
3// Moon vertex: the shared unit quad, scaled to the globe disc.
4//
5// The record path pushes a matrix that maps the quad's -1..1 to the disc's
6// bounding square (radius in clip units, centred on the viewport). Everything
7// spherical — the limb cut, the hemisphere z, the normal, the depth — is done
8// per fragment in `moon.frag`: the quad has only four corners, all outside the
9// unit disc, so a per-vertex disc test would discard the whole moon.
10//
11// Push layout (the stock `Push` block):
12// `tileToClip` the disc matrix described above.
13// `color.xy` the camera centre lon/lat (degrees), read by the fragment stage.
14// `misc.z` the DEM relief strength, read by the fragment stage.
15layout(location = 0) in vec3 inLocal;
16layout(location = 0) out vec2 outDisc;
17layout(push_constant) uniform Push {
18 mat4 tileToClip;
19 vec4 color;
20 vec4 line;
21 vec4 misc;
22 vec4 morph;
23} push;
24
25void main() {
26 outDisc = inLocal.xy;
27 gl_Position = push.tileToClip * vec4(inLocal.xy, 0.0, 1.0);
28}