2023-12-18 16:15:08 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
float AMBIENT = 0.1;
|
|
|
|
|
|
|
|
uniform vec3 color;
|
|
|
|
uniform vec3 lightPos;
|
2024-01-13 22:59:27 +01:00
|
|
|
uniform vec3 lightDir;
|
2023-12-18 16:15:08 +01:00
|
|
|
|
|
|
|
in vec3 vecNormal;
|
|
|
|
in vec3 worldPos;
|
|
|
|
|
|
|
|
out vec4 outColor;
|
2024-01-13 22:59:27 +01:00
|
|
|
|
2023-12-18 16:15:08 +01:00
|
|
|
void main()
|
|
|
|
{
|
2024-01-13 22:59:27 +01:00
|
|
|
//vec3 lightDir = normalize(lightPos - worldPos);
|
|
|
|
|
2023-12-18 16:15:08 +01:00
|
|
|
vec3 normal = normalize(vecNormal);
|
2024-01-13 22:59:27 +01:00
|
|
|
float diffuse = max(0, dot(normal, lightDir));
|
|
|
|
outColor = vec4(color * min(1, AMBIENT + diffuse), 1.0);
|
2023-12-18 16:15:08 +01:00
|
|
|
}
|