19 #ifndef _STELTONEREPRODUCER_HPP_ 20 #define _STELTONEREPRODUCER_HPP_ 93 oneOverMaxdL = 1.f/maxdL; lnOneOverMaxdL=std::log(oneOverMaxdL); term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, oneOverGamma);
100 return 1.f/oneOverGamma;
107 oneOverGamma = 1.f/gamma; term2TimesOneOverMaxdLpOneOverGamma = std::pow(term2*oneOverMaxdL, oneOverGamma);
115 return std::pow((
float)(inputScale*worldLuminance*M_PI*0.0001f),alphaWaOverAlphaDa) * term2;
123 return (
float) std::pow((
float)(displayLuminance/term2),1.f/alphaWaOverAlphaDa)/(inputScale*M_PI*0.0001f);
148 const float lnPix0p0001 = -8.0656104861f;
149 return std::exp(((lnInputScale+lnWorldLuminance+lnPix0p0001)*alphaWaOverAlphaDa+lnTerm2+lnOneOverMaxdL)*pFact);
157 void getShadersParams(
float& a,
float& b,
float & c)
const 159 a=alphaWaOverAlphaDa;
161 c=term2TimesOneOverMaxdLpOneOverGamma;
171 float lnOneOverMaxdL;
179 float alphaWaOverAlphaDa;
183 float term2TimesOneOverMaxdLpOneOverGamma;
186 #endif // _STELTONEREPRODUCER_HPP_ void setInputScale(float scale=1.f)
Set the global scale applied to input lumiances, i.e before the adaptation It is the parameter to mod...
void setDisplayAdaptationLuminance(float displayAdaptationLuminance)
Set the eye adaptation luminance for the display (and precompute what can be) Usual luminance range i...
float getWorldAdaptationLuminance() const
Get the eye adaptation luminance for the world.
float adaptLuminanceScaled(float worldLuminance) const
Return adapted luminance from world to display with 1 corresponding to full display white...
void xyYToRGB(float *xyY) const
Convert from xyY color system to RGB.
StelToneReproducer()
Constructor.
float reverseAdaptLuminance(float displayLuminance) const
Return adapted luminance from display to world.
Converts tones in function of the eye adaptation to luminance.
float getInputScale() const
Get the global scale applied to input luminances, i.e before the adaptation.
void setMaxDisplayLuminance(float maxdL)
Set the maximum luminance of the display (CRT, screen etc..) This value is used to scale the RGB rang...
void setDisplayGamma(float gamma)
Set the display gamma.
float getDisplayGamma() const
Get the display gamma.
float adaptLuminance(float worldLuminance) const
Return adapted luminance from world to display.
virtual ~StelToneReproducer()
Desctructor.
void setWorldAdaptationLuminance(float worldAdaptationLuminance)
Set the eye adaptation luminance for the world (and precompute what can be)
float reverseAdaptLuminanceScaled(float displayLuminance) const
Return adapted luminance from display to world with 1 corresponding to full display white...
float adaptLuminanceScaledLn(float lnWorldLuminance, float pFact=0.5f) const
Return adapted ln(luminance) from world to display with 1 corresponding to full display white...