From e3237034dbea2acba8485cfc712d041f28c202f8 Mon Sep 17 00:00:00 2001 From: maj00r Date: Fri, 31 Jul 2026 18:51:14 +0200 Subject: [PATCH] Give the editor a camera when it starts on its own The scenery camera is set up by the driver mode, which never runs when the exe starts straight in the editor - the editor then copied an untouched global camera and rendered a black view with only the UI on top. Entering the editor as the startup mode now initialises the camera itself, falling back on a view above the origin for sceneries that name no camera, and resets the timers so the loading time does not land in the first frame. --- application/editormode.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/editormode.cpp b/application/editormode.cpp index 89d54453..01a17aca 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -1347,6 +1347,20 @@ void editor_mode::update_camera(double const Deltatime) void editor_mode::enter() { + if (Global.editor_startup) + { + // kamerę ze scenerii ustawia tryb prowadzenia, a przy starcie prosto do edytora on w ogóle nie + // wstaje - bez tego kopiujemy niżej pustą kamerę globalną i widok jest czarny + auto const scenerycamera = Global.FreeCameraInit[0] != glm::dvec3(0.0); + // sceneria nie musi podawać kamery; wtedy zostaje domyślny widok edytora, znad punktu zerowego + Camera.Init(scenerycamera ? Global.FreeCameraInit[0] : glm::dvec3{0.0, 15.0, 0.0}, + scenerycamera ? Global.FreeCameraInitAngle[0] : glm::vec3{glm::radians(-30.0f), glm::radians(180.0f), 0.0f}, nullptr); + Global.pCamera = Camera; + Global.pDebugCamera = Camera; + FreeFlyModeFlag = true; + Timer::ResetTimers(); // czas wczytywania scenerii nie ma trafić w deltę pierwszej klatki + } + m_statebackup = {Global.pCamera, FreeFlyModeFlag, Global.ControlPicking}; Camera = Global.pCamera;