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.
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.
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).
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.
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.
- 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.
- 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.
- 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.
- 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.
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::.
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.
- 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.
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.
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.
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.