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

3379 Commits

Author SHA1 Message Date
494304903f Draw the instances from the GPU with multi draws, the model block of each draw read by its number 2026-10-18 00:47:05 +02:00
7221c153dd Let eu07.ini scale how much the moon lights the scenery at night (gfx.moonlight) 2026-10-17 23:10:01 +02:00
41cc966103 Show the moon by day as bright as its sunlit surface, and where the sun and the moon are in the sky window 2026-10-17 22:59:23 +02:00
435110cef9 Place the sun and the moon where they are and light the night by the phase of the moon 2026-10-17 22:47:24 +02:00
5a5c67aaaf Let the instances drawn from the GPU hide one another, in two phases 2026-10-17 21:50:23 +02:00
918c056b83 Merge branch 'master' into feat/gl46-migration 2026-10-17 20:57:15 +02:00
802e356c91 Curve the bases of the clouds up towards their edges and start every billow at a height of its own 2026-10-17 20:03:26 +02:00
0dae1f0b9f Give the fog volume a slice of the fog without its clouds for the sky 2026-10-17 19:56:35 +02:00
1730f400ad Let the base and the top of every cloud stand a little off those of its layer 2026-10-17 19:43:18 +02:00
df48637718 Switch the fog over the sky to the fog without the clouds as soon as the volume holds any cloud 2026-10-17 19:31:45 +02:00
56889679d9 Keep the clouds of the fog volume off the sky, where the ray march draws them already 2026-10-17 19:24:36 +02:00
1eeb5013cb Light the volumetric clouds by the sun three times as brightly 2026-10-17 19:03:46 +02:00
1152791e8c Space the steps towards the sun of the clouds geometrically and follow more orders of scattering 2026-10-17 19:01:39 +02:00
e1900a9cd3 Leave the finest octaves out of the cloud coverage noise so the sides of the clouds get no upright grooves 2026-10-17 18:41:15 +02:00
dd89aa5396 Fray the edges of the volumetric clouds with a finer noise and let their billows shade one another 2026-10-17 17:57:25 +02:00
22bf015939 Shade the volumetric clouds by the cloud over each point, not by the density at it 2026-10-17 17:24:51 +02:00
27e5c07837 Add screen-space contact shadows for the sun, lamps and headlights 2026-10-17 03:11:47 +02:00
c4da5c9867 Give the prefiltered environment map a texture unit of its own 2026-10-17 02:16:58 +02:00
97112b143b Draw the depth of the whole scene before its colour 2026-10-17 02:15:50 +02:00
f352718e4a Stream model data through persistently mapped buffers 2026-10-17 01:24:33 +02:00
8dd80c4d2e Even out the fog cells with their neighbours and stagger the points next to lamps 2026-10-17 00:37:58 +02:00
d07204db5c Take the light of a lamp in the fog along four rays in the cells next to it 2026-10-17 00:31:59 +02:00
f1c12ca651 Spread the light of a lamp in the fog over the size of a cell next to the lamp 2026-10-17 00:27:28 +02:00
e31a49f917 Sample the fog cells across their whole size and take their lamps from fixed clusters 2026-10-17 00:22:29 +02:00
e8dbaf70a9 Sample the fog cells in their middle across the view and dither the output 2026-10-17 00:11:27 +02:00
aa522d7376 Integrate the light of lamps across the fog cells instead of one point sample 2026-10-16 23:52:17 +02:00
0662df23a7 Copy the Python runtime next to the executable only when the Python install has changed 2026-10-16 23:37:27 +02:00
6ee628aaa5 Steady the volumetric fog and add a switch for the old headlight beams 2026-10-16 23:23:51 +02:00
8b929fc1da Give the volumetric clouds lumps, sky and ground light and a fog colour by the angle from the sun 2026-10-16 22:25:11 +02:00
2be85410ce Draw volumetric clouds, their shadows, a volumetric fog and catalogue stars from a new weather system in the GL 4.6 renderer 2026-10-16 21:44:47 +02:00
jerrrrycho
c7f9796387 fix(ai): release horn when human driver takes over from AI (#210)
* fix(ai): release what the AI was holding when the player takes over

* fix(ai): keep the light selector lookup within its table, Sonar findings of the handover

- the light selector size comes from the vehicle definition (LightsList Size)
  and isn't limited, while the table holds 18 positions; a bigger selector
  read past the table, and so did a table index other than the front or
  rear one. Only the positions the table holds are looked at now, and the
  selector stays where it is for a bad table index (cpp:S2259),
- the lambdas of the handover capture what they use explicitly (cpp:S3608),
- the chained assignments resetting the headlight state on the AI taking
  over are split (cpp:S1121).
build-master
2026-10-16 14:44:30 +02:00
d509775269 Cast shadows of vehicle headlights from the scene in their beam in the GL 4.6 renderer 2026-10-16 14:13:36 +02:00
466cb5339e Draw instances from the GPU culling with indirect draws, occlusion culling and a depth prepass 2026-10-16 12:54:52 +02:00
2f0a06b98e Cast shadows of scenery lamps from the scenery, nearby vehicles and the cab in the GL 4.6 renderer 2026-10-16 11:32:45 +02:00
06d7b9e9f0 Cast shadows of the cab lamp from the cab in the GL 4.6 renderer 2026-10-16 02:43:27 +02:00
4d3a401aae Cull and assign LOD to instances in a compute pass 2026-10-16 01:08:44 +02:00
9277c28805 Cull instances by compact records and draw them from a shader storage buffer 2026-10-16 00:37:54 +02:00
fd98d4eea5 Light the scene with lamps of models, vehicle compartments and the cab lamp in the GL 4.6 renderer 2026-10-16 00:07:08 +02:00
5f365a00c5 Fix the screen space ambient occlusion and add ground truth ambient occlusion to the GL 4.6 renderer 2026-10-15 23:03:50 +02:00
ce725c3d62 Add sky light, physical atmosphere, auto exposure and bloom to the GL 4.6 renderer 2026-10-15 22:16:41 +02:00
ea0dba6dae Add shader validator CI 2026-10-15 20:26:35 +02:00
2e02cf8137 Lay the light cluster tiles over the window when the post processing is skippe; Bind the light cluster buffers when a viewport is created 2026-10-15 20:26:23 +02:00
624c7f4f0b Do not cap the reach of a light at 1 km in the cluster culling 2026-10-15 20:25:51 +02:00
f47172f34d Migration cleanup and renderer documentation 2026-10-15 19:05:35 +02:00
jerrrrycho
b400255dae Test/physics unit tests (#213)
* build: doctest 2.4.11 in ref/

Single header test framework (MIT), vendored like the other libraries in
ref/ so the tests need nothing extra installed on the CI runners.

* refactor(physics): read vehicle definitions from text as well as files

TMoverParameters::LoadFIZ(path) opens the file and hands the parser over
to LoadFIZ_Parse(), which holds what LoadFIZ() did with it before. The
new LoadFIZ_Text() reads the same format from a string, so a definition
can be made up in memory, e.g. by a unit test. No change in behaviour for
files.

* build: the simulation core as a library the game links

The vehicle physics (McZapkie), the vehicle definition parser and the
helpers they use build as eu07_core, a static library the game links,
so the unit tests to come can link the very same objects instead of
compiling their own copy with their own settings.

The game's build settings (include dirs, definitions, compile options,
libraries) move from the executable to eu07_settings, an interface
target the library links publicly, so the game, the library and later
the tests all build with the same ones. What only the executable needs
stays with it: /MAP, /LARGEADDRESSAWARE, output dirs, the precompiled
header, runtime DLL copying, the crash reporter and the experimental
renderer. No change in what the game builds or links.

* test: unit tests of the simulation core, run as part of the build

eu07_unit_tests: C++ tests (doctest) of the simulation, which set up the
conditions, run the code and check the outcome. No game data, no window.

- the code under test is the core library (eu07_core), the very objects
  the game links, built with the game's settings; engine_stubs.cpp stands
  in for the logs, settings and scenery layers the library reaches for.
  python gets linked with the settings but isn't needed to run the tests
- test vehicles are JSON definitions in tests/unit/data, with the sections
  and keys of the game's vehicle definitions (tables as "rows", _keys are
  comments), changed by the tests where needed and loaded from memory by
  the game's own loader; an unknown section is an error rather than
  silently skipped
