message: Convert any SPD to RGB
diff: @@ -108,17 +108,13 @@ inline vector<3, T> xyz_to_rgb(vector<3, T> const& xyz)
  //-------------------------------------------------------------------------------------------------
  -// Convert spectrum to RGB
  +// Convert an arbitrary spectral power distribution to RGB
  //
  -template <typename T>
  +template <typename SPD, typename T = float>
  VSNRAY_FUNC
  -inline vector<3, T> spd_to_rgb(spectrum<T> const& spe)
  +inline vector<3, T> spd_to_rgb(SPD const& spd, T lmin = T(400.0), T lmax = T(700.0), T step = T(1.0))
  {
  - const float lmin = spectrum<T>::lambda_min;
  - const float lmax = spectrum<T>::lambda_max;
  - const float step = (lmax - lmin) / (spectrum<T>::num_samples - 1);
  -
  T x(0.0);
  T y(0.0);
  T z(0.0);
  @@ -126,8 +122,7 @@ inline vector<3, T> spd_to_rgb(spectrum<T> const& spe)
  for (float lambda = lmin; lambda <= lmax; lambda += step)
  {
  - auto p = spe(lambda);
  -
  + auto p = spd(lambda);
  x += p * cie_x(lambda);
  y += p * cie_y(lambda);
  @@ -139,6 +134,22 @@ inline vector<3, T> spd_to_rgb(spectrum<T> const& spe)
  }
  +//-------------------------------------------------------------------------------------------------
  +// Convert spectrum to RGB
  +//
  +
  +template <typename T>
  +VSNRAY_FUNC
  +inline vector<3, T> spd_to_rgb(spectrum<T> const& spe)
  +{
  + const float lmin = spectrum<T>::lambda_min;
  + const float lmax = spectrum<T>::lambda_max;
  + const float step = (lmax - lmin) / (spectrum<T>::num_samples - 1);
  +
  + return spd_to_rgb(spe, lmin, lmax, step);
  +}
  +
  +
  //-------------------------------------------------------------------------------------------------
  // Convert RGB to luminance (cd/m^2)
  //
  