18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 03:37:09 +01:00

refactor(model): the new model format is EU07M (.eu07m), not E4D

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.
This commit is contained in:
maj00r
2026-11-28 22:02:05 +01:00
parent 5185d69dc9
commit 92cc2dcc28
29 changed files with 300 additions and 300 deletions
+4 -4
View File
@@ -1875,9 +1875,9 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
Init();
assign_lod_ranges(Root, name);
}
else if (auto const e4dfile{Global.modelformat_e4d ? FileCased(name + ".e4d") : std::string{}}; (false == e4dfile.empty()) && LoadFromE4D(e4dfile, dynamic))
else if (auto const eu07mfile{Global.modelformat_eu07m ? FileCased(name + ".eu07m") : std::string{}}; (false == eu07mfile.empty()) && LoadFromEU07M(eu07mfile, dynamic))
{
// modelformat e4d: the .e4d made from the model takes its place; one which doesn't load leaves the .e3d / .t3d to go on
// modelformat eu07m: the .eu07m made from the model takes its place; one which doesn't load leaves the .e3d / .t3d to go on
asBinary = "";
Init();
assign_lod_ranges(Root, name);
@@ -2651,7 +2651,7 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
finish_binary(dynamic, hastangents);
}
// the submodels read from a file (E3D or E4D) tied together, their materials looked up and their geometry handed to the renderer
// the submodels read from a file (E3D or EU07M) tied together, their materials looked up and their geometry handed to the renderer
void TModel3d::finish_binary(bool const dynamic, bool const hastangents)
{
for (size_t i = 0; (int)i < iSubModelsCount; ++i)
@@ -2681,7 +2681,7 @@ void TModel3d::finish_binary(bool const dynamic, bool const hastangents)
}
if (false == Root[i].CompactPositions.empty())
{
// a submodel of an E4D model: its compact streams as they are, the renderer keeps them or makes basic_vertex of them
// a submodel of an EU07M model: its compact streams as they are, the renderer keeps them or makes basic_vertex of them
Root[i].m_geometry.handle = GfxRenderer->Insert_Compact(Root[i].Indices, Root[i].CompactPositions, Root[i].CompactAttributes, Root[i].Userdata, m_geometrybank, type);
continue;
}