import { Transform2D } from '../component/2d'; import { Transform3D } from '../component/3d'; import { Entity } from '../entity'; import { Mat3, Mat4 } from '../math'; import { Camera2DConfig, Camera2DFollow, Camera2DFollowRules } from './2d'; import { Camera3DConfig, Camera3DFollow, Camera3DFollowRules } from './3d'; /** * Abstract class representing a Camera, broken down into concrete 2D and 3D variants in Camera2D and Camera3D * * Cameras carry and produce the Projection Matrix and View Matrix used in Shader uniforms * * Cameras are stored in the World, and multiple Cameras can be maintained at runtime with one 'active' at any given time * * Cameras may be controlled and transformed directly, and may be configured to follow Entities according to configurable rules * * @typeparam TConfig the specific configuration object type, allowing for the type-correct configuration of Cameras within the Game/World * * @see World * @see Camera2D * @see Camera3D */ export declare abstract class Camera { protected readonly config: TConfig; /** Abstract projection matrix, to be implemented and managed and the type narrowed by the subclass */ abstract projection: Mat3 | Mat4; /** Abstract optional 'Follow' specification; to be implemented and the type narrowed by the subclass */ protected abstract following: Camera2DFollow | Camera3DFollow | undefined; /** Abstract Transform Component, used as the implementation mechanism for View matrices, to be type narrowed by the subclass */ protected abstract transform: Transform2D | Transform3D; /** * Constructor. Take and store the type-correct Camera Config * * @param config the type-correct Camera Config */ constructor(config: TConfig); /** * Getter for the Camera's name, as specified in its configuration */ get name(): string; /** * Abstract camera follow configuration routine, to be implemented by the subclass * * By not implementing generically, ensures that the rules are correctly typed for the consumer * * @param entity the Entity to follow * @param rules the FollowRules; the type will be narrowed by the subclass */ abstract attachTo(entity: Entity, rules?: Camera2DFollowRules | Camera3DFollowRules): void; /** * Abstract View Matrix computation routine, to be implemented and the return type narrowed by the subclass * * By not implementing generically, allows for different Camera types to approach View Matrix computation in distinct ways */ abstract getViewMatrix(): Mat3 | Mat4; /** * Detach the Camera from the Entity it's following by voiding the follow specification */ detach(): void; /** * Abstraction for (Transform2D|Transform3D).reset() - reset all Camera transformations to the offsets provided in its config */ reset(): void; }