gltf icon indicating copy to clipboard operation
gltf copied to clipboard

`gltf::import_buffers` consumes `Vec<u8>` blob

Open facundo-villa opened this issue 1 year ago • 1 comments

As it stands today gltf::import_buffers requires it's blob parameter to be a Vec<u8> since an underlying call to gltf::buffer::Data::from_source_and_blob may mutate this input blob to align it's size to a multiple of four.

I would like this parameter to be a u8 slice so we may feed it the resulting blob from a gltf::Gltf::from_slice import without having to turn that Cow into a Vec.

I suggest we make having an unaligned slice an error and return that from gltf::buffer::Data::from_source_and_blob if it's given one.

I volunteer to try to implement this under the V2 branch.

facundo-villa avatar Apr 10 '24 03:04 facundo-villa

That's a sensible suggestion. Feel free to make a PR into https://github.com/alteous/gltf/tree/v2-with-extension-macro if you want. I'll be reworking this area soon nonetheless.

alteous avatar Apr 22 '24 16:04 alteous