export const FP_SHADER_CHUNK_ACCUMULATION = `
#ifndef FP_SHADER_CHUNK_ACCUMULATION
    #define FP_SHADER_CHUNK_ACCUMULATION
        
    // read light data
    for(uint i=0u; i < fp_cluster_metadata.y; i++){
        uint lookup_index = fp_cluster_metadata.x + i;

        uint light_descriptor = texelFetch(fp_t_light_lookup, address_to_data_texture_coordinates(lookup_index), 0 ).r;

        uint type = (light_descriptor) & 0x3u;
        uint light_address = light_descriptor >> 2;
        

        if(type == 0u){
            // point light
            
            vec4 light_data_0 = texelFetch(fp_t_light_data, address_to_data_texture_coordinates(light_address), 0);
            vec4 light_data_1 = texelFetch(fp_t_light_data, address_to_data_texture_coordinates(light_address+1u), 0);
            
            vec3 light_position = light_data_0.xyz;
            float light_radius = light_data_0.w;
            
            vec3 light_color = light_data_1.xyz;
            float light_intensity = light_data_1.w;
            
            PointLight pointlight;
            
            pointlight.position = light_position;
            pointlight.distance = light_radius;
            pointlight.color = light_color*light_intensity;
            pointlight.decay = 1.0;
            
            fp_getPointDirectLightIrradiance( pointlight, directLight, vViewPosition );
            RE_Direct( directLight, geometry, material, reflectedLight );
        
        }
    }
#endif
`;
