import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";

import PREAMBLE from "./preable.frag.js";

//language=GLSL
const ACCUMULATION = `
{
        
    irradiance += getLightProbeIrradiance( lpv_values, geometry.normal ) * lpv_f_intensity;
        
}
`;


/**
 *
 * @param {string} source
 */
export function build_fragment_shader(source) {

    let result = PREAMBLE + source;


    result = insert_after(
        result,
        '#include <lights_fragment_begin>',
        ACCUMULATION
    );

    return result;
}