+"// Pasted from common_world.glsl\n"
+"vec3 water_compute_lighting( vec3 diffuse, vec3 normal, vec3 co )\n"
+"{\n"
+" float light_mask = compute_board_shadow();\n"
+"\n"
+" if( g_light_preview == 1 )\n"
+" diffuse = vec3(0.75);\n"
+"\n"
+" // Lighting\n"
+" vec3 halfview = uCamera - co;\n"
+" float fdist = length(halfview);\n"
+" halfview /= fdist;\n"
+"\n"
+" float world_shadow = newlight_compute_sun_shadow( \n"
+" co, g_sun_dir.xyz * (1.0/(max(g_sun_dir.y,0.0)+0.2)) );\n"
+"\n"
+" vec3 total_light = clearskies_lighting( \n"
+" normal, min( light_mask, world_shadow ), halfview );\n"
+"\n"
+" vec3 cube_coord = (co - g_cube_min.xyz) * g_cube_inv_range.xyz;\n"
+" cube_coord = floor( cube_coord );\n"
+"\n"
+" if( g_debug_indices == 1 )\n"
+" {\n"
+" return rand33(cube_coord);\n"
+" }\n"
+"\n"
+" if( g_debug_complexity == 1 )\n"
+" {\n"
+" ivec3 coord = ivec3( cube_coord );\n"
+" uvec4 index_sample = texelFetch( uLightsIndex, coord, 0 );\n"
+"\n"
+" uint light_count = (index_sample.x & 0x3u) + (index_sample.y & 0x3u);\n"
+" return vec3( float(light_count)*(1.0/6.0), 0.0, 0.5 );\n"
+" }\n"
+"\n"
+" // FIXME: this coord should absolutely must be clamped!\n"
+" \n"
+" ivec3 coord = ivec3( cube_coord );\n"
+" uvec4 index_sample = texelFetch( uLightsIndex, coord, 0 );\n"
+"\n"
+" total_light += \n"
+" scene_calculate_packed_light_patch( index_sample.x,\n"
+" halfview, co, normal ) \n"
+" * light_mask;\n"
+" total_light += \n"
+" scene_calculate_packed_light_patch( index_sample.y,\n"
+" halfview, co, normal )\n"
+" * light_mask;\n"
+"\n"
+" return diffuse * total_light;\n"
+"}\n"
+"\n"