]> git.tdb.fi Git - libs/gl.git/blobdiff - source/colorcurve.h
Use Renderer for rendering PostProcessors
[libs/gl.git] / source / colorcurve.h
index 74a19d04bc916878635d23dcaf24708be6989d36..2b854bec8b6f8ac5392f010e64a06b5269b83415 100644 (file)
@@ -1,9 +1,11 @@
-#ifndef COLORCURVE_H_
-#define COLORCURVE_H_
+#ifndef MSP_GL_COLORCURVE_H_
+#define MSP_GL_COLORCURVE_H_
 
 #include "postprocessor.h"
 #include "program.h"
 #include "programdata.h"
+#include "texture1d.h"
+#include "texturing.h"
 
 namespace Msp {
 namespace GL {
@@ -13,13 +15,17 @@ Processes oversaturated colors to preserve hues.  When one color component
 exceeds 1.0, the others are scaled towards white.  A transition curve is also
 applied near 1.0 to prevent the abrupt change in the gradient.
 
-Only makes sense when used in an HDR framebuffer.
+Gamma or sRGB correction can also be applied to the output.  It can be used to
+improve color reproduction by performing lighting calculations in linear color
+space and converting to sRGB for display.
 */
 class ColorCurve: public PostProcessor
 {
 private:
        Program shprog;
        ProgramData shdata;
+       Texture1D curve;
+       Texturing texturing;
        const Mesh &quad;
 
 public:
@@ -33,7 +39,18 @@ public:
        saturated value. */
        void set_brightness(float);
 
-       virtual void render(const Texture2D &, const Texture2D &);
+       /** Sets the gamma value used for mapping output colors.  Allowed range is
+       from 0.1 to 10. */
+       void set_gamma(float);
+
+       /** Sets output mapping to sRGB.  This is almost, but not exactly equivalent
+       to set_gamma(2.2). */
+       void set_srgb();
+
+       /// Sets output mapping to linear.  This is equivalent to set_gamma(1).
+       void set_linear();
+
+       virtual void render(Renderer &, const Texture2D &, const Texture2D &);
 };
 
 } // namespace GL