Skip to content

Conversation

ombalgude
Copy link

Resolves #8097

Changes:
This pull request introduces a new joint getter/setter function, activeCamera(), to the p5.RendererGL.prototype to standardize how the active camera is accessed and modified.

  1. New activeCamera() function:
  • When called with no arguments (activeCamera()), it acts as a getter and returns the current camera object.
  • When called with a camera object (activeCamera(myCam)), it acts as a setter for the active camera.
  1. Deprecated setCamera():
  • The existing setCamera() function is now deprecated.
  • For backward compatibility, it continues to function by calling the new activeCamera() internally.
  • These changes align with the common p5.js pattern of using joint getter/setter functions and improve the consistency of the WebGL API.

PR Checklist

  • npm run lint passes
  • Inline reference is included / updated
  • Unit tests are included / updated

Copy link

welcome bot commented Sep 23, 2025

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

@perminder-17 perminder-17 changed the base branch from main to dev-2.0 October 15, 2025 10:32
@perminder-17 perminder-17 self-requested a review October 15, 2025 10:35
Copy link
Collaborator

@perminder-17 perminder-17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in review, For the next time feel free to tag me on the PRs I can help reviewing them.

Actually, If we are thinking to add the activeCamera as a public API, so user can access it in sketch.js. But, here you only added it on RendererGL, not on the public p5 API (fn.activeCamera). Sketches won’t be able to call activeCamera() directly? What you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new getCamera function for V1 & V2

2 participants