blob: 816412057e49bb442c842be90ce5d52b13e3c67c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#version 460 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec4 aTangent;
layout (location = 3) in vec2 aTexCoord;
out vec3 Normal;
out vec2 TexCoord;
out vec3 FragPos;
out mat3 TBN;
uniform mat4 transform;
uniform mat4 view;
uniform mat4 projection;
void main() {
gl_Position = projection * view * transform * vec4(aPos, 1.0);
FragPos = vec3(transform * vec4(aPos, 1.0));
Normal = mat3(transpose(inverse(transform))) * aNormal;
TexCoord = aTexCoord;
vec3 T = normalize(vec3(transform * vec4(aTangent.xyz, 0.0)));
vec3 N = normalize(vec3(transform * vec4(aNormal, 0.0)));
vec3 B = aTangent.w * cross(N, T);
TBN = mat3(T,B,N);
}
|