Class Camera

Source
Expand description

Camera class for managing the view parameters and transformations in a 3D space. It provides methods to manipulate the camera position, orientation, and projection.

Constructors§

Source§

new Camera(params?: ICameraData): Camera

Constructs a Camera instance with the specified parameters. If no parameters are provided, it uses the default camera parameters.

Properties§

Source§

protected fovy: number = ...

The field of view angle in the y direction.

Source§

protected mModelMatrix: mat4 = ...

The model matrix for the camera.

Source§

protected mProjectionMatrix: mat4 = ...

The projection matrix for the camera.

Source§

protected mViewMatrix: mat4 = ...

The view matrix for the camera.

Source§

protected wEye: vec3 = ...

The world eye position of the camera.

Source§

protected wEyeDir: vec3 = ...

The world eye direction vector of the camera.

Source§

protected wFar: number = [object Object]

The far clipping plane distance.

Source§

protected wLookAt: vec3 = ...

The world look-at position of the camera.

Source§

protected wNear: number = [object Object]

The near clipping plane distance.

Source§

protected wUp: vec3 = ...

The world up vector of the camera.

Methods§

Source§

getModelViewMatrix(): number[] | Float32Array<ArrayBufferLike>

Gets the model-view matrix for the camera.

Source§

getProjectionMatrix(): number[] | Float32Array<ArrayBufferLike>

Gets the projection matrix for the camera.

Source§

pitch(delta: number): void

Pitches the camera around the x-axis.

Source§

resetCamera(wUp: number[], wLookAt: number[], wEye: number[]): void

Resets the camera to the initial position and orientation.

Source§

resize(width: number, height: number): void

Resizes the viewport for the camera.

Source§

screenCoordToWorldDir(x: number, y: number): vec3

Converts screen coordinates to world direction vector.

Source§

translate(dx: number, dy: number): void

Translates the camera position by the specified delta values in the x and y directions. The translation is scaled by the current eye distance to maintain consistent movement speed.

Source§

update(): void

Updates the camera's view and projection matrices.

Source§

updateEyeDirAndLen(): void

Updates the eye direction and length based on the current eye and look-at positions.

Source§

yaw(delta: number): void

Yaws the camera around the z-axis.

Source§

zoom(delta: number, x: number, y: number): void

Zooms the camera in or out based on the specified delta and screen coordinates.