DuctTaped_GL/PhongShader.vert

32 lines
678 B
GLSL

#version 330 core
layout (location = 0) in vec3 VertPosition;
layout (location = 1) in vec3 VertNormal ;
out vec3 FragPosition ;
out vec3 Normal ;
out vec3 LightViewPosition;
out vec3 LightRawPos;
uniform mat4 InverseModelSpace;
uniform mat4 ModelSpace;
uniform mat4 Viewport ;
uniform mat4 Projection;
uniform vec3 LightPosition;
void main()
{
gl_Position = Projection * Viewport * ModelSpace * vec4(VertPosition, 1.0);
FragPosition = vec3(Viewport * ModelSpace * vec4(VertPosition, 1.0));
Normal = mat3(transpose(InverseModelSpace)) * VertNormal;
LightViewPosition = vec3(Viewport * vec4(LightPosition, 1.0));
LightRawPos = LightPosition;
}