qmuntal / gltf

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

Allow removal of unused data #65

Closed anierzad closed 1 month ago

anierzad commented 1 year ago

Hello, firstly thank you for building this module; it's been really useful in a project I've been playing with.

My apologies if there is something in the documentation I've overlooked but I can't find a way to remove data that is no longer used.

For example in my use case, I'm loading a source gltf file, making some modifications to some of the data using the modeler package such as reading, editing and then writing vertex positions as well as replacing a texture assigned to a material). I'd like to be able to remove the old, no longer referenced, vertex and image data to keep the resulting file size as small as possible.

I'd love to contribute to the project too so if there's any way I could help with the implementation of the above I'd be more than happy to. However I am very new to gltf, I've only known about the formats existence for a few weeks.

qmuntal commented 1 year ago

Hi @anierzad, thanks for submitting this request. I'll think about this during the weekend and report back.

qmuntal commented 1 month ago

Better late than never: I've been toying with some prune implementations, and they end up being too complex. I hesitant to add this complexity here, my time is quite limited nowadays. I'm open to review and and merge a clean solution from an external contributor if someone wants to give it a try.