Grafika_2024/projekt_grk/shaders/shader_coin.frag

19 lines
361 B
GLSL
Raw Permalink Normal View History

2024-02-28 10:14:39 +01:00
#version 430 core
2024-02-29 09:09:11 +01:00
float AMBIENT = 0.1;
2024-02-28 10:14:39 +01:00
uniform vec3 color;
2024-02-29 09:09:11 +01:00
uniform vec3 lightPos;
2024-02-28 10:14:39 +01:00
2024-02-29 09:09:11 +01:00
in vec3 vecNormal;
in vec3 worldPos;
2024-02-28 10:14:39 +01:00
2024-02-29 09:09:11 +01:00
out vec4 finalColor;
2024-02-28 10:14:39 +01:00
void main()
{
2024-02-29 09:09:11 +01:00
vec3 lightDir = normalize(lightPos-worldPos);
vec3 normal = normalize(vecNormal);
float diffuse=max(0,dot(normal,lightDir));
finalColor = vec4(color*min(1,AMBIENT+diffuse), 1.0);
2024-02-28 10:14:39 +01:00
}