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-17 01:26:29 +01:00
|
|
|
uniform vec3 colorTex;
|
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-24 23:18:02 +01:00
|
|
|
float coef = pow(max(0,dot(normal,V)),2);
|
2021-01-16 20:33:47 +01:00
|
|
|
vec4 textureColor = texture2D(colorTexture, -vTexCoord);
|
2021-01-17 01:26:29 +01:00
|
|
|
vec3 texture = vec3(textureColor.x, textureColor.y, textureColor.z) * colorTex;
|
2021-01-16 20:33:47 +01:00
|
|
|
gl_FragColor = vec4(texture + texture * coef, 1.0);
|
2021-01-16 17:11:39 +01:00
|
|
|
}
|