1 | import { Camera } from './Camera';
|
2 |
|
3 | /**
|
4 | * Camera with perspective projection.
|
5 | *
|
6 | * @source https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js
|
7 | */
|
8 | export class PerspectiveCamera extends Camera {
|
9 | /**
|
10 | * @param [fov=50] Camera frustum vertical field of view. Default value is 50.
|
11 | * @param [aspect=1] Camera frustum aspect ratio. Default value is 1.
|
12 | * @param [near=0.1] Camera frustum near plane. Default value is 0.1.
|
13 | * @param [far=2000] Camera frustum far plane. Default value is 2000.
|
14 | */
|
15 | constructor(fov?: number, aspect?: number, near?: number, far?: number);
|
16 |
|
17 | type: 'PerspectiveCamera';
|
18 |
|
19 | readonly isPerspectiveCamera: true;
|
20 |
|
21 | /**
|
22 | * @default 1
|
23 | */
|
24 | zoom: number;
|
25 |
|
26 | /**
|
27 | * Camera frustum vertical field of view, from bottom to top of view, in degrees.
|
28 | * @default 50
|
29 | */
|
30 | fov: number;
|
31 |
|
32 | /**
|
33 | * Camera frustum aspect ratio, window width divided by window height.
|
34 | * @default 1
|
35 | */
|
36 | aspect: number;
|
37 |
|
38 | /**
|
39 | * Camera frustum near plane.
|
40 | * @default 0.1
|
41 | */
|
42 | near: number;
|
43 |
|
44 | /**
|
45 | * Camera frustum far plane.
|
46 | * @default 2000
|
47 | */
|
48 | far: number;
|
49 |
|
50 | /**
|
51 | * @default 10
|
52 | */
|
53 | focus: number;
|
54 |
|
55 | /**
|
56 | * @default null
|
57 | */
|
58 | view: null | {
|
59 | enabled: boolean;
|
60 | fullWidth: number;
|
61 | fullHeight: number;
|
62 | offsetX: number;
|
63 | offsetY: number;
|
64 | width: number;
|
65 | height: number;
|
66 | };
|
67 |
|
68 | /**
|
69 | * @default 35
|
70 | */
|
71 | filmGauge: number;
|
72 |
|
73 | /**
|
74 | * @default 0
|
75 | */
|
76 | filmOffset: number;
|
77 |
|
78 | setFocalLength(focalLength: number): void;
|
79 | getFocalLength(): number;
|
80 | getEffectiveFOV(): number;
|
81 | getFilmWidth(): number;
|
82 | getFilmHeight(): number;
|
83 |
|
84 | /**
|
85 | * Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
|
86 | * For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:
|
87 | *
|
88 | * +---+---+---+
|
89 | * | A | B | C |
|
90 | * +---+---+---+
|
91 | * | D | E | F |
|
92 | * +---+---+---+
|
93 | *
|
94 | * then for each monitor you would call it like this:
|
95 | *
|
96 | * const w = 1920;
|
97 | * const h = 1080;
|
98 | * const fullWidth = w * 3;
|
99 | * const fullHeight = h * 2;
|
100 | *
|
101 | * // A
|
102 | * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
|
103 | * // B
|
104 | * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
|
105 | * // C
|
106 | * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
|
107 | * // D
|
108 | * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
|
109 | * // E
|
110 | * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
|
111 | * // F
|
112 | * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); Note there is no reason monitors have to be the same size or in a grid.
|
113 | *
|
114 | * @param fullWidth full width of multiview setup
|
115 | * @param fullHeight full height of multiview setup
|
116 | * @param x horizontal offset of subcamera
|
117 | * @param y vertical offset of subcamera
|
118 | * @param width width of subcamera
|
119 | * @param height height of subcamera
|
120 | */
|
121 | setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void;
|
122 | clearViewOffset(): void;
|
123 |
|
124 | /**
|
125 | * Updates the camera projection matrix. Must be called after change of parameters.
|
126 | */
|
127 | updateProjectionMatrix(): void;
|
128 | toJSON(meta?: any): any;
|
129 |
|
130 | /**
|
131 | * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead.
|
132 | */
|
133 | setLens(focalLength: number, frameHeight?: number): void;
|
134 | }
|