Skip to content

Conversation

nfginola
Copy link
Contributor

@nfginola nfginola commented Feb 15, 2025

The assertion that the buffer view should strictly contains a view to the primitive it belongs to is sane , however I found that the GLTF Sponza model from the glTF-Sample-Assets has each of the primitives buffer view containing data for all primitives, not only the subset. In other words, the buffer view is identical for each glTF primitive index which views all data.

With the assertion, the library fails to load this model. Removing the assert, I can load each submesh with no issues.
Strictly speaking, in this case we found that the accessor size <= buffer view size and not accessor size == buffer view size.

Therefore, I believe this assertion is too strict and should be removed.

image

This assert does seem valid, however there may be GLTF models where each
of the primitives buffer view contains a view to all primitives.
One such example is Sponza from glTF-Sample-Assets.
Copy link
Member

@hazeycode hazeycode left a comment

Choose a reason for hiding this comment

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

Yes, this is too strict. Thanks!

I think we should delete the preceding assert also. Asserts aren't a good fit here because we're dealing with external data. Better to use errors for any show stopping problems with the input. And any nice to have checks should be moved to auxiliary validation functions.

@hazeycode hazeycode merged commit a994d3b into zig-gamedev:main Feb 16, 2025
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.

2 participants