opengl-deferred/assets/shader/deferred/deferred.vs

28 lines
620 B
Plaintext
Raw Permalink Normal View History

2024-10-11 23:02:12 +00:00
#version 460 core
2024-10-11 16:38:21 +00:00
2024-10-11 23:02:12 +00:00
layout (location = 0) in vec3 _pos;
2024-10-12 00:22:54 +00:00
layout (location = 1) in vec2 _tex;
layout (location = 2) in vec3 _norm;
2024-10-18 14:12:01 +00:00
layout (location = 3) in vec3 _tan;
2024-10-11 16:38:21 +00:00
2024-10-11 23:02:12 +00:00
uniform mat4 projection;
2024-10-12 12:31:15 +00:00
uniform mat4 view;
2024-10-11 23:02:12 +00:00
uniform mat4 model;
2024-10-11 16:38:21 +00:00
2024-10-11 23:02:12 +00:00
out vec3 pos;
out vec3 norm;
out vec2 tex;
2024-10-18 14:12:01 +00:00
out mat3 TBN;
2024-10-11 16:38:21 +00:00
void main() {
2024-10-18 14:12:01 +00:00
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);
2024-10-12 12:31:15 +00:00
gl_Position = projection * view * model * vec4(_pos, 1.0);
2024-10-11 23:02:12 +00:00
pos = vec3(model * vec4(_pos, 1.0));
2024-10-15 14:52:21 +00:00
norm = mat3(transpose(inverse(model))) * _norm;
2024-10-11 23:02:12 +00:00
tex = _tex;
2024-10-15 14:52:21 +00:00
}