18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 09:36:48 +01:00
Commit Graph

109 Commits

Author SHA1 Message Date
maj00r c446a1640d Merge branch 'feat/eu07m-clip-event' into feat/eu07m-gref
Brings the .ng3d extension and modelformat ng3d (8637101d9). Where both sides changed a line, this branch's text is kept with the names changed; what this branch adds is renamed with it: the model files .ng3d, the family store .ng3p.
2026-11-30 22:27:02 +01:00
maj00r ff55024be9 Merge branch 'feat/eu07m-skin-compute' into feat/eu07m-clip-event 2026-11-30 22:26:38 +01:00
maj00r 7cad10c39a Merge branch 'feat/eu07m-clips' into feat/eu07m-skin-compute 2026-11-30 22:26:38 +01:00
maj00r bf66a704b1 Merge branch 'feat/eu07m-skinning' into feat/eu07m-clips 2026-11-30 22:26:37 +01:00
maj00r 3be62b067e Merge branch 'feat/eu07m-instancing' into feat/eu07m-skinning 2026-11-30 22:26:36 +01:00
maj00r 3c7824199c Merge branch 'feat/e4d-compact' into feat/eu07m-instancing 2026-11-30 22:26:36 +01:00
maj00r 8637101d96 feat(model): the EU07M model files take the .ng3d extension, the switch is modelformat ng3d
In place of .r3a (2fe1064f9): the model files are .ng3d and eu07.ini selects them with modelformat ng3d. The format keeps its name (EU07M), its magic and the -eu07m command line tool. Neither name has been released.
2026-11-30 22:26:29 +01:00
maj00r a669be8f8f Merge branch 'feat/eu07m-clip-event' into feat/eu07m-gref
Brings the .r3a extension and modelformat r3a (2fe1064f9). docs/eu07m-format.md keeps this branch's English text, with the names changed. What this branch adds is renamed with it: the model files .r3a, the family store .r3p (geometry.r3p).
2026-11-30 22:12:49 +01:00
maj00r 20f6b2f52f Merge branch 'feat/eu07m-skin-compute' into feat/eu07m-clip-event 2026-11-30 22:12:13 +01:00
maj00r 981640d6e0 Merge branch 'feat/eu07m-clips' into feat/eu07m-skin-compute 2026-11-30 22:12:12 +01:00
maj00r 13d40487f8 Merge branch 'feat/eu07m-skinning' into feat/eu07m-clips 2026-11-30 22:12:11 +01:00
maj00r 79c90368a3 Merge branch 'feat/e4d-compact' into feat/eu07m-instancing 2026-11-30 22:12:09 +01:00
maj00r d12d54a83c Merge branch 'feat/eu07m-instancing' into feat/eu07m-skinning 2026-11-30 22:12:09 +01:00
maj00r 2fe1064f9a feat(model): the EU07M model files take the .r3a extension, the switch is modelformat r3a
The model files of the format are named .r3a in place of .eu07m, and eu07.ini selects them with modelformat r3a in place of
modelformat eu07m. The format keeps its name (EU07M), its magic and the -eu07m command line tool. Neither the extension nor
the key has been released, so nothing reads the old ones.
2026-11-30 22:11:57 +01:00
maj00r 7ab6080096 docs(eu07m): the store as the game reads it now, the id of a block hashed again only with verify_hash, the store opened again when its file changes; the id to settle before packing 2026-11-30 05:24:20 +01:00
maj00r 5bfdd756de Merge feat/eu07m-channels into feat/eu07m-gref 2026-11-30 00:33:53 +01:00
maj00r 96198fa7a4 Merge feat/eu07m-clip-event into feat/eu07m-channels 2026-11-30 00:33:51 +01:00
maj00r e80cfc4f14 Merge feat/eu07m-skin-compute into feat/eu07m-clip-event 2026-11-30 00:33:50 +01:00
maj00r 91d334a484 Merge feat/eu07m-clips into feat/eu07m-skin-compute 2026-11-30 00:33:48 +01:00
maj00r f640657549 Merge feat/eu07m-skinning into feat/eu07m-clips 2026-11-30 00:33:46 +01:00
maj00r 14dc873b05 Merge feat/eu07m-instancing into feat/eu07m-skinning
# Conflicts:
#	model/Model3d.h
#	rendering/common/scenewalk.cpp
#	rendering/common/scenewalk.h
#	rendering/opengl46/opengl46renderer.cpp
2026-11-30 00:33:39 +01:00
maj00r 470d4510ed Merge feat/e4d-compact into feat/eu07m-instancing
# Conflicts:
#	rendering/common/scenewalk.cpp
2026-11-30 00:33:16 +01:00
maj00r a4dd61cd2c Merge feat/e4d-load into feat/e4d-compact 2026-11-30 00:33:02 +01:00
maj00r 161a7762c9 Merge feat/model-format-e4d into feat/e4d-load 2026-11-30 00:33:00 +01:00
maj00r fc74ff0860 Merge origin/staging into feat/model-format-e4d 2026-11-30 00:32:49 +01:00
maj00r b3916500ce docs(eu07m): an animation event takes a node over from the clips and channels for good, and a sheared node loses its shear under a clip 2026-11-30 00:32:39 +01:00
Hirek 5d5e271edb Create vehicle-architecture.md 2026-11-29 18:32:22 +01:00
maj00r b03fff75df Merge the review fixes of the PRs below from feat/eu07m-channels into feat/eu07m-gref 2026-11-29 18:23:01 +01:00
maj00r 6efc1eb718 Merge the review fixes of the PRs below from feat/eu07m-clip-event into feat/eu07m-channels
RaPrepare() applies the clips, then the channels, then the animation events, so an event on a node takes over from both.
The spec has the fixes of #538, #540 and #542 in English.
2026-11-29 18:23:01 +01:00
maj00r 6402e2191b Merge the review fixes of the PRs below from feat/eu07m-skin-compute into feat/eu07m-clip-event
# Conflicts:
#	model/AnimModel.cpp
2026-11-29 18:22:25 +01:00
maj00r 49ef69bb34 Merge the review fixes of the PRs below from feat/eu07m-clips into feat/eu07m-skin-compute 2026-11-29 18:22:14 +01:00
maj00r c171e2e7d5 Merge the review fixes of the PRs below from feat/eu07m-skinning into feat/eu07m-clips 2026-11-29 18:22:13 +01:00
maj00r 05a8ddaabd Merge the review fixes of the PRs below from feat/eu07m-instancing into feat/eu07m-skinning 2026-11-29 18:22:12 +01:00
maj00r ce40e11b94 fix(model): EU07M review of #543: channel names keep their case, the joint moves from its rest value
- The channel event reads the name of the channel as written (getTokens lowercased it), and set_channel() finds it
  regardless of case: a channel named doorLeft couldn't be set from a scenery.
