18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 23:17:56 +01:00

Windscreen bugs: counted from none once the rain or the snow stops, none in winter [skip ci]

The insects were counted all the time the vehicle drove, so a glass turning
to mat_bugs_windscreen after snow or rain (or after winter) showed at once
all it had met meanwhile. Now the count stays at none in winter and while it
rains or snows (the rain or the snow washes them off), and what the blades
left of them before is forgotten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
This commit is contained in:
Claude
2026-11-15 21:34:50 +01:00
parent a7e229c69f
commit bfc4e77f16
2 changed files with 26 additions and 4 deletions
+13 -2
View File
@@ -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<float>(m_wiperbugs);
// the rain the glass meets (mat_rain_windscreen): counted in seconds of the heaviest rain standing still, more at speed (the