The track layout library came in as a subproject of its own -- its own
CMakeLists, its own install and export rules, its own include tree -- which only
made the build harder to follow now that everything else is a module. It is part
of the editor, so it lives where the editor lives.
- editor/plan_*.cppm / plan_*.cpp: the fifteen interface units and twelve
implementation units, flat in editor/ beside editorTerrain and orthophoto, with
the plan_ prefix keeping them clear of what was already there (editor/turnouts
is the preset catalogue, so the geometry is plan_turnout_geometry).
- modules are named eu07.editor.plan_*, like every other module in the tree.
- namespaces move under the editor's own: editor::plan, editor::plan::geometry,
::io, ::render. The library's old name is gone from the sources and the docs.
- every moved file carries the MPL header the rest of the tree carries; it had
none. version.hpp went with the subproject: macros only, and unused.
- the umbrella header is dropped -- nothing imported it.
- the unit tests survive the fold: editor/tests, behind EU07_EDITOR_PLAN_TESTS
(off by default), compiles the interfaces a second time into a small library of
its own, because a test can only import modules from a target it links and
linking the game would drag the whole simulator in. The code under test needs
nothing but a compiler. 7/7 pass.
- a switch may now be written with two dashes as well: --editor beside -editor.
Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF); -editor and --editor both come
up in the editor on empty ground.
The editor branch was written against headers and the PCH, both of which this
branch has done away with, so its own files were ported rather than merged: the
five headers it added are now interface units and their .cpp files module
implementation units.
- editor/{puwg1992,polandmap,turnouts,orthophoto} become eu07.editor.* modules,
application/planpanel becomes eu07.application.planpanel. The plan tool keeps
to its own module rather than joining the eu07.simcore partitions: it stands on
the editor's libraries and eu07.application.uilayer, not on the simulation core,
so :editoruilayer can export import it without a cycle.
- glm arrives by import eu07.glm, never by include, as the rest of the tree does.
maj0sted is header-only and glm-free, so its headers stay includes in the global
module fragment - every unit that names those types includes them itself, since
a global fragment is not visible across units.
- the one textual conflict was :editoruilayer's include block against this
branch's imports; resolved this branch's way plus the planpanel import.
Builds with clang 22 (-DWITH_BETTER_RENDERER=OFF) and starts into the editor on
empty ground with -editor alone.
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
A template defined in a module interface is instantiated in the importing
unit, where its body's types must be complete. A declaration reaching the
importer only through the interface's global module fragment is not
enough for MSVC: cParser::operator>> uses std::stringstream, and every
unit that parsed a float got an incomplete type.
526 headers across 161 units, derived from what each interface's template
bodies actually name.
Its sources reached the standard library through the project headers they
included; those are imports now. 178 headers across 56 files, plus 18 C
library headers elsewhere for memcpy/printf and friends. MSVC's STL does
not supply these transitively the way libstdc++ does.
Unqualified uint8_t/size_t and friends were reaching 24 units through
some other header on libstdc++; MSVC's STL does not do that, which broke
gl/ubo.cppm (and made its UBS_PAD macro look like garbage). Also
silences C5244, MSVC's counterpart to the clang warning about glm being
included in the module purview, which is deliberate here.
Every module unit now includes the standard headers it uses. Declarations
reaching a unit only through an imported module's global module fragment
are reachable but not visible, so ADL misses the free operators older
libstdc++ declares beside a type - reproduced on ubuntu 24.04 (libstdc++
13), where gl/vao.cpp could not compare vector iterators.
Also drops a stale editor/editorSettings.hpp from the MSVC source list,
which broke the Windows configure step, silences the deliberate
include-in-purview warning in the glm wrapper, and removes GCC support:
clang or MSVC only.
Linux CI switches to clang 22; fixes what that exposed - export on
out-of-line member definitions, missing std includes, missing glm
imports. GCC 16 still builds.
The library was a heap of half-built services - fitting, parallelism, niwelety,
an SVG writer - that never met each other. In their place is one authored
Document and one solver that lays it whole: tracks as element chains, turnouts
placed on them, and a Solution that is rebuilt from scratch every time and never
fed back into the document. What cannot be laid comes back as a diagnostic with
the number in it rather than as silence or a fitted-away error.
Turnouts are dimensioned the way the drawings dimension them. The blade follows
Koc's rys. 5.9 - the curve is theoretically tangent to the opornica at PR, the
blade starts at a with a planed nose of d, and A is where the rail stands u
thick - and a + d derived that way lands on his tablica 5.1. Bending follows
5.3.6: it rotates the triangle OBC about the centre of the turnout, so the
tangent t and the crossing angle stand and both radii follow from them. That is
Koc's (5.7) and (5.8) without coding either, and it puts a symmetrically bent
Rz 49E1-190-1:9 on the catalogue's Rlus 49E1-380,292-1:9. A rozjazd standing on
a curve is bent onto it; one on a track drawn straight can carry a bend of its
own. The szyny laczace take up the difference, because the switch and the frog
are only bent, not re-cut.
The plan panel draws all of it: the catalogue drawing of a type with its
construction points, the theoretical arc dashed where no rail runs, and the
blade nose as the straight it is cut as. Dragging a straight now stops where it
would pull the track out from under a turnout.
File format goes to m0s 6. Versions 3 to 5 still open.
A turnout's diverging track does not leave the through track tangentially. It
runs straight along the through track to the blade tip (odcinek przediglicowy),
breaks away there by the blade angle (kąt nagięcia iglicy, beta), runs straight
over the blade to its heel, and only then curves - through alfa - beta, not the
whole crossing angle - to the frog.
Give TurnoutSegment a turn_in: a signed heading break applied before the segment
is laid, which is the only way to express a track leaving by an angle rather than
a tangent. lay_turnout then places the lead, the break and the blade ahead of the
curve and hands the curve the angle that is actually left to spend; a zero blade
length keeps the break and starts the curve at the tip. Reject a blade angle that
is negative or already reaches the crossing angle.
All-zero blade figures lay exactly the old tangent arc from PR, so existing
layouts are untouched. Junction and turnout_preset carry the three new figures
through to the panel; the presets themselves still hold zeros until the Id-1
catalogue numbers are in.
Add test_turnout: the lead sits on the through track, the blade breaks by beta,
and the frog still lands on the full crossing angle and the catalogue length,
mirrored for a right-hand turnout.
Checkpoint of the editor branch so work isn't carried loose across a branch
switch. Builds.
- maj0sted turnout geometry moved into the domain: domain::lay_turnout lays the
diverging path (pre-blade lead, blade at beta, arc of alfa-beta, frog rail) and
solve_junction is a thin adapter onto it.
- the maj0sted web/ tree renamed to editor/ (namespace and paths) - there is no
WASM here, it's plain native C++ the editor calls.
- click places the switch at its start (początek rozjazdu); the branch's leaving
straight is locked tangent to the frog; switches can be slid along the through
track and flipped L/P.
- Polish turnout templates carry catalogue length (Id-1-consistent lengths), plus
blade-angle and pre-blade fields (left 0 until the catalogue figures are in).
- TURNOUT_SPEC.md: the Bezier-based runtime/model contract.
- also folds in other pending branch changes (scenery, tests) to leave a clean tree.
A switch (rozjazd) is a relation on a through niweleta, not a niweleta - the
through track is never split. It marks the theoretical point on the through
centreline; two tangent lines cross there (the through heading and that heading
turned by the crossing mark 1:n), and the internal diverging curve is fitted to
round the corner between them, reusing the same GapFitter the gap fits go
through. So the curve is free: a plain arc, or a łuk koszowy right inside the
switch. The theoretical tangent lengths and the curve length follow from it and
are read off, not set.
The branch niweleta's leaving straight is now locked to the frog: it starts at
the frog and runs along the frog heading every solve, only its length is the
user's. That enforces tangency no matter what is drawn, and because the first
straight is pinned tangent, any fit in the branch's first gap - including a
basket - meets the switch tangentially by construction.
solve_layout solves the niwelety and the switches together in two passes: solve,
read each frog, pin the branches, solve again. Switches serialize as an ejuncs /
ejunc section; older files without it still load.
Typical Polish turnouts (rozjazdy zwyczajne) are offered as templates that set
the crossing mark and radius together; the length each spans is computed from
them (arc = R*atan(1/n)) and shown, so how long the switch is is known.
The flip was my mistake. Measured against the service instead of guessed:
fetching a box and its northern half shows the half matching the top of the
whole, so the images arrive with their first row at the north edge and the
default texture coordinates were right all along. Both the base map and the
orthophoto go back to them.
Imagery of a given piece of ground does not change, so a fetched tile is now
kept under editor/cache/orto and the next session starts from it. Until now
the cache lived only in memory, which meant going back to a slow and flaky
service for ground that had already been fetched once.
Gaps can be fitted with a basket curve as well: the library's compound mode,
with clothoids at both ends and a chain of arcs between them. Arcs can be
added and removed; the closing one takes whatever deflection the earlier
ones leave, so its length is not offered for editing.
The Geoportal images arrive with their first row at the north edge, which is
the opposite of what the default texture coordinates assume - the vertical
ones are now swapped, for the picker's base map and the orthophoto alike.
With the real map carrying its own detail as the view zooms in, the drawn
city markers had nothing to add and are gone, along with the coordinate
table behind them. Only the country's extent remains, to open the picker on.
-editor no longer inherits the scenery named in eu07.ini. That is whatever
was last driven, which has nothing to do with editing; without an explicit
-s the editor opens on empty ground.
The location picker now shows the real topographic map instead of a
hand-drawn outline, fetched as one WMS image for whatever box is on screen;
the schematic border is gone and only the city list remains, to jump the
view somewhere recognisable. Under the plan itself a georeferenced map gets
the orthophoto, tiled through the layout library's own EPSG:2180 grid and
cache.
What a native build was missing is here: the download (WinHTTP, on worker
threads), the decode and the texture. Finished transfers are handed back on
the thread that drains them, so both the library's cache and the graphics
API stay on one thread. The imagery service turns down browser user agents
and fails the odd request even for a plain one, so requests go out as curl
and are retried a few times.
Starting a new map now drops the loaded scenery and comes back on empty
ground, instead of leaving the previous scenery's contents under a plan that
has nothing to do with them. The reload is deferred to the top of the frame:
taking the editor off the mode stack while it is drawing its own panels
would pull the ground out from under them.
"New map" now asks what is being started. A fictional scenery keeps its own
frame, where coordinates mean nothing outside it. A real one pins the
scenery's zero to a point picked off a map of Poland, so the plan is drawn
in EPSG:2180 - the frame the layout library already works in, and the one
Geoportal serves imagery in.
The projection is the standard transverse Mercator series for PUWG 1992 on
GRS80. Checked against known values: the central meridian comes out at
easting 500000 exactly, Warszawa at 637382/486757, Krakow at 567614/244588,
Gdansk at 477038/720937.
The map behind the picker is a schematic border outline plus the larger
cities, projected from geographic coordinates on first use. It is coarse on
purpose - it is there to point at a region, not to measure against - and the
dialog says so. No network is involved.
The plan panel had its own 2D canvas, which was the wrong place for it: the
layout is drawn on the scenery. The canvas is gone. Points are laid by
clicking the ground under the cursor, the solved geometry is painted over
the rendered world through the colour pass camera, and the panel keeps only
the controls - fits, storage and what is being edited.
The left button belongs to the plan tool while it is up, so a click no
longer also picks or places a scenery node. Clicks landing on a panel stay
with the panel.
With no georeference set the plan frame and the world share an origin, so
easting runs along world x and northing against world z.
Opening the Plan tool now switches the whole colour pass to an orthographic
projection and pins the camera looking straight down, so the plan is drawn
against the loaded scenery rather than in a window of its own. Closing the
tool hands the camera's orientation back; leaving the editor clears the view
outright. The wheel changes how much ground fits on screen instead of moving
the camera, which with no perspective would change nothing but the clipping.
Both configured backends follow: the experimental renderer swaps the pass
projection (and fits its shadow cascades to it), the modern GL renderer uses
its existing ortho helpers. Everything reading the pass projection - the
mouse ray, the frustum test - picks the change up on its own.
The experimental renderer also publishes its colour pass camera now, which
it previously left at the interface defaults, so overlays can place world
points on screen.
A "Plan" panel, opened from Track layout in the editor's menu bar, draws a
niweleta the way the web frontend did: click to lay chained straights, drag
a corner to move it, and pick a fit for each gap between them. The geometry
is entirely maj0sted's - the panel gathers the input, hands the document to
solve_project and paints the rails that come back, coloured by whether they
came from a straight, an arc or a clothoid. Scenery nodes are untouched.
A fit the library cannot produce is simply absent from its answer, so the
gap is labelled as not fitting rather than left looking as though its
parameters took effect. Save/load go through the library's own document
format, so a project written here opens in the same state.
Also translates the comments added with -editor into English, matching the
files they sit in.
The scenery camera is set up by the driver mode, which never runs when the
exe starts straight in the editor - the editor then copied an untouched
global camera and rendered a black view with only the UI on top. Entering
the editor as the startup mode now initialises the camera itself, falling
back on a view above the origin for sceneries that name no camera, and
resets the timers so the loading time does not land in the first frame.
The editor was reachable only from the driver mode with F11, which meant
loading a scenario and starting the whole simulation first. With -editor
the scenario loader hands over to the editor instead of the driver, so
physics, AI and timetables never run - only the loaded world is there to
be worked on.
Without -s the scenery from eu07.ini is used, falling back to pusta.scn
when the ini names none. F11 quits instead of popping the mode, since the
editor is now the bottom of the mode stack and popping it would leave the
rest of the frame reading an empty one. Editor entry forces free-fly even
with no vehicle to leave.
Consolidates platform-specific config-directory logic (APPDATA on Windows,
~/Library/Application Support on macOS, ~/.config on Linux) into a single
user_config_path(filename) function in utilities/utilities.{cpp,h}, removing
copy-pasted #ifdef blocks from application.cpp, editor/editorSettings.cpp,
input/{keyboard,gamepad,drivermouse,uart}input.cpp.
Pressing Alt toggles picking mode. This is fine for keyboard and mouse usage,
but some use cases, such as disabling picking mode when a finger is placed
on a thumbstick and enabling it back when it's lifted, require finer control.
Allow to always enable picking mode when pressing Alt with Shift, and to always
disable picking mode when pressing Alt with Ctrl.