#version 330 core #preinclude "light.glsl" #preinclude "vertex_data.glsl" #define MAX_POINT_LIGHT_CNT 64 out vec4 FragColor; in VertexData vertex_data; uniform vec3 view_pos; uniform sampler2D input_texture; uniform Material material; uniform PointLight point_lights[MAX_POINT_LIGHT_CNT]; uniform int point_light_cnt; void main() { vec3 ambient_light = calc_ambient_light(material, vertex_data.texture_coords); vec3 point_light_sum = vec3(0.0, 0.0, 0.0); for (int pl_index = 0; pl_index < point_light_cnt; pl_index++) { point_light_sum += calc_point_light( point_lights[pl_index], vertex_data, view_pos, material ); } FragColor = vec4((ambient_light + point_light_sum), 1.0); }