2018-03-11 11:58:50 +01:00
|
|
|
#version 150 core
|
|
|
|
|
|
|
|
in vec4 inCoord;
|
|
|
|
in vec3 inNormal;
|
|
|
|
in vec2 inUV;
|
|
|
|
in vec4 inColor;
|
|
|
|
|
2018-03-11 14:16:23 +01:00
|
|
|
uniform mat4 uModelMatrix;
|
|
|
|
uniform mat4 uViewMatrix;
|
|
|
|
uniform mat4 uProjectionMatrix;
|
2018-03-15 11:01:55 +01:00
|
|
|
uniform mat4 uLightSpaceMatrix;
|
2018-03-11 17:30:56 +01:00
|
|
|
uniform mat3 uNormalMatrix;
|
2018-03-11 11:58:50 +01:00
|
|
|
uniform vec3 uLightDirection;
|
2018-03-11 14:16:23 +01:00
|
|
|
uniform vec3 uViewPosition;
|
2018-03-11 11:58:50 +01:00
|
|
|
|
2018-03-11 14:16:23 +01:00
|
|
|
out vec3 ioFragPosition;
|
2018-03-15 11:01:55 +01:00
|
|
|
out vec3 ioFragNormal;
|
|
|
|
out vec2 ioFragTexCoords;
|
|
|
|
smooth out vec4 ioFragColor;
|
|
|
|
out vec4 ioFragPosLightSpace;
|
2018-03-11 11:58:50 +01:00
|
|
|
|
|
|
|
void main() {
|
2018-04-05 12:39:30 +02:00
|
|
|
ioFragPosition = (uViewMatrix * uModelMatrix * inCoord).xyz;
|
2018-04-05 14:36:00 +02:00
|
|
|
|
|
|
|
mat4 model_view_matrix = uViewMatrix * uModelMatrix;
|
|
|
|
ioFragNormal = transpose(inverse(mat3(model_view_matrix))) * inNormal;
|
2018-03-15 11:01:55 +01:00
|
|
|
ioFragTexCoords = inUV;
|
|
|
|
ioFragColor = inColor;
|
2018-04-05 12:39:30 +02:00
|
|
|
ioFragPosLightSpace = uLightSpaceMatrix * uModelMatrix * inCoord;
|
2018-03-15 11:01:55 +01:00
|
|
|
|
2018-04-05 14:36:00 +02:00
|
|
|
gl_Position = uProjectionMatrix * model_view_matrix * inCoord;
|
2018-03-11 11:58:50 +01:00
|
|
|
}
|