Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few camera bugs #7688

Merged
merged 1 commit into from
Mar 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ class Camera {
* // Point the camera at the origin.
* cam.lookAt(0, 0, 0);
*
* // Set the camera.
* setCamera(cam);
*
* describe(
* 'A white cube on a gray background. The text "eyeY: -400" is written in black beneath it.'
* );
Expand All @@ -180,7 +183,7 @@ class Camera {
* fill(0);
*
* // Display the value of eyeY, rounded to the nearest integer.
* text(`eyeX: ${round(cam.eyeY)}`, 0, 55);
* text(`eyeY: ${round(cam.eyeY)}`, 0, 55);
* }
* </code>
* </div>
Expand Down Expand Up @@ -2197,6 +2200,9 @@ class Camera {
* // Point it at the origin.
* cam.lookAt(0, 0, 0);
*
* // Set the camera.
* setCamera(cam);
*
* describe(
* 'A white cube drawn against a gray background. The cube appears to move when the user presses certain keys.'
* );
Expand Down Expand Up @@ -2450,6 +2456,9 @@ class Camera {
* // Copy cam1's configuration.
* cam2.set(cam1);
*
* // Set the camera.
* setCamera(cam2);
*
* describe(
* 'A white cube drawn against a gray background. The camera slowly moves forward. The camera resets when the user double-clicks.'
* );
Expand Down Expand Up @@ -3458,7 +3467,7 @@ function camera(p5, fn){
if (!(this._renderer instanceof RendererGL)) {
throw new Error('linePerspective() must be called in WebGL mode.');
}
this._renderer.linePerspective(enable);
return this._renderer.linePerspective(enable);
};


Expand Down