From 000728b708b35a173510fd442ef8d72491fff6e5 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sat, 6 Jun 2020 00:27:07 +0200 Subject: [PATCH] slight adjustment stippling and layers view --- Mixer.cpp | 2 +- RenderingManager.h | 1 + Source.cpp | 6 +++++- UserInterfaceManager.cpp | 19 +++++++++++++------ rsc/shaders/image.fs | 4 ++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Mixer.cpp b/Mixer.cpp index ef180c1..2dcea15 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -219,7 +219,7 @@ Source * Mixer::createSourceFile(std::string path) // test type of file by extension std::string ext = SystemToolkit::extension_filename(path); - if ( ext == "vmx" ) + if ( ext == "mix" ) { // create a session source SessionSource *ss = new SessionSource(); diff --git a/RenderingManager.h b/RenderingManager.h index 7f04af7..100ca0a 100644 --- a/RenderingManager.h +++ b/RenderingManager.h @@ -118,6 +118,7 @@ public: // get hold on the main window inline RenderingWindow& mainWindow() { return main_; } + inline RenderingWindow& outputWindow() { return output_; } // request screenshot void requestScreenshot(); diff --git a/Source.cpp b/Source.cpp index e757f08..60e068f 100644 --- a/Source.cpp +++ b/Source.cpp @@ -92,6 +92,10 @@ Source::Source() : initialized_(false), need_update_(true) overlays_[View::LAYER] = new Group; overlays_[View::LAYER]->translation_.z = 0.15; overlays_[View::LAYER]->visible_ = false; + frame = new Frame(Frame::ROUND_LARGE); + frame->translation_.z = 0.1; + frame->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f); + overlays_[View::LAYER]->attach(frame); groups_[View::LAYER]->attach(overlays_[View::LAYER]); // will be associated to nodes later @@ -159,7 +163,7 @@ void Source::attach(FrameBuffer *renderbuffer) groups_[View::RENDERING]->attach(rendersurface_); groups_[View::GEOMETRY]->attach(rendersurface_); groups_[View::MIXING]->attach(rendersurface_); - groups_[View::LAYER]->attach(rendersurface_); +// groups_[View::LAYER]->attach(rendersurface_); // for mixing view, add another surface to overlay (for stippled view in transparency) Surface *surfacemix = new FrameBufferSurface(renderbuffer_); diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 1261f35..a4ddf35 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -70,7 +70,7 @@ static void SessionFileDialogOpen(std::string path) sessionFileDialogLoadFinished_ = false; char const * open_file_name; - char const * open_pattern[1] = { "*.vmx" }; + char const * open_pattern[1] = { "*.mix" }; open_file_name = tinyfd_openFileDialog( "Open a session file", path.c_str(), 1, open_pattern, "vimix session", 0); @@ -88,7 +88,7 @@ static void SessionFileDialogSave(std::string path) sessionFileDialogSaveFinished_ = false; char const * save_file_name; - char const * save_pattern[1] = { "*.vmx" }; + char const * save_pattern[1] = { "*.mix" }; save_file_name = tinyfd_saveFileDialog( "Save a session file", path.c_str(), 1, save_pattern, "vimix session"); @@ -99,8 +99,8 @@ static void SessionFileDialogSave(std::string path) sessionFileDialogFilename_ = std::string( save_file_name ); // check extension std::string extension = sessionFileDialogFilename_.substr(sessionFileDialogFilename_.find_last_of(".") + 1); - if (extension != "vmx") - sessionFileDialogFilename_ += ".vmx"; + if (extension != "mix") + sessionFileDialogFilename_ += ".mix"; } sessionFileDialogSaveFinished_ = true; @@ -112,7 +112,7 @@ static void ImportFileDialogOpen(char *filename, std::atomic *success, con return; fileDialogPending_ = true; - char const * open_pattern[18] = { "*.vmx", "*.mp4", "*.mpg", "*.avi", "*.mov", "*.mkv", "*.webm", "*.mod", "*.wmv", "*.mxf", "*.ogg", "*.flv", "*.asf", "*.jpg", "*.png", "*.gif", "*.tif", "*.svg" }; + char const * open_pattern[18] = { "*.mix", "*.mp4", "*.mpg", "*.avi", "*.mov", "*.mkv", "*.webm", "*.mod", "*.wmv", "*.mxf", "*.ogg", "*.flv", "*.asf", "*.jpg", "*.png", "*.gif", "*.tif", "*.svg" }; char const * open_file_name; open_file_name = tinyfd_openFileDialog( "Import a file", path.c_str(), 18, open_pattern, "All supported formats", 0); @@ -665,6 +665,13 @@ void UserInterface::RenderPreview() float width = ImGui::GetContentRegionAvail().x; ImVec2 imagesize ( width, width / ar); + // virtual button to show the output window when clic on the preview + ImVec2 draw_pos = ImGui::GetCursorScreenPos(); + if (ImGui::Selectable("##preview", false, ImGuiSelectableFlags_PressedOnClick, imagesize)) + Rendering::manager().outputWindow().show(); + ImGui::SetCursorScreenPos(draw_pos); + + // preview image ImGui::Image((void*)(intptr_t)output->texture(), imagesize); ImGui::End(); @@ -1193,7 +1200,7 @@ void Navigator::RenderNewPannel() // helper ImGui::SetCursorPosX(pannel_width_ - 30 + IMGUI_RIGHT_ALIGN); - ImGuiToolkit::HelpMarker("Create a source from a file:\n- Video (*.mpg, *mov, *.avi, etc.)\n- Image (*.jpg, *.png, etc.)\n- Vector graphics (*.svg)\n- vimix session (*.vmx)\n\nEquivalent to dropping the file in the workspace."); + ImGuiToolkit::HelpMarker("Create a source from a file:\n- Video (*.mpg, *mov, *.avi, etc.)\n- Image (*.jpg, *.png, etc.)\n- Vector graphics (*.svg)\n- vimix session (*.mix)\n\nEquivalent to dropping the file in the workspace."); // browse for a filename static std::atomic file_selected = false; diff --git a/rsc/shaders/image.fs b/rsc/shaders/image.fs index 5cefa63..b54e692 100644 --- a/rsc/shaders/image.fs +++ b/rsc/shaders/image.fs @@ -23,8 +23,8 @@ 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 : 0.8; + A -= stipple * ( int(gl_FragCoord.x + gl_FragCoord.y) % 2 > 0 ? 0.0 : 9.0 ); // output RGBA - FragColor = vec4(RGB, A); + FragColor = vec4(RGB, clamp(A, 0.0, 1.0) ); }