1 #ifndef MSP_GL_COLORCURVE_H_
2 #define MSP_GL_COLORCURVE_H_
4 #include "postprocessor.h"
5 #include "programdata.h"
14 Processes oversaturated colors to preserve hues. When one color component
15 exceeds 1.0, the overflow is distributed to the other components, scaling the
18 Gamma or sRGB correction can also be applied to the output. It can be used to
19 improve color reproduction by performing lighting calculations in linear color
20 space and converting to sRGB for display.
22 class ColorCurve: public PostProcessor
25 struct Template: public PostProcessor::Template
27 class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
37 float exposure_adjust;
38 float brightness_response;
44 virtual ColorCurve *create(unsigned, unsigned) const;
48 const Program &shprog;
52 const Sampler &linear_sampler;
53 const Sampler &nearest_sampler;
58 /** Set exposure adjustment in EV units. Positive values brighten the
59 image, negative values darken it. Zero is neutral. */
60 void set_exposure_adjust(float);
62 /** Sets the exponent of the brightness response curve. It must be greater
63 than zero and at most one. A value of one gives a linear response; closer
64 to zero results in a more gentle curve. */
65 void set_brightness_response(float);
67 /** Sets the gamma value used for mapping output colors. Allowed range is
69 void set_gamma(float);
71 /** Sets output mapping to sRGB. This is almost, but not exactly equivalent
75 /// Sets output mapping to linear. This is equivalent to set_gamma(1).
78 virtual void render(Renderer &, const Texture2D &, const Texture2D &);
80 virtual void set_debug_name(const std::string &);