1 #ifndef MSP_GL_COLORCURVE_H_
2 #define MSP_GL_COLORCURVE_H_
4 #include "postprocessor.h"
6 #include "programdata.h"
13 Processes oversaturated colors to preserve hues. When one color component
14 exceeds 1.0, the overflow is distributed to the other components, scaling the
17 Gamma or sRGB correction can also be applied to the output. It can be used to
18 improve color reproduction by performing lighting calculations in linear color
19 space and converting to sRGB for display.
21 class ColorCurve: public PostProcessor
24 struct Template: public PostProcessor::Template
26 class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
36 float exposure_adjust;
37 float brightness_response;
43 virtual ColorCurve *create(Resources &, unsigned, unsigned) const;
47 const Program &shprog;
51 const Sampler &linear_sampler;
52 const Sampler &nearest_sampler;
55 ColorCurve(Resources &);
57 /** Set exposure adjustment in EV units. Positive values brighten the
58 image, negative values darken it. Zero is neutral. */
59 void set_exposure_adjust(float);
61 /** Sets the exponent of the */
62 void set_brightness_response(float);
64 /** Sets the gamma value used for mapping output colors. Allowed range is
66 void set_gamma(float);
68 /** Sets output mapping to sRGB. This is almost, but not exactly equivalent
72 /// Sets output mapping to linear. This is equivalent to set_gamma(1).
75 virtual void render(Renderer &, const Texture2D &, const Texture2D &);