Add support for negative vertex indices in OBJ loader for 2.x by avinxshKD · Pull Request #8512 · processing/p5.js
Navigation Menu
{{ message }}
processing / p5.js Public
- Notifications You must be signed in to change notification settings
- Fork 3.7k
Merged
davepagurek merged 2 commits intoprocessing:dev-2.0from
Feb 12, 2026Merged
Add support for negative vertex indices in OBJ loader for 2.x#8512
davepagurek merged 2 commits intoprocessing:dev-2.0from
Add support for negative vertex indices in OBJ loader for 2.x#8512
davepagurek merged 2 commits intoprocessing:dev-2.0from
Conversation
Copy link
Contributor
avinxshKD
commented
Feb 9, 2026
avinxshKD
commented
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()forloadedVerts.v,loadedVerts.vt,loadedVerts.vnlookups 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
avinxshKD
force-pushed
the
fix/obj-negative-indices-2.0
branch
from
a6043fc to
3d1f4d6
Compare
This was referenced
Feb 9, 2026davepagurek approved these changes Feb 12, 2026
Copy link
Contributor
davepagurek
left a comment
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!
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