loadModel() options break without fileType and ignore flipU/flipV #9302
Copy link
Copy link
Open
Labels
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- WebGPU
- p5.strands
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.3.2 / current main
Web browser and version
Chromium 151
Operating system
Fedora Linux
Steps to reproduce this
The documented loadModel(path, options) overload breaks depending on whether fileType is included.
async function setup() {
createCanvas(100, 100, WEBGL);
// Throws: fileType.toLowerCase is not a function
await loadModel('model.obj', { flipU: true });
// Loads, but flipU is ignored
await loadModel('model.obj', {
fileType: '.obj',
flipU: true
});
}Options like { normalize: true } or {} also throw when fileType is omitted. With fileType present, flipU / flipV are ignored, although calling model.flipU() / model.flipV() afterwards works.
Expected: loadModel(path, options) should work without requiring fileType, and the flip options should be applied.
I traced it to the options parsing here:
Lines 573 to 581 in 24a68d5
| if (typeof fileType === 'object') { | |
| // Passing in options object | |
| normalize = fileType.normalize || false; | |
| successCallback = fileType.successCallback; | |
| failureCallback = fileType.failureCallback; | |
| fileType = fileType.fileType || fileType; | |
| flipU = fileType.flipU || false; | |
| flipV = fileType.flipV || false; | |
| } else { |
fileType is reassigned before flipU / flipV are read, so without fileType the options object eventually reaches .toLowerCase(), while with it the flags are read from a string.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
bababananaa commentedon Oct 17, 2026
Hi! Can I be assigned to this issue?
saniyaa-17 commentedon Oct 17, 2026
Hi! I'd like to contribute to this issue. I've reviewed the problem with
loadModel()options, includingfileType,flipU, andflipV. I'd like to investigate the options parsing and add a regression test for the reported behavior. Please let me know if I can work on this. Thank you!