// :D #include "common_world.glsl" vec3 scene_do_lighting( vec3 diffuse, vec3 wnormal ) { // Lighting vec3 halfview = uCamera - aWorldCo; float fdist = length(halfview); halfview /= fdist; vec3 total_light = newlight_compute_ambient(); // Compute world lighting contribution and apply it according to the // shadow map // vec3 world_light = newlight_compute_world_diffuse( wnormal ); world_light += newlight_compute_sun_spec( wnormal, halfview, 0.1 ); float world_shadow = newlight_compute_sun_shadow(); total_light += world_light * world_shadow; // Compute the other lights that exist in the map, not effected by the sun // shadow total_light += newlight_compute_quadratic ( wnormal, halfview, g_point_light_positions[ aLights.x ].xyz, g_point_light_colours[ aLights.x ].rgb ); total_light += newlight_compute_quadratic ( wnormal, halfview, g_point_light_positions[ aLights.y ].xyz, g_point_light_colours[ aLights.y ].rgb ); total_light += newlight_compute_quadratic ( wnormal, halfview, g_point_light_positions[ aLights.z ].xyz, g_point_light_colours[ aLights.z ].rgb ); return apply_fog( diffuse * total_light, fdist ); }