qmuntal / gltf

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

Read/write external buffers from fs.FS #51

Closed qmuntal closed 2 years ago

qmuntal commented 2 years ago

The fs.FS interface exists since 1.16 and is a better abstraction that the custom ReadHandler.

The functions EncoderWithReadHandler and Decoder.WithWriteHandler have been removed. Use NewEncoderFS and NewDecoderFS instead.

The memory allocation for external buffers now relies on the fs.FS implementation, so the decoder quotas have been removed.

Additionally, external buffers with non-relative URIs will not be read nor write. This was previously documented but not enforced. The glTF spec only requires (and recommends) relative URIs, so if someone wants to use absolute URIs they will have to implement it on their side.

Fixes #50