spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability
https://fastgltf.readthedocs.io/v0.8.x/
MIT License
312 stars 48 forks source link

Exporting as glb with embedded buffer does not work for fastgltf::sources::ByteView #48

Closed Cyphall closed 8 months ago

Cyphall commented 8 months ago

Seems to be caused by the sources::ByteView case missing the if statement present in sources::Array and sources::Vector: https://github.com/spnda/fastgltf/blob/f8ed5a09e761dab002c143735c3643323435fac4/src/fastgltf.cpp#L4189-L4211

spnda commented 8 months ago

Can you be more specific about the meaning of "does not work"? Does the writeGltfBinary function return any error, or are there any specific side effects that you didn't want to happen? Or did the current code just export the GLB buffer as a normal buffer to a extra file instead of embedding it into the GLB file?

I have changed the code locally, and will push if that was your only concern. Thank you.

Cyphall commented 8 months ago

Sorry, I should have been a bit more explicit on my issue.

When exporting as glb an asset with one buffer (small or large, doesn't matter) whose data field is an fastgltf::sources::ByteView, the buffer is created in a separate file instead of being embedded in the glb file

spnda commented 8 months ago

Okay, so what I thought. That is fixed now in the latest commit. Thanks again for reporting.