feat(models): add opt-in u32 mesh index support - #6105
Closed
jvkabum wants to merge 2 commits into
Closed
Conversation
## Summary Adds opt-in 32-bit mesh index support while preserving the existing 16-bit index path and API behavior. `Mesh.indices` remains `unsigned short *` for backward compatibility. Meshes that require indices above `65535` can use the new `indices32` field together with `MESH_INDEX_UINT32`. ## Changes - Added `MeshIndexType` with `MESH_INDEX_UINT16` and `MESH_INDEX_UINT32`. - Added `Mesh.indices32` and `Mesh.indexType`. - Appended the new `Mesh` fields to preserve the offsets of existing public fields. - Updated mesh upload and draw paths to select the correct OpenGL index type: - `GL_UNSIGNED_SHORT` for `u16` - `GL_UNSIGNED_INT` for `u32` - Updated indexed and instanced drawing paths. - Updated mesh cleanup, validation, export, and collision-related index access. - Updated the glTF loader to preserve `UNSIGNED_INT` index accessors instead of narrowing them to `u16`. - Added a regression example containing an index value of `65536`. ## Compatibility Existing applications and models using `Mesh.indices` continue to use 16-bit indices unchanged. The new format is opt-in: ```c mesh.indices32 = indices; mesh.indexType = MESH_INDEX_UINT32;
Owner
|
@jvkabum thanks but I prefer to avoid two paths to maintain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in 32-bit mesh index support while preserving the existing 16-bit index path and API behavior.
Mesh.indicesremainsunsigned short *for backward compatibility. Meshes that require indices above65535can use the newindices32field together withMESH_INDEX_UINT32.Changes
MeshIndexTypewithMESH_INDEX_UINT16andMESH_INDEX_UINT32.Mesh.indices32andMesh.indexType.Meshfields to preserve the offsets of existing public fields.GL_UNSIGNED_SHORTforu16GL_UNSIGNED_INTforu32UNSIGNED_INTindex accessors instead of narrowing them tou16.65536.Compatibility
Existing applications and models using
Mesh.indicescontinue to use 16-bit indices unchanged.The new format is opt-in: