18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 04:47:06 +01:00
Commit Graph

14 Commits

Author SHA1 Message Date
Claude d8dc11aab2 Rebase onto staging (after #531)
The vehicle's physics is TDynamicObject::physics now (physics::Vehicle): the wipers, the insects and the
rain of the glasses, the snow of the windscreen water and the deer take it from there. The includes of
staging kept in opengl46renderer.cpp; the texture check of staging first in
Render_Instances_Indirect_Shadow(), then the materials with a vertex shader of their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:53 +01:00
Claude 5ce5a531b8 Windscreen water: a glass with drops is one with an atlas of drops, not of the snow (wants_rain_cells())
mat_rain_windscreen has no param water_slot (only the glasses of the snow have a slot of their own), so wants_rain_cells() never found the glass of the rain and the cells weren't worked out: the glass showed only its fine droplets. A material of the cab with raindropsatlas and without snow_slot now (the insects too, which don't come with rain).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:15 +01:00
Claude 160e8b8a46 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
2026-11-29 11:39:15 +01:00
Claude 5fe115657f Windscreen snow: a glass takes its slot on the material the cab has now, no fallback to the first glass in the shader
The renderer may give a glass a fresh copy of its material after the weather changed; the glass keeps its first submodel and re-resolves its material in assign(true). The fallback of mat_snow_windscreen (any material without a slot took the snow of the first simulated glass) is gone (OpenGL 4.6 and Vulkan).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:14 +01:00
Claude 04e877ffa6 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
2026-11-29 11:39:14 +01:00
Claude cc5bf11373 Windscreen: no drying or melting after the precipitation; the glass clears at once [skip ci]
Reverts e8a0e78 (kept on the branch stan/szyby-schniecie-2026-11-14).
The glass fills with rain only while it rains ("rain:" with precipitation)
and is clear at once when it doesn't: the rain stopped, or the glass holds
snow, so a glass switched from snow to rain starts dry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
Claude 4d993908f5 Windscreen: rain keeps its last state and dries, snow stays and melts after snowfall [skip ci]
- Rain drops, rivulets and micro droplets run on a rain clock (rain_state.w)
  that only advances while it rains, so they freeze when the rain stops and
  fade as the glass dries.
- Glass wetness fills only during "rain:" weather.
- Snow glasses keep their snow material after snowfall ends (until rain),
  so the snow stays, melts above 0 C into a wet film and drops, and dries.
- The baked snow layer uses a larger drop share while melting.

No new assets; no change to file formats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay 3de73b0e85 Windscreen snow: the layer over the rectangle of the glass, one for the cab
The layer of 1024 x 1024 texels over the whole uv gave a glass taking a part
of its texture too few of them (the EP09 104ec: ~470 across the glass, 1.8
pixels of the screen a texel at 1080p), so the lumps came out soft. Now the
layer lies over the rectangle of the uv the glass takes, its 2M texels across
and down as the glass is wide and high (~1 mm a texel); the renderer works
it out from the map of the glass when it sets the glass up and puts it in
the storage (water.glsl, water_layer_rect).

One layer, for the first glass of the snow of the cab (a cab has one as a
rule); a second one lays its snow at every pixel as before the layer, the
same look, slower. The storage of the water: 58 MiB before the layers,
82 MiB now (106 MiB with the four layers of 1024 x 1024).

No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay 02a0de85c2 Windscreen snow: lay the sprites into a layer of the glass, the glass only reads it
The glass of the snow laid its nine grids of lumps (81 cells) and its flakes
at every pixel in every frame, ~6-9 ms of the GPU at 1080p. Now a compute
pass (water_snowlayer.comp, the sprites in snow_sprites.glsl) lays the snow
of a glass into a layer of 1024 x 1024 texels over its uv after the step of
the snow: a band of every 8th row in a step (the snow under a lump changes
slowly) and at once wherever a blade went over the glass. The glass reads
the layer filtered (mat_snow_windscreen.frag), as the glass of the rain
reads its cells. Laid front to back: a texel stops once the snow over it
covers it, and a cell reads the map only when its sprite reaches the texel.

