mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 06:12:41 +01:00
Keep the wiper timers of the windscreen when the camera leaves the cab
The moments the blades were at the ends of their sweep (wiper_timer_out / wiper_timer_return, the drops on the glass come back from then) were set to -1000 whenever the camera wasn't in an active cab, so the glass came back fully wet on the return to the cab, and stayed so until the blades reached the end of their sweep again. They now follow the train driven while the camera is outside it (or the vehicle of the camera, as before, when it's in an active cab) and are kept; they're forgotten only when another vehicle is followed. Both renderers (OpenGL 4.6 and Vulkan). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
This commit is contained in:
@@ -1489,13 +1489,26 @@ void vulkan14_renderer::render_viewport(std::size_t const Index)
|
||||
air -= owner->VectorFront() * owner->MoverParameters->V;
|
||||
scene_ubs.rain_wind = glm::vec4{glm::vec3{air}, 0.f};
|
||||
}
|
||||
if (TDynamicObject const *owner = Global.pCamera.m_owner; owner && !!owner->MoverParameters->CabActive)
|
||||
// the wipers of the vehicle the camera is in, or of the train driven when the camera is outside it: the moments the blades
|
||||
// were at the ends of their sweep (the drops on the glass come back from then) are kept while the camera is away, so the glass
|
||||
// looks as the blades left it when it's back in the cab. they're forgotten only for another vehicle
|
||||
TDynamicObject const *owner = Global.pCamera.m_owner;
|
||||
if ((owner == nullptr) || (owner->MoverParameters->CabActive == 0))
|
||||
owner = (simulation::Train != nullptr) ? simulation::Train->Dynamic() : nullptr;
|
||||
if (owner != m_wipervehicle)
|
||||
{
|
||||
m_wipervehicle = owner;
|
||||
scene_ubs.wiper_timer_out = glm::vec4{-1000.};
|
||||
scene_ubs.wiper_timer_return = glm::vec4{-1000.};
|
||||
}
|
||||
if (owner != nullptr)
|
||||
{
|
||||
auto const cabactive{owner->MoverParameters->CabActive != 0 ? owner->MoverParameters->CabActive : 1};
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (i < owner->dWiperPos.size())
|
||||
{
|
||||
int index = owner->MoverParameters->CabActive > 0 ? i : static_cast<int>(owner->dWiperPos.size() - 1) - i;
|
||||
int index = cabactive > 0 ? i : static_cast<int>(owner->dWiperPos.size() - 1) - i;
|
||||
scene_ubs.wiper_pos[i] = owner->dWiperPos[index];
|
||||
if (owner->dWiperPos[index] > 0. && owner->wiperDirection[index])
|
||||
{
|
||||
@@ -1521,8 +1534,6 @@ void vulkan14_renderer::render_viewport(std::size_t const Index)
|
||||
else
|
||||
{
|
||||
scene_ubs.wiper_pos = glm::vec4{0.};
|
||||
scene_ubs.wiper_timer_out = glm::vec4{-1000.};
|
||||
scene_ubs.wiper_timer_return = glm::vec4{-1000.};
|
||||
}
|
||||
}
|
||||
// the stages after D: no contact shadows, no cascades fitted to the depth, no shadow maps of headlights
|
||||
|
||||
Reference in New Issue
Block a user