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

2968 Commits

Author SHA1 Message Date
maj00r
fd8bfdbcf3 Add two-pass progressive scenery load (sequential; infra then visuals)
When replaying a binary twin, load in two passes over the same data: the first
pass loads infrastructure (tracks/traction/events/memcells/sounds + directives),
the second pass loads the visual nodes (3d models, terrain shapes/lines) that the
reader skipped via the v6 node-class markers.

- cParser: setReplayPass() selects the served node class (propagated to include
  children); restartReplay() rewinds the twin for the second pass.
- state_serializer: first pass uses the infrastructure pass; on completion it
  restarts the twin for the visual pass. Stateful directives (trainset, event,
  camera, light, sky, time, ...) are skipped on the visual pass so their side
  effects do not duplicate; transform/group directives re-run so deferred visual
  nodes get correct placement. A text/compile load (no twin) stays single-pass.

Verified: td.scn replays through both passes with no duplicate vehicles/events
and reaches the normal load endpoint. This is the sequential foundation; moving
the visual pass into the driver (so play starts after the infrastructure pass) is
the next step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 23:10:06 +02:00
maj00r
c337866c58 Add v6 node-class markers (Stage 2 foundation for progressive loading)
Each top-level node is wrapped in a marker carrying its class (infrastructure vs
visual) and byte span, so the reader can serve or skip a whole node per load pass
without knowing its terminator token. The bake recognizes nodes by the "node"
keyword + type token (map type->terminator confirmed against the deserializers)
and classifies them; the writer buffers a node's entries and emits the marker.
The reader gains a pass selector (all / infrastructure / visual) and skips nodes
not in the pass by advancing past their byte span.

This is the foundation only: the default pass is "all", so loading is identical
to v5 (markers are transparent) -- verified by loading td.scn to the same point.
The eager/visual split is wired up by the upcoming loader/driver integration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:09:09 +02:00
maj00r
8a91559895 Fix infinite loop loading non-scenery files (e.g. .fiz) via cParser
The buffer-based tokenizer reads the source into memory once at construction, so
the underlying stream fail bit never flips at end-of-input. cParser::ok() was
not stream.fail(), so while( parser.ok() ) loops (TMoverParameters::LoadFIZ and
similar) never terminated -- they spun on empty tokens past EOF, hanging the
vehicle/.fiz load. Redefine ok() as "input still remains" (buffer not exhausted,
or for replay not exhausted), which terminates those loops while staying true
right after opening a non-empty file (the open checks if(!ok())).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 19:13:38 +02:00
maj00r
eec5986056 Improve binary scenery format (v5): streaming reader, smaller files, headless parallel bake
- Reader is buffer-based and streaming: the twin is read once and parsed by
  pointer, entries decoded on demand (no per-byte stream, no vector-of-entry
  materialisation), string tokens served as views into the buffer.
- Format v5 is markedly smaller without compression: string interning with
  varint indices, entry type packed into the head varint, integers as zig-zag
  varint and fractional numbers as f32 (f64 only when needed). Tokens are stored
  in original case with a quoted flag and lower-cased per consumer at replay, so
  capture is grammar-independent.
- Writer encodes entries incrementally into a compact buffer instead of holding
  a struct per token, keeping memory bounded when baking huge files in parallel.
- New headless bake mode (-bake) precompiles a scenario and all its includes into
  twins on a thread pool, with no window/renderer/scene; each file is tokenised in
  isolation and baked exactly once.
- Fix stack overflow on files with long runs of consecutive includes by handling
  include directives iteratively instead of recursively (also hardens the normal
  text load).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 18:49:09 +02:00
maj00r
65fd1c10f3 Add binary scenery format (eu7 v3) with async baking, replacing SBT
Text scenery component files (.scn/.inc/.scm/.ctr) are compiled into
per-file binary twins (.scnb/.incb/.scmb/.ctrb), handled transparently
at the cParser layer: a fresh twin (mtime-checked, version-matched) is
replayed instead of re-tokenizing text; otherwise the text is parsed and
a twin is compiled alongside it for next time.

Format details:
- per-file string interning: keywords/paths stored once, referenced by
  varint index (so node/endmodel/... are not repeated as text)
- numeric tokens stored as 8-byte IEEE doubles, not ASCII
- includes kept as references with parameters; random sets stored verbatim
  and re-evaluated on every load (choice not frozen at compile time)
- twin writing offloaded to a bounded thread pool so baking overlaps
  scene construction instead of blocking the load

The legacy terrain-only .sbt path is removed; terrain now loads as
ordinary scenery content.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 21:37:36 +02:00
1aac9b4e76 Merge pull request #111 from MaSzyna-EU07/opengl-instancing
Some rendering improvements
2026-06-16 23:09:12 +02:00
306ed64f38 Merge pull request #110 from xwizard/macos-arm64-build
Add macOS ARM64 build support
2026-06-16 11:15:46 +02:00
c0abea1473 Merge pull request #109 from docentYT/fix-compilation-warnings
Fix compilation warnings
2026-06-16 11:14:25 +02:00
f07c8fdcd2 Enable /map identifier in cmakelists.txt 2026-05-26 22:08:18 +02:00
426ee0baac use textureGather for shadow PCF 2026-05-26 22:08:06 +02:00
26c11ddca9 Improve sleeper LOD calculation 2026-05-24 15:22:44 +02:00
64a65b81ea Sleeper culling + Cell-level distance pre-cull 2026-05-23 20:36:41 +02:00
aff225c95f Global frame buckets 2026-05-23 19:28:29 +02:00
1be56de0fa Add sleepermodel optional parameter for tracks 2026-05-19 22:10:47 +02:00
Mateusz Włodarczyk
dd412894bb Add macOS ARM64 build support
Three small source tweaks that let the OpenGL renderer build and run
on Apple Silicon without affecting the Windows/Linux paths:

- stdafx.h: use GLM_FORCE_NEON on ARM64 instead of GLM_FORCE_AVX2.
  AVX2 pulls <immintrin.h>, which clang on ARM64 rejects because
  the x86 intrinsics are unimplemented.
- utilities/utilities.cpp: provide an Apple libc++ fallback for
  Now() using localtime_r + strftime, since
  std::chrono::current_zone() is not yet implemented there.
- audio/audio.h: prefer Khronos-style <AL/al.h> headers when they
  are on the include path (brew openal-soft) and fall back to the
  deprecated Apple OpenAL.framework's <OpenAL/al.h> only otherwise.
2026-05-19 10:45:18 +02:00
df5a8a897f Merge pull request #107 from MaSzyna-EU07/opengl-instancing
Opengl instancing + node::model scale
2026-05-14 16:24:26 +02:00
ee8ee0dafc Switch normalization from Blinn-Phong to GGX 2026-05-14 15:35:52 +02:00
docentYT
2bb8a64877 Specify auto as reference where possible 2026-05-12 19:16:33 +02:00
docentYT
4fa148e230 Fix C26478 2026-05-12 18:21:52 +02:00
docentYT
81eadbef73 Do not use temp variable when it is not needed 2026-05-12 18:19:11 +02:00
docentYT
e95e00a2e2 Use texture id casting recommended by ImGui wiki 2026-05-12 18:04:50 +02:00
Christopher Kwiatkowski
3707a7845b Merge pull request #1 from docentYT/fix-clamp-exception
Merge with fix-clamp-exception
2026-05-12 17:01:47 +02:00
Christopher Kwiatkowski
1e2b8b1374 Merge pull request #108 from docentYT/fix-clamp-exception
Fix two bugs that causes simulator crash
2026-05-12 16:58:41 +02:00
docentYT
a787bdd77c fix min max in Random 2026-05-12 16:56:48 +02:00
docentYT
fa2ed08955 Fix clamp min max values 2026-05-12 16:49:02 +02:00
docentYT
be91c4da70 Fix C4566 2026-05-12 16:36:32 +02:00
docentYT
4c7cf22d06 Use texture id casting recommended by ImGui wiki 2026-05-12 00:18:11 +02:00
docentYT
373c04c0b7 Add missing return 2026-05-12 00:12:55 +02:00
docentYT
991fb02414 Remove function declaration that has no implementation and is not used 2026-05-12 00:05:36 +02:00
docentYT
bcb9e644fb Replace probably wrong == with = 2026-05-12 00:04:08 +02:00
docentYT
3e360607d8 Do not discard glm::normalize return value 2026-05-12 00:03:40 +02:00
docentYT
4e0b4e6ff6 Check if Train pointer is not nullptr 2026-05-11 23:48:13 +02:00
docentYT
4878afbffc Change size arguments type to GLsizeiptr 2026-05-11 23:41:43 +02:00
3480d1c3a4 Replace wrap360 with clamp_circular 2026-05-10 22:49:58 +02:00
2677ef547b Fix anim true behavior 2026-05-10 13:27:57 +02:00
3419666070 scale/endscale/localscale per node model 2026-05-10 13:12:49 +02:00
587077629f Enable instancing 2026-05-09 23:29:20 +02:00
docentYT
6542021253 Optimize substr_path implementation and change return type to sd::string 26.05.2 2026-05-07 12:59:57 +02:00
b7283d8fb9 Instanced object grouping 2026-05-07 12:13:47 +02:00
b9e3dda3c4 Merge branch 'master' into feat/avx2-support 2026-05-06 22:21:31 +02:00
f4f4897798 Revert substr_path function 2026-05-06 22:20:32 +02:00
7525b54ff1 Enable GLM_FORCE_DEFAULT_ALIGNED_GENTYPES 2026-05-06 20:41:01 +02:00
02cffbe4ad Enable AVX2 support 2026-05-06 20:02:00 +02:00
cde62d42e3 Merge pull request #99 from docentYT/utilities-simplification
Utilities simplification
2026-05-06 18:35:29 +02:00
91c176c55c Merge pull request #104 from docentYT/faster-parser
Fix not all cars are loaded
2026-05-06 18:21:18 +02:00
docentYT
e06ae37f47 replace new clamps with std::clamp and to_string with std::string 2026-05-05 23:40:59 +02:00
docentYT
4a67b4b2a9 Fix conflict 2026-05-05 23:32:59 +02:00
docentYT
5367cb9940 Merge remote-tracking branch 'upstream/master' into utilities-simplification 2026-05-05 23:08:43 +02:00
39885afca0 Merge pull request #105 from docentYT/migrate-from-dumb3d-to-glm
Fix camera shake bug
26.05.1
2026-05-05 23:05:18 +02:00
docentYT
c833b8177b Use glm::dvec3 for Camera LookAt/init
Update Init(...) parameters to glm::dvec3, change LookAt to glm::dvec3 and adjust Camera.cpp to remove redundant glm::dvec3 casts (lookAt call and vector subtraction). These changes improve precision for camera lookAt vector in world coordinates above 4 digits
2026-05-05 23:02:16 +02:00