8000 Change `cgltf_accessor_unpack_indices` to work with int vectors by fda0 · Pull Request #267 · jkuhlmann/cgltf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Change cgltf_accessor_unpack_indices to work with int vectors #267

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.

8000

Already on GitHub? Sign in to your account

Merged

Conversation

fda0
Copy link
Contributor
@fda0 fda0 commented Mar 10, 2025

This PR introduces 3 improvements to the
cgltf_accessor_unpack_indices function:

  1. Query cgltf_num_components and use it to load int vectors properly - this is useful for loading vec4 uint8_t joint indices.
  2. Add support for uint8_t in slow path (for loop) in cases where data wasn't tightly packed (previously the function wouldn't do anything).
  3. Return 0 on failure instead of failing silently and leaving memory uninitialized.

This PR introduces 3 improvements to the
`cgltf_accessor_unpack_indices` function:
1. Query `cgltf_num_components` and use it to load int vectors
   properly - this is useful for loading vec4 uint8_t joint indices.
2. Add support for uint8_t in slow path (for loop) in cases where
   data wasn't tightly packed (previously the function wouldn't do
   anything).
3. Return 0 on failure instead of failing silently and leaving memory
   uninitialized.
@fda0
Copy link
Contributor Author
fda0 commented Mar 10, 2025

This brings this function closer to cgltf_accessor_unpack_floats and I think that ideally in the future both functions would be compressed into one. Perhaps both functions could call a common implementation.

@jkuhlmann jkuhlmann merged commit 08470a2 into jkuhlmann:master Mar 13, 2025
3 checks passed
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
0