mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Cleanup ImguiVisitor & image shaders interface
This commit is contained in:
@@ -115,8 +115,6 @@ void ImGuiVisitor::visit(MediaPlayer &n)
|
||||
|
||||
void ImGuiVisitor::visit(Shader &n)
|
||||
{
|
||||
float width = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
ImGui::PushID(n.id());
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(10, 2)) {
|
||||
@@ -149,9 +147,9 @@ void ImGuiVisitor::visit(ImageShader &n)
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(RIGHT_ALIGN);
|
||||
// combo list of masks
|
||||
if ( ImGui::Combo("Mask", &item_current, ImageShader::mask_names, ImageShader::mask_presets.size()+1 ) )
|
||||
if ( ImGui::Combo("Mask", &item_current, ImageShader::mask_names, IM_ARRAYSIZE(ImageShader::mask_names) ) )
|
||||
{
|
||||
if (item_current < ImageShader::mask_presets.size())
|
||||
if (item_current < (int) ImageShader::mask_presets.size())
|
||||
n.mask = ImageShader::mask_presets[item_current];
|
||||
else {
|
||||
// TODO ask for custom mask
|
||||
@@ -206,14 +204,11 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
if (ImGuiToolkit::ButtonIcon(1, 7)) n.filterid = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(RIGHT_ALIGN);
|
||||
ImGui::Combo("Filter", &n.filterid, "None\0Blur\0Sharpen\0Edge\0Emboss\0Denoising\0Erode 3x3\0Erode 5x5\0Erode 7x7\0Dilate 3x3\0Dilate 5x5\0Dilate 7x7\0");
|
||||
ImGui::Combo("Filter", &n.filterid, ImageProcessingShader::filter_names, IM_ARRAYSIZE(ImageProcessingShader::filter_names) );
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(7, 1)) n.invert = 0;
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(RIGHT_ALIGN);
|
||||
// static const char* invert_names[3] = { "None", "Color", "Luminance" };
|
||||
// const char* current_invert_name = invert_names[n.invert];
|
||||
// ImGui::SliderInt("Invert", &n.invert, 0, 2, current_invert_name);
|
||||
ImGui::Combo("Invert", &n.invert, "None\0Invert Color\0Invert Luminance\0");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(13, 4)) {
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
ShadingProgram imageProcessingShadingProgram("shaders/image.vs", "shaders/imageprocessing.fs");
|
||||
|
||||
const char* ImageProcessingShader::filter_names[12] = { "None", "Blur", "Sharpen", "Edge", "Emboss", "Denoising",
|
||||
"Erosion 3x3", "Erosion 5x5", "Erosion 7x7", "Dilation 3x3", "Dilation 5x5", "Dilation 7x7" };
|
||||
|
||||
|
||||
ImageProcessingShader::ImageProcessingShader()
|
||||
{
|
||||
program_ = &imageProcessingShadingProgram;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "Shader.h"
|
||||
|
||||
|
||||
class ImageProcessingShader : public Shader
|
||||
{
|
||||
public:
|
||||
@@ -41,6 +42,7 @@ public:
|
||||
// [5] 1 x convolution opening (denoising)
|
||||
// [6 11] 6 x convolutions: erosion 3x3, 5x5, 7x7, dilation 3x3, 5x5, 7x7
|
||||
int filterid;
|
||||
static const char* filter_names[12];
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
uint mask;
|
||||
float stipple;
|
||||
|
||||
static const char* mask_names[];
|
||||
static const char* mask_names[10];
|
||||
static std::vector< uint > mask_presets;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user