Class: CameraMath

CameraMath()

Camera-related matrix computations. Writes results into preallocated output buffers.

Constructor

new CameraMath()

Source:

Methods

(static) writeOrthographicMatrixTo(out, left, right, bottom, top, near, far) → {Float32Array}

Writes an orthographic projection matrix into an existing output matrix. This uses the same clip-space depth convention as `writePerspectiveMatrixTo`.
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix (length 16), that will receive the projection matrix.
left number Left plane.
right number Right plane.
bottom number Bottom plane.
top number Top plane.
near number Near clipping plane distance.
far number Far clipping plane distance.
Source:
Returns:
- The output matrix.
Type
Float32Array

(static) writePerspectiveMatrixTo(out, fieldOfViewRadians, aspectRatio, near, far) → {Float32Array}

Writes a perspective projection matrix into an existing output matrix.
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix (length 16), that will receive the projection matrix.
fieldOfViewRadians number Vertical field of view in radians.
aspectRatio number Viewport aspect ratio (width / height).
near number Near clipping plane distance (must be > 0).
far number Far clipping plane distance (must be > near).
Source:
Returns:
- The output matrix (out).
Type
Float32Array

(static) writeViewMatrixTo(out, position, rotation, scale) → {Float32Array}

Writes a view matrix (inverse of camera, TRS) into an existing output matrix. Assumes camera local transform order matches Object3D: local = T * (Rz * Ry * Rx) * S view = inv(S) * inv(R) * inv(T)
Parameters:
Name Type Description
out Float32Array Output 4x4 matrix (length 16), that will receive the view matrix.
position Vector3 Camera position.
rotation Vector3 Camera rotation in radians.
scale Vector3 Camera scale (must be non-zero on all axes).
Source:
Returns:
- The output matrix (out).
Type
Float32Array