qmuntal / gltf

Go library for encoding glTF 2.0 files
https://www.khronos.org/gltf/
BSD 2-Clause "Simplified" License
243 stars 32 forks source link

Improve modeler.ReadAccessor buffer handling #88

Closed qmuntal closed 2 months ago

qmuntal commented 2 months ago

modeler.ReadAccessor now takes a []byte as the buffer parameter instead of any. It will internally cast that slice to the appropriate type and use it as backing memory when reading the accessor data.

This new approach has the advantage of allowing to reuse the same buffer for different accessor types. Previously, the buffer would only be used if the buffer type would match the accessor type.

Additionally, all the other modeler.Read* functions have been updated to pass a pooled buffer into modeler.ReadAccessor instead of the buffer passed by the caller.