3 #include "common_world.glsl"
5 vec3 scene_do_lighting( vec3 diffuse, vec3 wnormal )
8 vec3 halfview = uCamera - aWorldCo;
9 float fdist = length(halfview);
12 vec3 total_light = newlight_compute_ambient();
14 // Compute world lighting contribution and apply it according to the
17 vec3 world_light = newlight_compute_world_diffuse( wnormal );
18 world_light += newlight_compute_sun_spec( wnormal, halfview, 0.1 );
20 float world_shadow = newlight_compute_sun_shadow();
22 total_light += world_light * world_shadow;
24 // Compute the other lights that exist in the map, not effected by the sun
26 total_light += newlight_compute_quadratic
29 g_point_light_positions[ aLights.x ].xyz,
30 g_point_light_colours[ aLights.x ].rgb
32 total_light += newlight_compute_quadratic
35 g_point_light_positions[ aLights.y ].xyz,
36 g_point_light_colours[ aLights.y ].rgb
38 total_light += newlight_compute_quadratic
41 g_point_light_positions[ aLights.z ].xyz,
42 g_point_light_colours[ aLights.z ].rgb
45 return apply_fog( diffuse * total_light, fdist );