2019-01-30 12:11:34 +00:00
|
|
|
#version 330 core
|
|
|
|
|
2019-05-14 06:43:07 +00:00
|
|
|
#include <globals.glsl>
|
|
|
|
|
2019-02-23 02:41:52 +00:00
|
|
|
in vec2 v_pos;
|
2019-01-30 12:11:34 +00:00
|
|
|
in vec2 v_uv;
|
2019-02-23 02:41:52 +00:00
|
|
|
in vec4 v_color;
|
|
|
|
in uint v_mode;
|
2019-01-30 12:11:34 +00:00
|
|
|
|
2019-05-14 06:43:07 +00:00
|
|
|
layout (std140)
|
|
|
|
uniform u_locals {
|
|
|
|
vec4 w_pos;
|
|
|
|
};
|
|
|
|
|
2019-01-30 12:11:34 +00:00
|
|
|
uniform sampler2D u_tex;
|
|
|
|
|
|
|
|
out vec2 f_uv;
|
2019-02-23 02:41:52 +00:00
|
|
|
flat out uint f_mode;
|
|
|
|
out vec4 f_color;
|
2019-01-30 12:11:34 +00:00
|
|
|
|
|
|
|
void main() {
|
2019-05-02 22:42:04 +00:00
|
|
|
f_uv = v_uv;
|
|
|
|
f_color = v_color;
|
2019-05-14 06:43:07 +00:00
|
|
|
|
|
|
|
if (w_pos.w == 1.0) {
|
2020-01-10 00:33:38 +00:00
|
|
|
// Fixed scale In-game element
|
|
|
|
vec4 projected_pos = proj_mat * view_mat * vec4(w_pos.xyz, 1.0);
|
|
|
|
gl_Position = vec4(projected_pos.xy / projected_pos.w + v_pos, 0.0, 1.0);
|
2019-05-14 06:43:07 +00:00
|
|
|
} else {
|
|
|
|
// Interface element
|
|
|
|
gl_Position = vec4(v_pos, 0.0, 1.0);
|
|
|
|
}
|
2019-05-02 22:42:04 +00:00
|
|
|
f_mode = v_mode;
|
2019-01-30 12:11:34 +00:00
|
|
|
}
|