GRK-Projekt/grafika_projekt/shaders/terrainShader.vert

28 lines
774 B
GLSL
Raw Normal View History

2022-01-23 19:19:09 +01:00
#version 400 core
2022-01-23 21:05:59 +01:00
layout(location = 3) in vec3 position;
layout(location = 4) in vec2 textureCoordinates;
layout(location = 5) in vec3 normal;
2022-01-23 19:19:09 +01:00
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;
}