]> git.tdb.fi Git - libs/gl.git/blobdiff - source/colorcurve.h
Remove the deprecated ProgramBuilder class
[libs/gl.git] / source / colorcurve.h
index f66ff976d7a0d06dc020980239b9adcf0676d008..3f65b04916897c6d85bde7ec4f33fece160a3cd1 100644 (file)
@@ -1,18 +1,19 @@
-#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 "postprocessor.h"
 #include "program.h"
 #include "programdata.h"
 #include "texture1d.h"
+#include "texturing.h"
 
 namespace Msp {
 namespace GL {
 
 /**
 Processes oversaturated colors to preserve hues.  When one color component
 
 namespace Msp {
 namespace GL {
 
 /**
 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.
+exceeds 1.0, the overflow is distributed to the other components, scaling the
+color towards white.
 
 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
 
 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
@@ -20,22 +21,47 @@ space and converting to sRGB for display.
 */
 class ColorCurve: public PostProcessor
 {
 */
 class ColorCurve: public PostProcessor
 {
+public:
+       struct Template: public PostProcessor::Template
+       {
+               class Loader: public DataFile::DerivedObjectLoader<Template, PostProcessor::Template::Loader>
+               {
+               public:
+                       Loader(Template &);
+
+               private:
+                       void gamma(float);
+                       void srgb();
+               };
+
+               float exposure_adjust;
+               float brightness_response;
+               float gamma;
+               bool srgb;
+
+               Template();
+
+               virtual ColorCurve *create(unsigned, unsigned) const;
+       };
+
 private:
        Program shprog;
        ProgramData shdata;
        Texture1D curve;
 private:
        Program shprog;
        ProgramData shdata;
        Texture1D curve;
-       const Mesh &quad;
+       Texturing texturing;
+       RefPtr<Mesh> quad;
+       RefPtr<Sampler> linear_sampler;
+       RefPtr<Sampler> nearest_sampler;
 
 public:
        ColorCurve();
 
 
 public:
        ColorCurve();
 
-       /// Sets the size of the peak zone.  Must be between 0 and 1, inclusive.
-       void set_peak(float);
+       /** Set exposure adjustment in EV units.  Positive values brighten the
+       image, negative values darken it.  Zero is neutral. */
+       void set_exposure_adjust(float);
 
 
-       /** Sets brightness for oversaturated colors.  Must be >= 1.  Suggested
-       values are between 1.5 and 2.0; a value of 1.0 will clamp colors to the
-       saturated value. */
-       void set_brightness(float);
+       /** Sets the exponent of the */
+       void set_brightness_response(float);
 
        /** Sets the gamma value used for mapping output colors.  Allowed range is
        from 0.1 to 10. */
 
        /** Sets the gamma value used for mapping output colors.  Allowed range is
        from 0.1 to 10. */
@@ -48,7 +74,7 @@ public:
        /// Sets output mapping to linear.  This is equivalent to set_gamma(1).
        void set_linear();
 
        /// Sets output mapping to linear.  This is equivalent to set_gamma(1).
        void set_linear();
 
-       virtual void render(const Texture2D &, const Texture2D &);
+       virtual void render(Renderer &, const Texture2D &, const Texture2D &);
 };
 
 } // namespace GL
 };
 
 } // namespace GL