- JOIN.rest is read: the node is modelled at the rest value of its joint, which moves it by the value less rest (the
  limits stay values of the joint). A part modelled half open no longer jumps when its channel is set. Files without it
  (rest 0) move as before.
- The spec says so, and that no vehicle sets channels yet.

Test: a slider modelled half out.
2026-11-29 18:20:09 +01:00
maj00r 7b6bdf22bb fix(events): EU07M review of #542: clip names keep their case and match regardless of it, an event without a pace told
- The clip event reads the name of the clip as written (getTokens lowercased it), and play_clip() finds the clip
  regardless of case, as the submodels are found by their names: a clip named Open or Armature|Wave couldn't be started
  from a scenery.
- An event without a pace (clip <name> endevent) plays the clip at its own pace with a line in the log, and leaves the
  keyword it met to the event: before, endevent was read as a pace of 0 (stopping the clips) and the next token was
  swallowed.
- Pace 0 with several instances of one model is held by #540's fix (the clips stopped stay set per instance).
- The spec says so.
2026-11-29 18:19:19 +01:00
maj00r 474c9ab5ae fix(model): EU07M review of #540: stopped clips held per instance, events over clips, the rest of a matrix node from its matrix
- stop_clips() holds each clip at the moment it was stopped instead of dropping it: the pose lives in the submodels the
  instances of a model share, so an instance whose clips were cleared snapped back to rest as soon as another instance of
  the model played one (two doors of one model).
- RaPrepare() applies the clips before the animation events of the scenery, so an event moving a node (rotate,
  translate...) takes it over from a clip, one ended or stopped included; before, a finished clip overrode the events
  on its nodes on every draw.
