mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 03:09:57 +01:00
New Shader Image Processing
Cleanup shaders and add image processing shader for source
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "Scene.h"
|
||||
#include "Primitives.h"
|
||||
#include "ImageShader.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
#include "MediaPlayer.h"
|
||||
|
||||
#include "imgui.h"
|
||||
@@ -111,7 +112,11 @@ void ImGuiVisitor::visit(Shader &n)
|
||||
{
|
||||
ImGui::PushID(n.id());
|
||||
|
||||
ImGui::ColorEdit3("color", glm::value_ptr(n.color) ) ;
|
||||
if (ImGuiToolkit::ButtonIcon(14, 8)) {
|
||||
n.color = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
||||
}
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::ColorEdit3("Color", glm::value_ptr(n.color) ) ;
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
@@ -120,13 +125,13 @@ void ImGuiVisitor::visit(ImageShader &n)
|
||||
{
|
||||
ImGui::PushID(n.id());
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(2, 1)) {
|
||||
if (ImGuiToolkit::ButtonIcon(4, 1)) {
|
||||
n.brightness = 0.f;
|
||||
n.contrast = 0.f;
|
||||
}
|
||||
ImGui::SameLine(0, 10);
|
||||
float bc[2] = { n.brightness, n.contrast};
|
||||
if ( ImGui::SliderFloat2("filter", bc, -1.0, 1.0) )
|
||||
if ( ImGui::SliderFloat2("B & C", bc, -1.0, 1.0) )
|
||||
{
|
||||
n.brightness = bc[0];
|
||||
n.contrast = bc[1];
|
||||
@@ -134,6 +139,63 @@ void ImGuiVisitor::visit(ImageShader &n)
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
{
|
||||
ImGui::PushID(n.id());
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(4, 1)) {
|
||||
n.brightness = 0.f;
|
||||
n.contrast = 0.f;
|
||||
}
|
||||
ImGui::SameLine(0, 10);
|
||||
float bc[2] = { n.brightness, n.contrast};
|
||||
if ( ImGui::SliderFloat2("B & C", bc, -1.0, 1.0) )
|
||||
{
|
||||
n.brightness = bc[0];
|
||||
n.contrast = bc[1];
|
||||
}
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(2, 1)) n.saturation = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderFloat("Saturation", &n.saturation, -1.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(12, 4)) n.hueshift = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderFloat("Hue shift", &n.hueshift, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(8, 1)) n.threshold = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderFloat("Threshold", &n.threshold, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(3, 1)) n.lumakey = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderFloat("Lumakey", &n.lumakey, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(18, 1)) n.nbColors = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderInt("Posterize", &n.nbColors, 0, 16);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(1, 7)) n.filter = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::Combo("Filter", &n.filter, "None\0Blur\0Sharpen\0Edge\0Emboss\0Erode 3x3\0Erode 5x5\0Erode 7x7\0Dilate 3x3\0Dilate 5x5\0Dilate 7x7\0");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(7, 1)) n.invert = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::Combo("Invert", &n.invert, "None\0Invert color\0Invert Luminance\0");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(14, 4)) n.chromadelta = 0.f;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SliderFloat("Chromakey", &n.chromadelta, 0.0, 1.0);
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(6, 4))
|
||||
n.chromakey = glm::vec4(0.f, 1.f, 0.f, 1.f);
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::ColorEdit3("Chroma color", glm::value_ptr(n.chromakey) ) ;
|
||||
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit(Scene &n)
|
||||
{
|
||||
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
|
||||
|
||||
Reference in New Issue
Block a user