Step 3b of docs/world-format-eu07.md (#516, section 13), on the map of sections of step 3a. With
world.unbounded 1 in eu07.ini (off by default; then nothing changes) the region keeps sections wherever the
nodes are: point_inside() takes any finite point, section() no longer puts a point beyond the classic square
into the section at its edge, and the walks of the renderer, the local lights and sections() go over the rows
and columns around the camera with no cut at 0 and 499 (region_index_low/high, section_in_region).
The binary files index only the classic square, so a scenery reaching beyond it gets no .sbt (the log says so)
and a terrain file beyond it no .btf. An unbounded region reads and writes its own binary files,
.unbounded.sbt and .unbounded.btf: a file made with the region ending at +-250 km has the nodes beyond left
out or put at the edge, and must not stand in for them, nor the other way round. For a scenery within the
square the two files come out byte for byte the same.
Checked in the game (--test 120 s, seed 1): td.scn with the switch on gives the same physics log bit for bit as
without it; a copy of td.scn moved 400 km out (origin 400000 0 0) gives with the switch on the same physics
log as td.scn at its own place, with 16 lines in the error log against 301 with the switch off, where it runs
as before.
Step 3a of docs/world-format-eu07.md (#516, section 13): the dense std::array of 250 000 section pointers
gives way to a std::map keyed by section_key (row and column, counted as before with the middle of the region
at 250, 250), holding only the sections that hold something. The map runs row by row, the order of the index
of the classic square, so the .sbt and .btf files keep their indices and come out byte for byte the same.
basic_region gains find_section(key or row and column) and all_sections(); get_section(index) stays for the
classic index. The renderer's walk, its prefetch and memory count, the local lights, the map, the terrain
files, the editor and its self-test use them instead of indexing the grid; the loops over all 250 000 slots
(the map every frame, the editor's terrain drop) go over the sections there are.
Nothing changes in what the game does: the region still ends at +-250 km, a point beyond it still goes to the
section at the edge, and the centre of a new section is computed from the row and column before that clamp,
as it was. Lifting the limit is a later step, behind a switch.
Checked in the game (td.scn, Glinojeck.scn, --test 120 s, seed 1): the physics logs are the same bit for bit
as before the change, with the .sbt written and with it read back, and the .sbt files written are byte for
byte the same as those of the build before.
- TCamera::OnCommand() hands the command to toggle_flashlight(), which keeps the complexity of the handler where it was (S3776)
- turned on with gfx.lights.clustered off the flashlight lights nothing: the log says so
- local_lights::add_flashlight() is private; gather() adds the flashlight right after the lights of the cab, apart from the
place the arcs of the pantographs of #431 are added in, so the two merge without a conflict
- a test of the toggle: the key going up switches it, a press and the repeats don't
The flashlight's command stays the last one in input/command.h and both lists of input/command.cpp,
after the genericset and the traction mode commands staging added; local_lights keeps both forget()
of staging and add_flashlight().
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.
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
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.
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.
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.
From 15 cm under the eye the flashlight's shadows fell right behind the things which cast them, where
the eye can't see them. It shines now from the right hand, 35 cm down and 25 cm right of the eye, along
the line of sight as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without shadows the flashlight lit everything in its cone, also behind the walls of the vehicles: the
snow on the ground beyond a car shone white through its windows as a band at their bottom. It now has
a cube shadow map as the lamps of the scenery do (opengl46/vulkan14 local shadows), made anew as it
moves, named to them by Global.flashlight. It doesn't skip any model drawing its shadow map
(shade_self).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cone is 16 degrees wide from its axis (was 24), at its full brightness within 8 (was 12), and the
light is a neutral white (1, 0.98, 0.95) instead of a warm one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new command flashlighttoggle (Ctrl+Shift+L, free in the default keyboard bindings) switches a cone
of warm white light from a little under the camera where it looks, in the cab, outside and in the free
camera, by day as well. It is one more local light of the clustered lighting (gfx::local_lights), so it
works with both the OpenGL 4.6 and the Vulkan renderers, and only with gfx.lights.clustered on. It
casts no shadows. It is off at the start and isn't kept between the runs.
The command is added at the end of user_command, so the numbers of the commands before it stay as they
were. Its key comes from the default bindings in the code: an eu07_input-keyboard.ini without it keeps
working, and one can bind it to another key with a "flashlighttoggle" line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Local lights: street lamps of the scenery light their surroundings
Optional settings, all off by default (nothing changes without them):
- gfx.lights.stars: Stars submodels (e.g. "lamp" of the SGP340 street lights) whose glowing points light downwards as lamps;
signal LEDs, chimneys and the sky only glow
- gfx.lights.points.near: scenery lamps shining downwards light also closer than their glare is seen from
- gfx.lights.freespot.mincone: wider cones for scenery lamps shining downwards (many have the narrow cone of their glare)
- gfx.lights.lamps.gain: brightness of the scenery lamps shining downwards
- gfx.lights.hideglow: textures of the planes faking the light of lamps (pools of light, glows), hidden while the lamps light
Lights shining sideways (signals) keep their cones, brightness and distances.
The lamps made of glowing points are gathered also from the opaque instances of a cell.
* Local lights: the lamp settings in a parser of their own, the draw phase test in a helper
The entries of the lamps are read by ConfigParse_gfx_lamps, which the parser of the sky hands the tokens it doesn't know, and
the opaque and translucent draws ask drawn_in_phase whether a submodel has a part in them, so the long functions keep their
complexity. The fake glow cache is private, the colour of a light point is lightcolor (no shadowing of rendermode::color),
the minimal distance of a submodel comes from walk_min_distance and the lit instances of a cell from add_lit_instances.
* Settings: the lamp entries are tried by the main loop of the parser, the parser of the sky stays as it was
* Local lights: the fake glows are left out only within the reach the lamps are gathered from
Beyond gfx.lights.range nothing lights the ground in place of the pools of light and glows of the lamps, so a scenery model
keeps them there. Render_Alpha(TAnimModel *) tells hide_fake_glows() which model it draws, and is_fake_glow() leaves out the
glows of that model only, when it is within the range (and its radius) of the camera the lamps are gathered around. The glow
planes are translucent, so the opaque draws are as they were.
* Local lights: hide_fake_glows() takes the model as it is drawn (radius() isn't const)
* Local lights: the fake glows hidden at any distance again, gfx.lights.lamps.range to see the lamps from afar
Glow planes kept beyond the reach of the lamps don't light a distant station either, they only float above it, so the glows
listed in gfx.lights.hideglow are left out at any distance again. A lit station is seen from afar with gfx.lights.lamps.range
instead: the lamps are gathered from that far when it's above gfx.lights.range (0, the default: from gfx.lights.range).
* Local lights: gfx.lights.lamps.range for the lamps of the scenery only, the vehicles keep gfx.lights.range
* Local lights: the fake glows are kept with gfx.lights.range 0, the limits of gfx.lights.hideglow in the docs