From a34c49f103c8950a57687ea3d866c244d95b4414 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 24 Aug 2026 18:28:39 +0200 Subject: [docs]: added a few comments cause i wont be able to read this in a week's time --- src/ui/ui_layer.cpp | 24 ++++++++++++------------ src/ui/ui_layer.h | 16 ++++++++-------- src/ui/workspace.h | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/ui') diff --git a/src/ui/ui_layer.cpp b/src/ui/ui_layer.cpp index 88e1b1d..dc61d2d 100644 --- a/src/ui/ui_layer.cpp +++ b/src/ui/ui_layer.cpp @@ -16,7 +16,7 @@ namespace Donut { - // Panel window titles. These are the identity DockBuilder docks against, so + // panel window titles. these are the identity DockBuilder docks against, so // they must match the ImGui::Begin() titles exactly. static const char* kOutliner = "Outliner"; static const char* kProperties = "Properties"; @@ -25,7 +25,7 @@ namespace Donut static const char* kExport = "Export"; static const char* kStats = "Stats"; - // One-time ImGui theme: rounded, roomy, dark with a warm accretion-disk accent. + // one-time ImGui theme: rounded, roomy, dark with a warm accretion-disk accent. static auto apply_donut_style() -> void { ImGuiStyle& s = ImGui::GetStyle(); @@ -76,13 +76,13 @@ namespace Donut draw_menu_bar(ctx); - // Full-viewport dock space with a pass-through centre: panels dock to the - // edges while the render shows through the middle. Sits under the menu bar. + // full-viewport dock space with a pass-through centre: panels dock to the + // edges while the render shows through the middle. sits under the menu bar. // ImGui owns the id (stable per viewport) and persists the layout in imgui.ini. const ImGuiID dockspace_id = ImGui::DockSpaceOverViewport( 0, ImGui::GetMainViewport(), ImGuiDockNodeFlags_PassthruCentralNode); - // On the first frame, seed a default layout unless imgui.ini restored one + // on the first frame, seed a default layout unless imgui.ini restored one // (a restored dock tree has splits/windows, so the root node isn't empty). if (m_first_frame) { @@ -143,7 +143,7 @@ namespace Donut ImGui::EndMenu(); } - // Right-aligned mode + FPS readout. + // right-aligned mode + FPS readout. char status[64]; std::snprintf(status, sizeof(status), "%s %.0f FPS", m_mode == Mode::Scene ? "Scene" : "Simulation", ImGui::GetIO().Framerate); @@ -154,13 +154,13 @@ namespace Donut ImGui::EndMainMenuBar(); } - // Rebuild the dock tree for the current layout. Windows named but not currently + // rebuild the dock tree for the current layout. windows named but not currently // visible still get a dock home here, so toggling them on lands them sensibly. auto UILayer::build_layout(unsigned int dockspace_id) -> void { ImGui::DockBuilderRemoveNode(dockspace_id); - // DockSpace is a private flag, PassthruCentralNode a public one; combine as - // int to avoid the C++20 mixed-enum bitwise-or warning. + // DockSpace is a private flag and PassthruCentralNode a public one, and + // C++20 whines about OR-ing two different enum types, so cast to int and move on. ImGui::DockBuilderAddNode(dockspace_id, (int)ImGuiDockNodeFlags_DockSpace | (int)ImGuiDockNodeFlags_PassthruCentralNode); ImGui::DockBuilderSetNodeSize(dockspace_id, ImGui::GetMainViewport()->WorkSize); @@ -215,7 +215,7 @@ namespace Donut ImGui::DockBuilderFinish(dockspace_id); } - // Apply a preset: set the centre view, choose which panels are visible, and + // apply a preset: set the centre view, choose which panels are visible, and // request a dock-tree rebuild next frame. auto UILayer::apply_layout(Layout layout) -> void { @@ -314,8 +314,8 @@ namespace Donut if (m_mode == Mode::Scene) { - // Viewport gizmo for the selected sphere, using the scene camera - // (its projection was set for this frame by the Application). Drawn + // viewport gizmo for the selected sphere, using the scene camera + // (its projection was set for this frame by the Application). drawn // into the background list so it sits over the render, under panels. ImGuizmo::SetOrthographic(false); ImGuizmo::SetDrawlist(ImGui::GetBackgroundDrawList()); diff --git a/src/ui/ui_layer.h b/src/ui/ui_layer.h index 15b5ff8..b913bc4 100644 --- a/src/ui/ui_layer.h +++ b/src/ui/ui_layer.h @@ -5,9 +5,9 @@ namespace Donut { - // The application's docking shell. Draws a main menu bar and a full-viewport + // the application's docking shell. draws a main menu bar and a full-viewport // dock space with a pass-through centre (the live 3D render shows through the - // middle), then a set of dockable tool panels. Ships a few default layouts + // middle), then a set of dockable tool panels. ships a few default layouts // built with the DockBuilder API and lets the user rearrange, hide, or restore // panels like a normal desktop app. draw() returns the View the RenderPath // should draw this frame. @@ -18,9 +18,9 @@ namespace Donut auto draw(const UIContext& ctx) -> View; private: - // Which 3D view fills the pass-through centre. + // which 3D view fills the pass-through centre. enum class Mode { Scene, Simulation }; - // A named default arrangement of the panels. + // a named default arrangement of the panels. enum class Layout { Simulation, SceneEditing, Export }; auto draw_menu_bar(const UIContext& ctx) -> void; @@ -39,7 +39,7 @@ namespace Donut bool m_rebuild_layout = false; // rebuild the dock tree next frame bool m_first_frame = true; // seed the default layout once, if no saved one - // Panel visibility (defaults match the Simulation layout the app opens in). + // panel visibility (defaults match the Simulation layout the app opens in). bool m_show_outliner = false; bool m_show_properties = false; bool m_show_black_hole = true; @@ -47,13 +47,13 @@ namespace Donut bool m_show_export = false; bool m_show_stats = true; - // Properties-panel gizmo op (0 = translate, 1 = scale); cast in the .cpp. + // properties-panel gizmo op (0 = translate, 1 = scale); cast in the .cpp. int m_gizmo_op = 0; - // Settings panel. + // settings panel. float m_ui_scale = 1.0f; - // Export panel. + // export panel. bool m_exp_color = true, m_exp_redshift = false, m_exp_temperature = false, m_exp_impact = false; int m_exp_resolution = 1, m_exp_format = 0; int m_exp_written = 0; bool m_exp_reported = false; diff --git a/src/ui/workspace.h b/src/ui/workspace.h index 16dff2a..5beedeb 100644 --- a/src/ui/workspace.h +++ b/src/ui/workspace.h @@ -7,8 +7,8 @@ namespace Donut { class Scene; - // App-level actions the UI can request (window/device changes it can't do - // itself). The Application implements this — it owns the window and device. + // app-level actions the UI can request (window/device changes it can't do + // itself). the Application implements this — it owns the window and device. struct AppActions { virtual ~AppActions() = default; @@ -18,12 +18,12 @@ namespace Donut virtual auto set_ui_scale(float scale) -> void = 0; virtual auto get_window_size(int& w, int& h) const -> void = 0; virtual auto is_fullscreen() const -> bool = 0; - // Renders the requested channels off-screen and writes files; returns the + // renders the requested channels off-screen and writes files; returns the // number written (0 on failure). virtual auto export_frame(const ExportConfig& cfg) -> int = 0; }; - // What the UI panels get each frame. `scene` is mutable — panels edit the + // what the UI panels get each frame. `scene` is mutable — panels edit the // document through it; `actions` performs app-level changes. struct UIContext { -- cgit v1.3