1 struct LightSourceParameters
9 const int max_lights = 6;
10 layout(set=0) uniform Lighting
12 LightSourceParameters light_sources[max_lights];
15 //float fog_start_distance;
19 #pragma MSP stage(fragment)
26 virtual IncomingLight get_incoming_light(int index, vec3 world_pos)
28 vec4 light_pos = light_sources[index].position;
29 vec3 rel_pos = light_pos.xyz-world_pos*light_pos.w;
30 float d = length(rel_pos);
31 float attenuation = 1.0/dot(vec3(1.0, d, d*d), light_sources[index].attenuation);
32 return IncomingLight(rel_pos/d, light_sources[index].color*attenuation);