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

Windscreen snow: compiles with the NVIDIA OpenGL driver, the state of the glasses in the log [skip ci]

- water_snow.comp named a variable "packed", a reserved word of GLSL: the
  NVIDIA OpenGL compiler refused the program, so the whole simulation of the
  windscreens was off under OpenGL. Now "packing".
- mat_snow_windscreen.frag: a material without its slot takes the first
  glass whose snow the simulation keeps.
- The log says, once it changes, whether each glass is baked, what it was
  built as and what its material is now, whether its snow is simulated,
  and whether the layer of the snow is laid: to find why the snow stays off
  under OpenGL.

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-22 20:12:36 +01:00
parent 26ed8650ff
commit 04e877ffa6
6 changed files with 38 additions and 7 deletions
+16 -1
View File
@@ -127,6 +127,8 @@ void windscreen_water::release()
m_glasses = {};
m_glasscount = 0;
m_layerslot = -1;
m_logged.fill(-1);
m_layerlogged = -1;
m_kinds.clear();
m_vehicle = nullptr;
m_cab = nullptr;
@@ -460,6 +462,14 @@ void windscreen_water::update(double const Seconds)
auto const *material{m_host.material(glass.material)};
auto const snowed{glass.baked && glass.snow && is_snow_glass(material)};
block.snow_slots[static_cast<glm::length_t>(slot)] = (snowed ? 1.f : 0.f);
// the state of the glass in the log once it changes: why a glass stays without its water or snow
if (auto const state{(glass.baked ? 1 : 0) | (glass.snow ? 2 : 0) | (glass_kind(material) << 2) | (snowed ? 16 : 0)}; state != m_logged[slot])
{
m_logged[slot] = state;
WriteLog("windscreen water: glass " + std::to_string(slot + 1) + (glass.baked ? " baked" : " not baked yet (the mask of the wipers not loaded)") +
(glass.snow ? ", built as a glass of the snow" : ", built as a glass of the water") + ", its material now " +
std::to_string(glass_kind(material)) + " (0 none, 1 water, 2 snow)" + (snowed ? ", its snow simulated" : ""));
}
anysnow = anysnow || snowed;
auto const simulated{glass.baked && (false == glass.snow) && is_water_glass(material)};
glass.landings += static_cast<double>(perground / fall * coming * glass.densest) * seconds;
@@ -573,7 +583,12 @@ void windscreen_water::lay_snow(gl::water_ubs const &Block)
auto layer{Block};
layer.counts.z = static_cast<std::uint32_t>(slot);
layer.counts.w = m_step;
gpu_snow_layer(slot, atlas, normal, layer);
auto const laid{gpu_snow_layer(slot, atlas, normal, layer)};
if (int const state{laid ? 1 : 0}; state != m_layerlogged)
{
m_layerlogged = state;
WriteLog("windscreen water: the layer of the snow of glass " + std::to_string(slot + 1) + (laid ? " laid" : " not laid (the atlas of the snow not loaded)"));
}
}
}
}