- A node with a matrix (XFRM) has its TRS fields only as an approximation: the parts the tracks of a clip don't move are
  taken from the decomposed matrix, so the node no longer jumps or skews when a clip starts moving another part of it.
- The spec says so.
2026-11-29 18:17:49 +01:00
maj00r 99bc0b125c fix(render): EU07M review of #538: an instance with light colours of its own drawn alone, the light records locked only when stale
- An instance with lightcolors of its own isn't instanced: the colours go onto the shared submodels as the instance is
  prepared, which the instances of a bucket don't each get, so they all showed the colours of one of them.
- The walk takes the exclusive lock for the light records of a bucket only when they are stale in this frame
  (Refresh_Light_Records() checks again under it): the later passes of the frame no longer stop the other walkers.
- instance_cull.comp (both renderers) puts the word of the light parts into [0][3] after the product with the view, so a
  view with a translation can't stretch the first column of a lit instance.
- The spec: ls_Dark / ls_Home switch without the fade too, and the instances with light colours of their own.
2026-11-29 18:14:35 +01:00
maj00r 8b75db6b70 Merge the review fixes of #535 and #536 from feat/eu07m-channels into feat/eu07m-gref 2026-11-29 17:55:01 +01:00
maj00r c6ece72d6a Merge the review fixes of #535 and #536 from feat/eu07m-clip-event into feat/eu07m-channels 2026-11-29 17:54:59 +01:00
maj00r bf8bb0caa0 Merge the review fixes of #535 and #536 from feat/eu07m-skin-compute into feat/eu07m-clip-event 2026-11-29 17:54:53 +01:00
maj00r 96ef809b07 Merge the review fixes of #535 and #536 from feat/eu07m-clips into feat/eu07m-skin-compute 2026-11-29 17:54:48 +01:00
maj00r 628f7eb707 Merge the review fixes of #535 and #536 from feat/eu07m-skinning into feat/eu07m-clips 2026-11-29 17:54:44 +01:00
maj00r 0efab6a080 Merge the review fixes of #535 and #536 from feat/eu07m-instancing into feat/eu07m-skinning 2026-11-29 17:54:34 +01:00
maj00r 6cb66b8b35 Merge the review fixes of #535 and #536 from feat/e4d-compact into feat/eu07m-instancing 2026-11-29 17:54:28 +01:00
maj00r 20f2156ce2 Merge #535 and #536's review fixes into feat/e4d-compact
Resolved for the rename to EU07M: the stale-file check is eu07m_up_to_date() before LoadFromEU07M, the loader catches
what reading throws, and the new tests name eu07m::.
2026-11-29 17:54:01 +01:00
maj00r fa98bdb8b0 Merge #535's review fixes into feat/e4d-load
Resolved: start_tools() parses the convertmodels flags with from_chars and both commands stop on bad flags; a vehicle's
.t3d is refused before it. The reader keeps the streams of this branch and the known sections of #535: an unknown
section the model needs is refused as unknown before its codec is looked at, and an unknown optional one in the codec of
the streams is passed over even by the tools, which can't keep it unpacked (forward compatibility of the codec flag). An
exception in a stream worker (no memory for a declared size) becomes the error of the file instead of std::terminate;
NOSONAR on the S2259 false positive there and on the seeded engines of the tests.
2026-11-29 17:53:28 +01:00
maj00r 0d095e225c fix(model): E4D review of #535: no guessed pass in the file, the header and the tree checked, unknown sections passed over
- The pass bits (0x30) BinInit guesses from a material when the E3D has none are marked (TSubModel::m_passguessed) and the
  converter leaves them out of legacy_flags and the primitive flags: it loads through the null renderer, whose materials
  all guess opaque, so the game makes the guess again with the real material.
- A vehicle's model isn't converted from its .t3d (dynamic 1): the game prepares it only after the vehicle marked its
  animated parts, so the .e3d the game makes of it is converted instead.
- read_header refuses a file_size smaller than the header, which made the hash check read outside the span.
- Sections seen twice are found with a set, not O(n^2); all the sections together may claim at most 2 GiB; a section the
  reader doesn't know and the model can do without is passed over before it is unpacked when keep_unknown is off.
- validate() checks that the parent of each node is the innermost node whose subtree holds it, so the tree of the ranges
  is the tree of the parents.
