From 90ff03c2fdffc09ddb26bdc7e32c3968a6d274fb Mon Sep 17 00:00:00 2001 From: hachem Date: Sun, 23 Aug 2026 22:39:47 +0200 Subject: [feat]: wire in scene into the simulation engine --- src/scene/scene.cpp | 4 ++-- src/scene/scene.h | 5 +++-- src/scene/scene_types.h | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/scene') diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index db70a8d..b8ab005 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -23,8 +23,8 @@ namespace Donut // Scene camera: normal-scale orbital world-builder viewer. scene_camera.set_camera_mode(CameraMode::Orbital); scene_camera.set_orbital_target(glm::vec3(0.0f)); - scene_camera.set_orbital_radius(15.0); - scene_camera.set_orbital_limits(2.0, 200.0); + scene_camera.set_orbital_radius(30.0); // frame the hole + orbiting objects (in r_s) + scene_camera.set_orbital_limits(3.0, 400.0); scene_camera.set_orbital_speed(0.01f); scene_camera.set_zoom_speed(2.0); scene_camera.set_azimuth(0.0f); diff --git a/src/scene/scene.h b/src/scene/scene.h index 27d1327..23d884f 100644 --- a/src/scene/scene.h +++ b/src/scene/scene.h @@ -17,8 +17,9 @@ namespace Donut public: Scene(); - // world-builder content - std::vector objects{ SceneObject{} }; + // world-builder content. The default object orbits clear of the hole at the + // origin (positions are in Schwarzschild radii; see BH_SCENE_RADIUS). + std::vector objects{ SceneObject{ { 18.0f, 6.0f, 0.0f }, 2.0f, { 0.85f, 0.35f, 0.2f } } }; int selected_object = 0; // black hole / accretion disk diff --git a/src/scene/scene_types.h b/src/scene/scene_types.h index d34983f..61bea35 100644 --- a/src/scene/scene_types.h +++ b/src/scene/scene_types.h @@ -8,6 +8,12 @@ namespace Donut // portable renderers (SceneRenderer, BlackHoleRenderer). The rendering itself // is written once on the RHI (rendering/rhi.h); these are just the inputs. + // The scene editor and the simulation share ONE world at this scale: this many + // grid units == one Schwarzschild radius. The SceneRenderer draws the hole's + // horizon at this radius; the BlackHoleRenderer maps scene positions into + // physical units (x SagA_rs / SCENE_UNITS_PER_RS) so placed objects line up. + constexpr float SCENE_UNITS_PER_RS = 3.0f; + // A placeable/editable sphere in the world-builder scene view. The app owns // the list; SceneRenderer draws it the same way on every backend. struct SceneObject -- cgit v1.3