message: Helpers to convert linear -> sRGB
diff: @@ -1273,6 +1273,9 @@ namespace irr { namespace video
  template<typename T>
  inline void SRGB2lin(T _srgb[3]);
  + template<typename T>
  + inline void lin2SRGB(T _lin[3]);
  +
  template<>
  inline void SRGB2lin<double>(double _srgb[3])
  {
  @@ -1284,6 +1287,17 @@ namespace irr { namespace video
  }
  }
  + template<>
  + inline void lin2SRGB<double>(double _lin[3])
  + {
  + for (uint32_t i = 0u; i < 3u; ++i)
  + {
  + double& s = _lin[i];
  + if (s <= 0.0031308) s *= 12.92;
  + else s = 1.055 * std::pow(s, 1./2.4) - 0.055;
  + }
  + }
  +
  template<typename T>// T is int64_t or uint64_t
  inline void SRGB2lin(T _srgb[3])
  {
  @@ -1293,6 +1307,16 @@ namespace irr { namespace video
  for (uint32_t i = 0; i < 3u; ++i)
  lin[i] = s[i] * 255.;
  }
  +
  + template<typename T>
  + inline void lin2SRGB(T _lin[3])
  + {
  + double s[3] { _lin[0]/255., _lin[1]/255., _lin[2]/255. };
  + lin2SRGB<double>(s);
  + T* srgb = _lin;
  + for (uint32_t i = 0; i < 3u; ++i)
  + srgb[i] = s[i] * 255.;
  + }
  }
  template<>
  