import { Transform3D } from '../../component/3d'; import { Entity } from '../../entity'; import { Mat4, Vec3 } from '../../math'; import { Camera } from '../camera'; import { Camera3DConfig, Camera3DFollow, Camera3DFollowRules } from './camera.3d.config'; /** * Concrete Camera3D, representing a 3D Camera and narrowing generic types to their corresponding 3D variants * * Supports both Orthographic and Perspecitve Projection approaches by way of the projection configuration member 'mode' * * // TODO due to being backed by the non-gimbal-locked Transform3D, technically produces a 'free' camera with 6-degrees of freedom * // suitable for use as a first or third person spaceship camera, for example * // * // Alongside implementing a Transform3D that does have gimbal lock, probably want to split into a few use cases: * // - freecam (this) * // - third person camera (lookat ?) * // - first person camera (gimbal locked transform3d ?) * * // TODO for now, due to the way the view matrix is computed, follow rules have no effect * // this will be solved alongside the review of Transform3D + thereby Camera3D implementation */ export declare class Camera3D extends Camera { /** Concrete Mat4 projection matrix */ projection: Mat4; /** Concrete 3D 'Follow' specification */ protected following: Camera3DFollow | undefined; /** Concrete 3D Transform */ protected transform: Transform3D; /** * Constructor. Take the type-correct Camera3DConfig and pass it up to the parent class * * Initialise the projection matrix and Transform3D * * @param config the Camera3DConfig */ constructor(config: Camera3DConfig); /** * Concrete Camera Follow configuration routine, narrowing the generic rules type to the Camera3DFollowRules for consumer safety * * Set out the default follow rules: * - position.x - true * - position.y - true * - position.z - true * - angles.x (pitch) - true * - angles.y (yaw) - true * - angles.z (roll) - false * * @param entity the Entity to follow * @param rules the Camera3DFollowRules, specifying how the Camera should follow the Entity */ attachTo(entity: Entity, rules?: Camera3DFollowRules): void; /** * Concrete View Matrix computatio routine, narrowing the generic return type to Mat4 * * @returns the View Matrix */ getViewMatrix(): Mat4; /** * Abstraction for (Transform3D).moveRight() - move the Camera along its right axis by an amount * * @param amount the amount to move */ moveRight(amount: number): void; /** * Abstraction for (Transform3D).moveUp() - move the Camera along its up axis by an amount * * @param amount the amount to move */ moveUp(amount: number): void; /** * Abstraction for (Transform3D).moveForward() - move the Camera along its forward axis by an amount * * @param amount the amount to move */ moveForward(amount: number): void; /** * Abstraction for (Transform3D).translate() - move the Camera according to the world axes by a translation vector * * @param translate the translation vector */ translate(translate: Vec3): void; /** * Abstraction for (Transform3D).rotateX() - rotate the Camera by an angle (radians) around its X axis * * @param angle the angle (radians) to rotate by */ rotateX(angle: number): void; /** * Abstraction for (Transform3D).rotateY() - rotate the Camera by an angle (radians) around its Y axis * * @param angle the angle (radians) to rotate by */ rotateY(angle: number): void; /** * Abstraction for (Transform3D).rotateZ() - rotate the Camera by an angle (radians) around its Z axis * * @param angle the angle (radians) to rotate by */ rotateZ(angle: number): void; /** * Abstraction for (Transform3D).rotate() - rotate the Camera by set of angles (radians) around its X, Y and Z axes * * @param angle the angles (radians) to rotate by */ rotate(angles: Vec3): void; /** * Abstraction for (Transform3D).scaleBy() - 'zoom' the Camera by scaling by a factor relative to its current scale * * @param factor the factor to scale by */ zoom(factor: Vec3): void; /** * Abstraction for (Transform3D).zoomTo() - 'zoom' the Camera by scaling to an absolute factor * * @param factor the factor to scale to */ zoomTo(factor: Vec3): void; }