mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
38 lines
779 B
GLSL
38 lines
779 B
GLSL
#version 330 core
|
|
|
|
#include <globals.glsl>
|
|
|
|
in vec2 v_pos;
|
|
in vec2 v_uv;
|
|
in vec4 v_color;
|
|
in uint v_mode;
|
|
|
|
layout (std140)
|
|
uniform u_locals {
|
|
vec4 w_pos;
|
|
};
|
|
|
|
uniform sampler2D u_tex;
|
|
|
|
out vec2 f_uv;
|
|
flat out uint f_mode;
|
|
out vec4 f_color;
|
|
|
|
void main() {
|
|
f_uv = v_uv;
|
|
f_color = v_color;
|
|
|
|
if (w_pos.w == 1.0) {
|
|
// In-game element
|
|
gl_Position = proj_mat * (view_mat * w_pos + vec4(v_pos, 0.0, 0.0));
|
|
} else if (w_pos.w == -1.0 ) {
|
|
// 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);
|
|
} else {
|
|
// Interface element
|
|
gl_Position = vec4(v_pos, 0.0, 1.0);
|
|
}
|
|
f_mode = v_mode;
|
|
}
|