Skip to content

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

Open
avinxshKD wants to merge 1 commit intoprocessing:dev-2.0from
avinxshKD:fix/obj-negative-indices-2.0
Open

Add support for negative vertex indices in OBJ loader for 2.x#8512
avinxshKD wants to merge 1 commit 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

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