mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Changed a bit the mixing process; source color is adjusted with gamma
RGB, not a global blending color.
This commit is contained in:
@@ -150,8 +150,8 @@ void ImGuiVisitor::visit(Shader &n)
|
||||
n.color = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
||||
}
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::ColorEdit3("Color", glm::value_ptr(n.color), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel ) ;
|
||||
ImGui::SameLine(0, 5);
|
||||
// ImGui::ColorEdit3("Color", glm::value_ptr(n.color), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel ) ;
|
||||
// ImGui::SameLine(0, 5);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
int mode = n.blending;
|
||||
if (ImGui::Combo("Blending", &mode, "Normal\0Screen\0Inverse\0Addition\0Subtract\0") )
|
||||
@@ -187,6 +187,17 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
{
|
||||
ImGui::PushID(n.id());
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(4, 0)) n.gamma = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
||||
float g[3] = { n.gamma.x, n.gamma.y, n.gamma.z};
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if ( ImGui::SliderFloat3("RGB", g, 1.0, 10.0) )
|
||||
{
|
||||
n.gamma.x = g[0];
|
||||
n.gamma.y = g[1];
|
||||
n.gamma.z = g[2];
|
||||
}
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(4, 1)) {
|
||||
n.brightness = 0.f;
|
||||
n.contrast = 0.f;
|
||||
@@ -205,6 +216,7 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Saturation", &n.saturation, -1.0, 1.0);
|
||||
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(12, 4)) n.hueshift = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
|
||||
10
Shader.cpp
10
Shader.cpp
@@ -173,7 +173,7 @@ void ShadingProgram::checkLinkingErr()
|
||||
Shader::Shader() : blending(BLEND_OPACITY)
|
||||
{
|
||||
// create unique id
|
||||
auto duration = std::chrono::system_clock::now().time_since_epoch();
|
||||
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
|
||||
id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000;
|
||||
|
||||
program_ = &simpleShadingProgram;
|
||||
@@ -204,11 +204,11 @@ void Shader::use()
|
||||
// Blending Function
|
||||
if ( blending != BLEND_CUSTOM) {
|
||||
glEnable(GL_BLEND);
|
||||
// glBlendEquation(blending_equation[blending]);
|
||||
// glBlendFunc(blending_source_function[blending], blending_destination_function[blending]);
|
||||
glBlendEquation(blending_equation[blending]);
|
||||
glBlendFunc(blending_source_function[blending], blending_destination_function[blending]);
|
||||
|
||||
glBlendEquationSeparate(blending_equation[blending], GL_MAX);
|
||||
glBlendFuncSeparate(blending_source_function[blending], blending_destination_function[blending], GL_ONE_MINUS_SRC_ALPHA, GL_ZERO);
|
||||
// glBlendEquationSeparate(blending_equation[blending], GL_FUNC_ADD);
|
||||
// glBlendFuncSeparate(blending_source_function[blending], blending_destination_function[blending], GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -44,11 +44,9 @@ Source::Source() : initialized_(false), need_update_(true)
|
||||
frame->translation_.z = 0.1;
|
||||
frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f);
|
||||
overlays_[View::MIXING]->attach(frame);
|
||||
|
||||
Icon *center = new Icon(Icon::GENERIC);
|
||||
center->translation_.z = 0.1;
|
||||
overlays_[View::MIXING]->attach(center);
|
||||
|
||||
groups_[View::MIXING]->attach(overlays_[View::MIXING]);
|
||||
|
||||
// default geometry nodes
|
||||
|
||||
@@ -23,7 +23,7 @@ void main()
|
||||
float maskIntensity = (maskColor.r + maskColor.g + maskColor.b) / 3.0;
|
||||
|
||||
float A = textureColor.a * vertexColor.a * color.a * maskIntensity;
|
||||
A *= int(gl_FragCoord.x + gl_FragCoord.y) % 2 > (1 - int(stipple)) ? 0.0 : 1.0;
|
||||
A *= int(gl_FragCoord.x + gl_FragCoord.y) % 2 > (1 - int(stipple)) ? 0.0 : 0.8;
|
||||
|
||||
// output RGBA
|
||||
FragColor = vec4(RGB, A);
|
||||
|
||||
Reference in New Issue
Block a user