mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-10-21 06:41:06 +08:00

Tinygltf is able to write files defined by a URI, so it needs to be able to decode it. Since it may also modify the path where the image is saved it may need to re-encode the URI too. This patch provides an API to set URI encoding and decoding callbacks and exposes the default decode method. Uses the existing dlib::urldecode as a decode default. The encode callback is left null, matching existing behaviour. Updates the WriteImageDataFunction signature to include tinygltf::URICallbacks. Decodes the image and buffer uris before using them as a filename. If the encode callback is set, encodes the written image location in the default WriteImageDataFunction and encodes generated buffer locations when writing .bin files. Adds a save+load step to the test image-uri-spaces to verify uri encoding.