]> git.tdb.fi Git - libs/gl.git/blob - source/colorcurve.h
Fix incorrect multiple inclusion guards
[libs/gl.git] / source / colorcurve.h
1 #ifndef MSP_GL_COLORCURVE_H_
2 #define MSP_GL_COLORCURVE_H_
3
4 #include "postprocessor.h"
5 #include "program.h"
6 #include "programdata.h"
7 #include "texture1d.h"
8
9 namespace Msp {
10 namespace GL {
11
12 /**
13 Processes oversaturated colors to preserve hues.  When one color component
14 exceeds 1.0, the others are scaled towards white.  A transition curve is also
15 applied near 1.0 to prevent the abrupt change in the gradient.
16
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.
20 */
21 class ColorCurve: public PostProcessor
22 {
23 private:
24         Program shprog;
25         ProgramData shdata;
26         Texture1D curve;
27         const Mesh &quad;
28
29 public:
30         ColorCurve();
31
32         /// Sets the size of the peak zone.  Must be between 0 and 1, inclusive.
33         void set_peak(float);
34
35         /** Sets brightness for oversaturated colors.  Must be >= 1.  Suggested
36         values are between 1.5 and 2.0; a value of 1.0 will clamp colors to the
37         saturated value. */
38         void set_brightness(float);
39
40         /** Sets the gamma value used for mapping output colors.  Allowed range is
41         from 0.1 to 10. */
42         void set_gamma(float);
43
44         /** Sets output mapping to sRGB.  This is almost, but not exactly equivalent
45         to set_gamma(2.2). */
46         void set_srgb();
47
48         /// Sets output mapping to linear.  This is equivalent to set_gamma(1).
49         void set_linear();
50
51         virtual void render(const Texture2D &, const Texture2D &);
52 };
53
54 } // namespace GL
55 } // namespace Msp
56
57 #endif