Saxum/Shader/phong.vsh

28 lines
728 B
V Shell
Raw Permalink Normal View History

2014-10-20 15:31:26 +00:00
#version 150
uniform mat4 modelMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 shadowMVPs[5];
2014-10-20 15:31:26 +00:00
in vec3 aPosition;
in vec3 aNormal;
2014-10-20 15:31:26 +00:00
in vec2 aTexCoord;
out vec3 vNormal;
out vec2 vTexCoord;
out vec4 fragPosition;
2014-12-04 16:19:58 +00:00
out vec4 shadowCoord_near;
out vec4 shadowCoord_middle;
out vec4 shadowCoord_far;
2014-10-20 15:31:26 +00:00
void main()
{
fragPosition = modelMatrix * vec4(aPosition, 1.0);
vNormal = inverse(transpose(mat3(modelMatrix))) * aNormal;
2014-10-20 15:31:26 +00:00
vTexCoord = aTexCoord;
shadowCoord_near = shadowMVPs[0] * vec4(aPosition, 1.0);
shadowCoord_middle = shadowMVPs[1] * vec4(aPosition, 1.0);
shadowCoord_far = shadowMVPs[2] * vec4(aPosition, 1.0);
gl_Position = modelViewProjectionMatrix * vec4(aPosition, 1.0);
2014-10-20 15:31:26 +00:00
}