17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 01:09:04 +01:00
Commit Graph

3833 Commits

Author SHA1 Message Date
154c42cb66 Merge remote-tracking branch 'origin/feat/track-uneven' into feat/renderers-cleanup 2026-10-31 19:13:23 +01:00
24b805b348 Merge remote-tracking branch 'origin/feat/track-uneven' into feat/renderers-cleanup 2026-10-31 18:53:48 +01:00
maj00r
798e8d6a84 feat(tools): grade the tracks of any scenery for the uneven attribute
Usage:

  python tools/track_uneven_grade.py scenery/lk357.scn --out graded
  python tools/track_uneven_grade.py scenery/baltyk_skm1.scn --out graded --route -107,2300 -4120,2491

It follows the includes from a .scn, .scm or .inc, and takes the state of
each track from what the scenery shows: ballast and rail textures, grass
on the track, curves, speed and road crossings. The originals stay as they
are, copies of the files with tracks go to --out, and with no --out it
only reports. Values stay under what a pantograph can follow on those
tracks, by simulation, the rise of the wire itself not counted.

Tracks in .inc files taking parameters are skipped and rotate blocks not
applied, the report says so. See track_uneven_doc.md.
2026-10-31 18:35:00 +01:00
maj00r
02abc7df0a feat(track): all of the unevenness in one attribute, with values for each path of a switch
Usage, before endtrack, in mm, 0-100, separated by semicolons with no
spaces:

  a plain track:  uneven value;up;side;cross;dip
  a switch:       uneven p1-p2;p3-p4;up p1-p2;side p1-p2;up p3-p4;side p3-p4

  uneven 18           the value alone
  uneven 18;;;25;6    with its own cross level and dip at the joints
  uneven 0;;30        sideways alone
  uneven 14;35        a switch, 14 on the straight path, 35 on the diverging

What's left out takes the first number, the dip goes by the up and down
one, and a path p3-p4 with no numbers of its own takes those of p1-p2.
This replaces unevenup, unevenside, unevencross and jointdip. The fields
in the editor stay, track panel, section Ride and sound.

At the end they share, the paths of a switch keep to the lower value, and
each comes to its own value along the way. Joined switches take the lowest
of the same path, a path joined to another path the lower of the two, and
a plain track comes to the value of the path it meets. See
track_uneven_doc.md.
2026-10-31 18:33:35 +01:00
maj00r
88609a1657 fix(track): the ends of joined paths meet, in place and in cant
Ends less than 20 cm apart meet in the middle with a common vector
across, which closes the cracks from coordinates that don't match in the
data, on tracks with no unevenness as well. At such a joint a switch takes
the cant of the plain track, and alike ones meet halfway: the slips on
Baltyk had steps of 0.2 degrees. The physics goes by the same cant.
2026-10-31 18:31:28 +01:00
maj00r
7aff1ee9ff feat(vehicle): an uneven track shakes the cab by itself
On such a track the sway drawn from the lateral acceleration, that is
from the curve radius, and the jolts drawn at random are off. Tracks
with no unevenness shake the cab as before. Hunting stays: it goes by the
vehicle and its speed, not by the track.
2026-10-31 18:29:22 +01:00
maj00r
3dbe8a75f8 feat(track): the foot of the ballast stays on the ground as designed
Rails, sleepers and the top of the ballast go with the unevenness, the
slope of the ballast takes up the difference.
2026-10-31 18:27:19 +01:00
maj00r
6aed9ec5bd feat(track): vertical unevenness comes near its limit more often, with longer buckles too
Fewer short waves: at uneven 18 the humps over 12.6 mm on the 10 m chord
go from 28 to 38 per km, with the peak still at 18 mm. Waves of 47-83 m
join them. They hardly count on that chord, the body rises and falls on
them.

The documentation tells how far unevenness goes before a pantograph
can't keep up. A wire rising fast enough trips the main breaker on a
straight track too: it does at tor0290 on Baltyk, over about 46 km/h.
2026-10-31 18:25:16 +01:00
maj00r
e74bbf951f fix(track): the cross level of an uneven track goes by the place, not by how it was laid
Tracks laid towards each other settled to opposite sides: a step of cant
of twice the value at their joint, in the geometry and under the axles.
It's now a tilt of the plan, which reads the same from either track.
2026-10-31 18:23:19 +01:00
maj00r
b2dcb8a42e fix(vehicle): wheel clatter on an uneven track doesn't loop into a buzz
The phase of the rails was wrapped to the rail length of the track the
vehicle is on, while an axle can be on a track with longer rails. From
then on every frame looked like a joint crossed.
2026-10-31 18:21:28 +01:00
0bc29af650 Merge remote-tracking branch 'origin/feat/switch-fastenings' into feat/renderers-cleanup 2026-10-31 17:13:45 +01:00
75cb88f275 Map BC7 (BPTC) dds textures to native VK_FORMAT_BC7 in the Vulkan renderer 2026-10-31 16:46:35 +01:00
maj00r
e5266e1e6b feat(track): track unevenness declared in the track entry
Usage, optional attributes of a track entry, before endtrack:

  uneven <mm>       peak deviation of a rail on a 10 m chord, 0-100; normal and switch
  unevenup <mm>     up and down alone, instead of uneven; normal and switch
  unevenside <mm>   sideways alone, instead of uneven; normal and switch
  unevencross <mm>  cross level alone, instead of uneven; normal only
  jointdip <mm>     depth of the dip at rail joints, every sound distance; normal only,
                    default 0.4 of the up and down component

Values of uneven follow PLK Id-14 appendix 1: 6 mm is the limit at 160 km/h, 10 at 120,
18 at 80, 35 at 40; half of it for a track in a good state. Example:

  uneven 18
  unevencross 25
  jointdip 6
  endtrack

The same fields are in the editor, track panel, section Ride and sound. See
track_uneven_doc.md.

The unevenness is a displacement field over the plan of the scenery, with no random
numbers: one place strays the same every time, and joined tracks, the paths of a switch,
sleepermodel and axles at one place move together. Tracks meet at a joint at the lower of
their values. Joined switches take the lowest of theirs, the tracks joined to them come to
it, and a track with none of a component keeps the switch to its design in it. The clatter
comes from the dipping joints. Curve radius and grade for the physics stay as designed.

Tracks with it get geometry every 2 m on straights: 4x the vertices on Baltyk with all
tracks flagged, 0.2 ms more per frame on td.scn.
2026-10-31 15:47:10 +01:00
7078edf138 fix(vulkan): read back the editor cursor depth and correct the depth pass bias 2026-10-30 01:33:41 +01:00
765153ad91 Merge remote-tracking branch 'origin/feat/switch-blades' into feat/renderers-cleanup 2026-10-29 23:55:04 +01:00
maj00r
80379b991c feat(editor): the work of the editor sessions not committed yet, as it stands: a curve traced on from the end of the diverging track of a switch goes on at its radius with no transition in, or from a straight right at the switch (alignment start_held, fit_going_on), the plan taking an end adjoining R 10 km or more for a straight; the switches and slips laid into curves, slid along them and laid alone on one straight (frame_path, switch slide); the route plan reading curves going on from the tracks adjoining, the kept designs taken or forgotten; the orthophoto and terrain model settings, downloads and layers, the tracks onto the terrain; the curvature of a path in the plan (bezier::plan_curvature); the Polish texts of all of it. Not built as committed 2026-10-29 22:19:06 +01:00
maj00r
2eda26b94c feat(editor): a warning of the sudden change of the cant deficiency right behind a switch, as ST-T1-A6 sees it (9.11): a track laid on from the end of the diverging track of a switch, or into it, is checked by switch_curve::check_exit from the end of the curve of the switch, a straight frog's length before its end, to the first sudden change of the curvature of the track laid. Two of them nearer than the intermediate element of table 9.16 (6 m in track connections up to 60 km/h) are taken together, else each one alone, against table 9.15 (130 mm up to 60 km/h), at the speed of the laying or of the diverging track of the switch, the lower one. The view tells of it by the cursor while the track is extended or laid, the status once it's laid; a transition out of the frog straight makes no sudden change. Selftest: from a Rz S42-190-1:7,5 with a frog straight of 1.66 m a curve the other way of R 200 m warned of 194 mm together, the same way none; from a Rz 60E1-190-1:9 with 6.09 m a curve the other way of R 200 m none, of R 120 m warned of 157 mm 2026-10-29 22:16:19 +01:00
a99882278a Fix the build after merging master: drop the GLES check from bptc_supported() 2026-10-29 20:46:11 +01:00
55372571b3 Merge branch 'master' into feat/renderers-cleanup 2026-10-29 20:42:39 +01:00
96100f1155 Draw the cab probe with all the lights of the cab 2026-10-29 20:05:03 +01:00
8bd41f431d Keep the slices of the ring caches within the window the shaders index from 2026-10-29 19:21:14 +01:00
975fc1b4ea Look 4 GiB lower for the buffer of a fault address that holds nothing 2026-10-29 19:15:44 +01:00
9bc9168230 Keep the contact shadow march and the traced reflections off NaN normals 2026-10-29 19:04:57 +01:00
bcf2c14b20 Place the images of the allocator blocks in the device-lost report exactly 2026-10-29 18:57:53 +01:00
325be54b2c Name the buffer or image a Vulkan device fault hit in the device-lost report 2026-10-29 18:04:38 +01:00
91c6324965 Add the optional LightOnly of FreeSpotLight 2026-10-28 21:50:08 +01:00
8c6a47f42c Light the occupied cab with the light points of its model 2026-10-28 21:16:22 +01:00
65e104f813 Light the occupied cab with the light points of its model 2026-10-28 21:06:02 +01:00
9904eddd0d Light the cab with cablight/dashboardlight light points of the cab model 2026-10-28 20:55:45 +01:00
8f891fdc14 Report where the GPU got to when the Vulkan device is lost 2026-10-28 20:21:00 +01:00
c4e23932bf Add the optional Radius, ShadeSelf, CastShadows and SoftFalloff of FreeSpotLight and make FalloffAngle 360 a point light 2026-10-28 16:18:03 +01:00
413cebed9c Hold the sky back only around tunnels and keep the cab lit by day 2026-10-28 14:01:37 +01:00
e8a90507f0 Light the cab with the sun coming in through its windows 2026-10-28 12:19:43 +01:00
1447dcf075 Walk the shadow passes and the culled model groups on worker threads in the Vulkan renderer 2026-10-27 20:56:11 +01:00
maj00r
b0918628b4 fix(editor): a curve traced from the end of the diverging track of a switch with one point clicked goes on with the curve of the switch as far as abreast of the point, seen from its centre, and ends on it there, instead of turning into a straight where the straight to the point left it: the curve is held to where it was clicked, a point inside it as well. Selftest: one point after P4 of a Rz 60E1-300-1:9 laid R 300 m on to 238.36 13.31 for a point at 240 8, to 243.31 14.88 for one at 240 25, the curvature at P4 going on within 0.5 % 2026-10-27 19:41:50 +01:00
maj00r
667e433af9 feat(editor): a slip is selected, slid and deleted whole: any track of it picked shows all of it selected, editor_mode::slip_of finding its switches by its record, the tracks between them and its four ends. Dragged along, the slip moves along its first track with the straights out to the joints of its template and its crossing track, as far as that one goes on into tracks with their ends free, the straights of its first track before it and past it lengthened and shortened, a metre of them kept; one bent into a curve isn't slid, nor one whose crossing track is joined on beyond it. Deleted, it leaves its two tracks crossing from end to end in its place, kept in the scenery as a crossing Skrz, as a switch leaves its main track; Shift+Del takes all of it, Ctrl+Z brings it back. Selftest: a Rkp laid with its crossing track slid 5 m on and 3 m back, the joints of its template with it, walked through; deleted into a crossing Skrz 1:9 walked through, back with Ctrl+Z; a Rkpd at a crossing of straights with free ends slid 2 m, deleted into a crossing 2026-10-27 19:40:56 +01:00
maj00r
7b11db566e feat(editor): a slip Rkp or Rkpd bent into a curve of a side track: dragged on a curve with a slip armed it's laid out on the tangent to the curve where it was pressed and bent onto the curve as a switch laid into one is, editor_mode::frame_path laying a path of a template into the curve for both, its crossing track coming along with its ends free, ahead to the side of the drag, the slip curve of a single slip on that side, the straights of both tracks out to the joints of its template. A crossing goes only where two straights cross, a curve as sharp as the slip curves is refused. As it's dragged the view tells the radii of its tracks and slip curves, its cant and what switch_curve::check_slip says, the 11.4 pkt 4b of ST-T1-A6 among it; laid, the status the same. A slip bent into a curve isn't replaced by one laid out of straights. Selftests switchcurve, bladetips: a Rkpd 49E1-190-1:9 in R 800 m with its slip curves of R 154 and 249 m and the warnings of 11.4 pkt 4b and table 9.2, one of R 300 m in R 800 m with no warning of table 9.2, a Rkp in R 4000 m, the blades from 1.248 m on all of them; refused in R 150 m, a Skrz refused 2026-10-27 19:39:38 +01:00
maj00r
7f6a8736ca feat(editor): a slip goes only where the straights cross at the skos of its template: a Rkpd 1:9 was laid at a crossing of 1:7 or 1:14 as well, shaped for the angle of the tracks there into no slip of the catalogue. The straights crossing at a skos more than 0.14 deg off it, half of what keeps 1:9.51 and 1:10 apart, are refused with the skos they cross at and the slip of the same kind made for it, of the same rail and radius first, or none; a double slip replaced by one of another skos likewise. The panel and the hints say the slip goes at its skos. Selftest: a Rkpd 49E1-190-1:9 laid at 1:9 and 1:9.08, refused at 1:7 with no template for it and at 1:9.51 with Rkpd S42-230-1:9,51 fitting 2026-10-27 19:35:01 +01:00
maj00r
f8a12107a0 feat(editor): a switch laid with no track there, and no switch laid by a click: a press on the ground with a switch armed lays the switch there, its start where it was pressed, the direction of its main track taken from the drag once it's 4 m long and held, the drag sideways then giving the side of the diverging track, back by the start the direction free again; pressed by a free end within 5 m it goes on from that end in its direction and grade, joined to it. Its ends are left free to lay on from, styled after the track it goes on from or as the lay tool lays its tracks (editor_track::create_switch with a path_style). A press let go within 10 pixels places no switch, a slip at a crossing included, which was laid at once on the press: it's laid once dragged, its straights shown meanwhile. The hints and the panel tell of both. Selftest switchfree: Rz 60E1-300-1:9 on the ground with its four ends free, from the free end of a straight joined and walked through; a click on a straight laid none, a drag laid z1 2026-10-27 19:33:23 +01:00
maj00r
1340017be3 feat(editor): a slip keeps in the scenery the radius of the main track it's bent with, as a switch does, the lists of the switches telling it as Rg: switch_store::main_radius_of gives it from the first path of a switch, classify takes it from there too; a slip laid on straights keeps 0 2026-10-27 19:23:31 +01:00
maj00r
89b6ca07af feat(editor): the norms of a slip switch bent into a curve, as ST-T1-A6 sees it: switch_curve::check_slip tells that a slip is bent in a side track only, never in the running nor the main tracks (11.4 pkt 4b), that a track through it is to keep its curvature of one sign (9.7 pkt 12), that a slip curve bent the way the curve turns gets sharper and no sharper than the 180 m of a side track (table 9.2), and the cant as over a bent switch, with none recommended in a side track (9.3 pkt 5). The cant over a switch is checked by one function for both. Unit tests: a Rkpd of R 190 m bent into R 800 m has its slip curves of R 154 m, below the side track, and 249 m; into R 4000 m of R 181 m, within it; on a straight it's no bent one 2026-10-27 19:23:24 +01:00
maj00r
c353435cc1 fix(track): a path with its radius given is a curve however gently it bends, it isn't straightened as it's loaded: a path whose control vectors lay within 2 cm of where a straight has them was laid as a straight, a short one bent with a gentle curve too, as the 9.44 m of the main track of a switch of a slip bent into a curve of R 800 m, whose diverging track kept its curve: the two tracks of the switch 14 mm apart where they're one, the blades of a side of the slip shaped from 0.354 m, of the other side not at all. Plain tracks, switches and the pieces of their paths alike; one with no radius, as a straight given its control vectors along it, is straightened as before. Selftest bladetips: a Rkpd 49E1-190-1:9 bent into R 800 m and R 4000 m with the blades of all four switches from 1.248 m, as on straights 2026-10-27 19:21:50 +01:00
maj00r
6533914024 fix(track): the blades of a slip laid in the editor are shaped from their templates as the ones of a switch are, from the tip where their planed nose ends, so they start where the view marks the tips of the blades and the drive stands, not at the joint before them: the crossings of the diamond the blades end short of were looked for only among the tracks with their rails cut, which the simulator never cuts, so the slips kept the blades laid from the start of the switch. They're found now among the tracks with their rails whole too, for the blades of a slip only. Selftest bladetips: the blades of the four switches of an Rkpd 49E1-190-1:9 from 1.248 m to 7.55 m, as the drives; Rz 60E1-300-1:9 unchanged, 1.5 to 12.69 m 2026-10-27 19:21:40 +01:00
c44b243698 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 17:11:06 +01:00
2961ce1445 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 16:08:35 +01:00
2a876befb0 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 16:02:36 +01:00
9dde5b0e5e Take the ambient occlusion into the lighting and add a probe of the cab 2026-10-27 13:23:52 +01:00
ac0b4e5f15 Add a white balance to the tonemapping 2026-10-27 01:40:19 +01:00
82d3842495 Load catenary node entries from included scenery files reliably 2026-10-27 01:04:22 +01:00
maj00r
476909581f fix(track): two switches laid right after one another, with no plain track between them, are joined, the vehicles no longer derail there: only the plain tracks looked for their neighbours, so the end of the main track of one switch at the start of the next one was joined to nothing, and an axle getting to it ran onto a track made to derail it. TTrack::join_switches joins the free ends of a switch to the ends of other switches in the same points, on both sides, with the codes of the ends the axles go on by: the end of either path of one at the start of the other, two facing at their starts, two meeting at their ends; done once the plain tracks are joined as the scenery is loaded, the old sceneries too, and as the editor joins a switch laid. Selftest pathwalk walks the tracks as an axle does: P2 to P1, P4 to P1, start to start and end to end go through either way 2026-10-26 20:40:51 +01:00