p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

Add visual regression tests for missing WebGL 3D primitives

Open aashu2006 opened this issue 9 months ago • 2 comments

Increasing access

This makes it easier for contributors and maintainers to work on WebGL code by providing clear visual feedback when changes affect 3D primitives, reducing the need for deep knowledge of WebGL internals.

Most appropriate sub-area of p5.js?

  • [ ] Accessibility
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [x] WebGL
  • [ ] Build process
  • [x] Unit testing
  • [ ] Internationalization
  • [ ] Friendly errors
  • [ ] Other (specify if possible)

Feature request details

The WebGL visual test suite currently has tests for some basic 3D primitives, but a few commonly used ones are not covered yet:

  • cylinder()
  • cone()
  • ellipsoid()
  • torus()

Proposed improvement

Add one simple visual regression test for each of these primitives. Each test would:

  • Render a single shape
  • Use stable lighting
  • Avoid animation
  • Generate a baseline screenshot for comparison

Scope

This would be an additive change only:

  • No API changes
  • No refactors
  • Tests will be live in test/unit/visual/cases/webgl.js

aashu2006 avatar Feb 02 '26 08:02 aashu2006

I've reviewed test/unit/visual/cases/webgl.js, and I plan to group these four shapes (cylinder, cone, ellipsoid, torus) under a new visualSuite('Primitives', ...) block within the main WebGL suite.

I'll ensure they use stable lighting and static rendering as requested to generate the baseline screenshots. Does that structural organization sound good to you?

If so, please assign this to me!

31puneet avatar Feb 03 '26 06:02 31puneet

Hi, @31puneet. Quick clarification on this, but this is actually my issue and I have already opened a PR #8485 for the same fix.

aashu2006 avatar Feb 03 '26 06:02 aashu2006