The storage of the water grows by the layers, 12 MiB for each of the four
glasses. The look stays as it was.

No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:13 +01:00
lcddisplay ba3129275c Snow windscreen: the snow of the glass simulated on a map that keeps it
A glass of mat_snow_windscreen (the material of the "snow:" block, with a
mask of the wipers) gets a slot of the windscreen water storage, as the
glasses of the water could, and two maps of its snow (a step reads one,
writes the other): the snow, the water, how packed the snow is and the shape
of its flakes for each of 256 x 256 texels of its uv. water_snow.comp runs a
step a frame, both APIs:
- the flakes land as many as come to the glass facing the snow against the
  cab (and a few from the eddies), the dry ones bouncing off at speed;
- the blades take the snow they go over (a little stays, a wet trace) and
  push it ahead of themselves, leaving it as ridges at the ends of their
  sweeps; piled snow slips onto its neighbours into a wedge;
- the glass is warmer than the air (the cab is heated, less so at speed):
  above zero the snow melts into water, slush slides down, dry powder is
  blown along by the air at speed, the water runs and dries.
mat_snow_windscreen.frag draws the map: flakes from the atlas where the snow
is thin (water spots where it melted), a layer with a torn edge, as opaque as
it is thick, grey when wet, its relief from the slopes of the map; the wet
glass bends the picture behind through the post-processing. Without the
simulation the glass is drawn as before.

The glasses are found again when a material of the cab changes its kind
(the weather switched its shader). The drop passes run only for glasses of
the water. No assets change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:10 +01:00
Hirek d0387753f8 refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:

  physics/mover.h                  physics/vehicle.h
  TMoverParameters                 physics::Vehicle (in namespace physics)
  TDynamicObject::MoverParameters  physics
  mvOccupied, mvControlled         occupied, controlled (TTrain, TController)
  mvSecond, mvThird                secondUnit, thirdUnit
  mvPantographUnit                 pantographUnit
  mover, Mover, movers             physics, Physics, vehicles (locals, params)
  m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
                                   m_physics, otherPhysics, currentPhysics,
                                   from_vehicles, renderPhysicsEventSounds

The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.

By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).

For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.

The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-28 23:56:46 +01:00
Hirek 19f884cdbb refactor(physics): the vehicle vocabulary in physics/vehicletypes.h; DynObj.h and Driver.h no longer include mover.h
DynObj.h included physics/mover.h, so nearly every file of the simulator
compiled the whole vehicle physics (TMoverParameters and the brakes) though
most of them only name a vehicle end, a coupling or a light.

- physics/vehicletypes.h: the enums, flags and small structures the rest of
  the simulator passes around (end, side, coupling, light, sound, activation,
  train_type, TEngineType, TBrakeSystem..., TLocation, TTrackShape,
  neighbour_data), moved from mover.h as they were. mover.h includes it.
- DynObj.h and Driver.h include vehicletypes.h; TMoverParameters is forward
  declared (utilities/Classes.h). Their inline accessors that read the mover
  (NextConnected(), GetVelocity(), is_emu(), DirectionalVel()...) are defined
  in DynObj.cpp and Driver.cpp.
- the files that use the mover include physics/mover.h themselves.

Now 140 of the 730 objects of the build depend on mover.h and brakes.h,
about 80 of them unit tests.

No change in behaviour: 1142/1142 tests, golden traces exact against staging
62f7a29b.
2026-11-27 18:53:06 +01:00
Hirek 7667e5b2ec fix: the bugs and vulnerabilities SonarCloud reports on PR #216 2026-11-07 22:11:08 +01:00
Hirek 719c729929 Improve rain shader 2026-10-26 15:51:56 +01:00