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.
Stage 8 of the EU07M model format. A model can carry animation clips; each track of a clip sets the translation, the
rotation or the scale of a node at a time of the clip, and the parts of a node without a track keep its TRS.
- Format, five optional sections: ACLP (clips: name, duration, flags 0x1 loop and 0x2 autoplay, range of tracks), ATRK
(tracks: node, part, interpolation step / linear / cubic, ranges of keys), ATIM (key times), AVEC (vectors; with cubic
the in-tangent, value and out-tangent of glTF) and AROT (rotations in 8 bytes, "smallest three": the three smaller
components as snorm16 scaled by sqrt(2) and the index of the largest; eu07m::encode_rotation / decode_rotation).
The validator refuses a node out of range, keys out of their arrays, times which aren't numbers from 0 up, a cubic
rotation and tracks out of the range of the clip. -eu07m dump lists the clips and their tracks. The current release
doesn't read these sections; a file without them loads as before.
- Sampling (model/clip.cpp): step, lerp / slerp the shorter way, the Hermite spline of glTF with tangents per second;
the first and the last key held outside of them; a looped clip goes around its duration, another stops at its end.
- In the game: the clips play by the simulation time, from TAnimModel::play_clip(name, speed) or, flagged autoplay, from
the first time the instance is drawn. RaPrepare() samples them for the instance drawn and sets the transforms of the
nodes (TSubModel::SetClipTransform(), the new animation type at_Clip, gated by the instance like the others), so a clip
moving the joints of a skin bends the skinned parts. The nodes a clip moves are flagged animated at load, which keeps
the model out of the instancing. stop_clips() stops them.
- The editor self-test gets "clip <node> <name> [speed]".
Not yet: a scenery event starting a clip, and the CHNL channels bound to the time of a clip.
Checked: a skinned tube with an autoplay clip (the tip to 60 degrees and back in 2 s, looped) beside a still one, six
screenshots in Vulkan and in GL 4.6 go from straight to fully bent while the other stays (time let run in the editor for
the test only). Unit tests 1200/1200, 6 new ones for the packing, the interpolations, the time and the file. Not built
with GCC here.
E4D read as the next version of E3D, which the format isn't meant to be tied to; EU07M goes with the world format .eu07.
The format isn't released, so nothing reads the old name.
- The extension .eu07m, the magic EU7M (the four bytes of the header), model/eu07m/ with eu07m_*.{h,cpp},
namespace eu07m, docs/eu07m-format.md, tests/unit/test_eu07m.cpp.
- The command line -eu07m convert|dump|validate|diff, TModel3d::LoadFromEU07M, and the key modelformat eu07m|legacy
of eu07.ini (Global.modelformat_eu07m).
- Nothing else changes: the sections, the records and the components are the same, so a converted file needs only its
magic and its extension changed.
Unit tests 1189/1189.