From cecb961faa88d8b3f37e61983850016e6988e1de Mon Sep 17 00:00:00 2001 From: Jannis Maier Date: Fri, 16 Aug 2024 15:06:19 +0200 Subject: [PATCH] Small UI fixes --- Intern/rayx-core/src/Tracer/Tracer.cpp | 2 +- Intern/rayx-ui/src/RayProcessing.cpp | 2 +- .../rayx-ui/src/UserInterface/UIHandler.cpp | 41 ++++++++----------- Intern/rayx-ui/src/UserInterface/UIHandler.h | 1 - 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Intern/rayx-core/src/Tracer/Tracer.cpp b/Intern/rayx-core/src/Tracer/Tracer.cpp index cbd9098a..859efa8d 100644 --- a/Intern/rayx-core/src/Tracer/Tracer.cpp +++ b/Intern/rayx-core/src/Tracer/Tracer.cpp @@ -46,7 +46,7 @@ Tracer::Tracer(const DeviceConfig& deviceConfig) { for (const auto& device : deviceConfig.devices) { if (device.enable) { - RAYX_LOG << "Creating tracer with device: " << device.name; + RAYX_VERB << "Creating tracer with device: " << device.name; m_deviceTracer = createDeviceTracer(device.type, device.index); break; } diff --git a/Intern/rayx-ui/src/RayProcessing.cpp b/Intern/rayx-ui/src/RayProcessing.cpp index 6acf768f..305fcab0 100644 --- a/Intern/rayx-ui/src/RayProcessing.cpp +++ b/Intern/rayx-ui/src/RayProcessing.cpp @@ -42,7 +42,7 @@ void displayFilterSlider(size_t& amountOfRays, size_t maxAmountOfRays, bool& dis // Display the actual number of rays next to the slider ImGui::SameLine(); ImGui::Text("%zu", amountOfRays); - ImGui::Checkbox("Render all rays", &renderAllRays); + ImGui::Checkbox("Show all rays", &renderAllRays); if (!displayRays) { ImGui::EndDisabled(); // End grey out } diff --git a/Intern/rayx-ui/src/UserInterface/UIHandler.cpp b/Intern/rayx-ui/src/UserInterface/UIHandler.cpp index 65d71793..101fe960 100644 --- a/Intern/rayx-ui/src/UserInterface/UIHandler.cpp +++ b/Intern/rayx-ui/src/UserInterface/UIHandler.cpp @@ -284,7 +284,6 @@ void UIHandler::setupUI(UIParameters& uiParams) { showUISettingsWindow(uiParams); showMissingFilePopupWindow(uiParams); showSimulationSettingsPopupWindow(uiParams); - showSettingsWindow(); m_BeamlineOutliner.showBeamlineOutlineWindow(uiParams); showHotkeysWindow(); ImGui::End(); @@ -372,10 +371,20 @@ void UIHandler::showUISettingsWindow(UIParameters& uiParams) { ImGui::ColorEdit3("Color", (float*)&m_ClearColor); ImGui::SliderFloat("Scale", &m_scale, 0.1f, 4.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); + if (ImGui::Button("Toggle Theme")) { + m_isDarkTheme = !m_isDarkTheme; // Toggle theme + if (m_isDarkTheme) { + applyDarkTheme(); + } else { + applyLightTheme(); + } + } + + // checkbox + ImGui::Checkbox("Load h5 with RML", &m_loadh5withRML); ImGui::Separator(); - uiParams.camController.displaySettings(); - ImGui::Separator(); + if (!uiParams.rmlPath.empty() && uiParams.rayInfo.raysLoaded) { size_t currentAmountOfRays = uiParams.rayInfo.amountOfRays; bool currentRenderAllRays = uiParams.rayInfo.renderAllRays; @@ -390,7 +399,12 @@ void UIHandler::showUISettingsWindow(UIParameters& uiParams) { uiParams.rayInfo.cacheChanged = true; } } - ImGui::Text("Application average %.6f ms/frame", uiParams.frameTime * 1000.0f); + + ImGui::Separator(); + + uiParams.camController.displaySettings(); + + ImGui::Text("Application averages %.2f ms/frame", uiParams.frameTime * 1000.0f); ImGui::End(); } @@ -507,25 +521,6 @@ void UIHandler::applyLightTheme() { style->Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 1.00f, 0.35f); // Light blue for text selection } -void UIHandler::showSettingsWindow() { - ImGui::Begin("Settings"); - - ImGui::SliderFloat("Scale", &m_scale, 0.1f, 4.0f, "%.1f", ImGuiSliderFlags_AlwaysClamp); - if (ImGui::Button("Toggle Theme")) { - m_isDarkTheme = !m_isDarkTheme; // Toggle theme - if (m_isDarkTheme) { - applyDarkTheme(); - } else { - applyLightTheme(); - } - } - - // checkbox - ImGui::Checkbox("Load h5 with RML", &m_loadh5withRML); - - ImGui::End(); -} - void UIHandler::showHotkeysWindow() { ImGui::Begin("Hotkeys"); diff --git a/Intern/rayx-ui/src/UserInterface/UIHandler.h b/Intern/rayx-ui/src/UserInterface/UIHandler.h index b78b0782..72918c53 100644 --- a/Intern/rayx-ui/src/UserInterface/UIHandler.h +++ b/Intern/rayx-ui/src/UserInterface/UIHandler.h @@ -56,7 +56,6 @@ class UIHandler { void showSceneEditorWindow(UIParameters& uiParams); void showUISettingsWindow(UIParameters& uiParams); - void showSettingsWindow(); void showHotkeysWindow(); void showMissingFilePopupWindow(UIParameters& uiParams); void showSimulationSettingsPopupWindow(UIParameters& uiParams);