diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 2f90aa0..173c045 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -171,7 +171,8 @@ void ImGuiVisitor::visit(Shader &n) // ImGui::SameLine(0, 5); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); int mode = n.blending; - if (ImGui::Combo("Blending", &mode, "Normal\0Screen\0Subtract\0Multiply\0Soft light\0Soft subtract\0Lighten only\0None\0") ) { + if (ImGui::Combo("Blending", &mode, "Normal\0Screen\0Subtract\0Multiply\0Soft light" + "\0Hard light\0Soft subtract\0Lighten only\0") ) { n.blending = Shader::BlendMode(mode); std::ostringstream oss; @@ -189,6 +190,9 @@ void ImGuiVisitor::visit(Shader &n) case Shader::BLEND_MULTIPLY: oss<<"Multiply"; break; + case Shader::BLEND_HARD_LIGHT: + oss<<"Hard light"; + break; case Shader::BLEND_SOFT_LIGHT: oss<<"Soft light"; break; diff --git a/Shader.cpp b/Shader.cpp index aac55b0..6362128 100644 --- a/Shader.cpp +++ b/Shader.cpp @@ -24,29 +24,32 @@ ShadingProgram *ShadingProgram::currentProgram_ = nullptr; ShadingProgram simpleShadingProgram("shaders/simple.vs", "shaders/simple.fs"); // Blending presets for matching with Shader::BlendModes: -GLenum blending_equation[8] = { GL_FUNC_ADD, // normal +GLenum blending_equation[9] = { GL_FUNC_ADD, // normal GL_FUNC_ADD, // screen GL_FUNC_REVERSE_SUBTRACT, // subtract GL_FUNC_ADD, // multiply GL_FUNC_ADD, // soft light + GL_FUNC_ADD, // hard light GL_FUNC_REVERSE_SUBTRACT, // soft subtract GL_MAX, // lighten only GL_FUNC_ADD}; -GLenum blending_source_function[8] = { GL_ONE, // normal +GLenum blending_source_function[9] = { GL_ONE, // normal GL_ONE, // screen GL_SRC_COLOR, // subtract (can be GL_ONE) GL_DST_COLOR, // multiply : src x dst color GL_DST_COLOR, // soft light : src x dst color + GL_SRC_COLOR, // hard light : src x src color GL_DST_COLOR, // soft subtract GL_ONE, // lighten only GL_ONE}; -GLenum blending_destination_function[8] = {GL_ONE_MINUS_SRC_ALPHA,// normal - GL_ONE, // screen - GL_ONE, // subtract +GLenum blending_destination_function[9] = {GL_ONE_MINUS_SRC_ALPHA,// normal + GL_ONE, // screen + GL_ONE, // subtract GL_ONE_MINUS_SRC_ALPHA, // multiply - GL_ONE, // soft light - GL_ONE, // soft subtract - GL_ONE, // lighten only + GL_ONE, // soft light + GL_ONE, // hard light + GL_ONE, // soft subtract + GL_ONE, // lighten only GL_ZERO}; ShadingProgram::ShadingProgram(const std::string& vertex_file, const std::string& fragment_file) : vertex_id_(0), fragment_id_(0), id_(0) diff --git a/Shader.h b/Shader.h index ee8e551..4ae850c 100644 --- a/Shader.h +++ b/Shader.h @@ -64,6 +64,7 @@ public: BLEND_SUBTRACT, BLEND_MULTIPLY, BLEND_SOFT_LIGHT, + BLEND_HARD_LIGHT, BLEND_SOFT_SUBTRACT, BLEND_LIGHTEN_ONLY, BLEND_NONE