spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability

Home Page:https://fastgltf.readthedocs.io/v0.7.x/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is EXT_meshopt_compression supported?

tigrazone opened this issue · comments

commented

I try to open with examples/gl_viewer file https://github.com/gkjohnson/3d-demo-data/tree/main/models/interior-scene/scene.gltf and viewer failed with error code
Failed to parse glTF: 2
Failed to parse glTF
I searched for this error in source code and understand it is an Error::MissingExtensions(2).
I find in src/fastgltf.cpp
line
SET_ERROR_RETURN_ERROR(Error::MissingExtensions)

and before it added
printf("extension: %s\n", std::string(extensionString).c_str());
and now error message is
Loading c:\msys64\home\user\from-git\3d-demo-data\models\interior-scene\scene.gltf
extension: EXT_meshopt_compression
Failed to parse glTF: 2
Failed to parse glTF

i.e EXT_meshopt_compression not supported?
Maybe I need to set some config flags?

commented

Please read the README thoroughly. Yes, the extension is fully supported by the fastgltf parser. For using extensions, please look at this constructor of the Parser object:

explicit Parser(Extensions extensionsToLoad = Extensions::None) noexcept;

You can OR together all Extensions you want to load to indicate that you do support them. If not, fastgltf assumes you don't support the Extensions and fails with the error code 2 (MissingExtensions):
// One or more extensions were not marked as supported by the client application but are
// required by the glTF.
MissingExtensions = 2,

And as the gl_viewer doesn't list those extensions in the constructor, it does not support it. I simply didn't want to make the example any more complex than it needs to be by adding another library. The gl_viewer is meant to show a very basic example of how to use most of the features fastgltf provides.