#version 330
in vec3 vsoNormal;
in vec4 vsoModPos;
in vec2 vsoTexCoord;
out vec4 fragColor;
uniform sampler2D tex0;
uniform mat4 viewMatrix;
uniform vec4 lumPos;
void main(void) {
const vec3 Vu = vec3(0, 0, -1);
vec4 lumPosv = viewMatrix * lumPos;
vec3 Ld = normalize(vsoModPos - lumPosv).xyz;
vec3 reflexion = normalize(reflect(Ld, vsoNormal));
float ispec = pow(clamp(dot(-Vu, reflexion), 0., 1.), 20);
float phongIL = clamp(dot(-Ld, vsoNormal), 0., 1.);
fragColor = phongIL * texture(tex0, vsoTexCoord) + ispec * vec4(1);
}