- Light_OnNN / Light_OffNN found by the game's GetFromName, so of two submodels of a name the same one counts; a
  replaceable skin drawn translucent gets material_flags::translucent; the convertmodels flags parsed without stoi.
- S3519: the matrix made with glm::make_mat4 instead of a memcpy into its first column; NOSONAR on the seeded engines of
  the tests (S2245).
- The spec: u16 indices up to 65 536 vertices, and the two rules above.

Tests: a file_size below the header, a node in the subtree of another than its parent, an unknown section passed over.
2026-11-29 17:25:23 +01:00
maj00r d930b6519d feat(model): the geometry shared by the variants of a family kept once, in a store of the folder
The variants of a vehicle repeat the same parts byte for byte, and each EU07M file carried them all again. PR #521 showed the
problem on E3D; EU07M solves it in the format.

- Block: the geometry of one primitive, its vertices in every vertex stream of the file and its indices, with a 16-byte header;
  its id is 128 bits, two FNV-1a 64 of its bytes. Only a primitive whose vertex and index ranges are its own can be shared.
- Store: geometry.eu07mpack in the folder of the models, the blocks each once (zstd when it saves an eighth) and an index
  sorted by their id (model/eu07m/eu07m_store.{h,cpp}).
- GREF, a new required section: the primitives kept in the store. The writer leaves their ranges out of the streams of the
  file; the reader takes their blocks from the store (read_options::blocks), checks the id and the counts of each and puts
  them back in place, so the model in memory has its whole streams and nothing past the reader knows the difference. A
  model with references and no store, or with a block which isn't the one referred to, is refused with the reason. The
  validator checks the references (primitive, counts, ranges of its own).
- The game opens the store of a folder once and keeps it (eu07m::family_store()); dump and validate read it too.
- Tools: "-eu07m pack <folder> [minimum bytes]" moves every block of at least 4 KiB (by default) which occurs more than
  once in the models of the folder into its store, made anew from all of them, and writes the models again referring to it,
  each read back and compared with what it was before it's replaced; "-eu07m unpack <folder>" writes them whole again.

Measured on copies of the converted models of the game: cd/181_v2 60.8 MB -> 4.0 MB (7%), pkp/11xa_v2/main 69.3 MB ->
5.8 MB (8%), pkp/elf_v1 109.6 MB -> 39.0 MB (36%), pkp/en57_v1 104.1 MB -> 39.3 MB (38%), 2-4 s a folder. All 223 packed
files pass -eu07m validate with their store. Four ELF parts drawn in the game (Vulkan) from the packed and from the whole
files, with the auto exposure off and the same seed: no pixel differs by more than 1. Unit tests 1208/1208, 4 new ones for a
round trip through a store, a model without its store, a wrong block, a primitive sharing its vertices and a folder packed,
packed again and unpacked.

The renderer still makes the geometry of each model on its own; sharing one range of the buffers between the models of a
family is the next step. No asset change: the game data has no .eu07m files, and the release doesn't read them.
2026-11-29 04:03:49 +01:00
maj00r cd9272144a docs: the EU07M model format spec in English
The spec of docs/eu07m-format.md was written in Polish, after docs/world-format-eu07.md. It is translated whole, with the state of the format brought up to date and a section on the channels added. No change to the format itself.
2026-11-29 01:47:21 +01:00
maj00r 64c54b8a38 feat(events): the animation event starts and stops the clips of EU07M models
A clip of stage 8 played on its own (autoplay) or from the code; a scenery event can start it now.

- New form of the animation event: "animation <delay> <model> clip <name> <pace>". A pace above 0 starts the clip from its
  beginning at that pace (a clip playing starts over), 0 stops the clips of the model, its nodes left where the clips put
  them. A clip the model hasn't gets "Bad event: ... can't find clip ..." in the log. The event is written back in the
  same form. The forms before it (rotate, translate, digital, .vmd) read and run as they did. The current release doesn't
  read the new form.
- The editor self-test gets "eventrun <name>", which finds the targets of the event and runs it at once, since the editor
  runs no events.

Checked in the game (Vulkan): after "clip bend 0" the tube stands still (no pixel differs between three shots), after
"clip bend 2" it moves, "clip nosuchclip 1" logs the error (time let run in the editor for the test only). No unit test:
the unit tests don't link world/Event.cpp. Unit tests 1200/1200. Not built with GCC here.
2026-11-29 01:31:37 +01:00