Loading a GLTF from a virtual file system #93
Replies: 1 comment
-
|
Just pass in an empty path ("/" or whatever) and don't specify LoadExternalBuffers or whatever. That way the directory parameter is unused, since fastgltf will only parse the provided JSON/GLB file. Afterwards buffers and images will contain URIs, which usually contain relative paths but might also contain absolute path or URLs. Using that, you would load those files yourself into whatever data structure you want. This is the beauty of fastgltf, it doesn't need nor care about how you load buffers and images, and simply provides the glTF data structure you need. The accessor tools also still work, but you will probably need a custom data adapter. See the documentation for more information. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, sorry to bother you.
I'm trying to load a gltf scene directly from a zip file using SDL_PhysFS, which is basically a SDL3 PhysicsFS wrapper.
Loading the scene.gltf as vector of bytes and passing it to fastgltf:
causes problems down the line because of:
auto load = parser.loadGLTF(&data, path.parent_path(), gltfOptions);considering there's no "parent" of a mount point. Even if I removed the: "!fs::is_directory(directory)" check that early returns InvalidPath I crash trying to parse the json files.
Also I wonder how am I supposed to load/give fastgltf the other scene.bin and how to load the textures as well.
So I was wondering if you could provide a simple example code for this kind of problems or pointers on how to achieve my goal, if that's possible.
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions