aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-23 21:55:36 +0200
committerhachem <im@hachem.wtf>2026-08-23 21:55:36 +0200
commit5ea6c14c0e14bacee766ce1280ab2c71564e05ec (patch)
tree34620051e8eaf65db4ff9cd40ffd982a03e1ccc8 /src/core
parent8742482311b86bb705d93336805ab26881e96070 (diff)
[feat]: implement ui layer arch
Diffstat (limited to 'src/core')
-rw-r--r--src/core/application.cpp359
-rw-r--r--src/core/application.h53
-rw-r--r--src/core/hdri_manager.h2
3 files changed, 56 insertions, 358 deletions
diff --git a/src/core/application.cpp b/src/core/application.cpp
index 9cd19ec..1541e34 100644
--- a/src/core/application.cpp
+++ b/src/core/application.cpp
@@ -2,25 +2,21 @@
#include "rendering/render_api.h" // RendererAPI
#include "settings_manager.h"
-#include "hdri_manager.h"
#include "platform/opengl/opengl_device.h"
#include "platform/vulkan/vulkan_device.h"
#include <GLFW/glfw3.h>
#include <imgui.h>
-
-#include <glm/gtc/matrix_transform.hpp>
+#include <glm/glm.hpp>
#include <algorithm>
-#include <cmath>
-#include <numbers>
namespace Donut
{
Application* Application::s_instance = nullptr;
// Scroll is delivered through a GLFW callback; accumulate it here and drain it
- // once per frame in process_input (chaining ImGui's own scroll handler).
+ // once per frame in update_input (chaining ImGui's own scroll handler).
static double g_scroll_accum = 0.0;
static GLFWscrollfun g_prev_scroll = nullptr;
static void donut_scroll_callback(GLFWwindow* w, double x, double y)
@@ -30,7 +26,6 @@ namespace Donut
}
Application::Application(const std::string& name, int width, int height)
- : m_running(true), m_minimized(false)
{
s_instance = this;
@@ -76,34 +71,10 @@ namespace Donut
return;
}
- m_hdri_path = "assets/hdri/hdr_blue_nebulae_1.hdr";
- m_cubemap = m_device->create_cubemap_from_hdri(m_hdri_path);
-
- m_scene_renderer = create_scope<SceneRenderer>();
- m_scene_renderer->init(*m_device);
- m_black_hole_renderer = create_scope<BlackHoleRenderer>();
- m_black_hole_renderer->init(*m_device);
-
- // Black-hole camera: large-scale orbital viewer outside the disk.
- m_camera.set_camera_mode(CameraMode::Orbital);
- m_camera.set_orbital_target(glm::vec3(0.0f));
- m_camera.set_orbital_radius(4e11); // ~31 r_s: outside the 12 r_s disk
- m_camera.set_orbital_limits(2.2e11, 1.5e12);
- m_camera.set_orbital_speed(0.01f);
- m_camera.set_zoom_speed(3e10);
- m_camera.set_azimuth(0.0f);
- m_camera.set_elevation(1.25f);
-
- // Scene camera: normal-scale orbital world-builder viewer.
- m_scene_camera.set_camera_mode(CameraMode::Orbital);
- m_scene_camera.set_orbital_target(glm::vec3(0.0f));
- m_scene_camera.set_orbital_radius(15.0);
- m_scene_camera.set_orbital_limits(2.0, 200.0);
- m_scene_camera.set_orbital_speed(0.01f);
- m_scene_camera.set_zoom_speed(2.0);
- m_scene_camera.set_azimuth(0.0f);
- m_scene_camera.set_elevation((float)std::numbers::pi / 3.0f);
- m_scene_camera.update_orbital();
+ m_scene = create_scope<Scene>();
+ m_render_path = create_scope<RenderPath>();
+ m_render_path->init(*m_device, m_scene->hdri_path);
+ m_ui = create_scope<UILayer>();
m_device->init_imgui();
// Load the UI font into the device-created ImGui context (backend-agnostic;
@@ -134,60 +105,19 @@ namespace Donut
if (!cmd) return; // frame skipped (e.g. swapchain recreation)
m_device->imgui_new_frame();
- build_ui();
- process_input();
+ View view = m_ui->draw(UIContext{ *m_scene, m_device->device_name() });
+ update_input(view);
+ m_render_path->sync_hdri(m_scene->hdri_path);
- const glm::vec4 clear(0.05f, 0.06f, 0.10f, 1.0f);
int w = 0, h = 0;
glfwGetFramebufferSize((GLFWwindow*)m_window->get_native_window(), &w, &h);
-
- if (m_scene_mode)
- {
- float aspect = (float)w / (float)std::max(h, 1);
- m_scene_camera.set_projection(45.0f, aspect, 0.1f, 1000.0f);
- CameraView cv;
- cv.view = m_scene_camera.get_view_matrix();
- cv.projection = m_scene_camera.get_projection_matrix();
- cv.position = m_scene_camera.get_orbital_position();
- cv.fb_width = w; cv.fb_height = h;
-
- cmd->begin_render_pass(nullptr, clear);
- m_scene_renderer->render(*cmd, cv, m_scene_objects, m_selected_object, m_cubemap.get());
- m_device->imgui_render(*cmd);
- cmd->end_render_pass();
- }
- else
- {
- GeodesicView gv;
- glm::vec3 pos, fwd;
- if (m_camera.get_camera_mode() == CameraMode::FPS)
- {
- pos = m_camera.get_position();
- fwd = m_camera.get_forward_direction();
- }
- else
- {
- pos = m_camera.get_orbital_position();
- fwd = glm::normalize(m_camera.get_orbital_target() - pos);
- }
- glm::vec3 right = glm::normalize(glm::cross(fwd, glm::vec3(0, 1, 0)));
- gv.position = pos; gv.right = right; gv.up = glm::cross(right, fwd); gv.forward = fwd;
- gv.tan_half_fov = (float)tan(glm::radians(m_bh_params.fov_degrees * 0.5f));
- gv.aspect = (float)BlackHoleRenderer::GEO_HI_W / (float)BlackHoleRenderer::GEO_HI_H;
- gv.moving = m_user_moving;
- gv.time = (float)(glfwGetTime() - m_start_time);
-
- m_black_hole_renderer->render_geodesic(*cmd, gv, m_bh_params, m_cubemap.get());
- cmd->begin_render_pass(nullptr, clear);
- m_black_hole_renderer->blit(*cmd, w, h);
- m_device->imgui_render(*cmd);
- cmd->end_render_pass();
- }
+ float time = (float)(glfwGetTime() - m_start_time);
+ m_render_path->render(*cmd, *m_scene, view, w, h, m_user_moving, time);
m_device->end_frame();
}
- auto Application::process_input() -> void
+ auto Application::update_input(View view) -> void
{
GLFWwindow* window = (GLFWwindow*)m_window->get_native_window();
bool over_ui = ImGui::GetCurrentContext() && ImGui::GetIO().WantCaptureMouse;
@@ -200,11 +130,23 @@ namespace Donut
glfwGetCursorPos(window, &mx, &my);
bool left_down = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS;
- if (!m_scene_mode && m_camera.get_camera_mode() == CameraMode::FPS)
+ // Tabs without a live viewport (Setup / Export) have no camera to drive.
+ if (view == View::None)
{
+ m_left_was_down = left_down; // keep the drag-edge state coherent
+ g_scroll_accum = 0.0; // discard scroll over inert tabs
+ m_user_moving = false;
+ return;
+ }
+
+ const bool scene_view = view == View::Scene;
+
+ if (!scene_view && m_scene->sim_camera.get_camera_mode() == CameraMode::FPS)
+ {
+ Camera& cam = m_scene->sim_camera;
if (left_down && !m_left_was_down) { m_fps_last_x = mx; m_fps_last_y = my; }
if (left_down && !over_ui)
- m_camera.on_mouse_move(float(mx - m_fps_last_x), float(m_fps_last_y - my));
+ cam.on_mouse_move(float(mx - m_fps_last_x), float(m_fps_last_y - my));
m_fps_last_x = mx; m_fps_last_y = my;
m_left_was_down = left_down;
@@ -213,19 +155,19 @@ namespace Donut
if (!over_kb && dt > 0.0f)
{
float mdt = dt * (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS ? 4.0f : 1.0f);
- if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) { m_camera.move_forward(mdt); moved = true; }
- if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) { m_camera.move_backward(mdt); moved = true; }
- if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) { m_camera.move_left(mdt); moved = true; }
- if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) { m_camera.move_right(mdt); moved = true; }
- if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) { m_camera.move_up(mdt); moved = true; }
- if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) { m_camera.move_down(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) { cam.move_forward(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) { cam.move_backward(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) { cam.move_left(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) { cam.move_right(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) { cam.move_up(mdt); moved = true; }
+ if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) { cam.move_down(mdt); moved = true; }
}
g_scroll_accum = 0.0;
m_user_moving = moved || (left_down && !over_ui);
}
else
{
- Camera& cam = m_scene_mode ? m_scene_camera : m_camera;
+ Camera& cam = scene_view ? m_scene->scene_camera : m_scene->sim_camera;
if (left_down && !m_left_was_down && !over_ui)
cam.process_orbital_mouse_button(GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, 0);
else if (!left_down && m_left_was_down)
@@ -242,227 +184,6 @@ namespace Donut
}
}
- auto Application::set_free_fly(bool enabled) -> void
- {
- const bool is_fps = m_camera.get_camera_mode() == CameraMode::FPS;
- if (enabled == is_fps) return;
- if (enabled)
- {
- // Seed the fly pose from the current orbital framing so the view is continuous.
- glm::vec3 pos = m_camera.get_orbital_position();
- glm::vec3 fwd = glm::normalize(m_camera.get_orbital_target() - pos);
- float pitch = glm::degrees(asin(glm::clamp(fwd.y, -1.0f, 1.0f)));
- float yaw = glm::degrees(atan2(fwd.z, fwd.x));
- m_camera.set_camera_mode(CameraMode::FPS);
- m_camera.set_movement_speed(2.0e10f);
- m_camera.set_mouse_sensitivity(0.15f);
- m_camera.set_position(pos);
- m_camera.set_rotation(glm::vec3(pitch, yaw, 0.0f));
- }
- else
- {
- m_camera.set_camera_mode(CameraMode::Orbital); // orbital state was left intact
- }
- }
-
- auto Application::reset_camera() -> void
- {
- m_camera.set_camera_mode(CameraMode::Orbital);
- m_camera.set_orbital_radius(4e11);
- m_camera.set_azimuth(0.0f);
- m_camera.set_elevation(1.25f);
- }
-
- auto Application::set_hdri(const std::string& path) -> void
- {
- if (m_hdri_path == path || !m_device) return;
- m_device->wait_idle();
- m_cubemap = m_device->create_cubemap_from_hdri(path); // old cube freed after idle
- m_hdri_path = path;
- }
-
- // One-time ImGui theme: rounded, roomy, dark with a warm accretion-disk accent.
- static auto apply_donut_style() -> void
- {
- ImGuiStyle& s = ImGui::GetStyle();
- s.WindowRounding = 7.0f; s.ChildRounding = 5.0f; s.FrameRounding = 4.0f;
- s.GrabRounding = 4.0f; s.PopupRounding = 4.0f; s.ScrollbarRounding = 5.0f; s.TabRounding = 4.0f;
- s.WindowPadding = ImVec2(12, 12); s.FramePadding = ImVec2(9, 5);
- s.ItemSpacing = ImVec2(9, 8); s.ItemInnerSpacing = ImVec2(7, 5);
- s.WindowBorderSize = 0.0f; s.FrameBorderSize = 0.0f; s.WindowTitleAlign = ImVec2(0.02f, 0.5f);
-
- const ImVec4 amber = ImVec4(0.98f, 0.62f, 0.20f, 1.00f);
- const ImVec4 amberHi = ImVec4(1.00f, 0.73f, 0.36f, 1.00f);
- ImVec4* c = s.Colors;
- c[ImGuiCol_WindowBg] = ImVec4(0.07f, 0.08f, 0.10f, 0.97f);
- c[ImGuiCol_ChildBg] = ImVec4(0.10f, 0.11f, 0.13f, 0.55f);
- c[ImGuiCol_PopupBg] = ImVec4(0.09f, 0.10f, 0.12f, 0.98f);
- c[ImGuiCol_TitleBg] = ImVec4(0.09f, 0.10f, 0.12f, 1.00f);
- c[ImGuiCol_TitleBgActive] = ImVec4(0.13f, 0.14f, 0.17f, 1.00f);
- c[ImGuiCol_Text] = ImVec4(0.90f, 0.91f, 0.93f, 1.00f);
- c[ImGuiCol_TextDisabled] = ImVec4(0.48f, 0.50f, 0.54f, 1.00f);
- c[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.17f, 0.20f, 1.00f);
- c[ImGuiCol_FrameBgHovered] = ImVec4(0.22f, 0.24f, 0.28f, 1.00f);
- c[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.28f, 0.33f, 1.00f);
- c[ImGuiCol_Header] = ImVec4(0.17f, 0.19f, 0.23f, 1.00f);
- c[ImGuiCol_HeaderHovered] = ImVec4(0.24f, 0.27f, 0.32f, 1.00f);
- c[ImGuiCol_HeaderActive] = ImVec4(0.28f, 0.31f, 0.37f, 1.00f);
- c[ImGuiCol_Button] = ImVec4(0.20f, 0.22f, 0.26f, 1.00f);
- c[ImGuiCol_ButtonHovered] = ImVec4(0.27f, 0.30f, 0.35f, 1.00f);
- c[ImGuiCol_ButtonActive] = amber;
- c[ImGuiCol_SliderGrab] = amber;
- c[ImGuiCol_SliderGrabActive]= amberHi;
- c[ImGuiCol_CheckMark] = amberHi;
- c[ImGuiCol_Separator] = ImVec4(0.20f, 0.22f, 0.26f, 1.00f);
- c[ImGuiCol_ScrollbarGrab] = ImVec4(0.24f, 0.26f, 0.30f, 1.00f);
- }
-
- auto Application::build_ui() -> void
- {
- static bool styled = false;
- if (!styled) { apply_donut_style(); styled = true; }
- if (!m_device) return;
-
- // Full-viewport dock space with a pass-through centre, so the panel can be
- // docked to any edge while the render shows through the middle.
- ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport(), ImGuiDockNodeFlags_PassthruCentralNode);
-
- ImGui::SetNextWindowSize(ImVec2(340, 580), ImGuiCond_FirstUseEver);
- ImGui::Begin("Donut \xc2\xb7 Black Hole");
-
- ImGuiIO& io = ImGui::GetIO();
- ImGui::TextDisabled("%s", m_device->device_name().empty() ? "GPU" : m_device->device_name().c_str());
- ImGui::Text("%.0f FPS", io.Framerate);
- ImGui::SameLine(); ImGui::TextDisabled("%.1f ms/frame", io.Framerate > 0 ? 1000.0f / io.Framerate : 0.0f);
- ImGui::Spacing();
-
- if (ImGui::CollapsingHeader("Renderer", ImGuiTreeNodeFlags_DefaultOpen))
- {
- auto& s = SettingsManager::get_settings();
- const char* apis[] = { "OpenGL", "Vulkan" };
- int cur = (s.graphics.render_api == "Vulkan") ? 1 : 0;
- if (ImGui::Combo("Graphics API", &cur, apis, 2))
- {
- s.graphics.render_api = apis[cur];
- SettingsManager::save_settings();
- }
- const char* running = (RendererAPI::get_api() == RendererAPI::API::Vulkan) ? "Vulkan" : "OpenGL";
- if (s.graphics.render_api != running)
- ImGui::TextColored(ImVec4(0.98f, 0.62f, 0.20f, 1.0f), "Restart to apply (%s running)", running);
- else
- ImGui::TextDisabled("Active backend: %s", running);
- }
-
- ImGui::Spacing();
- ImGui::TextDisabled("VIEW");
- if (ImGui::RadioButton("Black hole", !m_scene_mode)) m_scene_mode = false;
- ImGui::SameLine();
- if (ImGui::RadioButton("Scene", m_scene_mode)) m_scene_mode = true;
- ImGui::Separator();
-
- if (m_scene_mode)
- {
- build_scene_ui();
- }
- else
- {
- BlackHoleParams& bh = m_bh_params;
-
- if (ImGui::CollapsingHeader("Camera", ImGuiTreeNodeFlags_DefaultOpen))
- {
- bool ff = m_camera.get_camera_mode() == CameraMode::FPS;
- if (ImGui::RadioButton("Orbital", !ff)) set_free_fly(false);
- ImGui::SameLine();
- if (ImGui::RadioButton("Free-fly", ff)) set_free_fly(true);
- ImGui::SameLine();
- if (ImGui::Button("Reset view")) reset_camera();
- ImGui::SliderFloat("FOV", &bh.fov_degrees, 20.0f, 90.0f, "%.0f\xc2\xb0");
- ImGui::TextDisabled(ff ? "WASD move | Q/E down-up | Shift boost | drag look"
- : "Drag to orbit | scroll to zoom");
- }
-
- if (ImGui::CollapsingHeader("Accretion disk", ImGuiTreeNodeFlags_DefaultOpen))
- {
- ImGui::SliderFloat("Temperature", &bh.temperature, 2000.0f, 15000.0f, "%.0f K");
- ImGui::SliderFloat("Brightness", &bh.brightness, 0.0f, 3.0f, "%.2f");
- ImGui::SliderFloat("Inner radius", &bh.disk_inner_rs, 3.0f, 12.0f, "%.1f r_s");
- if (bh.disk_outer_rs < bh.disk_inner_rs + 0.5f) bh.disk_outer_rs = bh.disk_inner_rs + 0.5f;
- ImGui::SliderFloat("Outer radius", &bh.disk_outer_rs, bh.disk_inner_rs + 0.5f, 25.0f, "%.1f r_s");
- ImGui::SliderFloat("Turbulence", &bh.turbulence, 0.0f, 2.0f, "%.2f");
- ImGui::TextDisabled("Inner edge is the ISCO (3 r_s). Novikov-Thorne profile.");
- }
-
- if (ImGui::CollapsingHeader("Quality"))
- {
- ImGui::SliderInt("Integration steps", &bh.quality_steps, 2000, 15000);
- ImGui::TextDisabled("Deeper lensing at higher cost. Settled frame is 4x supersampled.");
- }
-
- if (ImGui::CollapsingHeader("Environment", ImGuiTreeNodeFlags_DefaultOpen))
- {
- auto& hdri = HDRIManager::get();
- std::string preview = hdri.get_hdri_name(m_hdri_path);
- if (ImGui::BeginCombo("Starfield", preview.c_str()))
- {
- for (const auto& path : hdri.get_available_hdri())
- {
- bool selected = (path == m_hdri_path);
- if (ImGui::Selectable(hdri.get_hdri_name(path).c_str(), selected))
- set_hdri(path);
- if (selected) ImGui::SetItemDefaultFocus();
- }
- ImGui::EndCombo();
- }
- ImGui::TextDisabled("Switching rebuilds the cubemap (brief pause).");
- }
- }
-
- ImGui::End();
- }
-
- auto Application::build_scene_ui() -> void
- {
- if (!ImGui::CollapsingHeader("Objects", ImGuiTreeNodeFlags_DefaultOpen))
- return;
-
- ImGui::TextDisabled("Drag to orbit, scroll to zoom. HDRI skybox behind.");
- auto& objs = m_scene_objects;
- if (m_selected_object >= (int)objs.size()) m_selected_object = (int)objs.size() - 1;
-
- ImGui::Text("Spheres (%d)", (int)objs.size());
- if (ImGui::Button("Add") && objs.size() < 64)
- {
- SceneObject o;
- o.position = glm::vec3(((int)objs.size() % 5) * 5.0f - 10.0f, 2.0f, ((int)objs.size() / 5) * 5.0f);
- o.radius = 1.5f;
- o.color = glm::vec3(0.35f + 0.12f * (objs.size() % 5), 0.55f, 0.9f - 0.12f * (objs.size() % 4));
- objs.push_back(o);
- m_selected_object = (int)objs.size() - 1;
- }
- ImGui::SameLine();
- if (ImGui::Button("Delete") && !objs.empty())
- {
- objs.erase(objs.begin() + m_selected_object);
- if (m_selected_object >= (int)objs.size()) m_selected_object = (int)objs.size() - 1;
- }
-
- ImGui::BeginChild("obj_list", ImVec2(0, 90), true);
- for (int i = 0; i < (int)objs.size(); ++i)
- {
- std::string label = "Sphere " + std::to_string(i);
- if (ImGui::Selectable(label.c_str(), m_selected_object == i)) m_selected_object = i;
- }
- ImGui::EndChild();
-
- if (m_selected_object >= 0 && m_selected_object < (int)objs.size())
- {
- SceneObject& o = objs[m_selected_object];
- ImGui::DragFloat3("Position", &o.position.x, 0.1f);
- ImGui::DragFloat("Radius", &o.radius, 0.05f, 0.1f, 20.0f);
- ImGui::ColorEdit3("Color", &o.color.x);
- }
- }
-
auto Application::close() -> void
{
m_running = false;
@@ -492,18 +213,14 @@ namespace Donut
if (m_device)
{
m_device->wait_idle();
- m_scene_renderer.reset();
- m_black_hole_renderer.reset();
- m_cubemap.reset();
- // Free HDRIManager's cached GPU textures now, while the render context
- // is still alive. On OpenGL these are GL textures owned by a static
- // singleton; letting them destruct at program exit would call
- // glDeleteTextures after the GL context is gone and crash on close.
- HDRIManager::get().clear_cache();
+ if (m_render_path) m_render_path->shutdown();
+ m_render_path.reset();
+ m_ui.reset();
+ m_scene.reset();
m_device->shutdown();
m_device.reset();
}
SettingsManager::shutdown();
Logger::shutdown();
}
-};
+}
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;
};
diff --git a/src/core/hdri_manager.h b/src/core/hdri_manager.h
index d98830f..6b3df1e 100644
--- a/src/core/hdri_manager.h
+++ b/src/core/hdri_manager.h
@@ -1,7 +1,7 @@
#pragma once
#include "core/log.h"
-#include "rendering/texture.h"
+#include "platform/opengl/texture.h"
#include <string>
#include <unordered_map>