GLTF/GLB write operations always use FS despite TINYGLTF_NO_FS
Opened this issue · 1 comments
W4RH4WK commented
For reading GLTF/GLB file system access can be controlled by defining TINYGLTF_NO_FS
and providing the necessary callback functions.
Writing GLTF/GLB files seems to be missing this functionality. Even when TINYGLTF_NO_FS
is defined, certain functions using std::ofstream
are still active (e.g. WriteGltfFile
).
Side note: if TINYGLTF_NO_FS
is defined, <fstream>
is not included. However, it still compiles on most platforms successfully as std::ofstream
is pulled in transitively.
syoyo commented
TINYGLTF_NO_FS
is primarily for reading glTF. It is not well considered in the writer.
To make TINYGLTF_NO_FS
effective for the writer(no <fstream>, <cstdio>
dependency), we need to introduce WriteGltfSceneToMemory
API, something like:
bool WriteGltfSceneToStream(const Model *model, std::vector<uint8_t> &output,
bool prettyPrint, bool writeBinary);