Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#9,302 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
computer-graphics

Hướng nghiên cứu

Phân tích tùy chọn cho loadModel(path, options) nằm trong src/webgl/loading.js quanh các dòng 573-581; issue cho biết fileType bị gán lại trước khi flipU và flipV được đọc, nên đối tượng options có thể đi tới .toLowerCase(). Bắt đầu bằng cách đọc khối đó, rồi tái tạo lỗi với loadModel('model.obj', { flipU: true }) và với fileType được truyền vào. Hoàn thành khi cả hai dạng gọi đều tải được mà không lỗi và các tùy chọn lật được áp dụng cho mô hình đã tải.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
24.1k
Fork
3.9k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
38

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của processing/p5.js

Tất cả issue của processing/p5.js

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.