diff --git a/rendering/opengl46/opengl46renderer.cpp b/rendering/opengl46/opengl46renderer.cpp index 504462a03..7fe24f7bb 100644 --- a/rendering/opengl46/opengl46renderer.cpp +++ b/rendering/opengl46/opengl46renderer.cpp @@ -1657,8 +1657,19 @@ void opengl46_renderer::Render_pass(viewport_config &vp, rendermode const Mode) m_wiperbugs = 0.0; } // the insects the vehicle meets (mat_bugs_windscreen): none below 20 km/h, above it the more the faster, counted in seconds of - // driving at 100 km/h - if (owner != nullptr) + // driving at 100 km/h. none in winter, and the rain or the snow washes them off: once it stops (and out of winter) the glass + // gets them anew from none, and what the blades left of them before is forgotten + auto const insects{(Global.Season != "winter:") && (Global.Weather != "rain:") && (Global.Weather != "snow:")}; + if (false == insects) + { + if (m_wiperbugs > 0.0) + { + scene_ubs.wiper_bugs_out = glm::vec4{-1.}; + scene_ubs.wiper_bugs_return = glm::vec4{-1.}; + } + m_wiperbugs = 0.0; + } + else if (owner != nullptr) m_wiperbugs += Timer::GetDeltaTime() * std::max(std::abs(owner->MoverParameters->V) * 3.6 - 20.0, 0.0) / 80.0; scene_ubs.rain_wind.w = static_cast(m_wiperbugs); // the rain the glass meets (mat_rain_windscreen): counted in seconds of the heaviest rain standing still, more at speed (the diff --git a/rendering/vulkan14/vulkan14frame.cpp b/rendering/vulkan14/vulkan14frame.cpp index 14be5ab8a..bb54f97d0 100644 --- a/rendering/vulkan14/vulkan14frame.cpp +++ b/rendering/vulkan14/vulkan14frame.cpp @@ -1512,8 +1512,19 @@ void vulkan14_renderer::render_viewport(std::size_t const Index) m_wiperbugs = 0.0; } // the insects the vehicle meets (mat_bugs_windscreen): none below 20 km/h, above it the more the faster, counted in seconds of - // driving at 100 km/h - if (owner != nullptr) + // driving at 100 km/h. none in winter, and the rain or the snow washes them off: once it stops (and out of winter) the glass + // gets them anew from none, and what the blades left of them before is forgotten + auto const insects{(Global.Season != "winter:") && (Global.Weather != "rain:") && (Global.Weather != "snow:")}; + if (false == insects) + { + if (m_wiperbugs > 0.0) + { + scene_ubs.wiper_bugs_out = glm::vec4{-1.}; + scene_ubs.wiper_bugs_return = glm::vec4{-1.}; + } + m_wiperbugs = 0.0; + } + else if (owner != nullptr) m_wiperbugs += Timer::GetDeltaTime() * std::max(std::abs(owner->MoverParameters->V) * 3.6 - 20.0, 0.0) / 80.0; scene_ubs.rain_wind.w = static_cast(m_wiperbugs); // the rain the glass meets (mat_rain_windscreen): counted in seconds of the heaviest rain standing still, more at speed (the