#version 330 core in vec3 normal; in vec3 fragmentPosition; in vec2 textureCoordinate; flat in mat3 TBN; uniform float shininess; uniform vec4 ambientLight; uniform vec3 lightPosition; uniform vec4 lightColor; uniform sampler2D textureSampler; uniform sampler2D normalMap; float emissionStrength = 0.0; void main() { vec4 color = vec4(texture(textureSampler, textureCoordinate).rgb, 1.0); vec3 norm = normalize(normal); vec3 lightDir = normalize(lightPosition - fragmentPosition); vec3 eyeDir = (-normalize(fragmentPosition)); float diff = max(dot(norm, lightDir), 0.0); vec3 halfway = (lightDir + eyeDir) / length(lightDir + eyeDir); float specular = pow(max(dot(halfway, norm), 0.0), shininess); gl_FragColor = // EMISSION color * emissionStrength + // // AMBIENT ambientLight * color + // DIFFUSION color * diff + // SPECULAR specular * lightColor * color; }