#version 460 core
layout(location = 0) in vec3 inFragPos;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec2 inUV;
layout(location = 0) out vec4 outColor;
struct Light {
vec4 position;
vec3 color;
};
layout(set = 0, binding = 0) uniform Lights {
Light lights[32];
layout(set = 1, binding = 0) uniform sampler2D albedoSampler;
void main() {
vec3 diffuse = vec3(0);
for(int i = 0; i < 32; i++) {
const vec3 norm = normalize(inNormal);
const vec3 lightDir = normalize(lights[i].position.xyz - inFragPos);
const float diff = max(dot(norm, lightDir), 0.0);
diffuse += vec3(diff) * lights[i].color;
}
outColor = vec4(vec3(0.1) + diffuse * texture(albedoSampler, inUV).rgb, 1.0);