2019-11-21 11:03:40 +00:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
#include <globals.glsl>
|
|
|
|
#include <srgb.glsl>
|
2019-11-21 20:57:46 +00:00
|
|
|
#include <lod.glsl>
|
2019-11-21 11:03:40 +00:00
|
|
|
|
|
|
|
in vec2 v_pos;
|
|
|
|
|
|
|
|
layout (std140)
|
|
|
|
uniform u_locals {
|
|
|
|
vec4 nul;
|
|
|
|
};
|
|
|
|
|
|
|
|
out vec3 f_pos;
|
2020-04-26 19:01:23 +00:00
|
|
|
out vec3 f_norm;
|
2020-04-26 22:13:10 +00:00
|
|
|
out vec2 v_pos_orig;
|
2020-04-26 19:01:23 +00:00
|
|
|
// out vec4 f_square;
|
2020-04-12 22:29:59 +00:00
|
|
|
// out vec4 f_shadow;
|
|
|
|
// out float f_light;
|
2019-11-21 11:03:40 +00:00
|
|
|
|
|
|
|
void main() {
|
2020-04-26 19:01:23 +00:00
|
|
|
// Find distances between vertices.
|
|
|
|
f_pos = lod_pos(v_pos, focus_pos.xy);
|
|
|
|
vec2 dims = vec2(1.0 / view_distance.y);
|
|
|
|
vec4 f_square = focus_pos.xyxy + vec4(splay(v_pos - dims), splay(v_pos + dims));
|
|
|
|
f_norm = lod_norm(f_pos.xy, f_square);
|
2020-04-26 22:13:10 +00:00
|
|
|
v_pos_orig = v_pos;
|
2020-04-26 19:01:23 +00:00
|
|
|
|
|
|
|
// f_pos = lod_pos(focus_pos.xy + splay(v_pos) * /*1000000.0*/(1 << 20), square);
|
2019-11-21 11:03:40 +00:00
|
|
|
|
2020-04-12 22:29:59 +00:00
|
|
|
// f_norm = lod_norm(f_pos.xy);
|
|
|
|
|
2020-04-24 14:12:20 +00:00
|
|
|
// f_shadow = textureBicubic(t_horizon, pos_to_tex(f_pos.xy));
|
2020-02-23 16:53:17 +00:00
|
|
|
|
2020-02-23 16:04:03 +00:00
|
|
|
//f_pos.z -= 1.0 / pow(distance(focus_pos.xy, f_pos.xy) / (view_distance.x * 0.95), 20.0);
|
|
|
|
|
2020-04-26 19:01:23 +00:00
|
|
|
// f_pos.z -= 100.0 * pow(1.0 + 0.01 / view_distance.x, -pow(distance(focus_pos.xy, f_pos.xy), 2.0));
|
2020-04-12 22:29:59 +00:00
|
|
|
// f_pos.z = mix(-f_pos.z, f_pos.z, view_distance.x <= distance(focus_pos.xy, f_pos.xy) + 32.0);
|
2020-04-26 19:01:23 +00:00
|
|
|
f_pos.z -= max(view_distance.x - distance(focus_pos.xy, f_pos.xy), 0.0) * (1.0 + max(0.0, f_pos.z - focus_pos.z));
|
2019-11-21 11:03:40 +00:00
|
|
|
|
2020-04-12 22:29:59 +00:00
|
|
|
// f_light = 1.0;
|
2019-11-21 11:03:40 +00:00
|
|
|
|
|
|
|
gl_Position =
|
|
|
|
proj_mat *
|
|
|
|
view_mat *
|
|
|
|
vec4(f_pos, 1);
|
2020-02-21 14:40:19 +00:00
|
|
|
gl_Position.z = -1000.0 / (gl_Position.z + 10000.0);
|
2019-11-21 11:03:40 +00:00
|
|
|
}
|