Hey @najadojo, I get to send you a PR for a change.
This one fixes AnalyticalGraphicsInc/gltf-vscode#80. In that issue, @zellski has a model where multiple image blocks in a GLB refer to the same internal buffer. I'm not sure that's good practice in general, as one could more easily re-use the same image index number. But, it doesn't appear to be forbidden by glTF, and it's fixable here.
This change makes a list of image blocks that all reference a given bufferView index, and will adapt all of them to use the newly created filesystem file. There's a baked-in assumption that the first reference to a bufferView will have the correct MIME type and that all following references to the same bufferView will have the same type (because how could they not? It's the same data). Hopefully this doesn't decrease the readability here, let me know.
Hey @najadojo, I get to send you a PR for a change.
This one fixes AnalyticalGraphicsInc/gltf-vscode#80. In that issue, @zellski has a model where multiple
image
blocks in a GLB refer to the same internal buffer. I'm not sure that's good practice in general, as one could more easily re-use the same image index number. But, it doesn't appear to be forbidden by glTF, and it's fixable here.This change makes a list of
image
blocks that all reference a given bufferView index, and will adapt all of them to use the newly created filesystem file. There's a baked-in assumption that the first reference to a bufferView will have the correct MIME type and that all following references to the same bufferView will have the same type (because how could they not? It's the same data). Hopefully this doesn't decrease the readability here, let me know.