File size: 3,485 Bytes
6cd9596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import { Camera } from './Camera';

/**
 * Camera with perspective projection.
 *
 * # example
 *     var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
 *     scene.add( camera );
 *
 * @source https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js
 */
export class PerspectiveCamera extends Camera {
  /**
   * @param fov Camera frustum vertical field of view. Default value is 50.
   * @param aspect Camera frustum aspect ratio. Default value is 1.
   * @param near Camera frustum near plane. Default value is 0.1.
   * @param far Camera frustum far plane. Default value is 2000.
   */
  constructor(fov?: number, aspect?: number, near?: number, far?: number);

  type: 'PerspectiveCamera';

  isPerspectiveCamera: true;

  zoom: number;

  /**
   * Camera frustum vertical field of view, from bottom to top of view, in degrees.
   */
  fov: number;

  /**
   * Camera frustum aspect ratio, window width divided by window height.
   */
  aspect: number;

  /**
   * Camera frustum near plane.
   */
  near: number;

  /**
   * Camera frustum far plane.
   */
  far: number;

  focus: number;
  view: null | {
    enabled: boolean;
    fullWidth: number;
    fullHeight: number;
    offsetX: number;
    offsetY: number;
    width: number;
    height: number;
  };
  filmGauge: number;
  filmOffset: number;

  setFocalLength(focalLength: number): void;
  getFocalLength(): number;
  getEffectiveFOV(): number;
  getFilmWidth(): number;
  getFilmHeight(): number;

  /**
   * Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
   * For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:
   *
   *     +---+---+---+
   *     | A | B | C |
   *     +---+---+---+
   *     | D | E | F |
   *     +---+---+---+
   *
   * then for each monitor you would call it like this:
   *
   *     var w = 1920;
   *     var h = 1080;
   *     var fullWidth = w * 3;
   *     var fullHeight = h * 2;
   *
   *     // A
   *     camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
   *     // B
   *     camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
   *     // C
   *     camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
   *     // D
   *     camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
   *     // E
   *     camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
   *     // F
   *     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.
   *
   * @param fullWidth full width of multiview setup
   * @param fullHeight full height of multiview setup
   * @param x horizontal offset of subcamera
   * @param y vertical offset of subcamera
   * @param width width of subcamera
   * @param height height of subcamera
   */
  setViewOffset(
    fullWidth: number,
    fullHeight: number,
    x: number,
    y: number,
    width: number,
    height: number
  ): void;
  clearViewOffset(): void;

  /**
   * Updates the camera projection matrix. Must be called after change of parameters.
   */
  updateProjectionMatrix(): void;
  toJSON(meta?: any): any;

  /**
   * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead.
   */
  setLens(focalLength: number, frameHeight?: number): void;
}