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

Various glTF fixes, mostly meshopt related #875

Merged
merged 10 commits into from
May 21, 2024
Merged

Various glTF fixes, mostly meshopt related #875

merged 10 commits into from
May 21, 2024

Conversation

kring
Copy link
Member

@kring kring commented May 6, 2024

EXT_meshopt_compression is fun because it is, as far as I'm aware, the only thing other than a regular bufferView that can reference a buffer. This wasn't being accounted for in a lot of the glTF manipulation code.

From the changelog:

  • Added support for the following glTF extensions to Model::merge. Previously these extensions could end up broken after merging.
    • ...
    • EXT_meshopt_compression
  • GltfUtilities::collapseToSingleBuffer now works correctly even if some of the buffers in the model have a uri property and the data at that URI has not yet been loaded. Such buffers are left unmodified.
  • GltfUtilities::collapseToSingleBuffer now works correctly with bufferViews that have the EXT_meshopt_compression extension.
  • GltfUtilities::compactBuffer now accounts for bufferViews with the EXT_meshopt_compression when determining unused buffer ranges.
  • When GltfReader decodes buffers with data URLs, and the size of the data in the URL does not match the buffer's byteLength, the byteLength is now updated and a warning is raised. Previously, the mismatch was ignored and would cause problems later when trying to use these buffers.
  • EXT_meshopt_compression and KHR_mesh_quantization are now removed from extensionsUsed and extensionsRequired after they are decoded by GltfReader.

Draft because I need to write tests for a lot of this, though I have empirical evidence in another project that these changes are necessary and that they are working well.

Comment on lines 283 to 287
// Leave intact any buffers that have a URI and no data.
if (sourceBuffer.uri && sourceBuffer.cesium.data.empty()) {
keepBuffer[i] = true;
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kring kring marked this pull request as ready for review May 21, 2024 12:19
@kring
Copy link
Member Author

kring commented May 21, 2024

I've addressed @lilleyse's comment and added tests, so this is now ready to review and merge.

@lilleyse
Copy link
Contributor

The macOS runners are taking a while to launch. But everything else passed and the code looks good to me, so I'm going to merge.

@lilleyse lilleyse merged commit f631bdf into main May 21, 2024
24 checks passed
@lilleyse lilleyse deleted the meshopt-bugs branch May 21, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants