]> git.tdb.fi Git - libs/gl.git/blobdiff - source/colorcurve.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / colorcurve.cpp
diff --git a/source/colorcurve.cpp b/source/colorcurve.cpp
deleted file mode 100644 (file)
index d008593..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "colorcurve.h"
-#include "mesh.h"
-#include "shader.h"
-#include "texture2d.h"
-
-using namespace std;
-
-namespace {
-
-static const char fragment_src[] =
-       "uniform sampler2D texture;\n"
-       "uniform float peak;\n"
-       "uniform float brightness;\n"
-       "varying vec2 texcoord;\n"
-       "void main()\n"
-       "{\n"
-       "       vec4 sample = texture2D(texture, texcoord);\n"
-       "       float maxc = max(sample.r, max(sample.g, sample.b));\n"
-       "       if(maxc>1.0-peak)\n"
-       "       {\n"
-       "               vec3 saturated = sample.rgb/maxc;\n"
-       "               if(maxc>1.0+peak)\n"
-       "               {\n"
-       "                       gl_FragColor.rgb = mix(vec3(1.0), saturated, 1.0/pow(brightness, maxc-1-peak));\n"
-       "               }\n"
-       "               else\n"
-       "               {\n"
-       "                       float x = (1.0+peak-maxc)/(2.0*peak);\n"
-       "                       gl_FragColor.rgb = saturated.rgb*(1.0-peak+(1-x*x)*peak);\n"
-       "               }\n"
-       "               gl_FragColor.a = sample.a;\n"
-       "       }\n"
-       "       else\n"
-       "               gl_FragColor = sample;\n"
-       "}";
-
-}
-
-namespace Msp {
-namespace GL {
-
-ColorCurve::ColorCurve():
-       quad(get_fullscreen_quad())
-{
-       shprog.attach_shader(get_fullscreen_vertex_shader());
-       shprog.attach_shader_owned(new FragmentShader(fragment_src));
-       shprog.link();
-
-       set_peak(0.2);
-       set_brightness(1.5);
-}
-
-void ColorCurve::set_peak(float p)
-{
-       if(p<0 || p>1)
-               throw invalid_argument("ColorCurve::set_peak");
-       shdata.uniform("peak", p);
-}
-
-void ColorCurve::set_brightness(float b)
-{
-       if(b<1)
-               throw invalid_argument("ColorCurve::set_brightness");
-       shdata.uniform("brightness", b);
-}
-
-void ColorCurve::render(const Texture2D &color_buf, const Texture2D &)
-{
-       Bind _bind_shader(shprog);
-       shdata.apply();
-       Bind _bind_tex(color_buf);
-       quad.draw();
-}
-
-} // namespace GL
-} // namespace Msp