fn compute_spectral_radiance_to_luminance_factors(wavelengths: &[f32], solar_irradiance: &[f32], lambda_power: f32) -> Vector3<f32> {
    let mut k_r: f32 = 0.0;
    let mut k_g: f32 = 0.0;
    let mut k_b: f32 = 0.0;

    let solar_r = interpolate(wavelengths, solar_irradiance, K_LAMBDA_R);
    let solar_g = interpolate(wavelengths, solar_irradiance, K_LAMBDA_G);
    let solar_b = interpolate(wavelengths, solar_irradiance, K_LAMBDA_B);

    for l in (K_LAMBDA_MIN as usize)..(K_LAMBDA_MAX as usize) {
        let x_bar: f32 = cie_color_matching_function_table_value(l as f32, 1);
        let y_bar: f32 = cie_color_matching_function_table_value(l as f32, 2);
        let z_bar: f32 = cie_color_matching_function_table_value(l as f32, 3);
        let r_bar: f32 = XYZ_TO_SRGB[0] * x_bar + XYZ_TO_SRGB[1] * y_bar + XYZ_TO_SRGB[2] * z_bar;
        let g_bar: f32 = XYZ_TO_SRGB[3] * x_bar + XYZ_TO_SRGB[4] * y_bar + XYZ_TO_SRGB[5] * z_bar;
        let b_bar: f32 = XYZ_TO_SRGB[6] * x_bar + XYZ_TO_SRGB[7] * y_bar + XYZ_TO_SRGB[8] * z_bar;
        let irradiance = interpolate(wavelengths, solar_irradiance, l as f32);
        k_r += r_bar * irradiance / solar_r * (l as f32 / K_LAMBDA_R).powf(lambda_power);
        k_g += g_bar * irradiance / solar_g * (l as f32 / K_LAMBDA_G).powf(lambda_power);
        k_b += b_bar * irradiance / solar_b * (l as f32 / K_LAMBDA_B).powf(lambda_power);
    }
    k_r *= MAX_LUMINOUS_EFFICACY;
    k_g *= MAX_LUMINOUS_EFFICACY;
    k_b *= MAX_LUMINOUS_EFFICACY;
    Vector3::new(k_r, k_g, k_b)
}
// The returned constants are in lumen.nm / watt.
The returned constants are in lumen.nm / watt.
The returned constants are in lumen . nm / watt .
fn compute_spectral_radiance_to_luminance_factors(wavelengths: &[f32], solar_irradiance: &[f32], lambda_power: f32) -> Vector3<f32> {
    let mut k_r: f32 = 0.0;
    let mut k_g: f32 = 0.0;
    let mut k_b: f32 = 0.0;
    let solar_r = interpolate(wavelengths, solar_irradiance, K_LAMBDA_R);
    let solar_g = interpolate(wavelengths, solar_irradiance, K_LAMBDA_G);
    let solar_b = interpolate(wavelengths, solar_irradiance, K_LAMBDA_B);
    for l in (K_LAMBDA_MIN as usize)..(K_LAMBDA_MAX as usize) {
        let x_bar: f32 = cie_color_matching_function_table_value(l as f32, 1);
        let y_bar: f32 = cie_color_matching_function_table_value(l as f32, 2);
        let z_bar: f32 = cie_color_matching_function_table_value(l as f32, 3);
        let r_bar: f32 = XYZ_TO_SRGB[0] * x_bar + XYZ_TO_SRGB[1] * y_bar + XYZ_TO_SRGB[2] * z_bar;
        let g_bar: f32 = XYZ_TO_SRGB[3] * x_bar + XYZ_TO_SRGB[4] * y_bar + XYZ_TO_SRGB[5] * z_bar;
        let b_bar: f32 = XYZ_TO_SRGB[6] * x_bar + XYZ_TO_SRGB[7] * y_bar + XYZ_TO_SRGB[8] * z_bar;
        let irradiance = interpolate(wavelengths, solar_irradiance, l as f32);
        k_r += r_bar * irradiance / solar_r * (l as f32 / K_LAMBDA_R).powf(lambda_power);
        k_g += g_bar * irradiance / solar_g * (l as f32 / K_LAMBDA_G).powf(lambda_power);
        k_b += b_bar * irradiance / solar_b * (l as f32 / K_LAMBDA_B).powf(lambda_power);
    }
    k_r *= MAX_LUMINOUS_EFFICACY;
    k_g *= MAX_LUMINOUS_EFFICACY;
    k_b *= MAX_LUMINOUS_EFFICACY;
    Vector3::new(k_r, k_g, k_b)
}
fn compute_spectral_radiance_to_luminance_factors ( wavelengths : & [ f32 ] , solar_irradiance : & [ f32 ] , lambda_power : f32 ) -> Vector3 < f32 > { let mut k_r : f32 = 0.0 ; let mut k_g : f32 = 0.0 ; let mut k_b : f32 = 0.0 ; let solar_r = interpolate ( wavelengths , solar_irradiance , K_LAMBDA_R ) ; let solar_g = interpolate ( wavelengths , solar_irradiance , K_LAMBDA_G ) ; let solar_b = interpolate ( wavelengths , solar_irradiance , K_LAMBDA_B ) ; for l in ( K_LAMBDA_MIN as usize ) .. ( K_LAMBDA_MAX as usize ) { let x_bar : f32 = cie_color_matching_function_table_value ( l as f32 , 1 ) ; let y_bar : f32 = cie_color_matching_function_table_value ( l as f32 , 2 ) ; let z_bar : f32 = cie_color_matching_function_table_value ( l as f32 , 3 ) ; let r_bar : f32 = XYZ_TO_SRGB [ 0 ] * x_bar + XYZ_TO_SRGB [ 1 ] * y_bar + XYZ_TO_SRGB [ 2 ] * z_bar ; let g_bar : f32 = XYZ_TO_SRGB [ 3 ] * x_bar + XYZ_TO_SRGB [ 4 ] * y_bar + XYZ_TO_SRGB [ 5 ] * z_bar ; let b_bar : f32 = XYZ_TO_SRGB [ 6 ] * x_bar + XYZ_TO_SRGB [ 7 ] * y_bar + XYZ_TO_SRGB [ 8 ] * z_bar ; let irradiance = interpolate ( wavelengths , solar_irradiance , l as f32 ) ; k_r += r_bar * irradiance / solar_r * ( l as f32 / K_LAMBDA_R ) . powf ( lambda_power ) ; k_g += g_bar * irradiance / solar_g * ( l as f32 / K_LAMBDA_G ) . powf ( lambda_power ) ; k_b += b_bar * irradiance / solar_b * ( l as f32 / K_LAMBDA_B ) . powf ( lambda_power ) ; } k_r *= MAX_LUMINOUS_EFFICACY ; k_g *= MAX_LUMINOUS_EFFICACY ; k_b *= MAX_LUMINOUS_EFFICACY ; Vector3 :: new ( k_r , k_g , k_b ) }
The returned constants are in lumen.nm / watt.
The returned constants are in lumen . nm / watt .
wavelengths
&[f32]
solar_irradiance
&[f32]
lambda_power
f32