mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 05:57:08 +01:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
This commit is contained in:
@@ -1461,7 +1461,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;
|
||||
|
||||
@@ -348,6 +348,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)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,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) {
|
||||
|
||||
@@ -2296,9 +2296,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)
|
||||
{
|
||||
@@ -3166,6 +3174,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)
|
||||
{
|
||||
|
||||
@@ -189,6 +189,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
|
||||
|
||||
@@ -1816,11 +1816,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
|
||||
|
||||
@@ -1647,6 +1647,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}) ||
|
||||
|
||||
Reference in New Issue
Block a user