2021-01-16 17:11:39 +01:00
|
|
|
#version 430 core
|
|
|
|
|
|
|
|
uniform vec3 objectColor;
|
|
|
|
//uniform vec3 lightDir;
|
|
|
|
uniform vec3 lightPos;
|
|
|
|
uniform vec3 cameraPos;
|
2021-01-16 20:33:47 +01:00
|
|
|
uniform sampler2D colorTexture;
|
2021-01-16 17:11:39 +01:00
|
|
|
|
|
|
|
in vec3 interpNormal;
|
|
|
|
in vec3 fragPos;
|
2021-01-16 20:33:47 +01:00
|
|
|
in vec2 vTexCoord;
|
2021-01-16 17:11:39 +01:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec3 normal = normalize(interpNormal);
|
|
|
|
vec3 V = normalize(cameraPos-fragPos);
|
2021-01-16 20:33:47 +01:00
|
|
|
float coef = pow(max(0,dot(normal,V)),3);
|
|
|
|
vec4 textureColor = texture2D(colorTexture, -vTexCoord);
|
|
|
|
vec3 texture = vec3(textureColor.x, textureColor.y, textureColor.z);
|
|
|
|
gl_FragColor = vec4(texture + texture * coef, 1.0);
|
2021-01-16 17:11:39 +01:00
|
|
|
}
|