18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 18:47:06 +01:00
Commit Graph

62 Commits

Author SHA1 Message Date
maj00r d8e6c6e36e feat(model): the game loads .e4d models, behind modelformat e4d in eu07.ini
Stage 2 of the E4D model format. With modelformat e4d a model with an .e4d file beside its .e3d / .t3d is loaded from it;
legacy, the default, leaves the .e4d files alone and the game loads models exactly as before. The key is written to the
log at the start.

- TModel3d::LoadFromE4D (model/e4d/e4d_load.cpp) builds the same tree of submodels LoadFromBinFile builds from E3D,
  and both go on through the same finish_binary() (the end of the E3D loading, moved out of deserialize unchanged).
  .mmd, events, GetFromName and the editor work as before. A file that can't be read or isn't valid is logged and the
  .e3d / .t3d is loaded instead. TModelsManager finds a model which comes as an .e4d alone.
- Format additions found by comparing loads (the format isn't released, so still version 1.0):
  - the LMAT component: the material of a node without geometry (light points, rotators), whose light threshold,
    colours and material the lights use;
  - node_flags::no_transform: an E3D submodel without a matrix, told apart from one with the identity matrix;
  - section_flags::meshopt: the vertex and index streams in the codecs of meshoptimizer (vertex codec version 1,
    index sequence codec), lossless, several times faster to unpack than zstd on this data. zstd packs the other
    sections; zstd over the coded streams is an option for archives (write_options::compress_streams).
- meshoptimizer v1.3 (MIT) as a submodule in ref/meshoptimizer; only its vertex and index codecs are built, into
  eu07_core.
- Loading speed: the big streams unpack on threads of their own, and a model of 100 000 vertices or more fills the
  vertices and indices of its submodels on up to 8 threads (std::jthread); the vertices are written once, without the
  zeroes of resize(). QTangent decoding takes the two matrix columns it needs without a square root.
- eu07 -e4d diff <e3d|t3d> <e4d> [dynamic] compares the two loads submodel by submodel and times them.

Checked:
- 250 random models of the installed game: all convert, and loaded from E4D they give the same tree, names, flags,
  materials and indices as from E3D; positions and UVs bit for bit, transforms within 6.5e-5, normals within 0.03 deg
  (4 vertices with a broken normal in the E3D get a proper one).
- Size 39% of the E3D (263 MB against 682 MB). Load outside the game, with the files in the system's cache: 516 ms
  against 561 ms, 0.75 of the time for the models of 5 MB and more, 1.21 for the smaller ones.
- In the game on Vulkan (self-test, the same 250 models): 3.05 s against 3.15 s to load them, the same frame time and
  device memory, the picture within 1/255 of the legacy one.
- Unit tests 1189/1189, among them the codecs with and without zstd, a codec on a wrong section and a cut stream. Not
  built with GCC here.

No asset change is needed: the game data has no .e4d files, and the release doesn't read them.
2026-11-28 20:55:57 +01:00
jerrrrycho 3eb2fdf462 Merge staging into feat/gl46-migration
origin/staging 7ac2472c3 into feat/gl46-migration db26a33ed, so that #468
merges into staging. Merge base 037158104. Staging carries master up to
571487612 (squashed in #514); this branch had merged master up to 7c12b83ba.

Conflicts, file by file:
- README.md: WITH_BETTER_RENDERER row dropped (gl46), USE_SYSTEM_JSON row kept (staging)
- CMakeLists.txt: gl46 lists, plus staging's new core sources (hardwareinfo, sn_utils, regionfile, inionlysettings, fieldshunting, gaugewrap, drivingaid, signalpassing, brakereleaser, crew, brakecharge); none listed twice
- tests/unit/CMakeLists.txt: both (texturealpha, freecameramotion; editorSwitchDrives, Camera)
- vehicle/brakingcurve.{h,cpp}, tests/unit/test_braking_curve.cpp (add/add): staging (#479 brake_acting on the same #409 code)
- editor/editorHttp.cpp: staging (it has gl46's #432 and certificate fixes, plus #439 libcurl loaded at run time)
- tests/unit/test_editor_http.cpp (add/add): staging (adds the available() case of #439)
- utilities/Globals.h: gl46 crashdump_full (staging's CrashDumpFull is #425, replaced here by utilities/crashdump.cpp); fmradio and staging's OpenAL options both; gfx_headlights_beamwidth (#481) not taken
- utilities/Globals.cpp: both (odometer.expiry, OpenAL keys, fmradio, gl46 gfx keys); gfx.headlights.beamwidth (#481) not taken
- utilities/Logs.cpp: staging's log_file_name() for both files, with gl46's crashdump_set_log_file() for both
- utilities/utilities.h: gl46 set_thread_random_engine(); Random(int, int) gone on both sides
- tests/unit/test_utilities.cpp: staging's includes
- simulation/simulationtest.cpp: gl46 (no NvRenderer, LegacyRenderer, BasicRenderer here)
- ci_shadervalidator/* (incl. add/add utilities/Logs.h): gl46's validator of shaders/ogl46 and shaders/vk14; staging's #437 fixed the GL 3.3 one
- gl/shader.cpp, gl/glsl_common.cpp: gl46 (shaders come from rendering/common/shadersource.cpp); HEADLIGHT_BEAM_WIDTH (#481) not taken
- shaders/mat_wire.frag: gl46. Rename detection paired staging's mat_colored.frag (#481) with it
- lang/editor_pl.po: union; the 12 camera speed / orthophoto entries staging adds are here already (master #312)
- audio/audiorenderer.{h,cpp}: both (fmradio; startsample and the low-pass filter); the destructor releases the radio, then the filter
- application/editormode.h, application/editormodeswitchdrive.cpp: staging (#509 on #330, which is all this side had)
- application/application.cpp: gl46's start sequence (no init_ogl, ANGLE or NvRenderer; crash window after init_ui) with staging's hardware::log_system() (#389)
- EU07.cpp: gl46 (crash reports of utilities/crashdump.cpp); staging's side was #425's handler, replaced here
- model/Texture.{h,cpp}: gl46 (texture_source); staging's side is master #399/#411/#362/#386, merged here before
- world/Track.h, world/TrackSleepers.h: both (TrackBlend, lay(Fastened)/fasten; TrackBuckle, pack_models)
- world/Segment.cpp: staging's track buckling on the split stray factors both sides have
- vehicle/Driver.h: staging's additions (#444, #494, #473, #346, timetable flags)
- vehicle/Driver.cpp: staging's file, with this branch's f4f8c75e4 (road orders measured along the lane) and 8fbf05674 (a holding road order blocks the ones past it) applied again; #409's SeenAheadTolerance gives way to #473
- vehicle/DynObj.h: friend opengl46_renderer and friend class vehicle_table
- vehicle/DynObj.cpp: gl46's vehicle_table::update() with staging's update_off_track_contacts() and update_brake_pipes()
- McZapkie/Mover.cpp: staging's function splits (#239) and hose exchange (#388); every line this branch added to Mover.cpp/MOVER.h is kept
- .github/workflows/build_bin.yml: staging's apt-install step (#497) and pinned download-artifact (#331)

Modify/delete, kept deleted:
- rendering/opengl33renderer.{cpp,h}, rendering/openglparticles.cpp, rendering/openglrenderer.{cpp,h}: staging's versions are master's, and every master change to them is in this branch's history already
- shaders/light_common.glsl, shaders/mat_sunlessnormalmap_specgloss.frag: see below

Carried into this branch's code:
- the hose exchange after each sub-step (#387/#388) also in update_steps_parallel(), per group of vehicles, as update() does it single-threaded
- physics.pipewake (pipe_wakes(), wake_cause::scndpipe) in staging's GetScndDVc(), where the main reservoir hose exchange went
- hardware::log_gl_context() (#389) in after_window() of the GL 4.6 backend, init_ogl() being gone

Taken back out of the auto-merge (renderers this branch removed):
- shaders/vk14/tonemapping.glsl: #481's switch to ACES, applied there by rename detection
- environment/skydome.cpp, simulation/simulationenvironment.cpp: #415, the sky of the legacy renderer
- application/application.cpp: #384's fallback of an unknown gfxrenderer, which this branch had dropped

Not carried from staging (renderer files removed here):
- master #481 (571487612): old assets drawn as in 26.05 (metal diffuse, sun highlight tint, ACES, SUN_DIFFUSE_SCALE 2.5, untinted Diffuse, mat_colored base) and gfx.headlights.beamwidth. Made for the GL 3.3 shaders; the PBR shaders of shaders/ogl46 and vk14 (and their SPIR-V binaries) are the author's call
- #437: the unique temporary file of the shader validator (Sonar S5443); gl46's validator still writes /tmp/shader*

Unit tests: 1133 of 1137 cases pass. Four staging tests fail (derailment: a
repaired vehicle is back on the rails; three pullee cases): the vehicle
stands, and with physics.sleepheld (on by default here) its physics sleeps
with the Fb / FStand of before. With physics.sleepheld off they pass. Left
to the author.
2026-11-27 05:26:13 +01:00
jerrrrycho df95395ded docs/build: track_uneven_doc.md to docs/, the local ImGui changes listed, the audio license texts kept in ref/licenses (#495)
* docs: track_uneven_doc.md from the root of the repository to docs/ (#237)

The tool that grades the tracks points to its new place; directoryDescription.md
names docs/.

* docs: the local changes of the bundled ImGui (#236)

docs/imgui_patches.md lists what imgui/ changes against upstream
v1.91.9b-docking (io.ConfigViewportsNoAutoDetach, io.ConfigTooltipsWrapWidth,
BufferingBar/Spinner, the glad loader, the main-window origin of the GLFW
backend, the gamma of the OpenGL 3 backend) and in ImGuizmo, with the commits
that brought them, so an update of ImGui carries them over.

* build: the license texts of the audio DLLs from ref/licenses instead of downloads (#405)

The Windows build downloaded 14 license texts on every run without a cache
hit, from raw.githubusercontent.com, scm.orgis.org (mpg123) and
sources.debian.org (LAME). They are now in ref/licenses, byte for byte as at
the pinned URLs (-text in .gitattributes, so a checkout with CRLF doesn't
change them), and the step copies them from there, still checked by their
SHA-256. ref/licenses/README.md names the URL of each. The two release zips
are still downloaded and cached as before.

* docs: the ImAbs shim of ImGuizmo listed, stale comments of the DLL step, a plain docs/ row
2026-11-25 05:24:58 +01:00
Hirek 8701c5de02 Merge branch 'master' into feat/renderers-cleanup 2026-11-10 17:09:09 +01:00
Hirek 18c333b089 wasm display support 2026-11-10 00:57:37 +01:00
Hirek 550d47e97c Merge remote-tracking branch 'jano211/siec-radio' into feat/renderers-cleanup 2026-10-26 16:36:36 +01:00
Hirek bd589f272d feat(vulkan): vulkan 1.4 core with the user interface and the launcher, shaders split into ogl46/vk14 with SPIR-V binaries loaded first 2026-10-24 05:47:11 +02:00
Hirek 12c2aaf1db chore: remove the NVRHI-based betterRenderer 2026-10-21 19:30:32 +02:00
Hirek 918c056b83 Merge branch 'master' into feat/gl46-migration 2026-10-17 20:57:15 +02:00
IwanXXI b4b1e6c32f Broadcast radio receiver in the cab
Plays internet radio streams (http, mp3) through a positional emitter in the cab, with analog tuning, inter-station noise and two speaker profiles. Stations are listed in fmradio.txt, cab controls are defined with fmradio entries in the .mmd file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 00:14:32 +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
Hirek 9e64244ebd Require OpenGL 4.6 core context and regenerate glad 2026-10-15 01:39:32 +02:00
Hirek 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
Hirek d9eb705d4a Revert "Update GLM ref"
This reverts commit 38db27d3de.
2026-07-25 12:59:54 +02:00
Hirek 38db27d3de Update GLM ref 2026-07-24 13:05:18 +02:00
maj00r cb02dc6480 openal: update vendored AL headers to a modern OpenAL Soft
Refresh ref/openal with current OpenAL Soft headers: adds alext.h (ALC_SOFT
extensions incl. reopen_device / system_events, ALC_CONNECTED, the EFX
presets) and efx*.h, and updates al.h/alc.h. Enables the audio device-change
following to build against native tokens instead of local fallbacks.
2026-07-04 15:22:33 +02:00
maj00r 3786ecd98f Python 3.14 build and CI updates
Squashes the last five commits: migrate to Python 3.14 (CMake, AppVeyor, Azure, README), vcpkg/setup-ci fixes, CMake adjustments, remove bundled ref/python 2.7, and related scripting/static file updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 18:21:12 +02:00
docentYT c39decc733 Update vcpkg version 2026-02-02 17:22:19 +01:00
Hirek f43d4b5201 Add trivia randomisation 2025-09-16 00:25:00 +02:00
Hirek 3810fff0dc Revert "Add TGUI library"
This reverts commit c6564351e8.
2025-09-09 16:46:12 +02:00
Hirek c6564351e8 Add TGUI library 2025-09-08 18:32:38 +02:00
Hirek 37d28a4603 Change discord-rpc fork 2025-09-05 20:39:10 +02:00
Hirek 12d6a1578d Add vcpkg as submodule and ref it in cmake 2025-04-15 00:23:36 +02:00
Hirek 27f4920869 Add discord-rpc library 2025-03-16 16:22:54 +01:00
Hirek 34b3a00687 Add missing asio ref 2025-03-09 21:28:22 +01:00
Hirek 548f4263d0 Add glfw as ref 2025-03-09 21:09:52 +01:00
Hirek dd3b258967 Remove old glfw ref 2025-03-09 21:08:27 +01:00
WLs50 a5f6397eca merge manul 2025-03-09 15:36:11 +01:00
milek7 659345c1fa legacy wireframe fix 2021-02-16 23:12:25 +01:00
antonisauren d1ecbdc8ff Sim (#11)
* Wheels animation distance changed to 200*D*LODbias

* Fixed spelling error in event syntax; old one remains for compatibility.

* Spelling error left in log text

* Zamiana metalic na floata z wazonym efektem.

# Conflicts:
#	shaders/light_common.glsl

* Detail normalmap shaders @Jan21

* Explicit type conversion

* Leftover metalic as bool

* Syntax error

* Normalmap sampling inside ParallaxMapping function
2021-01-23 22:24:14 +01:00
milek7 9e7c528114 make legacy gl2.0 work without BaseVertex extensions 2021-01-22 22:19:23 +01:00
milek7 7cacab0dc8 add gfx.angleplatform ini setting 2021-01-21 22:15:57 +01:00
milek7 4e868288ee add support for ETC2_EAC in .ktx files 2021-01-20 22:46:52 +01:00
milek7 5aa8dfe1a1 use DrawElementsBaseVertexOES if available 2021-01-20 19:39:05 +01:00
milek7 f0b364bafe basic GLES working again 2021-01-20 19:29:50 +01:00
milek7 1c5dcfb87e enable openvr for windows CI 2020-11-18 01:19:46 +01:00
milek7 29f8f91ad8 Merge remote-tracking branch 'tmj/master' into sim 2020-10-18 23:35:14 +02:00
milek7 09f442456f cppzmq libs 2020-03-29 22:14:47 +02:00
tmj-fstate db49440653 Merge branch 'master' of https://github.com/tmj-fstate/maszyna 2019-12-17 19:46:55 +01:00
tmj-fstate 57b88ec64a maintenance: obsolete dependencies cleanup 2019-12-16 11:19:28 +01:00
tmj-fstate 0ac92fca62 Add files via upload 2019-12-16 11:11:35 +01:00
tmj-fstate 75503c50d1 maintenance: imgui update to v 1.73 2019-11-14 15:51:04 +01:00
tmj-fstate ae3cecfa42 opengl 3.3 renderer integration, minor renderer tweaks 2019-10-31 19:38:11 +01:00
tmj-fstate 0fd23a53d9 milek7/sim branch opengl 3.3 renderer import 2019-10-26 15:17:09 +02:00
milek7 23d0093df0 Merge branch 'gfx-work' into sim 2019-09-07 02:53:57 +02:00
milek7 ee1c0ae8d4 Merge branch 'milek-dev' into gfx-work 2019-09-07 02:40:38 +02:00
milek7 6190060b1a Merge branch 'tmj-dev' into milek-dev 2019-09-07 02:25:43 +02:00
tmj-fstate 269e271f01 maintenance: glew update to v 2.1.0, glfw update to v3.3 2019-08-20 12:48:24 +02:00
tmj-fstate 2002587d01 mantenance: stb_vorbis update to v1.16 2019-04-09 00:54:05 +02:00
milek7 4383b0c7e0 geometry shaders, map poi icons 2019-03-17 20:30:25 +01:00