Skip to content

WebGL: add parameter count validation to directionalLight() and pointLight() #8581

@MASTERsj01

Description

@MASTERsj01

Increasing access

Both directionalLight() and pointLight() in src/webgl/light.js have a @TODO: check parameters number comment but no actual validation. Invalid argument counts silently cause unexpected behavior instead of showing a helpful error.

These functions accept 2, 4, or 6 arguments but currently don't validate the count.

I have a PR ready for this.

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

Both directionalLight() and pointLight() in src/webgl/light.js have a @TODO: check parameters number comment (lines 644 and 920) but no actual validation. These functions accept 2, 4, or 6 arguments but currently don't check the count — invalid argument counts silently cause unexpected behavior instead of showing a helpful error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions