Skip to content

fix: Accept any integer index dtype in VertexNormalsExtension - #86

Open
kylebarron wants to merge 1 commit into
fix/ritter-float64from
fix/vertex-normals-index-dtype
Open

kylebarron wants to merge 1 commit into
fix/ritter-float64from
fix/vertex-normals-index-dtype

Conversation

@kylebarron

@kylebarron kylebarron commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

Fixes VertexNormalsExtension rejecting the default integer index dtype.

The bug

encode casts indices to uint32, but VertexNormalsExtension passed them straight to the Cython add_vertex_normals helper, which only accepts uint32. Indices built with np.array([...]) are int64 by default. Passing the same indices to both, as the README example does, raised:

ValueError: Buffer dtype mismatch, expected 'uint32_t' but got 'long'

This happens on numpy 1.26 too.

Fix

Cast indices to uint32 in compute_vertex_normals, as encode does.

Tests

test_vertex_normals_extension_index_dtype fails without the fix and passes with it.

🤖 Written by Claude Code

`encode` casts indices to uint32, but `VertexNormalsExtension` passed them
straight to the Cython `add_vertex_normals` helper, which only accepts
uint32. Indices built with `np.array([...])` are int64 by default, so
passing the same indices to both, as the README example does, raised
`ValueError: Buffer dtype mismatch, expected 'uint32_t' but got 'long'`.
This happens with numpy 1.26 too.

Cast indices to uint32 in `compute_vertex_normals`, matching `encode`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kylebarron
kylebarron added this pull request to stack #91 October 5, 2026 21:52

This branch has not been deployed

No deployments
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.

1 participant