18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 19:57:06 +01:00
Files
maszyna/docs
maj00r d6bace0fda feat(model): the E4D model format: spec, reader, writer and conversion from E3D/T3D
A fully binary successor of E3D, laid out for the GL 4.6 and Vulkan 1.4 renderers. Stage 1 of the plan: the format
and its tools. The game doesn't load .e4d yet; that is stage 2, behind a switch in eu07.ini.

- docs/e4d-format.md: the spec (in Polish, like world-format-eu07.md).
- model/e4d/e4d_format.h: the records and FourCCs, with static_asserts on sizes and offsets.
  - A table of sections with required/optional flags and zstd per section; tables carry count and stride, so a later
    version appends fields and an older reader takes the part it knows.
  - Nodes in depth-first order with TRS (XFRM for sheared matrices), meshes, 48-byte primitives.
  - Split vertex streams: VPOS f32x3, VATT QTangent snorm16x4 + UV f32x2 (28 B a vertex instead of 48 B), VSKN/VSKW
    skin weights, VUSR user data, VBND for primitives merged from several nodes (rigid joints, light slots).
  - Indices u16 or u32 per primitive, local to its base vertex.
  - Typed components on the model, nodes, meshes and vertex groups (PROP, SOCK, JOIN, SPRG, CHAN, VARI, CHNL, LSLT,
    LGHT, EMIT, MREF, COLL, LANM, LTXT, STAR), skins, vertex groups, a name index and bounds.
- model/e4d/e4d_io: write and read; the file is untrusted, so every offset, size, index, parent and reference is
  checked (validate) before anything is used, and a broken file is refused with a reason.
- model/e4d/e4d_build: QTangent packing, TRS from matrices, the name index and the bounds.
- model/e4d/e4d_convert: a model loaded from E3D or T3D into E4D, and the command line:
  eu07 -e4d convert <in.e3d|in.t3d> <out.e4d> [dynamic], eu07 -e4d dump <file>, eu07 -e4d validate <file>.
- zstd moves to eu07_core, which the unit tests link.
- tests/unit/test_e4d.cpp: round trip, section alignment, records of a later version, broken files, random mutations,
  QTangent, TRS, name lookup, bounds, merged primitives.

Checked: 250 random .e3d of the installed game convert (E4D 21% of their size with zstd, 60% without), and the
vehicle families en57_v2, t448p_v2 and vectron_v1 (701 files). Unit tests 1188/1188. Not built with GCC here.
2026-11-28 19:45:55 +01:00
..