MCPcopy
hub / github.com/processing/p5.js / set

Method set

src/webgl/p5.Camera.js:1426–1449  ·  view source on GitHub ↗

* Sets the camera’s position, orientation, and projection by copying another * camera. * * The parameter, `cam`, is the `p5.Camera` object to copy. For example, calling * `cam2.set(cam1)` will set `cam2` using `cam1`’s configuration. * * @param {p5.Camera} cam camera to copy. *

(cam)

Source from the content-addressed store, hash-verified

1424 * }
1425 */
1426 set(cam) {
1427 const keyNamesOfThePropToCopy = [
1428 'eyeX', 'eyeY', 'eyeZ',
1429 'centerX', 'centerY', 'centerZ',
1430 'upX', 'upY', 'upZ',
1431 'cameraFOV', 'aspectRatio', 'cameraNear', 'cameraFar', 'cameraType',
1432 'yScale', 'useLinePerspective'
1433 ];
1434 for (const keyName of keyNamesOfThePropToCopy) {
1435 this[keyName] = cam[keyName];
1436 }
1437
1438 this.cameraMatrix = cam.cameraMatrix.copy();
1439 this.projMatrix = cam.projMatrix.copy();
1440
1441 if (this._isActive()) {
1442 this._renderer.states.setValue('uModelMatrix', this._renderer.states.uModelMatrix.clone());
1443 this._renderer.states.setValue('uViewMatrix', this._renderer.states.uViewMatrix.clone());
1444 this._renderer.states.setValue('uPMatrix', this._renderer.states.uPMatrix.clone());
1445 this._renderer.states.uModelMatrix.reset();
1446 this._renderer.states.uViewMatrix.set(this.cameraMatrix);
1447 this._renderer.states.uPMatrix.set(this.projMatrix);
1448 }
1449 }
1450 /**
1451 * Sets the camera’s position and orientation to values that are in-between
1452 * those of two other cameras.

Callers 15

slerpMethod · 0.95
_tesselateShapeMethod · 0.45
_recreateTexturesMethod · 0.45
beginMethod · 0.45
rescaleMethod · 0.45
pushMethod · 0.45
ensureLengthMethod · 0.45
_edgesToVerticesMethod · 0.45
perspectiveMethod · 0.45
orthoMethod · 0.45
frustumMethod · 0.45
cameraMethod · 0.45

Calls 5

_isActiveMethod · 0.95
copyMethod · 0.45
setValueMethod · 0.45
cloneMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected