17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 20:19:20 +02:00
Commit Graph

3344 Commits

Author SHA1 Message Date
maj00r
2b554183ed fix(track): a loft cut along its length keeps its surface where the cut crosses a point of the profile: each span between stations sorts the points as clamped or open by its middle, so the ring at a station where a point lies right on the edge does not drop the next point to its own height and leave a dark groove along the top of the rail; clamped points that are not on the edge are kept between the heights of the edge on both sides of the run, so they never stand above the surface 2026-10-14 00:47:39 +02:00
maj00r
1797484809 fix(track): the pieces of the top of a rail head are laid only where they have width on the head between its cut edges, split where the edges of the wheel treads cross those cut edges, and the shared spans reach 2 cm further for the fade, so no inverted piece is drawn inside the neighbouring rail and no fin stands out of the head; EU07_EDITOR_TREADS paints the pieces in plain colours: blue shared, green and red the fades, yellow the edge of the rolled band, magenta the matte part out of reach of the wheels 2026-10-14 00:47:39 +02:00
maj00r
5122c2ccb4 fix(track): the treads of the wheels reach from the gauge line as far as a wheel 140 mm wide with the back faces 1360 mm apart does, 820 mm from the axis of a standard gauge track, instead of a flat 100 mm 2026-10-14 00:03:06 +02:00
maj00r
a6e39ba77f feat(track): frogs, crossings and shared running surfaces only for the rail profiles the sceneries of the package use: tracks without a profile, default, s60, uic60 and s39; rails of other profiles are laid whole again 2026-10-14 00:03:06 +02:00
maj00r
592d1687d5 feat(track): the texture of a shared running surface blends into the texture of the rail it lies on: 2 cm on each side of the boundary both are drawn in tinted variants of their materials that fade per vertex into the mean colour of the two treads, sampled from the texture files, so the edge of the wheels of the other track leaves a soft band instead of a line 2026-10-14 00:01:20 +02:00
maj00r
1219dde073 fix(track): obtuse crossings share the running surface too: the top of a rail crossed by the treads of the wheels of the other track takes the brighter texture between the gauge line of the other rail and the edge of its treads, so the boundary runs aslant on both sides 2026-10-13 23:22:31 +02:00
maj00r
90e80aa161 fix(track): the shared running surface ends along the edge of the treads of the wheels of the other track, not across the rail: on a nose leg the edge runs aslant over the head, on a stock rail it follows the curve of the other path; only the top of the head takes the other texture, the rest of the rail keeps its own 2026-10-13 23:13:01 +02:00
maj00r
6d8c40b504 fix(track): the two legs of a V nose are cut along the bisector of their gauge lines and meet in the middle as one nose, from a tip 12 mm wide to where their full profiles part, instead of the splice rail giving way under the head of the point rail 2026-10-13 22:57:34 +02:00
maj00r
989a6cd47e fix(track): flat rail frogs have no plates in the V; the shared running surface of a nose leg goes from its tip to where the wheels of the other track stop reaching its head, on the leg only and not on the wing beside it; the stock rail of a switch is shared up to a quarter of the blade length, where the blade head is half its width and takes the wheel 2026-10-13 22:54:43 +02:00
maj00r
7e20023d07 feat(track): where two rails share a running surface it takes the texture whose running surface is brighter; the brightness is read from the texture file over the u range of the rail head top, the shared parts are the block of crossing grooved rails, the nose of an acute frog from its tip to the end of the V, the through rail across a wide or grooved crossing, the frog of a switch, and the stock rails of a switch with frogs up to half the blade length where the blade grows to a full head 2026-10-13 22:36:09 +02:00
maj00r
2ece18cc4a fix(track): a crossing of grooved rails is one flat block where their lofts overlap; the rail cut by the other covers the roundings of the rail going through, the tops in the block are flat in one texture, the plates of the V reach up to the rail top, the walls of the cuts are lit and textured as walls, and the nose between two flangeways starts blunt at the width of a nose tip instead of a thin sliver standing in the groove 2026-10-13 22:03:36 +02:00
maj00r
18c01ceb72 feat(track): frogs and crossings for every rail profile; grooved rails share the floor of their grooves where they cross and need no check rails, the V beside the rail going through is one block where the lofts of the rails overlap; the nose of an acute frog of flat rails is filled between its legs as far as their lofts overlap, like a cast insert 2026-10-13 21:03:17 +02:00
maj00r
6fe30714f7 fix(track): the lowest of two height lists also takes the points where they cross, so the top of an obtuse point rail is not cut narrower than its sides; the end of a short neighbour track joined at a crossing is the nearer one, not any within half a metre 2026-10-13 19:59:43 +02:00
maj00r
d4d8168aec fix(editor): self-test frog takes the throat, nose, wing end and check rails from the sizes the rails are laid with, so the wing end is logged where it is laid; self-test crossings tells crossings at middle angles apart and counts them 2026-10-13 19:07:17 +02:00
maj00r
1aaaa3be9c refactor(track): one plan projection, cross product and meeting of two lines in plan for the crossings of rails, the frog of a switch and the check rails, in place of copies in each 2026-10-13 19:05:11 +02:00
maj00r
9016d72d74 refactor(track): the rails of the two paths of a switch are laid by one loop for left and right switches alike, the side of the blade of a path and the blade itself come from one place, used when a switch is made, thrown and its frog found 2026-10-13 19:03:20 +02:00
maj00r
324974041c refactor(track): the blades of a thrown switch are drawn again with their cut faces by one helper instead of four copies; self-test command switches sets every switch to a path and moves its blades there at once 2026-10-13 18:56:21 +02:00
maj00r
38b2f4108a perf(track): pieces of gauge lines whose bounding boxes do not meet are skipped before they are intersected; self-test railtime logs how much of the time goes to finding the crossings 2026-10-13 18:54:11 +02:00
maj00r
c0b50cc3d2 perf(track): the gauge lines, crossings and check rails of a track are kept until a track is made, rebuilt or removed, so laying the rails of a track no longer recomputes its neighbours' crossings for each wing rail; self-test command railtime times planning the rails of all tracks 2026-10-13 18:47:04 +02:00
maj00r
420e4742b5 feat(editor): self-test command guards logs each guard rail and what each of its ends and breaks is cut along: the rail of the other track, how far off its gauge line and how skewed; a fault when a cut is not along a rail, or a glued end of the frame of a crossing at a middle angle is not on the face of a guard rail of the other track 2026-10-13 18:41:56 +02:00
maj00r
a93ed67c58 feat(editor): every switch laid in the editor gets the key frogs, a box in the Switch panel sets or clears it as one undo step; the editor rebuilds the tracks crossing a changed or removed one; self-test commands frog, crossings, frogkey and geomhash; Polish translation 2026-10-13 18:30:16 +02:00
maj00r
16672e81cc feat(track): rails are cut where they cross other rails: a switch with the key frogs draws its frog, wing rails and check rails from its rails, tracks crossing other tracks get acute frogs with wing rails and check rails, obtuse points, guard rails along the quadrilateral of a crossing between 20 and 45 degrees and broken rails with guard rails at wider angles, the track going through chosen by name; sizes come from the rail profile, only for the profiles default, s60, uic60 and s39, others are laid whole; rail ends left open are closed with their cross-section; switches of older sceneries, with check rails in their includes and no key, are drawn as before 2026-10-13 18:30:16 +02:00
maj00r
f067824014 feat(renderer): a matte variant of a material for the parts of rails no wheel rolls on: it lights the same maps as weathered steel, with the weathering scaled per vertex by userdata, so a polished running surface fades into unused steel without a bright stripe; the cut faces of rails are drawn in it in an extra pass 2026-10-13 18:30:16 +02:00
maj00r
05ffb9058c Merge pull request #212 from MaSzyna-EU07/fix/targetfps-default
fix(gfx): targetfps off by default again
2026-10-11 23:27:54 +02:00
maj00r
eaf7e787b8 fix(gfx): targetfps off by default again, draw range stays at heightbase instead of being driven by measured fps (with vsync on a 60 Hz monitor it sank to half); targetfps in eu07.ini still turns the regulator on build-fix-targetfps-default 2026-10-11 23:20:08 +02:00
combolek
3ed864812f Fix line endings (#211)
There where some extra CRs introduced in a recent commit.
2026-10-11 20:42:09 +02:00
jerrrrycho
8125166690 Fix/sonar reliability security (#205)
* fix(sonar): addressing reliability/security issues

* fix(sonar): addressing reliability/security issues

* fix(sonar): addressing reliability/security issues

* fix(sonar): addressing last reliability/security issues

* fix(sonar): addressing last reliability/security issues

* fix(sonar): addressing last reliability/security issues

* refactor(sonar): imgui update

* refactor(sonar): hasChar revert
2026-10-11 15:31:45 +02:00
jerrrrycho
6263fe539b Fix/sonar maintainability rebased (#209)
* refactor(sonar): use override instead of redundant virtual (cpp:S3471)

* refactor(sonar): remove empty statements, one declaration per statement (cpp:S1116, cpp:S1659)

* refactor(sonar): drop redundant lambda return types (cpp:S3574)

* refactor(sonar): prefer using over typedef (cpp:S5416)

* refactor(sonar): use =default for trivial special members (cpp:S3490)

* refactor(sonar): use nullptr literal (cpp:S4962)

* refactor(sonar): remove redundant access specifiers (cpp:S3539)

* refactor(sonar): remove redundant casts (cpp:S1905)

* refactor(sonar): use std::scoped_lock instead of std::lock_guard (cpp:S5997)

* refactor(sonar): construct elements in place with emplace_back (cpp:S6003)

* refactor(sonar): make narrowing conversions explicit (cpp:S5276)

* refactor(sonar): mark unused parameters (cpp:S1172)

Unused names are commented out; parameters used only on some platforms
are marked [[maybe_unused]].

* refactor(sonar): declare non-mutating member functions const (cpp:S5817)

Virtual functions are left untouched so overrides keep matching.

* refactor(sonar): merge collapsible nested if statements (cpp:S1066)

Comments that preceded the inner if are kept above the merged statement.

* refactor(sonar): scope single-use variables in if init-statements (cpp:S6004)

* fix(sonar): give polymorphic base classes virtual destructors (cpp:S1235)

* refactor(sonar): use try_emplace for map insertion (cpp:S6030)

* refactor(sonar): use auto where the type is spelled out on the right (cpp:S5827)

* refactor(sonar): remove redundant parentheses (cpp:S1110)

* refactor(sonar): document intentionally empty functions (cpp:S1186)

* refactor(sonar): remove dead stores (cpp:S1854)

Side effects (e.g. LISTLINE++) are kept.

* refactor(sonar): remove unused variables, captures and private fields (cpp:S1481, cpp:S1068)

* refactor(sonar): use structured bindings for pair access (cpp:S6005)

* refactor(sonar): use range-based loops and ranges algorithms (cpp:S5566)

* refactor(sonar): split chained assignments (cpp:S1121)

* refactor(sonar): add default cases to switch statements (cpp:S3562)

* refactor(sonar): use std::size for array lengths (cpp:S7127)

* refactor(sonar): use std::ranges algorithms and std::erase(_if) (cpp:S6197)

* refactor(sonar): access static members through the class (cpp:S2209)

* refactor(sonar): add braces around nested if-else (cpp:S5261)

* refactor(sonar): avoid side effects inside typeid operands (cpp:S5279)

* refactor(sonar): drop top-level const from by-value return types (cpp:S5951)

* refactor(sonar): declare variables separately from their type definitions (cpp:S3646)

* refactor(sonar): declare loop counters in the for statement (cpp:S5955)

* refactor(sonar): rely on class template argument deduction (cpp:S6012)

* refactor(sonar): inherit base constructors instead of forwarding them (cpp:S5952)

* refactor(sonar): rename locals that shadow outer declarations (cpp:S1117)

Only local variables and definition parameters are renamed; shadowing
struct fields and enumerators in headers are left for a separate change.

* refactor(sonar): reduce enum qualification with using enum (cpp:S6177)

Applied only where no unqualified name in the block could be captured by
the introduced enumerators.

* refactor(sonar): mark converting constructors explicit (cpp:S1709)

sound_source and the gl::object conversion operators stay implicit; they
are relied upon by copy-list-initialisation and GL calls.

* refactor(sonar): initialise members in initialiser lists or declarations (cpp:S3230)

* refactor(sonar): make read-only local references and pointers const (cpp:S5350)

* refactor(sonar): take read-only pointer and reference parameters as const (cpp:S995)

TTrain command handlers keep their signature, it is fixed by the handler table.

* refactor(sonar): pass expensive-to-copy parameters by const reference (cpp:S1238)

Signatures declared in files touched by PR 206 (Driver.h, EU07.cpp) and
virtual overrides are left unchanged.

* refactor(sonar): use transparent comparators for string-keyed maps (cpp:S6045)

std::unordered_map instances and map types exposed in headers used by
other modules are left as they are.

* fix(sonar): do not use UI text as a printf format string (cpp:S5281)

Text lines containing '%' would otherwise be interpreted as format
specifiers by ImGui::TextColored.

* refactor(sonar): use std::bind_front for callbacks (cpp:S5995)

* refactor(sonar): drop const_cast on string literals passed to the Python C API (cpp:S859)

* refactor(sonar): take read-only string parameters as std::string_view (cpp:S6009)

The Windows messaging helpers keep std::string, they need c_str().

* refactor(sonar): make read-only global tables const (cpp:S5421)

Mutable global state (flags, timers, singletons) is left as is.

* refactor(sonar): replace single-case switch statements with if (cpp:S1301)

* refactor(sonar): format UUIDs and log timestamps with std::format (cpp:S6494, cpp:S5945)

* refactor(sonar): use std::array for local fixed-size arrays (cpp:S5945)

Arrays that are class members or part of headers are left unchanged.

* fix(sonar): test the bearing damage bit, not bit 0 (cpp:S872)

'DamageFlag & dtrain_bearing > 0' parsed as 'DamageFlag & (dtrain_bearing > 0)',
i.e. DamageFlag & 1, so bearing friction reacted to the wrong damage flag.

* refactor(sonar): assorted small fixes

- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

* refactor(sonar): more small fixes

- std::format instead of iostream manipulators in to_string/to_hex_str (cpp:S6495);
  output verified identical, negative hex values keep the unsigned form
- remove an empty compound statement (cpp:S108)
- drop an always-false unsigned < 0 branch (cpp:S1768)
- explicit lambda capture (cpp:S3608)
- std::make_unique (cpp:S5950)

* chore: strip stray carriage returns left in TTrain constructor comments

* fix: keep quantize() in its own value type

The S5276 change cast the result of the generic quantize<Type_>() to
unsigned int, which truncated float/double callers (shadow angle slider,
editor rotation snapping, AI speed control steps) and broke negative values.

* fix(sonar): use integer loop counters in segment sampling (cpp:S2193)

* refactor(sonar): clean up issues reported on PR 209

- remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854)
- unnamed unused parameter (cpp:S1172)
- single-use declarations moved into if init-statements (cpp:S6004)
- auto for casted initialisers (cpp:S5827)
- const references and pointers where nothing is modified (cpp:S5350)
- rename structured bindings shadowed by inner declarations (cpp:S1117)
2026-10-11 13:22:33 +02:00
c26041f2e7 Merge pull request #199 from MaSzyna-EU07/brake-diag
AI - prevent overcharge when pipe pressure of car is too high for too long
2026-10-10 20:37:12 +02:00
3ade849d50 Merge pull request #206 from MaSzyna-EU07/feat/modern-editor
New road system, simple export, layers, editor features etc.
2026-10-10 20:24:04 +02:00
7d331ee65a Editor: brace ImGui clipper loops, rename scenery wizard file name field build-feat-modern-editor 2026-10-10 19:55:50 +02:00
21445507cc Editor orthophoto: own geometry bank per scene tile, per-frame vertex budget 2026-10-10 18:24:26 +02:00
dab227d16d Editor: keep the terrain palette rotation/repeat values when the slider is released 2026-10-10 18:19:10 +02:00
7b9eaf1ccb Editor terrain: area fill with blurred or sharp edge, texture rotation 2026-10-10 17:35:52 +02:00
63302c1ace Editor terrain: soft stitching to tracks, chunk resolution conversion, water materials 2026-10-10 16:08:12 +02:00
243ce636a7 Editor terrain: level brush with height picker, faster orthophoto fit 2026-10-10 01:27:48 +02:00
8cd0bab27b Editor terrain: texture browser, undo, conversion from terrain files
- Terrain work mode shows a browser of the textures folder in place of the
  node bank; textures/materials can be dragged onto the palette entries
  (replacing the material), the material field and the water material field
- Ctrl+Z/Ctrl+Y for heightmap terrain changes: a brush stroke or an
  operation is one step of the editor history
- Ground conversion reads only the files of the terrain directives
  (.txtf with origin/rotate, or .btf without text), paints the chunks with
  the materials of the triangles, drops only the shapes of those files
- Fix: ground grids converted out-of-range floats to int, so whole-scene
  queries returned the triangles of a single cell (shifted chunks)
- Fix: terrain layers copied from textures already uploaded without their
  data stayed grey
- Fix: ImGui ID conflict between terrain tool radios and section headers
- Fix: layers of terrain .txtf files named with the scenery/ prefix and
  could not be saved
- Editor selftest commands for the terrain
2026-10-09 23:39:26 +02:00
5716bc1669 Fix windows compilation 2026-10-09 21:16:34 +02:00
35bda3778c Heightmap terrain: .tch chunk packs, streaming with LOD, terrain painting, water and modifiers - terrain/<name>/terrain.yaml + <px>_<pz>.tch packs of 16x16 chunks (250 m, 0.5/1/2/5 m spacing), slices with crc-32 and optional zstd (vendored zstd 1.5.6 in ref/zstd) - heightmap_terrain [name] endheightmap_terrain directive replaces editorterrain - streamer: worker threads, camera + look-ahead loading, geomipmap LOD with skirts, pooled geometry - mat_terrain shader: up to 8 painted layer materials per chunk via texture arrays (opengl33); other renderers fall back to the dominant material - water bodies (outline + level), terrain modifiers (vertical profile shaping kept non-destructive) - F11 Terrain work mode rebuilt: chunks, sculpt, smooth, paint, point spacing, water tools 2026-10-09 21:02:25 +02:00
bbccce0e29 Merge branch 'feat/modern-editor' of https://github.com/MaSzyna-EU07/maszyna into feat/modern-editor 2026-10-09 18:40:51 +02:00
9935257783 Add nosonar tags 2026-10-09 18:40:31 +02:00
maj00r
e910615bf6 removed draw limit in track editor 2026-10-09 15:37:23 +02:00
1c28809dd7 Sonar fixes 2026-10-09 14:42:55 +02:00
7a9e3754cc Merge pull request #207 from MaSzyna-EU07/feat/mini-generation
Mini generation, new editor UI interface, bump imgoj version
2026-10-09 13:37:07 +02:00
5160ffb87d Windows macro fixes build-feat-mini-generation 2026-10-09 13:30:21 +02:00
ff25e71e90 Merge branch 'feat/modern-editor' into feat/mini-generation 2026-10-09 13:13:33 +02:00
3e3317d26f feat(editor): the toolbar as buttons with icons and names, the chosen tool standing out as the chosen field of work does, the names left out when the row is too narrow for them; the fields of work with icons of their own (surroundings, tracks, roads, terrain) and both rows captioned at their left end (work modes, tools); the tools of the toolbar and of the left edge of the 3d view from one list; Polish translation 2026-10-09 12:49:45 +02:00
1bf687b4c9 feat(editor): the node bank in two panes, as the assets of unity: its groups on the left with the scenery templates, the entries of the chosen one on the right, as cards or a list, a search going through all of them; the models dragged from the node bank onto a model set, the templates of a set or the list of the brush or the area fill; the templates of the model sets shown with their previews; the model sets docked by the node bank by default; Polish translation 2026-10-09 12:01:00 +02:00
645a54a739 feat(editor): icons over the 3d view: the tools of the field of work along its left edge (the edit modes of the surroundings, the track tools, the road tools with the lanes, the terrain tools with the orthophoto), the modes of the gizmo at its top, the axes of the world as the camera sees them in its top right corner, a click on one looking along it, with the top view under them; the icons drawn by editor/icons/editor_icons.py into a png which CMake writes out as an array built into the executable; the gizmo modes and the top view left out of the toolbar; Polish translation 2026-10-09 11:54:47 +02:00
f2e73812d9 feat(editor): View menu with the top view, the lanes of the roads, the structure gauge and a window of the weather and time (time of day, day of the year, visibility, clouds, air temperature, seen in the editor only); the orthophoto settings in a window of their own again; the tracks and roads menus left out, their tools being in the row of the field of work; End drops the models onto the same ground the insert puts them on, the terrain tile models and the terrain patches of the editor included; the loading screen kept in the main window; Polish translation 2026-10-09 11:46:42 +02:00