From 142dc068fb06ff934e22ae80987c65a31d6395e7 Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sat, 29 Mar 2025 13:26:48 -0400 Subject: [PATCH] Fix a few camera bugs --- src/webgl/p5.Camera.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/webgl/p5.Camera.js b/src/webgl/p5.Camera.js index 1fc0a1219f..11a051f32f 100644 --- a/src/webgl/p5.Camera.js +++ b/src/webgl/p5.Camera.js @@ -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.' * ); @@ -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); * } * * @@ -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.' * ); @@ -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.' * ); @@ -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); };