- "vec3 to_light = light.position - vtx_viewspace;\n"
- "float distance = length(to_light);\n"
- "vec3 light_dir = normalize(to_light);\n"
- "float attenuation = light.strength / (distance * distance);\n"
- "vec3 ambient = tex_color * vec3(0.01, 0.01, 0.01);\n"
- "vec3 diffuse = attenuation * max(0.0, dot(normal, light_dir)) * light.color * tex_color;\n"
- "vec3 view_dir = vec3(0.0, 0.0, 1.0);\n"
- "vec3 specular = vec3(0.0, 0.0, 0.0);\n"
- "if (dot(normal, light_dir) >= 0.0) {\n"
- "attenuation * light.color * pow(max(0.0, dot(reflect(-light_dir, normal), view_dir)), 25.0);\n"
+ "vec3 total_light = tex_color * vec3(0.01, 0.01, 0.01);\n"
+ "for (int i = 0; i < num_lights; ++i) {\n"
+ "vec3 to_light = light[i].position - vtx_viewspace;\n"
+ "float distance = length(to_light) + length(vtx_viewspace);\n"
+ "vec3 light_dir = normalize(to_light);\n"
+ "float attenuation = light[i].strength / (distance * distance);\n"
+ "vec3 diffuse = attenuation * max(0.0, dot(normal, light_dir)) * light[i].color * tex_color;\n"
+ "vec3 view_dir = vec3(0.0, 0.0, 1.0);\n"
+ "vec3 specular = vec3(0.0, 0.0, 0.0);\n"
+ "if (dot(normal, light_dir) >= 0.0) {\n"
+ "attenuation * light[i].color * pow(max(0.0, dot(reflect(-light_dir, normal), view_dir)), 25.0);\n"
+ "}\n"
+ "total_light = total_light + diffuse + specular;\n"