-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Increasing access
Increasing access
Allows properly loading OBJ files that use negative indices (standard OBJ format feature).
Most appropriate sub-area of p5.js?
- WebGL
Feature enhancement details
The OBJ loader has a TODO about not supporting negative vertex indices, which are actually pretty common in OBJ files.
In src/webgl/loading.js around line 615:
// TODO: Faces can technically use negative numbers to refer to the
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
Feature enhancement details
In the OBJ format, negative numbers count backwards from the most recent vertex. So -1 means the last vertex that was defined, -2 means second-to-last, etc. A lot of modeling software uses this.
Right now p5.js either ignores these or handles them incorrectly, which can mess up how models look when loaded.
Should be fixable by converting negative indices to positive ones based on the current vertex count (like vertexCount + negativeIndex + 1).