Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

loadModel() options break without fileType and ignore flipU/flipV

未关闭 适合新手
#9,302 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript

调研方向

loadModel(path, options) 的选项解析位于 src/webgl/loading.js 第 573-581 行附近;issue 指出 fileType 在读取 flipU 和 flipV 之前被重新赋值,因此 options 对象可能会走到 .toLowerCase()。请先阅读该代码块,然后分别使用 loadModel('model.obj', { flipU: true }) 以及包含 fileType 的调用形式复现问题。当两种调用形式都能无错误加载,并且翻转选项已应用到加载的模型上时,即完成。

由索引模型根据 Issue 内容生成。

描述

Area:WebGL p5.js 2.0+
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:

https://github.com/processing/p5.js/blob/24a68d5c19eb70931c9a08c41b43a658978835f3/src/webgl/loading.js#L573-L581

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.

主要语言
JavaScript
星标
24.1k
派生
3.9k
平均合并
2 天 22 小时
30 天内合并 PR
38

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

processing/p5.js 的其他 Issue

查看 processing/p5.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。