- vec3 light = get_light_direction(i);
- float shadow = get_shadow_factor(i);
- color += phong_one_light(light, normal, look, light_sources[i].color, surface_diffuse, surface_specular, shininess)*shadow;
+ IncomingLight incoming = get_incoming_light(i, world_vertex.xyz);
+ float shadow = get_shadow_factor(i, world_vertex);
+ color += phong_one_light(incoming.direction, normal, look, surface_diffuse, surface_specular, shininess)*incoming.color*shadow;