cesium-native
cesium-native copied to clipboard
Remove glTF compressed buffers after decompressing
When a glTF contains a Draco-compressed buffer or a jpg/png compressed image, we decompress/decode them at load time. However, the original compressed data hangs around. We could save memory by freeing these original buffers after we're done loading data from them.
Doing this is mostly trivial, except for (unlikely?) edge cases where a single block of compressed data in a glTF Buffer is used by multiple primitives (draco) or images (jpg/png).
Also, it's tricky to surgically remove data from a buffer because of the need to preserve alignment in the process.
I started on this in https://github.com/CesiumGS/cesium-native/compare/gltf-remove-draco awhile back, but it's not complete or working.