- test::vehicle creates the mover the way TDynamicObject::Init() does and
  steps it the way the simulation loop does, on a straight track of given
  friction and gradient, optionally holding the brake pipe pressure the
  way a coupled locomotive would
- the random numbers of the simulation are reseeded before every test
  case, so a test gives the same result alone (IDE) or among the others
- building the game runs the tests at the end, once the game is linked,
  and prints a one line summary ("Unit tests: 11/11 passed (80 checks)").
  A failure prints the full report and fails the build, in CI and locally
  alike, and removes the game binary so the next build reruns them. A
  change of the tests alone relinks the game so they run (Ninja and
  Makefile generators). -DWITH_TESTS=OFF leaves them out
- first tests: definitions reach the vehicle, KE service application and
  release, deeper reduction brakes harder, every implemented distributor
  valve charges/applies/releases, service braking stops a moving wagon

* test: stub basic_node::radius_() for GCC and Clang

The Linux build failed to link the unit tests: undefined reference to
scene::basic_node::radius_() from basic_node's vtable in engine_stubs.o.
basic_node has no key function for the Itanium C++ ABI (tooltip() is
declared plain but defined inline in the header), so GCC and Clang emit
its vtable in every unit using scenenode.h, and the vtable needs
radius_(), defined in scenenode.cpp, which the tests don't link. MSVC
emits vtables differently, so the Windows build linked.

* test: test vehicle definitions load with GCC and Clang

All the tests reading a definition failed on Linux with "unknown vehicle
definition section 0": the parsed definition was brace-initialised
(auto const json{parse(...)}), which GCC and Clang take for the
initializer list constructor of nlohmann::json, making an array holding
the definition, while MSVC copies it. Initialise it with =, and require
the definition to be a JSON object.


* test: SonarCloud issues of the unit tests

- test::definition_error for unusable test vehicle definitions instead of
  std::runtime_error (S112)
- the rows of a table section written by a function of their own, less
  nesting in definition::text() (S134)
- std::less<> for the section table (S6045)
- comments in the empty methods of the reseeding listener and stub (S1186)
- NOSONAR where the engine's headers fix the stubs: the extern globals
  and the member function signatures (S5421, S5817, S1238)
- NOSONAR on LoadFIZ_Parse(): the cognitive complexity is the former body
  of LoadFIZ(), moved as it was (S3776)
- a comment Sonar took for code reworded (S125)
2026-10-15 17:56:41 +02:00
c77151979a Bind an empty shadow map instead of unbinding the shadow map unit 2026-10-15 17:11:31 +02:00
9f2ae071a6 Use clustered light lists in forward shading 2026-10-15 16:16:53 +02:00
6aa6e505e8 Cull lights into clusters in a compute pass 2026-10-15 15:21:21 +02:00
f85cf5fe52 Build view-space light cluster grid in a compute pass 2026-10-15 14:16:55 +02:00
c0f45184b8 Move light data from UBO to std430 SSBO 2026-10-15 13:20:59 +02:00