Saxum/Shader/phong.vsh

21 lines
432 B
V Shell
Raw Normal View History

2014-10-20 15:31:26 +00:00
#version 150
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
in vec3 aNormal;
in vec3 aPosition;
in vec2 aTexCoord;
out vec3 vNormal;
out vec2 vTexCoord;
out vec4 fragPosition;
2014-10-20 15:31:26 +00:00
void main()
{
fragPosition = uViewMatrix * vec4(aPosition, 1.0);
2014-10-20 15:31:26 +00:00
vNormal = inverse(transpose(mat3(uViewMatrix))) * aNormal;
vTexCoord = aTexCoord;
gl_Position = uProjectionMatrix * uViewMatrix * vec4(aPosition, 1.0);
}