#version 460 core layout (location = 0) in vec3 _pos; layout (location = 1) in vec2 _tex; layout (location = 2) in vec3 _norm; layout (location = 3) in vec3 _tan; uniform mat4 projection; uniform mat4 view; uniform mat4 model; out vec3 pos; out vec3 norm; out vec2 tex; out mat3 TBN; void main() { vec3 T = normalize(vec3(model * vec4(_tan, 0))); vec3 N = normalize(vec3(model * vec4(_norm, 0))); vec3 B = cross(N, T); TBN = mat3(T, B, N); gl_Position = projection * view * model * vec4(_pos, 1.0); pos = vec3(model * vec4(_pos, 1.0)); norm = mat3(transpose(inverse(model))) * _norm; tex = _tex; }