2023-02-02 23:18:07 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
float AMBIENT = 0.1;
|
|
|
|
|
|
|
|
uniform vec3 color;
|
2023-02-07 19:35:37 +01:00
|
|
|
uniform vec3 lightPos;
|
2023-02-02 23:18:07 +01:00
|
|
|
uniform sampler2D colorTexture;
|
|
|
|
|
|
|
|
in vec3 vecNormal;
|
|
|
|
in vec3 worldPos;
|
|
|
|
in vec2 vecTex;
|
|
|
|
|
|
|
|
out vec4 outColor;
|
|
|
|
void main()
|
|
|
|
{
|
2023-02-07 19:35:37 +01:00
|
|
|
vec3 lightDir = normalize(lightPos-worldPos);
|
2023-02-02 23:18:07 +01:00
|
|
|
vec3 normal = normalize(vecNormal);
|
|
|
|
vec3 textureColor = texture2D(colorTexture, vecTex).xyz;
|
2023-02-07 19:35:37 +01:00
|
|
|
float diffuse=max(0,dot(normal,lightDir));
|
|
|
|
outColor = vec4(textureColor*min(1,AMBIENT+diffuse), 1.0);
|
2023-02-02 23:18:07 +01:00
|
|
|
}
|