1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#pragma once
#include "workspace.h" // AppActions, UIContext
#include "rendering/view.h"
namespace Donut
{
// 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
// 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.
class UILayer
{
public:
UILayer() = default;
auto draw(const UIContext& ctx) -> View;
private:
// Which 3D view fills the pass-through centre.
enum class Mode { Scene, Simulation };
// A named default arrangement of the panels.
enum class Layout { Simulation, SceneEditing, Export };
auto draw_menu_bar(const UIContext& ctx) -> void;
auto build_layout(unsigned int dockspace_id) -> void; // DockBuilder tree
auto apply_layout(Layout layout) -> void; // preset: view + panels
auto panel_outliner(const UIContext& ctx) -> void;
auto panel_properties(const UIContext& ctx) -> void;
auto panel_black_hole(const UIContext& ctx) -> void;
auto panel_settings(const UIContext& ctx) -> void;
auto panel_export(const UIContext& ctx) -> void;
auto panel_stats(const UIContext& ctx) -> void;
Mode m_mode = Mode::Simulation;
Layout m_layout = Layout::Simulation;
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).
bool m_show_outliner = false;
bool m_show_properties = false;
bool m_show_black_hole = true;
bool m_show_settings = false;
bool m_show_export = false;
bool m_show_stats = true;
// Properties-panel gizmo op (0 = translate, 1 = scale); cast in the .cpp.
int m_gizmo_op = 0;
// Settings panel.
float m_ui_scale = 1.0f;
// 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;
};
}
|