30 lines
942 B
GLSL
30 lines
942 B
GLSL
#version 430 core
|
|
|
|
in layout(location = 0) vec3 position;
|
|
in layout(location = 1) vec3 normal_in;
|
|
in layout(location = 2) vec2 textureCoordinates_in;
|
|
in layout(location = 6) vec3 tangents;
|
|
in layout(location = 7) vec3 bitangents;
|
|
|
|
uniform layout(location = 3) mat4 MVP;
|
|
uniform layout(location = 4) mat4 modelMatrix;
|
|
uniform layout(location = 5) mat3 normalMatrix;
|
|
|
|
out layout(location = 0) vec3 normal_out;
|
|
out layout(location = 1) vec2 textureCoordinates_out;
|
|
out layout(location = 2) vec3 worldSpaceVertices;
|
|
out layout(location = 3) mat3 TBN;
|
|
|
|
void main()
|
|
{
|
|
TBN = (mat3(
|
|
mat3(modelMatrix) * normalize(tangents),
|
|
mat3(modelMatrix) * normalize(bitangents),
|
|
mat3(modelMatrix) * normalize(normal_in)
|
|
));
|
|
worldSpaceVertices = vec3(modelMatrix * vec4(position, 1.0));
|
|
normal_out = normalize(normalMatrix * normal_in);
|
|
gl_Position = MVP * vec4(position, 1.0f);
|
|
textureCoordinates_out = textureCoordinates_in;
|
|
}
|