nuclear-plant-sim/assets/shader/model.vert

30 lines
583 B
GLSL

#include "header.glsl"
layout (location = 0) in vec4 v_pos;
layout (location = 1) in vec4 v_colour;
layout (location = 2) in vec2 v_uv;
layout (location = 3) in uint v_texid;
out VS_OUT {
vec4 pos;
vec4 colour;
vec2 uv;
flat uint texid;
} vout;
uniform mat4 u_model = mat4(1);
uniform mat4 u_view = mat4(1);
uniform mat4 u_projection = mat4(1);
void main() {
mat4 mat_mv = u_view * u_model;
vout.pos = mat_mv * v_pos;
vout.colour = v_colour;
vout.uv = v_uv;
vout.texid = v_texid;
vec4 p = u_projection * vout.pos;
gl_Position = vec4(p.xy, 2 / (p.z + 2) - 1, p.w);
}