2023-02-19 15:47:55 +00:00
|
|
|
#version 330 core
|
|
|
|
|
2024-01-30 23:24:01 +00:00
|
|
|
out float flogz;
|
2023-04-07 06:17:37 +00:00
|
|
|
out vec4 ap_color;
|
2023-02-19 15:47:55 +00:00
|
|
|
|
2023-05-02 23:57:20 +00:00
|
|
|
// cloud_static_common.vert
|
|
|
|
void cloud_static_common_vert(out vec4 vs_pos, out vec4 ws_pos);
|
2023-04-07 06:17:37 +00:00
|
|
|
// aerial_perspective.glsl
|
|
|
|
vec4 get_aerial_perspective(vec2 coord, float depth);
|
2024-01-30 23:24:01 +00:00
|
|
|
// logarithmic_depth.glsl
|
|
|
|
float logdepth_prepare_vs_depth(float z);
|
2023-02-19 15:47:55 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2023-05-02 23:57:20 +00:00
|
|
|
vec4 vs_pos, ws_pos;
|
|
|
|
cloud_static_common_vert(vs_pos, ws_pos);
|
2023-02-19 15:47:55 +00:00
|
|
|
|
2024-01-30 23:24:01 +00:00
|
|
|
flogz = logdepth_prepare_vs_depth(gl_Position.w);
|
|
|
|
|
2023-02-19 15:47:55 +00:00
|
|
|
// Perspective division and scale to [0, 1] to get the screen position
|
|
|
|
// of the vertex.
|
|
|
|
vec2 coord = (gl_Position.xy / gl_Position.w) * 0.5 + 0.5;
|
2023-05-02 23:57:20 +00:00
|
|
|
ap_color = get_aerial_perspective(coord, length(vs_pos));
|
2023-02-19 15:47:55 +00:00
|
|
|
}
|