2019-08-06 02:50:49 +00:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
#include <globals.glsl>
|
2019-10-16 11:39:41 +00:00
|
|
|
#include <srgb.glsl>
|
2019-08-06 02:50:49 +00:00
|
|
|
|
|
|
|
in uint v_pos_norm;
|
|
|
|
in uint v_col_light;
|
|
|
|
|
|
|
|
layout (std140)
|
|
|
|
uniform u_locals {
|
|
|
|
vec3 model_offs;
|
2019-09-24 15:43:51 +00:00
|
|
|
float load_time;
|
2019-08-06 02:50:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
out vec3 f_pos;
|
2019-10-16 14:05:45 +00:00
|
|
|
flat out uint f_pos_norm;
|
2019-08-06 02:50:49 +00:00
|
|
|
flat out vec3 f_norm;
|
|
|
|
out vec3 f_col;
|
|
|
|
out float f_light;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
f_pos = vec3(
|
2019-08-14 21:28:37 +00:00
|
|
|
float((v_pos_norm >> 0) & 0x00FFu),
|
|
|
|
float((v_pos_norm >> 8) & 0x00FFu),
|
|
|
|
float((v_pos_norm >> 16) & 0x1FFFu)
|
2019-08-06 02:50:49 +00:00
|
|
|
) + model_offs;
|
2020-01-19 18:39:20 +00:00
|
|
|
f_pos.z *= min(1.0001 - 0.02 / pow(tick.x - load_time, 10.0), 1.0);
|
2019-11-20 10:38:11 +00:00
|
|
|
f_pos.z -= 25.0 * pow(distance(focus_pos.xy, f_pos.xy) / view_distance.x, 20.0);
|
2019-08-06 02:50:49 +00:00
|
|
|
|
2020-03-27 15:13:36 +00:00
|
|
|
// Small waves
|
|
|
|
f_pos.z -= 0.05 + 0.05 * (sin(tick.x * 2.0 + f_pos.x * 2.0 + f_pos.y * 2.0) + 1.0) * 0.5;
|
|
|
|
|
2019-10-16 14:05:45 +00:00
|
|
|
f_col = vec3(
|
2019-08-14 21:28:37 +00:00
|
|
|
float((v_col_light >> 8) & 0xFFu),
|
|
|
|
float((v_col_light >> 16) & 0xFFu),
|
|
|
|
float((v_col_light >> 24) & 0xFFu)
|
2019-10-16 14:05:45 +00:00
|
|
|
) / 255.0;
|
2019-08-06 02:50:49 +00:00
|
|
|
|
|
|
|
f_light = float(v_col_light & 0xFFu) / 255.0;
|
|
|
|
|
2019-10-16 14:05:45 +00:00
|
|
|
f_pos_norm = v_pos_norm;
|
|
|
|
|
2019-08-06 02:50:49 +00:00
|
|
|
gl_Position =
|
2020-01-21 12:57:59 +00:00
|
|
|
all_mat *
|
2019-08-14 21:28:37 +00:00
|
|
|
vec4(f_pos, 1);
|
2020-01-27 14:27:36 +00:00
|
|
|
gl_Position.z = -1000.0 / (gl_Position.z + 10000.0);
|
2019-08-14 21:28:37 +00:00
|
|
|
}
|