]> git.tdb.fi Git - libs/gl.git/blob - source/colorcurve.h
Add a color curve post-processor
[libs/gl.git] / source / colorcurve.h
1 #ifndef COLORCURVE_H_
2 #define COLORCURVE_H_
3
4 #include "postprocessor.h"
5 #include "program.h"
6 #include "programdata.h"
7
8 namespace Msp {
9 namespace GL {
10
11 /**
12 Processes oversaturated colors to preserve hues.  When one color component 
13 exceeds 1.0, the others are scaled towards white.  A transition curve is also
14 applied near 1.0 to prevent the abrupt change in the gradient.
15
16 Only makes sense when used in an HDR framebuffer.
17 */
18 class ColorCurve: public PostProcessor
19 {
20 private:
21         Program shprog;
22         ProgramData shdata;
23         const Mesh &quad;
24
25 public:
26         ColorCurve();
27
28         /// Sets the size of the peak zone.  Must be between 0 and 1, inclusive.
29         void set_peak(float);
30
31         /** Sets brightness for oversaturated colors.  Must be >= 1.  Suggested
32         values are between 1.5 and 2.0; a value of 1.0 will clamp colors to the
33         saturated value. */
34         void set_brightness(float);
35
36         virtual void render(const Texture2D &, const Texture2D &);
37 };
38
39 } // namespace GL
40 } // namespace Msp
41
42 #endif