17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 23:07:38 +01:00
Commit Graph

218 Commits

Author SHA1 Message Date
7667e5b2ec fix: the bugs and vulnerabilities SonarCloud reports on PR #216 2026-11-07 22:11:08 +01:00
8e85def98f Merge pull request #240 from miloszunio/fix/gl46-editor-cursor-depth
fix(gl46): editor cursor depth read in the biased depth pass (port of 7078edf)
2026-11-07 19:58:31 +00:00
acbea51f81 fix: the build after the merge of master 2026-11-07 16:46:11 +01:00
d4120ea5db Merge branch 'master' into feat/renderers-cleanup 2026-11-07 16:44:51 +01:00
917c472cc9 Merge pull request #257 from MaSzyna-EU07/fix/vehicle-removal-smoke
fix(gfx): a vehicle taken off the tracks stops smoking (#90)
2026-11-07 13:28:31 +00:00
pawelw
bb009b0499 Text displays: draw opaque characters in the opaque pass (#201)
* Text displays: accept characters above 127, in windows-1250 or utf-8

A text display (sub-model of type "text") looks up the sub-model of each character
in a 256 entry table, and indexed it with a plain char. With char being signed, any
character above 127 gave a negative index: reading the text went outside the table,
and so did filling the table if a character sub-model had such a name. In effect the
displays could only show ASCII, and a text with national characters could crash.

The lookup is now keyed by unicode code point. Both the displayed text and the names
of the character sub-models are decoded as utf-8 if they are valid utf-8, and as
windows-1250 otherwise, so legacy (ansi) sceneries and models work next to utf-8
ones, and the two can be mixed. A short ansi text can be valid utf-8 by accident
(two upper case accented letters in a row will do); when both readings are possible
the one which finds more of its characters in the model is used.

The rest is unchanged: the first character of the text still isn't displayed, the
characters are still drawn in the translucent pass only. A missing text pointer no
longer gets dereferenced.

* Text displays: draw opaque characters in the opaque pass

The characters of a text display were only laid out in the translucent pass, so a
display had to be made of translucent sub-models to show anything. Those don't write
depth: overhead wires and other translucent geometry drawn later showed through the
display, and translucent geometry in front of it could end up painted over.

The opaque pass now lays the characters out the same way, so a display built from
opaque sub-models is drawn with depth like any other opaque geometry (and casts
shadows). Translucent characters keep working as before.

A model with a text display shows the text of its own instance, so such models are
excluded from the GPU-instanced opaque path.

* Text displays: prepare the characters once for each text

The sequence of character sub-models was cached for the last text only, so
displays of several instances drawn in turn decoded their texts again on
every draw. It is now kept for each text the display shows; the texts of the
instances don't change, so a draw costs a single lookup.

Also the comments added in the renderers are now in English.

* Text displays: move the text decoding to utilities

utf8_to_utf32() and win1250_to_utf32(), with the windows-1250 table, now sit
next to win1250_to_utf8(). The existing function maps only the Polish letters
and passes other bytes above 127 through, so it can't serve the displays.

* Text displays: address the SonarCloud findings

std::array instead of the C-style arrays, the utf-8 sequence length worked
out in a function of its own instead of nested conditional operators,
std::byte for the bit operations, std::ranges::count_if and contains().
The character loop of the renderers moved to Render_Alpha_text(), which
takes the nesting back to the limit, and the static pasText is accessed
through the class.

* Text displays: move the opaque character loop to Render_text()

The same as for the translucent pass: the loop sits in a function of its
own and the static pasText is accessed through the class, which keeps the
nesting within the limit.

* Text displays: access the static iAlpha through the class in the opaque pass

* Text displays: transparent lookup of the text layouts, init-statement for the lookup result

Two SonarCloud findings left in the code of #198: the map of the text layouts
gets a transparent hasher with std::equal_to<>, and the result of the lookup
is declared in the if statement.
2026-11-07 12:36:17 +01:00
pawelw
55ba7a9f41 Instancing: skip the buckets of a cell lying wholly beyond the range of their instances (#225)
* perf(instancing): skip a cell's buckets lying wholly beyond the range of their instances

* perf(instancing): go only through the instances drawn one by one in the per-node pass

* perf(instancing): leave out of the color pass the cells holding only instances too far to be drawn

* refactor(instancing): keep the caches of the instances of a cell without mutable fields, set by the renderer when the cell is queued
2026-11-07 12:35:55 +01:00
Sebastian Krzyszkowiak
ecdef7f753 opengl*renderer: Show an empty frame early (#233)
Gives a better feedback to the user that something has actually launched.
2026-11-07 12:33:22 +01:00
349e94aef8 Merge pull request #245 from MaSzyna-EU07/split/2-materials
Split/2 materials
2026-11-07 11:20:50 +00:00
jerrrrycho
4489dd7469 test(gfx): unit tests of the smoke of a vehicle taken off the tracks (#90)
The spawn count of the smoke source of a vehicle moves out of
smoke_source::update() into smoke::vehicle_spawn_count() (vehicle/smoke.h),
a free function on the mover state, which joins the core library so the
unit tests can call it the way the source does. The rates are the same as
before, the steady rate of the source still counted in before the share of
the engine.

Tests: tests/unit/test_smoke.cpp. A vehicle taken off the tracks spawns no
smoke and drops the pending particles, with the engine starting, idling or
under load; a road vehicle back from the pool puffs again; the engine adds
to the steady rate; the pending count stays within the room of the source.
Two of the four fail without the fix.

Checked again on td.scn with the SM42 driven into a portal: the smoke
source keeps puffing on the run and drops to 0 particles once the vehicle
is taken off the tracks.
2026-11-07 11:38:49 +01:00
jerrrrycho
28cf5fe276 fix(gfx): a vehicle taken off the tracks stops smoking (#90)
The smoke sources of a vehicle stay in the particle manager when the vehicle
is taken off the tracks: one gone through a portal, or a road vehicle
waiting in the pool of its spawn point. They kept spawning particles where
the vehicle had vanished, for good. A source of a disabled vehicle spawns
no more particles now, the ones it let out fade away as usual, and a pooled
road vehicle puffs again once it's back on the road.

Checked on td.scn with a portal added at the dead end of tdo_n585 and an
SM42 driven into it by the AI: on master its smoke source kept about 100
particles where it vanished for the rest of the run (over 200 s); with the
fix they were gone within a second.
2026-11-07 09:37:40 +01:00
maj00r
d232cd0a69 refactor: the Sonar remarks on the material copies taken care of
- the params of a shader named by the type the shader keeps them in
- ranges::any_of and erase_if, with explicit captures
- the weathering set component by component with an index of the
  type of the vector
- the lookups declared in the ifs that use them
- the empty Erase of the base renderer told why it is empty
2026-11-06 19:58:24 +01:00
maj00r
a6778c9fe2 refactor: the Sonar remarks on the small fixes taken care of
- the log stops through a flag kept in a function, not a global one
- the messages are put together with std::format
- a vehicle dropped on a trainset in the launcher goes in once the
  trainset is drawn, so the vehicles are gone through with a plain loop
  again; the drop split into a new vehicle and a moved one
- the scenario that can't be opened is caught as the runtime error it
  is, a file name outside of the code page as the system error it is
- a track of an unknown type is left out through the pointer owning it
- the keyword of a track type written out by a function of its own
- the picked node forgotten with ranges::replace_if, the empty
  Forget_Node of the base renderer told why it is empty
- FileCased takes the path it works on
2026-11-06 19:54:54 +01:00
maj00r
48af69cbf1 fix(render): the matte and tinted copies of a material made again with its season and weather, the primitive of a handle to no chunk told as none
The copies don't update themselves, their names aren't files to read again: after a change of the weather or the season the material got its new textures and its copies kept the old ones. They are made again from it then, under their handles. primitive() of an empty handle or one past the banks read out of the bank list; it gives no_primitive there, -1 from the renderer.
2026-11-03 22:00:48 +01:00
maj00r
a24118baf7 feat(render): a geometry chunk emptied in place, the kind of its primitive told; a chunk gaining or losing its userdata gets a new buffer
Erase() empties a chunk and keeps its handle to be filled again, for geometry made anew as it changes. Primitive() tells whether a chunk holds triangles or strips, -1 from a renderer which doesn't know. The VAO bank reused the buffer of a chunk of the same length even when the userdata came or went, the layout of the buffer differing then.
2026-11-03 21:50:31 +01:00
maj00r
e230d7b902 fix: a deleted model is no longer the picked node, an orthophoto tile isn't swept as a grey stub, the ED brake arrays freed
Deleting a model in the editor left the renderer holding it as the picked node, the next pick used freed memory: the renderer forgets it now (Forget_Node). A texture filled straight from memory (internalsrc:) can't be read again, released by the garbage sweep it came back grey; it stays now, and the units bound with the old name are rebound. The arrays of the ED brake force sharing are vectors, they leaked once per update. The scene hierarchy and the editor menu items go through the translation. Python caches ignored.
2026-11-03 21:45:58 +01:00
miloszunio
df66315f55 fix(gl46): keep the editor cursor point in world space, with the view of its depth read 2026-11-01 13:12:41 +01:00
miloszunio
3a4b878304 fix(gl46): read back the editor cursor depth and correct the depth pass bias
GL46 read the depth under the editor cursor in the depth pass of the scene, drawn with glPolygonOffset(-1, -1), and took it as it was: the ground came out about a pixel row farther than it lies (metres at a grazing angle). Same correction as 7078edf for vulkan: a 3x3 block read back, the slope and the unit of the bias taken back. The depth is also worked out in the view of the frame it was asked in, and the point kept in world space, so a moved cursor or camera does not shift it. See #238.
2026-11-01 13:12:01 +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
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
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
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
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
550d47e97c Merge remote-tracking branch 'jano211/siec-radio' into feat/renderers-cleanup 2026-10-26 16:36:36 +01:00
719c729929 Improve rain shader 2026-10-26 15:51:56 +01:00
Claude
619f048f31 Sieć trakcyjna: kotwienia, kotwienie środkowe, parasole i wysięgniki rozstawione, konsole 4890/4690
Sam kod exe z gałęzi siec-trakcyjna od poprzedniego commita (bez testów, notatek i danych z tests/catenary).
Dane (data/traction_*.txt) leżą poza repozytorium.

- kotwienia ciężarowe i stałe (0404/0405, przewody zakotwione osobno, sieci bez własnych danych: network <symbol> as <kod>)
- kotwienie środkowe 0406/0408/0418/0416: lina, V i zaciski na linie nośnej liczonej jak przęsło, obejma 4160 na teownikach
- parasole i wysięgniki rozstawione na konsolach 4890, wysięgi pomocnicze 0167 na belkach 4690, trzeci wysięgnik w osi słupa,
  lina nośna z innego wysięgnika (messenger_from)
- przęsła w nietypowych sytuacjach nie przechodzą na stary wygląd (bez Y, bez wieszaków, lina nad przewodem)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GfTogWDsfCE8RGFGvm2eyp
2026-10-26 01:12:06 +01:00
a6bdeeaa2b Add DLSS Frame Generation (gfx.framegeneration x2/x3/x4) and Reflex (gfx.reflex) to the Vulkan renderer 2026-10-25 20:52:12 +01:00
1841e6d7b0 Add NVIDIA DLSS to the Vulkan renderer (gfx.antialiasing dlss/dlaa) and gfx.buffer.percent 2026-10-25 19:35:33 +01:00
71a6628a4a Vulkan ray tracing: shade the heightmap terrain from its layers; longer default SSR range 2026-10-25 17:15:58 +01:00
e201c83825 Vulkan ray tracing: trace only visible reflections, sun shadow from the shadow map, foliage switch and timings 2026-10-25 16:09:19 +01:00
08f4f6ed60 Vulkan ray tracing: include tracks and roads, build triangle strips and fans 2026-10-25 15:35:26 +01:00