- float shadow = get_shadow_factor(0);
- color += phong_one_light(light, normal, look, light_sources[0].diffuse.rgb, surface_diffuse, surface_specular, shininess)*shadow;
+ for(int i=0; i<max_lights; ++i)
+ if(light_sources[i].type!=0)
+ {
+ 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;
+ }