2019-01-14 23:13:58 +00:00
|
|
|
#version 330 core
|
|
|
|
|
2019-05-12 09:10:13 +00:00
|
|
|
#include <globals.glsl>
|
2019-08-04 21:07:29 +00:00
|
|
|
#include <srgb.glsl>
|
2019-05-12 09:10:13 +00:00
|
|
|
|
2019-06-03 21:35:03 +00:00
|
|
|
in uint v_pos_norm;
|
|
|
|
in uint v_col_light;
|
2019-01-14 23:13:58 +00:00
|
|
|
|
|
|
|
layout (std140)
|
|
|
|
uniform u_locals {
|
|
|
|
vec3 model_offs;
|
2019-09-24 15:43:51 +00:00
|
|
|
float load_time;
|
2019-01-14 23:13:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
out vec3 f_pos;
|
2019-10-16 14:05:45 +00:00
|
|
|
flat out uint f_pos_norm;
|
2019-01-14 23:13:58 +00:00
|
|
|
out vec3 f_col;
|
2019-05-31 20:37:11 +00:00
|
|
|
out float f_light;
|
2020-04-16 13:42:20 +00:00
|
|
|
out float f_ao;
|
2019-01-14 23:13:58 +00:00
|
|
|
|
2020-04-14 23:02:15 +00:00
|
|
|
const float EXTRA_NEG_Z = 65536.0;
|
|
|
|
|
2019-01-14 23:13:58 +00:00
|
|
|
void main() {
|
2020-04-14 23:02:15 +00:00
|
|
|
f_pos = vec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0x1FFFFu)) - vec3(0, 0, EXTRA_NEG_Z) + model_offs;
|
2019-05-22 18:30:18 +00:00
|
|
|
|
2020-04-16 01:40:09 +00:00
|
|
|
f_pos.z -= 250.0 * (1.0 - 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-09-24 15:43:51 +00:00
|
|
|
|
2020-01-21 12:57:59 +00:00
|
|
|
f_col = vec3((uvec3(v_col_light) >> uvec3(8, 16, 24)) & uvec3(0xFFu)) / 255.0;
|
2019-01-14 23:13:58 +00:00
|
|
|
|
2020-04-16 13:42:20 +00:00
|
|
|
f_light = float(v_col_light & 0x3Fu) / 64.0;
|
|
|
|
f_ao = float((v_col_light >> 6u) & 3u) / 4.0;
|
2019-05-31 20:37:11 +00:00
|
|
|
|
2019-10-16 14:05:45 +00:00
|
|
|
f_pos_norm = v_pos_norm;
|
|
|
|
|
2019-01-14 23:13:58 +00:00
|
|
|
gl_Position =
|
2020-01-21 12:57:59 +00:00
|
|
|
all_mat *
|
2019-05-31 20:37:11 +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-28 18:32:44 +00:00
|
|
|
}
|