#version 400 core layout(location = 3) in vec3 position; layout(location = 4) in vec2 textureCoordinates; layout(location = 5) in vec3 normal; out vec2 pass_textureCoordinates; out vec3 surfaceNormal; out vec3 toLightVector; out vec3 toCameraVector; uniform mat4 transformationMatrix; uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform vec3 lightDir; void main(void){ vec4 worldPosition = transformationMatrix * vec4(position,1.0); gl_Position = projectionMatrix * viewMatrix * worldPosition; pass_textureCoordinates = textureCoordinates * 40.0; surfaceNormal = (transformationMatrix * vec4(normal,0.0)).xyz; toLightVector = lightDir - worldPosition.xyz; toCameraVector = (inverse(viewMatrix) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz; }