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

326 Commits

Author SHA1 Message Date
maj00r a4dd61cd2c Merge feat/e4d-load into feat/e4d-compact 2026-11-30 00:33:02 +01:00
Hirek cabd53a01c Merge pull request #382 from pwarszawski/fix/gl46-text-displays
fix(gl46): station name boards show their text
2026-11-29 17:40:25 +00:00
Hirek fe45bb5811 Merge pull request #374 from pwarszawski/fix/glare-occlusion
fix(gl46): no more glares of light points through walls
2026-11-29 17:39:59 +00:00
maj00r 3b9d8b2fa3 fix(render): EU07M review of #537: no whole vertices kept for the bounds, the compact variant checked by CI and given up when it fails
- The bounding radius, offset() and MaxY() read the positions of a chunk alone (Positions(), geometry_bank::positions()):
  on Vulkan the compact streams are no longer decoded into basic_vertex and kept for the life of the bank as every model
  loads, so the host memory of EU07M models stays below that of E3D. What still needs whole vertices (the editor, the
  picking, the export) decodes them on first use as before.
- A COMPACT_VERTEX variant which doesn't compile is told once in the log and the banks of EU07M models go back to
  basic_vertex (compact_layout_failed()), those built already when they are drawn next, instead of the models being left
  out for the session.
- The shader validator compiles the vk14 shaders which have COMPACT_VERTEX with it, alone and with MODEL_DRAWS, as the
  renderer makes the variants.
