]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/colorcurve.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / effects / colorcurve.h
index e34834aa4e72bf83311b8b9bc41fd657c1d2ba83..99263407d965bccaea891025a8ef7df035f67dea 100644 (file)
@@ -2,17 +2,21 @@
 #define MSP_GL_COLORCURVE_H_
 
 #include "postprocessor.h"
-#include "program.h"
 #include "programdata.h"
 #include "texture1d.h"
 
 namespace Msp {
 namespace GL {
 
+class Program;
+
 /**
-Processes oversaturated colors to preserve hues.  When one color component
-exceeds 1.0, the overflow is distributed to the other components, scaling the
-color towards white.
+Maps high dynamic range colors to 8-bit and applies gamma correction.
+
+An exponential curve (with exponent less than or equal to 1) is applied to
+simulate the response of the human eye.  If the maximum color component of the
+result exceeds 1, the overflow is distributed to the other components to
+increase the apparent brightness without changing the hue.
 
 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
@@ -33,14 +37,12 @@ public:
                        void srgb();
                };
 
-               float exposure_adjust;
-               float brightness_response;
-               float gamma;
-               bool srgb;
+               float exposure_adjust = 0.0f;
+               float brightness_response = 0.4f;
+               float gamma = 1.0f;
+               bool srgb = false;
 
-               Template();
-
-               virtual ColorCurve *create(Resources &, unsigned, unsigned) const;
+               virtual ColorCurve *create(unsigned, unsigned) const;
        };
 
 private:
@@ -52,13 +54,15 @@ private:
        const Sampler &nearest_sampler;
 
 public:
-       ColorCurve(Resources &);
+       ColorCurve();
 
        /** Set exposure adjustment in EV units.  Positive values brighten the
        image, negative values darken it.  Zero is neutral. */
        void set_exposure_adjust(float);
 
-       /** Sets the exponent of the */
+       /** Sets the exponent of the brightness response curve.  It must be greater
+       than zero and at most one.  A value of one gives a linear response; closer
+       to zero results in a more gentle curve. */
        void set_brightness_response(float);
 
        /** Sets the gamma value used for mapping output colors.  Allowed range is
@@ -73,6 +77,8 @@ public:
        void set_linear();
 
        virtual void render(Renderer &, const Texture2D &, const Texture2D &);
+
+       virtual void set_debug_name(const std::string &);
 };
 
 } // namespace GL