@@ -11,22 +11,22 @@ import p5 from '../core/main';
1111////////////////////////////////////////////////////////////////////////////////
1212
1313/**
14- * Sets the camera position for a 3D sketch. Parameters for this function define
15- * the position for the camera, the center of the sketch (where the camera is
16- * pointing), and an up direction (the orientation of the camera).
14+ * Sets the position of the current camera in a 3D sketch.
15+ * Parameters for this function define the camera's position,
16+ * the center of the sketch (where the camera is pointing),
17+ * and an up direction (the orientation of the camera).
1718 *
1819 * This function simulates the movements of the camera, allowing objects to be
1920 * viewed from various angles. Remember, it does not move the objects themselves
20- * but the camera instead. For example when centerX value is positive, the camera
21- * is rotating to the right side of the sketch, so the object would seem like
22- * moving to the left.
21+ * but the camera instead. For example when the centerX value is positive,
22+ * and the camera is rotating to the right side of the sketch,
23+ * the object will seem like it's moving to the left.
2324 *
2425 * See this <a href = "https://www.openprocessing.org/sketch/740258">example</a>
2526 * to view the position of your camera.
2627 *
27- * When called with no arguments, this function creates a default camera
28- * equivalent to
29- * camera(0, 0, (height/2.0) / tan(PI*30.0 / 180.0), 0, 0, 0, 0, 1, 0);
28+ * If no parameters are given, the following default is used:
29+ * camera(0, 0, (height/2) / tan(PI/6), 0, 0, 0, 0, 1, 0)
3030 * @method camera
3131 * @constructor
3232 * @for p5
@@ -113,18 +113,19 @@ p5.prototype.camera = function(...args) {
113113} ;
114114
115115/**
116- * Sets a perspective projection for the camera in a 3D sketch. This projection
117- * represents depth through foreshortening: objects that are close to the camera
118- * appear their actual size while those that are further away from the camera
119- * appear smaller. The parameters to this function define the viewing frustum
116+ * Sets a perspective projection for the current camera in a 3D sketch.
117+ * This projection represents depth through foreshortening: objects
118+ * that are close to the camera appear their actual size while those
119+ * that are further away from the camera appear smaller.
120+ *
121+ * The parameters to this function define the viewing frustum
120122 * (the truncated pyramid within which objects are seen by the camera) through
121123 * vertical field of view, aspect ratio (usually width/height), and near and far
122124 * clipping planes.
123125 *
124- * When called with no arguments, the defaults
125- * provided are equivalent to
126- * perspective(PI/3.0, width/height, eyeZ/10.0, eyeZ*10.0), where eyeZ
127- * is equal to ((height/2.0) / tan(PI*60.0/360.0));
126+ * If no parameters are given, the following default is used:
127+ * perspective(PI/3, width/height, eyeZ/10, eyeZ*10),
128+ * where eyeZ is equal to ((height/2) / tan(PI/6)).
128129 * @method perspective
129130 * @for p5
130131 * @param {Number } [fovy] camera frustum vertical field of view,
@@ -173,14 +174,18 @@ p5.prototype.perspective = function(...args) {
173174} ;
174175
175176/**
176- * Sets an orthographic projection for the camera in a 3D sketch and defines a
177- * box-shaped viewing frustum within which objects are seen. In this projection,
178- * all objects with the same dimension appear the same size, regardless of
179- * whether they are near or far from the camera. The parameters to this
180- * function specify the viewing frustum where left and right are the minimum and
181- * maximum x values, top and bottom are the minimum and maximum y values, and near
182- * and far are the minimum and maximum z values. If no parameters are given, the
183- * default is used: ortho(-width/2, width/2, -height/2, height/2).
177+ * Sets an orthographic projection for the current camera in a 3D sketch
178+ * and defines a box-shaped viewing frustum within which objects are seen.
179+ * In this projection, all objects with the same dimension appear the same
180+ * size, regardless of whether they are near or far from the camera.
181+ *
182+ * The parameters to this function specify the viewing frustum where
183+ * left and right are the minimum and maximum x values, top and bottom are
184+ * the minimum and maximum y values, and near and far are the minimum and
185+ * maximum z values.
186+ *
187+ * If no parameters are given, the following default is used:
188+ * ortho(-width/2, width/2, -height/2, height/2).
184189 * @method ortho
185190 * @for p5
186191 * @param {Number } [left] camera frustum left plane
@@ -229,7 +234,8 @@ p5.prototype.ortho = function(...args) {
229234} ;
230235
231236/**
232- * Sets a perspective matrix as defined by the parameters.
237+ * Sets the frustum of the current camera as defined by
238+ * the parameters.
233239 *
234240 * A frustum is a geometric form: a pyramid with its top
235241 * cut off. With the viewer's eye at the imaginary top of
@@ -242,6 +248,8 @@ p5.prototype.ortho = function(...args) {
242248 * This can be achieved more simply in many cases by using
243249 * <a href="https://p5js.org/reference/#/p5/perspective">perspective()</a>.
244250 *
251+ * If no parameters are given, the following default is used:
252+ * frustum(-width/2, width/2, -height/2, height/2, 0, max(width, height)).
245253 * @method frustum
246254 * @for p5
247255 * @param {Number } [left] camera frustum left plane
@@ -295,9 +303,22 @@ p5.prototype.frustum = function(...args) {
295303////////////////////////////////////////////////////////////////////////////////
296304
297305/**
298- * Creates a new <a href="#/p5.Camera">p5.Camera</a> object and tells the
299- * renderer to use that camera.
300- * Returns the p5.Camera object.
306+ * Creates a new <a href="#/p5.Camera">p5.Camera</a> object and sets it
307+ * as the current (active) camera.
308+ *
309+ * The new camera is initialized with a default position
310+ * (see <a href="#/p5.Camera/camera">camera()</a>)
311+ * and a default perspective projection
312+ * (see <a href="#/p5.Camera/perspective">perspective()</a>).
313+ * Its properties can be controlled with the <a href="#/p5.Camera">p5.Camera</a>
314+ * methods.
315+ *
316+ * Note: Every 3D sketch starts with a default camera initialized.
317+ * This camera can be controlled with the global methods
318+ * <a href="#/p5/camera">camera()</a>,
319+ * <a href="#/p5/perspective">perspective()</a>, <a href="#/p5/ortho">ortho()</a>,
320+ * and <a href="#/p5/frustum">frustum()</a> if it is the only camera
321+ * in the scene.
301322 * @method createCamera
302323 * @return {p5.Camera } The newly created camera object.
303324 * @for p5
@@ -1705,8 +1726,8 @@ p5.Camera.prototype._isActive = function() {
17051726} ;
17061727
17071728/**
1708- * Sets rendererGL's current camera to a p5.Camera object. Allows switching
1709- * between multiple cameras.
1729+ * Sets the current (active) camera of a 3D sketch.
1730+ * Allows for switching between multiple cameras.
17101731 * @method setCamera
17111732 * @param {p5.Camera } cam p5.Camera object
17121733 * @for p5
0 commit comments