36 lines
779 B
GLSL
36 lines
779 B
GLSL
#version 330 core
|
|
layout (location = 0) in vec3 aPosition;
|
|
layout (location = 1) in vec3 aNormal;
|
|
layout (location = 2) in vec2 aTextureCoordinate;
|
|
layout (location = 3) in vec3 aTangent;
|
|
|
|
uniform mat4 modelView;
|
|
uniform mat3 normalModelView;
|
|
uniform mat4 projection;
|
|
|
|
|
|
out vec3 normal;
|
|
out vec3 fragmentPosition;
|
|
out vec2 textureCoordinate;
|
|
flat out mat3 TBN;
|
|
void main() {
|
|
textureCoordinate = aTextureCoordinate;
|
|
|
|
vec3 tangent = normalize(normalModelView * aTangent);
|
|
normal = normalize(normalModelView * aNormal);
|
|
|
|
vec3 bitangent = normalize(cross(normal, tangent));
|
|
|
|
TBN = transpose(mat3(
|
|
tangent,
|
|
bitangent,
|
|
normal
|
|
));
|
|
|
|
|
|
vec4 modelViewPos = modelView * vec4(aPosition, 1.0);
|
|
|
|
gl_Position = projection * modelViewPos;
|
|
|
|
fragmentPosition = vec3(modelViewPos);
|
|
} |