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
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
- 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
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
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
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
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
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
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
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
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
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.
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.
* fix(render): particle vertex attribute offsets from offsetof
* fix(render): particle vertex attribute offsets from offsetof in the GL 4.6 and Vulkan renderers
The GL 4.6 particles passed 0, 12 and 28 to setup_attrib, the Vulkan layout of
vertex_kind::particle had the stride 36 and the same offsets as numbers. They
now come from sizeof and offsetof of particle_vertex. The Vulkan particle_vertex
moves from vulkan14frame.cpp to vulkan14context.h so the layout in
vulkan14scene.cpp can use it.
A build with static_asserts that each offsetof equals the old number (and the
size 36) compiled; the asserts were taken out after.
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.
* fix(gl46): the loading screen stays until the shaders are compiled, no black window at the first start of a new version
At the first start of a new build (the driver keeps the compiled shaders of each executable apart, and every build has a name of
its own) the window went black and didn't answer for about half a minute after the scenery was loaded. Measured on
calkowo_osobowy with a copy of the executable under a new name: 33 of those seconds were the first step of the water on the
windscreens, which compiled its nine programs (water_*.comp) in the first frame of the simulation.
- After the scenery is loaded the loader keeps its screen, with the bar going and the note on preparing the graphics, until the
renderer says the programs are ready (gfx_renderer::Prewarm_Shaders(), about 50 ms a frame): the programs of the materials
are drawn with once each into a small target of the formats of the colour pass, as the opaque things and as the translucent
ones, then the programs of the windscreen water are compiled one a frame (opengl46_windscreen_water::prepare_next()), which
gpu_init() then keeps. The window answers in between.
- The Vulkan renderer, which has its pipeline cache, says it's all done at once (the default of the interface).
Checked with a copy of the executable under a new name (nothing kept by the driver): the loading screen with the note from the
end of the loading (19 s) to the first frame (58 s), the window answering all the time; the first frame no longer stalls (the
water 12 ms instead of 33 s). With the shaders kept by the driver the preparing takes no time.
No asset changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(gl46): the missing program of the windscreen water found by find_if, which GCC 13 and MSVC 14.4x compile
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(loading): the notice that the graphics are being prepared at the top of the screen
The notice stood at the bottom left, beside where the loading icon goes, over the trivia and the texts some
of the backgrounds carry at the bottom. It is now centred at the top of the screen on a dark plate, so it
reads on any background. The text and its translation are the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(vk14): the loading screen stays until the pipelines of the scene are made, as with OpenGL 4.6
vulkan14_renderer::Prewarm_Shaders() lists the pipelines the loaded scenery draws with most: those of the
programs of its materials for the colour pass of the main view, opaque and blended, and those of the
shadows. With the background threads (gfx.vulkan.asyncresources) they are handed to them, made ahead and
not counted as made late; without them they are made on the main thread for about 50 ms a frame. The
loading screen, with its notice and progress bar, waits for them and for the pipelines of the last
session the background threads make ahead. Before, a pipeline first asked for by a draw either left the
draw out for a few frames or held the frame while it was made.
The images of a viewport are made by make_viewport_targets(), taken out of render_scene() unchanged, so
the main view's formats are known before the first frame. The key and the settings of a pipeline come
from the same helpers bind_scene_pipeline() uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(gl46, vk14): the review of #476: the multi draw variants prewarmed with a model block, the last session's list in the progress
OpenGL 4.6: with gfx.gpucull 1 and the multi draws on, Prewarm_Shaders() also draws the multi draw variants
of the material programs. Their shaders read the model block from the storage buffer at
MODEL_DRAW_SSBO_BINDING, which nothing bound before the first frame, so the draw was undefined. The
prewarm now binds a buffer of one model block there. With the default gfx.gpucull 0 there are no such
variants and nothing changes.
Vulkan: the loading screen waits for the background threads, and so for the list of the last session, up
to 4096 pipelines. With a cold cache the bar stood at n/(n+1) all that time and looked stuck. The
pipelines of that list are now counted in the progress as they are done with, made or not. The wait still
ends when the background threads are idle, as before.
make_viewport_targets() returns false without a context, which Sonar reported as a null pointer
dereference. Its callers checked the context already.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRgQ1LqB4YXWorLDBBL6hD
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>