18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 01:55:21 +01:00

Windscreen water: the review of 27.11 (the snow list stops when full, the cells of the rain only for a cab with a glass of the rain)

- snList() stops listing when its SN_REFS are taken: no lumps worked out for nothing, and the cover of the texel counts only the
  sprites the glass lays (no gaps where it took the dropped ones for covering); OpenGL 4.6 and Vulkan
- update_rain_cells() gets no rain for a cab without a material of the shader of the rain in this weather
  (windscreen_water::wants_rain_cells(); as before when the simulation isn't used)
- Vulkan: a rain-cell buffer which can't be made leaves the glasses with rain dry (a small stand-in the pass sets hold) instead of
  failing the whole windscreen water; it is still made at the start, since the pass sets and those of the cullings hold it

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-27 12:42:31 +01:00
parent a9579a9841
commit 160e8b8a46
8 changed files with 56 additions and 16 deletions
+15
View File
@@ -130,6 +130,7 @@ void windscreen_water::release()
m_logged.fill(-1);
m_layerlogged = -1;
m_kinds.clear();
m_cabmaterials.clear();
m_vehicle = nullptr;
m_cab = nullptr;
}
@@ -272,6 +273,8 @@ void windscreen_water::build(TModel3d &Cab)
}
}
auto const material{Submodel->m_material};
if ((material != null_handle) && (material > 0) && (Submodel->eType == GL_TRIANGLES) && (std::find(m_cabmaterials.begin(), m_cabmaterials.end(), material) == m_cabmaterials.end()))
m_cabmaterials.push_back(material);
if ((material != null_handle) && (material > 0) && (Submodel->eType == GL_TRIANGLES) && std::ranges::none_of(m_kinds, [material](auto const &Kind) { return Kind.first == material; }))
{
// every material with a mask of the wipers, what it is kept: it's a glass of another kind when the weather changes
@@ -362,6 +365,18 @@ void windscreen_water::build(TModel3d &Cab)
}
}
bool windscreen_water::wants_rain_cells()
{
// without the simulation the cab isn't looked at: the cells as before, whenever it rains
if (m_state <= 0)
return true;
// a material of the cab of the shader of the rain, as it is in this weather (with a mask of the wipers or without)
return std::ranges::any_of(m_cabmaterials, [this](material_handle const Material) {
auto const *opengl{m_host.material(Material)};
return (opengl != nullptr) && (opengl->shader != nullptr) && (opengl->shader->param_conf.count("water_slot") > 0);
});
}
void windscreen_water::update(double const Seconds)
{
if (false == available())