2019-02-04 18:32:08 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
in layout(location = 0) vec3 position;
|
|
|
|
in layout(location = 1) vec3 normal_in;
|
2019-03-14 12:43:41 +01:00
|
|
|
in layout(location = 2) vec2 UV;
|
|
|
|
in layout(location = 3) vec3 tangent;
|
|
|
|
in layout(location = 4) vec3 bitangent;
|
2019-02-04 18:32:08 +01:00
|
|
|
|
2019-03-15 16:26:31 +01:00
|
|
|
uniform mat4 MVP;
|
|
|
|
uniform mat4 MV;
|
|
|
|
uniform mat4 MVnormal;
|
2019-03-14 12:43:41 +01:00
|
|
|
uniform bool isIlluminated;
|
|
|
|
uniform bool isTextured;
|
|
|
|
uniform bool isNormalMapped;
|
2019-02-04 18:32:08 +01:00
|
|
|
|
|
|
|
out layout(location = 0) vec3 normal_out;
|
2019-02-19 16:16:13 +01:00
|
|
|
out layout(location = 1) vec3 vertex_out;
|
2019-03-14 12:43:41 +01:00
|
|
|
out layout(location = 2) vec2 uv_out;
|
|
|
|
out layout(location = 3) mat3 TBN;
|
2019-02-04 18:32:08 +01:00
|
|
|
|
2019-03-14 12:43:41 +01:00
|
|
|
void main() {
|
|
|
|
TBN = mat3(
|
|
|
|
normalize(vec3(MV * vec4(tangent, 0.0))),
|
|
|
|
normalize(vec3(MV * vec4(bitangent, 0.0))),
|
|
|
|
normalize(vec3(MV * vec4(normal_in, 0.0)))
|
|
|
|
);
|
|
|
|
|
2019-02-19 16:16:13 +01:00
|
|
|
normal_out = normalize(vec3(MVnormal * vec4(normal_in, 1.0f)));
|
|
|
|
vertex_out = vec3(MV*vec4(position, 1.0f));
|
2019-03-14 12:43:41 +01:00
|
|
|
uv_out = UV;
|
2019-02-19 16:16:13 +01:00
|
|
|
gl_Position = MVP * vec4(position, 1.0f);
|
2019-02-04 18:32:08 +01:00
|
|
|
}
|