Skip to content

Add support for negative vertex indices in OBJ loader for 2.x#8512

Merged
davepagurek merged 2 commits intoprocessing:dev-2.0from
avinxshKD:fix/obj-negative-indices-2.0
Feb 12, 2026
Merged

Add support for negative vertex indices in OBJ loader for 2.x#8512
davepagurek merged 2 commits intoprocessing:dev-2.0from
avinxshKD:fix/obj-negative-indices-2.0

Conversation

@avinxshKD
Copy link
Contributor

Switched OBJ face parsing to use .at() for array access instead of bracket notation. Negative indices (like -1 for last vertex) now work per OBJ spec, positive indices still get converted from 1-based to 0-based.

Resolves #8493

Changes

  • Also removed TODO about negative indices from src/webgl/loading.js
  • Uses .at() for loadedVerts.v, loadedVerts.vt, loadedVerts.vn lookups to handle both negative and positive indexing
  • Added test/unit/assets/cube-negative-indices.obj ,, test file with negative face indices
  • Added two tests confirming negative index OBJs load and produce identical geometry to positive index versions

PR Checklist

  • npm run lint passes
  • Inline reference is included / updated
  • Unit tests are included / updated

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@davepagurek davepagurek merged commit c538e7d into processing:dev-2.0 Feb 12, 2026
2 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