mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-21 07:09:59 +01:00
Store RenderingWindows whitebalance in Settings
This commit is contained in:
@@ -120,7 +120,6 @@ DisplaysView::DisplaysView() : View(DISPLAYS)
|
|||||||
show_window_menu_ = false;
|
show_window_menu_ = false;
|
||||||
current_window_ = -1;
|
current_window_ = -1;
|
||||||
current_window_status_ = new Group;
|
current_window_status_ = new Group;
|
||||||
current_window_whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f);
|
|
||||||
draw_pending_ = false;
|
draw_pending_ = false;
|
||||||
|
|
||||||
// display actions : 0 = move output, 1 paint, 2 erase
|
// display actions : 0 = move output, 1 paint, 2 erase
|
||||||
@@ -380,6 +379,7 @@ void DisplaysView::draw()
|
|||||||
if (ImGuiToolkit::IconButton(18, 4, "More windows")) {
|
if (ImGuiToolkit::IconButton(18, 4, "More windows")) {
|
||||||
++Settings::application.num_output_windows;
|
++Settings::application.num_output_windows;
|
||||||
current_window_ = Settings::application.num_output_windows-1;
|
current_window_ = Settings::application.num_output_windows-1;
|
||||||
|
Settings::application.windows[1+current_window_].whitebalance = Rendering::manager().outputWindow(current_window_).whiteBalance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -420,13 +420,13 @@ void DisplaysView::draw()
|
|||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
window->DC.CursorPos.y += g.Style.FramePadding.y;
|
window->DC.CursorPos.y += g.Style.FramePadding.y;
|
||||||
|
|
||||||
if (ImGui::ColorButton("White balance", ImVec4(current_window_whitebalance.x,
|
if (ImGui::ColorButton("White balance", ImVec4(Settings::application.windows[1+current_window_].whitebalance.x,
|
||||||
current_window_whitebalance.y,
|
Settings::application.windows[1+current_window_].whitebalance.y,
|
||||||
current_window_whitebalance.z, 1.f),
|
Settings::application.windows[1+current_window_].whitebalance.z, 1.f),
|
||||||
ImGuiColorEditFlags_NoAlpha)) {
|
ImGuiColorEditFlags_NoAlpha)) {
|
||||||
whitebalancedialog.setRGB( std::make_tuple(current_window_whitebalance.x,
|
whitebalancedialog.setRGB( std::make_tuple(Settings::application.windows[1+current_window_].whitebalance.x,
|
||||||
current_window_whitebalance.y,
|
Settings::application.windows[1+current_window_].whitebalance.y,
|
||||||
current_window_whitebalance.z) );
|
Settings::application.windows[1+current_window_].whitebalance.z) );
|
||||||
whitebalancedialog.open();
|
whitebalancedialog.open();
|
||||||
}
|
}
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
@@ -434,12 +434,12 @@ void DisplaysView::draw()
|
|||||||
// get picked color if dialog finished
|
// get picked color if dialog finished
|
||||||
if (whitebalancedialog.closed()){
|
if (whitebalancedialog.closed()){
|
||||||
std::tuple<float, float, float> c = whitebalancedialog.RGB();
|
std::tuple<float, float, float> c = whitebalancedialog.RGB();
|
||||||
current_window_whitebalance.x = std::get<0>(c);
|
Settings::application.windows[1+current_window_].whitebalance.x = std::get<0>(c);
|
||||||
current_window_whitebalance.y = std::get<1>(c);
|
Settings::application.windows[1+current_window_].whitebalance.y = std::get<1>(c);
|
||||||
current_window_whitebalance.z = std::get<2>(c);
|
Settings::application.windows[1+current_window_].whitebalance.z = std::get<2>(c);
|
||||||
|
|
||||||
// set White Balance Color matrix to shader
|
// set White Balance Color matrix to shader
|
||||||
Rendering::manager().outputWindow(current_window_).setWhiteBalance( current_window_whitebalance );
|
Rendering::manager().outputWindow(current_window_).setWhiteBalance( Settings::application.windows[1+current_window_].whitebalance );
|
||||||
}
|
}
|
||||||
|
|
||||||
// White ballance temperature
|
// White ballance temperature
|
||||||
@@ -451,13 +451,13 @@ void DisplaysView::draw()
|
|||||||
{
|
{
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
||||||
ImGuiToolkit::Indication("9000 K", " " ICON_FA_THERMOMETER_FULL);
|
ImGuiToolkit::Indication("9000 K", " " ICON_FA_THERMOMETER_FULL);
|
||||||
if ( ImGui::VSliderFloat("##Temperature", ImVec2(30,260), ¤t_window_whitebalance.w, 0.0, 1.0, "") ){
|
if ( ImGui::VSliderFloat("##Temperature", ImVec2(30,260), &Settings::application.windows[1+current_window_].whitebalance.w, 0.0, 1.0, "") ){
|
||||||
|
|
||||||
Rendering::manager().outputWindow(current_window_).setWhiteBalance( current_window_whitebalance );
|
Rendering::manager().outputWindow(current_window_).setWhiteBalance( Settings::application.windows[1+current_window_].whitebalance );
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) {
|
if (ImGui::IsItemHovered() || ImGui::IsItemActive() ) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::Text("%d K", 4000 + (int) ceil(current_window_whitebalance.w * 5000.f));
|
ImGui::Text("%d K", 4000 + (int) ceil(Settings::application.windows[1+current_window_].whitebalance.w * 5000.f));
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGuiToolkit::Indication("4000 K", " " ICON_FA_THERMOMETER_EMPTY);
|
ImGuiToolkit::Indication("4000 K", " " ICON_FA_THERMOMETER_EMPTY);
|
||||||
@@ -578,7 +578,6 @@ std::pair<Node *, glm::vec2> DisplaysView::pick(glm::vec2 P)
|
|||||||
|
|
||||||
// test all windows
|
// test all windows
|
||||||
current_window_ = -1;
|
current_window_ = -1;
|
||||||
current_window_whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f);
|
|
||||||
|
|
||||||
for (int i = 0; i < Settings::application.num_output_windows; ++i) {
|
for (int i = 0; i < Settings::application.num_output_windows; ++i) {
|
||||||
|
|
||||||
@@ -597,7 +596,6 @@ std::pair<Node *, glm::vec2> DisplaysView::pick(glm::vec2 P)
|
|||||||
(pick.first == windows_[i].handles_) ||
|
(pick.first == windows_[i].handles_) ||
|
||||||
(pick.first == windows_[i].menu_) ) {
|
(pick.first == windows_[i].menu_) ) {
|
||||||
current_window_ = i;
|
current_window_ = i;
|
||||||
current_window_whitebalance = Rendering::manager().outputWindow(current_window_).whiteBalance();
|
|
||||||
windows_[i].overlays_->setActive(1);
|
windows_[i].overlays_->setActive(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -80,23 +80,8 @@ private:
|
|||||||
std::vector<WindowPreview> windows_;
|
std::vector<WindowPreview> windows_;
|
||||||
int current_window_;
|
int current_window_;
|
||||||
Group *current_window_status_;
|
Group *current_window_status_;
|
||||||
glm::vec4 current_window_whitebalance;
|
|
||||||
bool show_window_menu_;
|
bool show_window_menu_;
|
||||||
|
|
||||||
// Group *window_;
|
|
||||||
// Group *window_status_;
|
|
||||||
// Surface *window_surface_;
|
|
||||||
// Surface *window_render_;
|
|
||||||
// Switch *window_overlays_;
|
|
||||||
// Switch *window_mode_;
|
|
||||||
// Handles *window_handles_;
|
|
||||||
// Handles *window_menu_;
|
|
||||||
// Handles *window_icon_;
|
|
||||||
// Surface *window_title_;
|
|
||||||
// Symbol *window_fullscreen_;
|
|
||||||
//// Surface *preview_surface_;
|
|
||||||
// std::string window_monitor_;
|
|
||||||
|
|
||||||
// bool window_selected_;
|
// bool window_selected_;
|
||||||
int display_action_;
|
int display_action_;
|
||||||
|
|
||||||
|
|||||||
@@ -1109,11 +1109,12 @@ glm::vec4 RenderingWindow::whiteBalance() const
|
|||||||
{
|
{
|
||||||
glm::vec4 ret(1.f, 1.f, 1.f, 0.5f);
|
glm::vec4 ret(1.f, 1.f, 1.f, 0.5f);
|
||||||
|
|
||||||
|
if (shader_) {
|
||||||
ret.x = shader_->uniforms_["Red"];
|
ret.x = shader_->uniforms_["Red"];
|
||||||
ret.y = shader_->uniforms_["Green"];
|
ret.y = shader_->uniforms_["Green"];
|
||||||
ret.z = shader_->uniforms_["Blue"];
|
ret.z = shader_->uniforms_["Blue"];
|
||||||
ret.w = shader_->uniforms_["Temperature"];
|
ret.w = shader_->uniforms_["Temperature"];
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ void Settings::Save(uint64_t runtime)
|
|||||||
window->SetAttribute("s", w.scaled);
|
window->SetAttribute("s", w.scaled);
|
||||||
window->SetAttribute("d", w.decorated);
|
window->SetAttribute("d", w.decorated);
|
||||||
window->SetAttribute("m", w.monitor.c_str());
|
window->SetAttribute("m", w.monitor.c_str());
|
||||||
|
window->InsertEndChild( XMLElementFromGLM(&xmlDoc, w.whitebalance) );
|
||||||
windowsNode->InsertEndChild(window);
|
windowsNode->InsertEndChild(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,6 +518,9 @@ void Settings::Load()
|
|||||||
w.name = APP_NAME " output " + std::to_string(i);
|
w.name = APP_NAME " output " + std::to_string(i);
|
||||||
else
|
else
|
||||||
w.name = APP_TITLE;
|
w.name = APP_TITLE;
|
||||||
|
|
||||||
|
tinyxml2::XMLElementToGLM( windowNode->FirstChildElement("vec4"), w.whitebalance);
|
||||||
|
|
||||||
application.windows[i] = w;
|
application.windows[i] = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,12 @@ struct WindowConfig
|
|||||||
bool decorated;
|
bool decorated;
|
||||||
std::string monitor;
|
std::string monitor;
|
||||||
bool show_pattern;
|
bool show_pattern;
|
||||||
|
glm::vec4 whitebalance;
|
||||||
|
|
||||||
WindowConfig() : name(APP_TITLE), x(15), y(15), w(1280), h(720),
|
WindowConfig() : name(APP_TITLE), x(15), y(15), w(1280), h(720),
|
||||||
fullscreen(false), scaled(false), decorated(true), monitor(""), show_pattern(false) { }
|
fullscreen(false), scaled(false), decorated(true),
|
||||||
|
monitor(""), show_pattern(false), whitebalance(glm::vec4(1.f, 1.f, 1.f, 0.5f))
|
||||||
|
{ }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user