import ClayNode, { ClayNodeOpts } from './Node'; import Frustum from './math/Frustum'; import Matrix4 from './math/Matrix4'; import Ray from './math/Ray'; import Vector2 from './math/Vector2'; export interface CameraOpts extends ClayNodeOpts { } type CameraProjectionTypes = 'perspective' | 'orthographic'; export declare class CameraPerspectiveProjection { type: 'perspective'; /** * Vertical field of view in degrees */ fov: number; /** * Aspect ratio, typically viewport width / height */ aspect: number; /** * Near bound of the frustum */ near: number; /** * Far bound of the frustum */ far: number; } export declare class CameraOrthographicProjection { type: 'orthographic'; left: number; right: number; near: number; far: number; top: number; bottom: number; } type Projections = { orthographic: CameraOrthographicProjection; perspective: CameraPerspectiveProjection; }; declare class Camera extends ClayNode { /** * Camera projection */ projection: Projections[T]; /** * Camera projection matrix */ projectionMatrix: Matrix4; /** * Inverse of camera projection matrix */ invProjectionMatrix: Matrix4; /** * View matrix, equal to inverse of camera's world matrix */ viewMatrix: Matrix4; /** * Camera frustum in view space */ frustum: Frustum; /** * Jitter offset. In pixels. */ offset: Vector2; /** * @param type Default to be perspective */ constructor(type?: T, opts?: Omit, 'type'>); update(): void; updateOffset?: (width: number, height: number, dpr: number) => void; /** * Set camera view matrix */ setViewMatrix(viewMatrix: Matrix4): void; /** * Set camera projection matrix * @param {clay.Matrix4} projectionMatrix */ setProjectionMatrix(projectionMatrix: Matrix4): void; /** * Update projection matrix, called after update */ updateProjectionMatrix(): void; /** * Decompose camera projection matrix */ decomposeProjectionMatrix(): void; /** * Cast a picking ray from camera near plane to far plane * @function * @param {clay.Vector2} ndc * @param {clay.Ray} [out] * @return {clay.Ray} */ castRay(ndc: Vector2, out?: Ray): Ray; clone(): Camera; } export default Camera;