1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Improve glTF logging (#15274)

Also removes all animations but the first one from gltf_frog.gltf
to address the corresponding warning.

Catches some more possible exceptions (out of bounds, optional access)
which might be caused by a broken model to properly log them.
This commit is contained in:
Lars Müller 2024-10-15 12:19:19 +02:00 committed by GitHub
parent 6d7a519740
commit c7938ce81c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 54 deletions

View file

@ -118,6 +118,9 @@ private:
std::size_t getPrimitiveCount(const std::size_t meshIdx) const;
void load();
const std::vector<std::string> &getWarnings() {
return warnings;
}
private:
const tiniergltf::GlTF m_gltf_model;
@ -126,6 +129,11 @@ private:
std::vector<std::function<void()>> m_mesh_loaders;
std::vector<CSkinnedMesh::SJoint *> m_loaded_nodes;
std::vector<std::string> warnings;
void warn(const std::string &warning) {
warnings.push_back(warning);
}
void copyPositions(const std::size_t accessorIdx,
std::vector<video::S3DVertex>& vertices) const;
@ -152,7 +160,7 @@ private:
void loadAnimation(const std::size_t animIdx);
};
std::optional<tiniergltf::GlTF> tryParseGLTF(io::IReadFile *file);
tiniergltf::GlTF parseGLTF(io::IReadFile *file);
};
} // namespace scene