2024-01-11 17:57:31 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
float AMBIENT = 0.1;
|
|
|
|
|
2024-01-12 17:03:22 +01:00
|
|
|
uniform vec3 colorStart;
|
|
|
|
uniform vec3 colorEnd;
|
2024-01-11 17:57:31 +01:00
|
|
|
uniform vec3 lightPos;
|
|
|
|
|
|
|
|
in vec3 vecNormal;
|
|
|
|
in vec3 worldPos;
|
|
|
|
|
|
|
|
out vec4 outColor;
|
2024-01-12 17:03:22 +01:00
|
|
|
|
2024-01-11 17:57:31 +01:00
|
|
|
void main()
|
|
|
|
{
|
2024-01-12 17:03:22 +01:00
|
|
|
vec3 lightDir = normalize(lightPos - worldPos);
|
|
|
|
vec3 normal = normalize(vecNormal);
|
|
|
|
float diffuse = max(0, dot(normal, lightDir));
|
|
|
|
|
|
|
|
|
|
|
|
vec3 gradientColor = mix(colorStart, colorEnd, diffuse);
|
|
|
|
|
|
|
|
outColor = vec4(gradientColor, 1.0);
|
2024-01-11 17:57:31 +01:00
|
|
|
}
|