diff options
| author | hachem <im@hachem.wtf> | 2026-08-23 21:55:36 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-23 21:55:36 +0200 |
| commit | 5ea6c14c0e14bacee766ce1280ab2c71564e05ec (patch) | |
| tree | 34620051e8eaf65db4ff9cd40ffd982a03e1ccc8 /src/core/application.h | |
| parent | 8742482311b86bb705d93336805ab26881e96070 (diff) | |
[feat]: implement ui layer arch
Diffstat (limited to 'src/core/application.h')
| -rw-r--r-- | src/core/application.h | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/src/core/application.h b/src/core/application.h index 4b67c84..cbd741d 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -4,22 +4,21 @@ #include "window.h" #include "event.h" #include "log.h" -#include "camera.h" #include "rendering/rhi.h" -#include "rendering/scene_renderer.h" -#include "rendering/black_hole_renderer.h" +#include "rendering/render_path.h" +#include "rendering/view.h" +#include "scene/scene.h" +#include "ui/ui_layer.h" #include <string> -#include <vector> namespace Donut { - // The application owns ONE RHI::Device (OpenGL or Vulkan, chosen at startup) - // and the two portable renderers written on top of it, plus all the shared - // state (cameras, scene objects, disk parameters, HDRI). Because the rendering - // lives in the RHI and the shared renderers, the app behaves identically no - // matter which backend is active. + // Thin shell: owns the window, the RHI device, the Scene (document), the + // RenderPath (device-side rendering) and the UILayer (tabbed workspaces), and + // runs the frame loop that wires them together. All the rendering lives in the + // RHI + shared renderers; all the editing lives in the Scene + workspaces. class Application { public: @@ -38,43 +37,25 @@ namespace Donut auto on_shutdown() -> void; auto on_event(Event& event) -> void; - auto build_ui() -> void; // shared ImGui panel - auto build_scene_ui() -> void; // scene-view (object list) section - - auto process_input() -> void; // orbit / free-fly / zoom, was per-backend - auto set_free_fly(bool enabled) -> void; - auto reset_camera() -> void; - auto set_hdri(const std::string& path) -> void; - auto render_frame() -> void; + auto update_input(View view) -> void; // orbit / free-fly / zoom for the active camera private: - Scope<Window> m_window; - - // The unified renderer: one device + the shared renderers on top of it. - Scope<RHI::Device> m_device; - Scope<SceneRenderer> m_scene_renderer; - Scope<BlackHoleRenderer> m_black_hole_renderer; - Ref<RHI::Texture> m_cubemap; // shared HDRI environment - - Camera m_camera{ 60.0f, 16.0f / 9.0f, 0.1f, 100.0f }; // black-hole view - Camera m_scene_camera{ 45.0f, 16.0f / 9.0f, 0.1f, 1000.0f }; // world-builder view - - BlackHoleParams m_bh_params; - std::vector<SceneObject> m_scene_objects{ SceneObject{} }; - int m_selected_object = 0; - bool m_scene_mode = false; - std::string m_hdri_path; + Scope<Window> m_window; + Scope<RHI::Device> m_device; + Scope<Scene> m_scene; + Scope<RenderPath> m_render_path; + Scope<UILayer> m_ui; - // input tracking (mirrors the old per-backend process_input) + // input tracking (per-frame transient state) bool m_left_was_down = false; double m_fps_last_x = 0.0, m_fps_last_y = 0.0; double m_last_frame_time = 0.0; double m_start_time = 0.0; bool m_user_moving = false; - bool m_running; - bool m_minimized; + bool m_running = true; + bool m_minimized = false; static Application* s_instance; }; |
