Skip to content

Commit

Permalink
Solves issue processing#6519
Browse files Browse the repository at this point in the history
  • Loading branch information
Garima3110 committed Nov 11, 2023
1 parent 8e97213 commit 3d8876c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/webgl/p5.Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,29 @@ p5.prototype.camera = function (...args) {
* vertical field of view, aspect ratio (usually width/height), and near and far
* clipping planes.
*
* If no parameters are given, the following default is used:
* perspective(PI/3, width/height, eyeZ/10, eyeZ*10),
* where eyeZ is equal to ((height/2) / tan(PI/6)).
* If no parameters are given, the default values are used as:
*
* fov- The default field of view for the camera is such that the full height of renderer is visible when it is positioned at a default distance of 800 units from the camera.
*
* aspect- The default aspect ratio is the ratio of renderer's width to renderer's height.
*
* near - The default value for the near clipping plane is 0.1 times the default distance from the camera to the point it is looking at i.e 800.
*
* far - The default value for the far clipping plane is 10 times the default distance from the camera to the point it is looking at i.e 800.
*
* If you prefer a fixed field of view, follow these steps:
*
* 1.Choose your desired field of view angle (`fovy`). This is how wide the camera can see.
*
* 2.To position the camera correctly, use the formula:
* cameraDistance = (height / 2) / tan(fovy / 2);
* This ensures that you can see the entire width across horizontally and height across vertically at the fixed field of view.
*
* 3.Set the near value to cameraDistance / 10 and the far value to cameraDistance * 10 .
*
* 4.Simply, call perspective with the chosen field of view, canvas aspect ratio, and near/far values:
* perspective(fovy, width / height, cameraDistance / 10, cameraDistance * 10);
*
* @method perspective
* @for p5
* @param {Number} [fovy] camera frustum vertical field of view,
Expand All @@ -156,7 +176,7 @@ p5.prototype.camera = function (...args) {
*
* rotateX(-0.3);
* rotateY(-0.2);
* translate(0, 0, -50);
* translate(0, 0, -100);
*
* push();
* translate(-15, 0, sin(frameCount / 30) * 95);
Expand Down

0 comments on commit 3d8876c

Please sign in to comment.