2026-11-29 18:12:50 +01:00
Hirek 969864f204 Merge staging into cleanup/mover
The windscreen weather (#367) and the compiler cache of the CI (#434). The
wipers' code of both renderers takes staging's side, reading the active cab and
the speed through TDynamicObject (ActiveCab(), Speed()) as the renderer does on
this branch; the windscreen water reads the speed the same way, and the deer
(world/deer.cpp) read the vehicle through its queries (V(), WarningSignal(),
CabOccupied()).

The golden traces recorded on dfb43c4f still match bit for bit: staging didn't
touch the physics.
2026-11-29 16:55:25 +01:00
Claude 7cea551157 Wipers and insects: the views from outside the cab follow the train driven
The new views of the consist put the camera at any vehicle of the train, one with an active cab of
its own too: taken for another vehicle, it wiped the insects met and the memory of the blades, so
the insects were gone from the glass after a change of the view. Outside the cab (FreeFlyModeFlag)
the glasses now follow the train driven, in both renderers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 12:53:29 +01:00
Claude 5d6f443450 Review 28.11: rain cells always bound, the velocity target and the blur pass only when needed
- the cells of the rain: the opengl renderer makes their storage (cleared) with the first bind and keeps it
  bound, the glasses read the cells only when they were worked out in the frame (scene_ubs.rain_state.w,
  both renderers): never the storage before the first rain, nor the stand-in of the vulkan renderer
- the pass of the motion blur and (opengl) the velocities drawn only in the frames which need them: the
  motion blur with something moving, the taa, or a glass of the rain, the insects or the snow in the view
  (windscreen_water::wants_glass_requests(): the cab seen from inside has one, or the view is not from the
  cab). the glasses keep their drops and haze with the motion blur off, the motion is blurred by 0 then

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 12:53:29 +01:00
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 a9579a9841 Rebase onto staging (after #468): the water programs made ahead with the snow passes and the rain cells
- opengl46water: the two passes of the snow join PROGRAM_NAMES and prepare_next() (#476), optional as before: one which doesn't
  compile leaves the snow out (both passes) and the rain working; rain_cells.comp is made ahead too (its storage still waits for
  the first rain), so the first rain doesn't compile it in the middle of a frame; program_count() counts it
- vulkan14indirect: the path of the materials with their own shadow program passes the pending flag of multidraw_program()
- opengl46renderer.h: staging's shader_prewarm kept with m_ownvertexprograms / m_materialshadowprograms

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 29dcfd3769 Drop what the rebase fix-up c0ebdd5 brought back that the base no longer has
The second "null" renderer branch of select_gfx_backend(), the opaque text displays (Render_text) and the catch of
std::exception in scenarioloader_mode::update(): the base's own code again (std::runtime_error, its own null branch).

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 05be4bff29 Windscreen water: the passes of the snow are optional
A snow kernel that doesn't compile (as water_snow.comp did on NVIDIA) leaves the glasses of the snow clear and the rain working, instead of disabling the whole simulation (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:15 +01:00
Claude ab3b0e1565 Moths: a swarm doesn't flip its visibility at the range of the lamp lights
A swarm shown before stays shown while its lamp is out of the lights of the frame by its distance (the range of its node hides it there), so node_state_version changes only when a lamp goes out, not each time the camera passes the range.

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 d896c7d81d Windscreens: the insects and the rain the glass meets advance once a frame, not once a view
The step is taken in the first view of a frame (the views of a frame share its time); 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: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 da8f06dde1 Rebase onto feat/gl46-migration: the code of the base the replayed hunks covered, back
The rebase replayed the hunks of this branch over the ones of feat/gl46-migration where both touched the same lines; this brings
back what of the base they covered: the null renderer, the black box of the camera, the opaque text displays, the motion blur of
the free camera (OpenGL 4.6 and Vulkan), the scenario loader catching std::exception. The log keeps off the console in test mode.

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 48e4ef517f Windscreen water (OpenGL): the mask of the wipers read for the kernels [skip ci]
The OpenGL renderer reads a texture when a draw binds it. The glasses never
draw the mask of their wipers, only the kernels read it, so under OpenGL the
mask stayed unread, the glass was never baked and had no map: no snow (the
log said "glass 1 not baked yet" for good). The kernels now have a texture
they read loaded from its file when nothing read it yet. Vulkan reads its
textures without a draw, so it had this right.

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 c4d32ef85f 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
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
Claude 87ef243169 Vulkan: define WIPER_PASS_BUCKETS for the shaders
The preamble of the vulkan renderer didn't define it, and with the constants of common.glsl skipped
(MASZYNA_CONSTANTS) the shaders didn't compile: the renderer failed to start and fell back to
opengl. Now defined by the preamble, and common.glsl defines it when the renderer doesn't (an older
exe with these shaders).

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
Claude 2fe11d39a1 Rain windscreen: the rain fallen since a blade went over each place of its sweep
The glass took the rain fallen since one of the two moments the blades were at the ends of their
sweep, picked by the way the blade was going. After a pass that gave a place the blade had just
wiped the rain of the sweep before, until the blade reached the other end: the haze and the drops
there jumped back and forth with every sweep (a jump in brightness under the wiper mask, best seen
in a light rain).

Now the renderers keep, for 64 places along the sweep of each blade (the value of the wiper mask),
the rain fallen when the blade last went over them (gl::scene_ubs::wiper_rain_pass, marked for all
the places a blade went over since the last frame), and the glass reads the one of its pixel.
wiper_rain_out / wiper_rain_return are gone; the timers and the insects keep the ends of the sweep.

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
Claude dbad19b92a Rain windscreen: the glass fills up to full in any rain, more slowly in a lighter one
The game now counts the rain the glass meets (more at speed) and how wet the glass is (scene_ubs.rain_state: it fills with the
rain and dries when the rain stops), and the rain fallen when each blade was at the end of its sweep (wiper_rain_out/return).
The glass with rain gets as many drops, droplets, rivulets and as much haze as the heaviest rain gives, scaled by how wet it
is; where a blade went over it they come back with the rain fallen since. A lighter rain only takes longer: 95% full in 10 s of
the heaviest rain standing still, 20 s at cloud cover 1.5, 2.5x as fast at 100 km/h; half dry in 3 minutes standing still.

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
lcddisplay 8050ea8eb6 Deer at the tracks: graze ahead of the train, take fright at the horn and bound away
A deer is put on the path the player's train goes along (world/deer.cpp), grazing. The horn
within deer.hornrange, or the train closer than deer.fleedistance, frightens it: it raises its
head, looks at the train and bounds away from the tracks, then grazes where it stopped. The deer
go once the train is past them; they aren't parts of the scenery (not saved, not edited).

Off unless eu07.ini turns it on: deer (no), deer.interval (2000 m), deer.distance (2000 m),
deer.chance (1), deer.hornrange (600 m), deer.fleedistance (150 m).

- mat_vat.vert (ogl46, vk14): vat_random -1, the game picks the clip and the moment of an instance
  by the fraction of ten times its turn about the vertical, so one animation hands over to the
  next in the very same pose. 0 and 1 work as before.
- TAnimModel::draw_alone(): an instance the game moves leaves the groups of its model.
- scene_walk::Queue_Model: the record of an instance drawn on its own is made anew when the
  instance moved.

Assets (game data, installed locally in the game folder, not yet in the SVN; without them no deer
is made):
- models/animals/jelen_je.t3d, jelen_zryw.t3d, jelen_skok.t3d (the deer of jelen_lewo.t3d with the
  head turned straight, three animations baked by jelen_anim2.py)
- textures/animals/jelen_{je,zryw,skok}.mat and their _vatpos_hi, _vatpos_lo, _vatnormal .tga;
  diffuse animals/sarna_d_1, in winter animals/sarna_f_1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:10 +01:00
lcddisplay d8f0c46c7f Sun shadows of the gpu culling: the replayed walks keep the parameters of the materials
A walk kept from an earlier frame (gfx.gpucull.walkcache) gave the draws of the
shadows the parameters the pass had at the moment, not those of their
materials. mat_vat.vert reads vat_speed from them in the shadow too, so the
shadows of the animals and people animated by textures stood still on
Vulkan with gfx.gpucull.shadows. The common shadow programs read none of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:10 +01:00
Claude 77e4abadae Rain: the cab in the depth prepass also in the rain
In the rain the cab is drawn after the precipitation (so the rain inside it is hidden), and it was left out of the depth
prepass too, so the opaque pass shaded everything behind it. Its depth now goes into the prepass in any weather (Vulkan 1.4,
and OpenGL 4.6 without gfx.depthprepass.replay); the colour of the cab is still drawn after the rain, so nothing changes in
the picture.

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
Claude 91d5851ea4 Rain windscreen: a glass looks only at the drops which reach the quarter of its cell
A second pass of rain_cells.comp writes, for every drop cell, which of the drops of the 9 cells around reach each quarter of
it, so a pixel looks at those (usually 1 to 3) instead of all 9. The bias of the drop sizes is applied there too, and the
glass keeps fewer values through its loops (the frame of the glass and the lens are worked out after them, the rivulet of
the pixel is read again where it is needed), so more pixels run at once. The look is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:09 +01:00
Claude 394e252daf Rain windscreen: the cells of the drops and rivulets worked out once a frame
The glass with rain worked out, in every pixel, the hashes and the life cycles of the 9 drop cells around it, of the rivulet
cells of its 5 layers and of those the drops are swept by. A compute pass (rain_cells.comp) now does it once a frame for every
cell into a buffer (rain_cells.glsl: RAIN_CELLS_SSBO in the pass set of Vulkan 1.4, binding 18 in OpenGL 4.6); the glass only
reads it, and asks the wipers only for the drops the pixel lies on. The hashes are the same, so the drops and the rivulets
are where they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:09 +01:00
lcddisplay 339d70a6e6 Moths fly about the lit lamps of the scenery
A part of the lamps of the scenery models which shine downwards (moths.share,
picked by the places of the lamps) gets a swarm of moths: an instance of
animals/cmy.t3d (animated by textures, shader vat) put at the light point when
the lamp first comes within moths.range of the camera. The swarm is shown while
its lamp shines (the light points gathered by the local lights in the frame),
not in the winter and not below moths.temperature. The swarms are made by the
game (basic_node::m_generated): not saved with the scenery, not edited.

Settings (eu07.ini): moths yes/no, moths.share 0-1 (0.4), moths.range metres
(80), moths.temperature degrees (8). Also in the debug window of the lights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay 0df374a5e9 Vulkan 1.4: a material can have its own vertex shader, mat_<name>.vert, also in the sun shadows
As in the OpenGL 4.6 renderer: Fetch_Shader() takes shaders/vk14/mat_<name>.vert when the file is there (the animals and
people animated by textures, mat_vat.vert), vertex.vert otherwise; the multi draw variant is made of the same one. Such a
material gets the programs of its sun shadows with it: its vertex shader with MATERIAL_SHADOW and (alpha)shadowmap.frag,
drawn with all its textures and its params, also from the gpu culling (the draws of one such material go together). The
cube maps of the lamps keep their programs, the depth prepass leaves these materials out (prepass class 0).

The scene block carries the rotation and the place of the camera of each sun cascade and headlight map (inv_view,
camera_hi, camera_lo, gl::set_camera_place()), and those of the view in the colour pass, so the shaders see a model in the
world the same way in every pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay 2b415fdb16 Textures with the trait r are kept as they are; the scene block carries the place of the camera of the pass
A texture named with :r (the frames of the animations baked into textures, mat_vat) is never scaled down to maxtexturesize
nor compressed by the driver with compresstex: its texels are data, not a picture.

gl::scene_ubs::camera_hi, camera_lo: the place of the camera of the pass in the world, which the models are drawn relative
to, split so both parts are exact in floats. Set with inv_view in every pass that has it (the color pass, the faces of the
environment map, the sun cascades, the headlight shadows, the previews). mat_vat.vert takes the place of a model in the world
from them, so models standing turned the same way still get a moment of the animation of their own, the same in every pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
lcddisplay f3b70c3886 OpenGL 4.6: the scene block carries the rotation of the shadow pass's own camera
The sun cascades and the headlight shadows draw with the camera of the light, but inv_view stayed the one of the color pass.
mat_vat.vert takes the turn of a model in the world from inv_view and the modelview, so in the shadow passes it saw another
turn, gave the animation another moment, and the shadows of the animated people and animals lagged behind them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:08 +01:00
lcddisplay fd3d081191 OpenGL 4.6: a material can have its own vertex shader, mat_<name>.vert
Fetch_Shader() links mat_<name>.vert with the fragment shader of the material
when the file is there (people animated by textures, mat_vat.vert), the common
vertex.vert otherwise. The multi draw variant takes the same shader with
MODEL_DRAWS. The sun shadows of such materials go through the same vertex
shader with MATERIAL_SHADOW and (alpha)shadowmap.frag, with the textures and
params of the material bound; in the indirect shadow pass they are drawn one by
one. The depth prepass leaves them out (Prepass_Class() 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:08 +01:00
Claude 03766899af Windscreen post pass in every frame: drops and haze also standing still, with any anti-aliasing
The velocity target is always drawn and the motion blur pass always runs;
the motion itself is blurred only when the motion blur is on and something
moves (by 0 otherwise). The rain and bugs windscreens send their drops and
haze through it, so they look the same with MSAA, TAA or none, moving or not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:08 +01:00
Claude 12d7fbb00e Windscreen bugs from the insects met: none below 20 km/h, more the faster
The engine counts the insects the vehicle of the wipers meets (seconds of
driving at 100 km/h: nothing below 20 km/h, then (v - 20) / 80 a second) and
gives the count to the shaders in rain_wind.w, with the count of the moments
the blades were at the ends of their sweep in two new vec4 at the end of the
block of the scene (wiper_bugs_out, wiper_bugs_return, next to the timers).
mat_bugs_windscreen grows the dirt from the insects met since the glass was
clean instead of from the time, so a vehicle standing still gets no bugs and
a fast one gets them sooner (full after an hour at 100 km/h).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqfRrTiBDaAyQ2gT6ZrnZD
2026-11-29 11:39:08 +01:00
Claude a9d9c74a70 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
2026-11-29 11:39:08 +01:00
Hirek d28b908ca4 refactor(render): the renderer reads a vehicle through TDynamicObject, not its physics
No file of rendering/ includes physics/vehicle.h any more. What the renderers
read of a vehicle comes through a few queries of TDynamicObject
(vehicle/dynamic/lights.cpp): its dimensions, its speed, its active cab, the
light of its compartments, the adapters of its couplers, the lights switched
on at an end, the low voltage for them, and the multiplier and the colour of
its headlights. The shares of the speed and the opacity of the exhaust smoke
(ExhaustScales()) move out of the particles into the vehicle, as they are.

The headlights pick their multiplier once, by the dimming and the high beam
switches, where the light array repeated the same four branches twice; the
light of a switched off end still goes to zero as before.
2026-11-29 10:43:31 +01:00
Hirek 160ffe2147 refactor(physics): the low voltage, the train heating and the pantographs keep their state to themselves
As the parts of the main circuit: the battery and the low voltage circuits,
the train heating, the circuit of the pantographs and their air become classes
with the definition in `config` and the state behind queries and operations.

The step of the air of the pantographs (the small compressor, the three-way
cock, the leaks, the pressure switch) moves into PantographAir::Update(), which
gets what it needs as plain values (PantographAirSupply) and reports a trip of
the pressure switch, so the vehicle opens its line breaker or switches the
converter of a unit off as before. The drain of the battery and its limits move
into LowVoltageSupply. The latch of the held battery button of the cab moves
from the physics to TTrain, where the button is.

The gauges of the cab bind to the values they show through const pointers
(TGauge::Assign*() take them), so the queries they bind to return const
references and the cab reads the state live without being able to change it.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 10:08:54 +01:00
Hirek 38b1110d1b Merge origin/staging into cleanup/mover
Staging's 7 commits since 62f7a29b. Two of them changed files this branch
split up, so their changes are carried into the new files by hand:
- #445 (the decisions of an uphill start in uphill_start::): the changes to
  TController::control_tractive_force() and control_uphill_start() of
  vehicle/Driver.cpp go into vehicle/ai/force.cpp, with the names of this
  branch (VehicleEnd::front, ->physics)
- #530 (the lowpoly driver figure follows the direction in single desk
  vehicles): the figure in ABuLittleUpdate() goes into
  vehicle/dynamic/visual.cpp; the reading of cab1model:/cab2model: and of
  driverNpos:/driverNsitpos: goes into the helpers of the internaldata:
  section in vehicle/dynamic/mmd.cpp, which pass the cab places along
  (loadInternalDataKeyword, loadInternalDataDeviceKeyword,
  loadInternalDataCabKeyword); read_driver_position() takes the tokens no
  group of keywords knows, as the last else of the chain did
vehicle/Driver.cpp and vehicle/DynObj.cpp stay deleted. The rest merged on
its own. 1185/1185 tests, golden traces exact against staging 62f7a29b.
2026-11-29 04:00:11 +01:00
Hirek 89258eb72c refactor(physics): the low voltage, the train heating and the electrodynamic brake as components
The rest of the electrics of physics::Vehicle beside the traction motors
becomes components, with English names:

  lowVoltage (LowVoltageSupply,   Battery batteryOn, BatteryVoltage,
  physics/components/lowvoltage.h) NominalBatteryVoltage, BatteryStart,
                                  Power110vIsAvailable / Power24vIsAvailable /
                                  Power24vVoltage power110vAvailable /
                                  power24vAvailable / power24vVoltage, the
                                  battery button of the cab: batteryButtonFired,
                                  batteryButtonImpulse, batteryButtonHeld,
                                  batteryButtonHoldTime
  trainHeating (TrainHeating)     Heating on, HeatingAllow allow,
                                  HeatingSwitchImpulse switchImpulse,
                                  HeatingPower power, EngineHeatingRPM engineRpm
  brakes.electrodynamic           the DynamicBrake* fields: type, ammeters,
  (ElectrodynamicBrake,           controllerPositions, controllerPosition,
  physics/components/braking.h)   resistance(1, 2), on, emuWorking;
                                  SplitEDPneumaticBrake splitFromPneumatic;
                                  the fans of the braking resistor (BRVentilators,
                                  BRVto, BRVtimer, Imaxrpc): resistorFansRunning,
                                  resistorFansSustain, resistorFansTimer,
                                  resistorPassiveMaxCurrent

The diesel-electric dynamic brake (DEDynamicBrake) and the currents of the
traction circuit (Im, Itot, EngineVoltage ...) stay for the traction stage.

No string literal changed (checked over all the changed files).

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 03:15:56 +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
maj00r 92cc2dcc28 refactor(model): the new model format is EU07M (.eu07m), not E4D
E4D read as the next version of E3D, which the format isn't meant to be tied to; EU07M goes with the world format .eu07.
The format isn't released, so nothing reads the old name.

- The extension .eu07m, the magic EU7M (the four bytes of the header), model/eu07m/ with eu07m_*.{h,cpp},
  namespace eu07m, docs/eu07m-format.md, tests/unit/test_eu07m.cpp.
- The command line -eu07m convert|dump|validate|diff, TModel3d::LoadFromEU07M, and the key modelformat eu07m|legacy
  of eu07.ini (Global.modelformat_eu07m).
- Nothing else changes: the sections, the records and the components are the same, so a converted file needs only its
  magic and its extension changed.

Unit tests 1189/1189.
2026-11-28 22:02:05 +01:00
maj00r 5185d69dc9 feat(render): the Vulkan renderer keeps the vertex streams of E4D models as they are, 28 bytes a vertex
Stage 3 of the E4D model format. A model loaded from .e4d (modelformat e4d) reaches the Vulkan renderer as its compact
streams: positions (12 B), attributes (QTangent snorm16x4 + uv f32x2, 16 B), user data and indices, without the 48-byte
gfx::basic_vertex in between.

- gfx: gfx::compact_attributes, geometry_bank::create_compact() and GfxRenderer->Insert_Compact(). The default of
  Insert_Compact decodes to basic_vertex, so the OpenGL 4.6 and the null renderers get the models as before. The CPU
  readers of a chunk (pantograph, bounds, picking, the editor) get basic_vertex made from the streams the first time they
  read it; a chunk which is changed (replace, append) turns into basic_vertex first.
- Vulkan: a bank whose chunks are all compact keeps positions, user data, attributes and indices in buffers of their own;
  vertex_kind::scene_compact reads them (location 5 the quaternion as R16G16B16A16_SNORM). A program gets a COMPACT_VERTEX
  variant the first time a compact chunk is drawn with it, in the background with gfx.vulkan.asyncresources, as the
  MODEL_DRAWS one; the variant of the multi draws makes a compact one of its own. Only vertex.vert and cabprobe.vert
  decode the normal (compact_frame() in common.glsl); the shaders of shadows, prepass, picking and cube shadows read
  position and uv as before.
- Ray tracing: the BLAS of a compact chunk reads the positions with a stride of 12, and the reflections read the normal
  and uv from the attributes (RT_FLAG_COMPACT in the record). Not tried with ray tracing on.
- The loader hands the streams of the file to Insert_Compact as they are; the stars keep their colours in the normals
  of basic_vertex and go as before.

Measured on Vulkan (self-test, 250 models of the game, runs alternating with legacy): device memory 1.60-1.64 GiB
against 1.89 GiB, GPU time a frame 1.27-1.39 ms against 1.37-1.57 ms, the same frame time and load time, the picture
within 1/255 of the legacy one, no errors of Vulkan in the log. Unit tests 1189/1189; -e4d diff gives the same results
through the new decode. Not built with GCC here.
2026-11-28 21:52:47 +01:00
Hirek fbb9dc1e89 refactor(physics): the ends and the sides of a vehicle as scoped enums
end and side were unscoped enums: front, rear, left and right sat in the
global namespace (the test PCH had to leave mover.h out for it), and an end
went into any int, a side into an end, without a word from the compiler. They
become enum class VehicleEnd and VehicleSide (physics/vehicletypes.h); the
names follow the rule for types, and leave "end" and "side" to the many
locals of that name. The numbers stay: front 0, rear 1, right 0, left 1.

- ByEnd<T> / BySide<T>: two values indexed by the enum, and by a number
  where a loop or a format counts them. The arrays of the ends and the sides
  are these now: Couplers, Neighbours, Pantographs, MotorBlowers, Lights,
  iLights, Doors.instances, pVehicles, IsAnyDoor*, m_lighthints, vCoulpler,
  m_couplersounds, m_mirrormotion, iInventory, and the voltages of the
  couplers
- VehicleEnds / VehicleSides to go through them, Opposite() in place of
  1 - end, NumberOf() where a number is needed
- the couplers and the collisions take the ends they work on as VehicleEnd:
  CouplerForce, CouplerVelocityDifference, CollisionDetect, crush_hit,
  CompatibleCoupling and the rest of their family, DirF, DirPatch, and of
  the vehicle couple, uncouple, the adapters, off_track_gap, has_signal_on;
  Attach, Dettach and DettachStatus have overloads by the ends
- neighbour_data::FacingEnd() and TCoupling::ConnectedEnd() give the end of
  the other vehicle as VehicleEnd; the fields stay numbers, as they hold -1
  and 2 for "none" in places

The walks along the consist (FirstFind, Neighbour, the AI's coupling and
uncoupling) still carry the ends as numbers; where one of them meets a typed
end, NumberOf() and EndOf() say so, and keep the number as it was.

Kept as it was, and worth a look: TDynamicObject::SetLights() switches the
headlights A/B off by CabActive with the cases end::front and end::rear, that
is CabActive 0 and 1, while CabActive is 1 or -1 for the cabs; the cases are
NumberOf(VehicleEnd::front / rear) now, the same numbers.

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b. betterRenderer/, not built, has had only end:: and side:: renamed.
2026-11-28 18:32:58 +01:00
Hirek 04f76951f5 refactor(physics): the diesel engine, the torque converter and the retarder are components of their own
TMoverParameters held some 80 fields of the diesel engine and its hydraulic
transmission among its other 600, named dizel_*, hydro_TC_* and hydro_R_*.
They are now three structures of physics/components/dieselengine.h, with
English names:

- DieselEngine diesel: the definition (maxMoment, maxRevolutions,
  minRevolutions, the governor, the clutch, the fuel consumption, the tables)
  and the state (fill, clutchState, clutchPressure, torque, power, the start
  up, the fuel consumed) and its heat (EngineHeat, heat_data before)
- TorqueConverter torqueConverter: present, the ratios, the lockup, the
  fill rates, the table, and its state (fill, lockedUp, torqueRatio, the
  revolutions in and out)
- Retarder retarder: present, its placement, torque, power, fill rates,
  clutch, and its state

The .fiz keywords, the keys of the dictionaries of the Python screens and the
names of the golden channels (dizel_fill...) are unchanged; only the C++
names changed. The functions of the engine (dizel_Update, dizel_Momentum...)
stay members of TMoverParameters for now.

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
2026-11-28 15:23:36 +01:00