From da8f06dde1465ba3acdcbf9021315f8d3f9921f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 12:11:07 +0100 Subject: [PATCH] Rebase onto feat/gl46-migration: the code of the base the replayed hunks covered, back The rebase replayed the hunks of this branch over the ones of feat/gl46-migration where both touched the same lines; this brings back what of the base they covered: the null renderer, the black box of the camera, the opaque text displays, the motion blur of the free camera (OpenGL 4.6 and Vulkan), the scenario loader catching std::exception. The log keeps off the console in test mode. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD --- application/application.cpp | 7 +++++- application/drivermode.cpp | 11 ++++++++++ application/scenarioloadermode.cpp | 2 +- rendering/common/scenewalk.cpp | 29 +++++++++++++++++++++++-- rendering/common/scenewalk.h | 1 + rendering/opengl46/opengl46renderer.cpp | 15 ++++++++----- rendering/vulkan14/vulkan14frame.cpp | 5 +++++ 7 files changed, 61 insertions(+), 9 deletions(-) diff --git a/application/application.cpp b/application/application.cpp index 6b3cc4a8f..e8624b9e4 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -1538,7 +1538,12 @@ void eu07_application::select_gfx_backend() auto *factory{gfx_renderer_factory::get_instance()}; m_gfxbackend = nullptr; - if (Global.GfxRenderer == "vulkan") + if (Global.GfxRenderer == "null") + { + // draws nothing and loads no textures (test mode) + m_gfxbackend = factory->backend("null"); + } + else if (Global.GfxRenderer == "vulkan") { // a renderer which can't run here falls back to opengl, so a setting in eu07.ini doesn't leave the user with a black screen std::string reason; diff --git a/application/drivermode.cpp b/application/drivermode.cpp index f36656226..c4a2f063b 100644 --- a/application/drivermode.cpp +++ b/application/drivermode.cpp @@ -349,6 +349,17 @@ bool driver_mode::update() simulation::Lights.update(); Timer::subsystem.sim_lights.stop(); simulation::Deer.update(deltatime); + { + // where the user looks from, for the black box + auto const &camera{DebugCameraFlag ? DebugCamera : Camera}; + auto const mode{DebugCameraFlag ? blackbox::camera_modes::debug : + false == FreeFlyModeFlag ? blackbox::camera_modes::cab : + m_externalview ? blackbox::camera_modes::external : + blackbox::camera_modes::free}; + simulation::Blackbox.camera(blackbox_camera(camera, mode, mode == blackbox::camera_modes::external ? m_externalviewmode : 0), + DebugCameraFlag ? nullptr : camera.m_owner); + } + simulation::Blackbox.update(deltatime); if (Global.test.enabled && simulation::is_ready) { diff --git a/application/scenarioloadermode.cpp b/application/scenarioloadermode.cpp index 85f81a337..349ff691f 100644 --- a/application/scenarioloadermode.cpp +++ b/application/scenarioloadermode.cpp @@ -71,7 +71,7 @@ bool scenarioloader_mode::update() { } // the file it can't read, as the parser and the scenery opening report it; invalid_scenery_exception is one of these, and so is // what the file system throws - catch (std::runtime_error const &e) { + catch (std::exception const &e) { ErrorLog(std::format("Bad init: scenario \"{}\" couldn't be opened ({})", Global.SceneryFile, e.what())); state.reset(); if (Global.test.enabled) { diff --git a/rendering/common/scenewalk.cpp b/rendering/common/scenewalk.cpp index de01564f4..1b0cf12e3 100644 --- a/rendering/common/scenewalk.cpp +++ b/rendering/common/scenewalk.cpp @@ -2297,9 +2297,17 @@ void scene_walk::Render(TSubModel *Submodel) } } } - if (Submodel->Child != nullptr) - if (Submodel->iAlpha & Submodel->iFlags & 0x001F0000) + if (Submodel->Child != nullptr && (TSubModel::iAlpha & Submodel->iFlags & 0x001F0000)) + { + if (Submodel->eType == TP_TEXT) + { // the opaque characters of a text display, drawn with depth like the rest of the opaque geometry + Render_text(Submodel); + } + else + { Render(Submodel->Child); + } + } if (Submodel->iFlags & 0xC000) { @@ -3167,6 +3175,23 @@ bool scene_walk::Render_Alpha(TModel3d *Model, material_data const *Material, fl return result; } +// opaque characters of a text display, laid out in a row the same way as the translucent ones +void scene_walk::Render_text(TSubModel *Submodel) +{ + if (TSubModel::pasText == nullptr) + { + return; + } + ::glPushMatrix(); + for (auto *p : Submodel->text_letters(*TSubModel::pasText)) + { + Render(p); + if (p->fMatrix) + ::glMultMatrixf(p->fMatrix->readArray()); // move on to the place of the next character + } + ::glPopMatrix(); +} + // characters of a text display, laid out in a row. the text can be encoded in utf-8 or in windows-1250 void scene_walk::Render_Alpha_text(TSubModel *Submodel) { diff --git a/rendering/common/scenewalk.h b/rendering/common/scenewalk.h index 0db605644..111fa73fb 100644 --- a/rendering/common/scenewalk.h +++ b/rendering/common/scenewalk.h @@ -190,6 +190,7 @@ class scene_walk bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance, glm::dvec3 const &Position, glm::vec3 const &Angle); bool Render_Alpha(TModel3d *Model, material_data const *Material, float const Squaredistance); void Render_Alpha(TSubModel *Submodel); + void Render_text(TSubModel *Submodel); // opaque characters of a text display void Render_Alpha_text(TSubModel *Submodel); // characters of a text display // TDynamicObject::renderme as the walk sets and reads it: the walk keeps its own while the passes are walked by several threads at diff --git a/rendering/opengl46/opengl46renderer.cpp b/rendering/opengl46/opengl46renderer.cpp index ba087821b..9858863a3 100644 --- a/rendering/opengl46/opengl46renderer.cpp +++ b/rendering/opengl46/opengl46renderer.cpp @@ -1871,11 +1871,16 @@ void opengl46_renderer::Render_pass(viewport_config &vp, rendermode const Mode) if (vp.main && !vp.custom_backbuffer) // TODO: update window sizes also for extra viewports target_size = Global.fb_size; - // the motion is blurred only when something in the view moves: the vehicle of the camera, or a vehicle drawn in the last - // frame (a vehicle setting off is blurred from its second frame, when its velocity is still far below a pixel). the pass - // itself runs in every frame: the windscreens (mat_rain_windscreen, mat_bugs_windscreen) ask it in the velocity target for - // the picture in their drops and the haze, also standing still, with the motion blur off and with any anti-aliasing (the - // motion is then blurred by 0) + // the camera with no vehicle of its own (freefly, the editor) blurs the world with its own movement, as a vehicle does with + // its (rendering/common/freecameramotion.h) + if (vp.main && (Global.pCamera.m_owner != nullptr)) + m_freecamera.reset(); + auto const freecameramovement{(vp.main && (Global.pCamera.m_owner == nullptr)) ? m_freecamera.next_frame(Global.pCamera.Pos) : glm::vec3{0.f}}; + // the motion is blurred only when something in the view moves: the vehicle of the camera, the camera with no vehicle of its + // own, or a vehicle drawn in the last frame (a vehicle setting off is blurred from its second frame, when its velocity is + // still far below a pixel). the pass itself runs in every frame: the windscreens (mat_rain_windscreen, mat_bugs_windscreen) + // ask it in the velocity target for the picture in their drops and the haze, also standing still, with the motion blur off + // and with any anti-aliasing (the motion is then blurred by 0) auto const moving{ Global.gfx_postfx_motionblur_enabled && (m_vehiclesmoved diff --git a/rendering/vulkan14/vulkan14frame.cpp b/rendering/vulkan14/vulkan14frame.cpp index eb8527b37..6e26f1315 100644 --- a/rendering/vulkan14/vulkan14frame.cpp +++ b/rendering/vulkan14/vulkan14frame.cpp @@ -1724,6 +1724,11 @@ void vulkan14_renderer::render_viewport(std::size_t const Index) render_ray_scene(vp); } + // the camera with no vehicle of its own (freefly, the editor) blurs the world with its own movement, as a vehicle does with its + // (rendering/common/freecameramotion.h) + if (vp.main && (Global.pCamera.m_owner != nullptr)) + m_freecamera.reset(); + auto const freecameramovement{(vp.main && (Global.pCamera.m_owner == nullptr)) ? m_freecamera.next_frame(Global.pCamera.Pos) : glm::vec3{0.f}}; // the motion blurred only when something in the view moves (see opengl46_renderer::Render_pass()); the pass runs anyway auto const motionblur{Global.gfx_postfx_motionblur_enabled && targets.motion && (m_vehiclesmoved || (freecameramovement != glm::vec3{0.f}) ||