mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 18:47:06 +01:00
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.
This commit is contained in:
@@ -2729,6 +2729,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
||||
float opacity = mat->get_or_guess_opacity();
|
||||
|
||||
// set phase flag based on material opacity
|
||||
m_passguessed = true;
|
||||
if (opacity == 0.0f)
|
||||
iFlags |= 0x20; // translucent
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user