Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTF/GLB write operations always use FS despite TINYGLTF_NO_FS #488

Open
W4RH4WK opened this issue Jun 6, 2024 · 1 comment
Open

GLTF/GLB write operations always use FS despite TINYGLTF_NO_FS #488

W4RH4WK opened this issue Jun 6, 2024 · 1 comment

Comments

@W4RH4WK
Copy link

W4RH4WK commented Jun 6, 2024

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
Copy link
Owner

syoyo commented Jun 6, 2024

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants