import { Camera, Vector3Like } from 'three/webgpu'; import { DIVEComponent } from '../../engine/component/Component.ts'; export declare abstract class DIVECameraComponent extends DIVEComponent { readonly isDIVECameraComponent: true; /** * Everything a camera can show. * * Deliberately every layer, including `DEFAULT_LAYER_MASK` — three puts an * object on layer 0 unless someone says otherwise, and the transform gizmo is * one of them, so an editor that left it out would hide whatever never picked * a layer. * * `COORDINATE_LAYER_MASK` is the one left out. The orientation display adds its * axes to the same scene and draws them with its own camera in the corner; * having that bit here would draw them a second time in the middle of the * viewport. */ static readonly EDITOR_VIEW_LAYER_MASK: number; /** * What an end user sees: the content and the ground it stands on. * * A short list on purpose, and one that has to be opted into. Everything that * exists to help build a scene stays out — the gizmo, the helper lines, the * proxies for entities without geometry — and so does `DEFAULT_LAYER_MASK`, * because it is the catch-all: anything that never chose a layer is a thing * nobody decided to show an end user. `SHADOW_LAYER_MASK` is in: a baked * contact shadow is part of the picture, not a building aid, and so is the * backdrop it lies on. */ static readonly LIVE_VIEW_LAYER_MASK: number; /** Told whenever {@link setCameraLayer} changed what is visible. */ onSetCameraLayer: (mask: number) => void; protected _camera: Camera; /** * @param camera - The three camera this component owns. */ constructor(camera: Camera); /** The three camera this component owns. */ get camera(): Camera; /** * Switches between what an editor shows and what an end user sees. * * @param layer - Which of the two. */ setCameraLayer(layer: 'LIVE' | 'EDITOR'): void; /** * Turns the node this camera sits on to face a point. * * Not `owner.lookAt`: three's `Object3D.lookAt` swaps eye and target unless the * object reports `isCamera`, so a plain node comes out oriented 180 degrees the * other way -- its `+Z` at the target instead of its `-Z`. What follows is the * camera branch, applied to the node. * * @param target - The point to face, in world space. */ lookAt(target: Vector3Like): void; /** * Takes on what the source camera is allowed to see. * * The layer mask only; `onSetCameraLayer` is wiring a caller installed, not * state, and a clone that inherited the callback would report to a listener * that never asked for it. * * @param source - The component to copy from. */ copy(source: this): this; /** * Fits the camera to a new viewport. * * Abstract because what a viewport means differs: a perspective camera changes * its aspect, an orthographic one its extents. * * @param width - Viewport width in pixels. * @param height - Viewport height in pixels. */ abstract onResize(width: number, height: number): void; }