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

Add: glTF Exporter #33

Merged
merged 25 commits into from
Jan 28, 2024
Merged

Add: glTF Exporter #33

merged 25 commits into from
Jan 28, 2024

Conversation

spnda
Copy link
Owner

@spnda spnda commented Sep 27, 2023

This PR adds a fastgltf::Exporter object that can serialize a fastgltf::Asset into either a JSON or a binary blob (GLB). fastgltf::FileExporter builds upon this object by also automatically writing all of the relevant data to disk.

TODO list:

  • Figure out how to write the various data sources
  • Get binary glTFs to work
  • Rework the texture image index API to work with writing
  • Add the missing material fields
  • Add support for extensions

I'm opening this PR to keep track of the work and to have other people take their look before I push this into the main branch of the repository.

I also thought of a functional API for writing glTFs that would guarantee data safety while writing in various ways. That could, however, also be achieved by calling the validate function at the start of Composer::writeGLTF to guarantee the data is valid. Having the user properly figure out data relations from the glTF spec could still be tedious, where a functional API would be much more intuitive to use, as data relations would be much more apparent from the code itself. I will see if this additional API is necessary in the future.

@spnda spnda added the enhancement New feature or request label Sep 27, 2023
@spnda spnda force-pushed the gltf_composing branch 4 times, most recently from ee3a673 to f1cfd62 Compare January 2, 2024 01:32
@spnda spnda changed the title Add: Composer for writing glTF files Add: glTF Exporter Jan 2, 2024
@spnda spnda merged commit 0272e59 into main Jan 28, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant