]> git.sesse.net Git - movit/blobdiff - white_balance_effect.cpp
Remove C++11 dependency from ResampleEffect.
[movit] / white_balance_effect.cpp
index 2c99ca85c0b791379bd9e564ce2770df467e4664..07c95cac4ca473b52dda9f9d80ddbf9fda918a52 100644 (file)
@@ -1,15 +1,19 @@
 #include <Eigen/Core>
 #include <Eigen/LU>
-#include <GL/glew.h>
+#include <epoxy/gl.h>
 #include <assert.h>
 
 #include "colorspace_conversion_effect.h"
 #include "d65.h"
 #include "effect_util.h"
+#include "image_format.h"
 #include "util.h"
 #include "white_balance_effect.h"
 
 using namespace Eigen;
+using namespace std;
+
+namespace movit {
 
 namespace {
 
@@ -101,14 +105,15 @@ WhiteBalanceEffect::WhiteBalanceEffect()
 {
        register_vec3("neutral_color", (float *)&neutral_color);
        register_float("output_color_temperature", &output_color_temperature);
+       register_uniform_mat3("correction_matrix", &uniform_correction_matrix);
 }
 
-std::string WhiteBalanceEffect::output_fragment_shader()
+string WhiteBalanceEffect::output_fragment_shader()
 {
        return read_file("white_balance_effect.frag");
 }
 
-void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Matrix3d rgb_to_xyz_matrix = ColorspaceConversionEffect::get_xyz_matrix(COLORSPACE_sRGB);
        Vector3d rgb(neutral_color.r, neutral_color.g, neutral_color.b);
@@ -138,11 +143,12 @@ void WhiteBalanceEffect::set_gl_state(GLuint glsl_program_num, const std::string
         * Note that since we postmultiply our vectors, the order of the matrices
         * has to be the opposite of the execution order.
         */
-       Matrix3d corr_matrix =
+       uniform_correction_matrix =
                rgb_to_xyz_matrix.inverse() *
                Map<const Matrix3d>(xyz_to_lms_matrix).inverse() *
                lms_scale.asDiagonal() *
                Map<const Matrix3d>(xyz_to_lms_matrix) *
                rgb_to_xyz_matrix;
-       set_uniform_mat3(glsl_program_num, prefix, "correction_matrix", corr_matrix);
 }
+
+}  // namespace movit