UNPKG

2.54 kBTypeScriptView Raw
1import { CoordinateSystem } from "../constants.js";
2import { Layers } from "../core/Layers.js";
3import { Object3D } from "../core/Object3D.js";
4import { Matrix4 } from "../math/Matrix4.js";
5import { Vector3 } from "../math/Vector3.js";
6import { Vector4 } from "../math/Vector4.js";
7
8/**
9 * Abstract base class for cameras
10 * @remarks
11 * This class should always be inherited when you build a new camera.
12 * @see {@link https://threejs.org/docs/index.html#api/en/cameras/Camera | Official Documentation}
13 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/cameras/Camera.js | Source}
14 */
15export class Camera extends Object3D {
16 /**
17 * @remarks
18 * Note that this class is not intended to be called directly; you probably want a
19 * {@link THREE.PerspectiveCamera | PerspectiveCamera} or
20 * {@link THREE.OrthographicCamera | OrthographicCamera} instead.
21 */
22 constructor();
23
24 /**
25 * Read-only flag to check if a given object is of type {@link Camera}.
26 * @remarks This is a _constant_ value
27 * @defaultValue `true`
28 */
29 readonly isCamera: true;
30
31 /**
32 * @override
33 * @defaultValue `Camera`
34 */
35 override readonly type: string | "Camera";
36
37 /**
38 * @override
39 * The {@link THREE.Layers | layers} that the {@link Camera} is a member of.
40 * @remarks Objects must share at least one layer with the {@link Camera} to be n when the camera's viewpoint is rendered.
41 * @defaultValue `new THREE.Layers()`
42 */
43 override layers: Layers;
44
45 /**
46 * This is the inverse of matrixWorld.
47 * @remarks MatrixWorld contains the Matrix which has the world transform of the {@link Camera} .
48 * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
49 */
50 matrixWorldInverse: Matrix4;
51
52 /**
53 * This is the matrix which contains the projection.
54 * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
55 */
56 projectionMatrix: Matrix4;
57
58 /**
59 * This is the inverse of projectionMatrix.
60 * @defaultValue {@link THREE.Matrix4 | `new THREE.Matrix4()`}
61 */
62 projectionMatrixInverse: Matrix4;
63
64 coordinateSystem: CoordinateSystem;
65
66 viewport?: Vector4;
67
68 /**
69 * Returns a {@link THREE.Vector3 | Vector3} representing the world space direction in which the {@link Camera} is looking.
70 * @remarks Note: A {@link Camera} looks down its local, negative z-axis.
71 * @param target The result will be copied into this Vector3.
72 */
73 getWorldDirection(target: Vector3): Vector3;
74}