Camera
Abstract base class for cameras.
A camera pairs a world-space transform with a projection, producing the view and projection matrices used to render a viewport. The concrete cameras, OrthographicCamera and PerspectiveCamera, define the projection. This class provides the shared transform, derived matrices, and navigation helpers.
Extends Node and inherits all public properties and methods.
Extended by
Types
CameraType
Identifies a concrete camera implementation.
type CameraType = "OrthographicCamera" | "PerspectiveCamera";Accessors
type CameraType overrides
Identifies the camera type.
get abstract type(): CameraType;projectionMatrix mat4
The camera's projection matrix.
get projectionMatrix(): mat4;transform TrsTransform
The camera's world-space transform.
get transform(): TrsTransform;viewMatrix mat4
The view matrix: the inverse of the camera's world transform.
get viewMatrix(): mat4;right vec3
The camera's local right axis in world space.
get right(): vec3;up vec3
The camera's local up axis in world space.
get up(): vec3;frustum Frustum
The view frustum derived from the current view-projection.
get frustum(): Frustum;position vec3
The camera's world-space position.
get position(): vec3;Methods
update() void
Recomputes the camera's projection matrix.
update(): void;getViewProjection() mat4
Computes the combined view-projection matrix.
getViewProjection(): mat4;setAspectRatio() void
Sets the aspect ratio (width / height) of the viewport the camera renders into. Called automatically by the owning viewport when it resizes.
abstract setAspectRatio(aspectRatio): void;| Parameter | Description |
|---|---|
aspectRatio: number | The viewport's width divided by its height. |
zoom() void
Zooms the view by the given factor relative to the current zoom level. Factors greater than 1 zoom in and factors between 0 and 1 zoom out.
abstract zoom(factor): void;| Parameter | Description |
|---|---|
factor: number | The magnification factor to apply. |
pan() void
Moves the camera by the given world-space offset.
pan(vec): void;| Parameter | Description |
|---|---|
vec: vec3 | The translation to add to the camera's position. |
clipToWorld() vec3
Transforms a position from clip space to world space.
clipToWorld(position): vec3;| Parameter | Description |
|---|---|
position: vec3 | The clip-space position to transform. |