@types/three 0.150.0 → 0.150.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/controls/OrbitControls.d.ts +3 -3
  3. three/examples/jsm/controls/TrackballControls.d.ts +2 -2
  4. three/examples/jsm/controls/TransformControls.d.ts +2 -6
  5. three/examples/jsm/geometries/TextGeometry.d.ts +92 -15
  6. three/examples/jsm/loaders/EXRLoader.d.ts +3 -2
  7. three/examples/jsm/misc/GPUComputationRenderer.d.ts +4 -2
  8. three/package.json +2 -2
  9. three/src/Three.d.ts +0 -1
  10. three/src/audio/Audio.d.ts +184 -20
  11. three/src/audio/AudioAnalyser.d.ts +42 -4
  12. three/src/audio/AudioContext.d.ts +12 -1
  13. three/src/audio/AudioListener.d.ts +76 -8
  14. three/src/audio/PositionalAudio.d.ts +86 -5
  15. three/src/cameras/ArrayCamera.d.ts +23 -2
  16. three/src/cameras/Camera.d.ts +42 -13
  17. three/src/cameras/CubeCamera.d.ts +49 -1
  18. three/src/cameras/OrthographicCamera.d.ts +77 -25
  19. three/src/cameras/PerspectiveCamera.d.ts +132 -56
  20. three/src/cameras/StereoCamera.d.ts +29 -2
  21. three/src/constants.d.ts +431 -26
  22. three/src/core/BufferGeometry.d.ts +5 -3
  23. three/src/core/Object3D.d.ts +17 -13
  24. three/src/core/Raycaster.d.ts +1 -0
  25. three/src/geometries/BoxGeometry.d.ts +39 -16
  26. three/src/geometries/CapsuleGeometry.d.ts +35 -12
  27. three/src/geometries/CircleGeometry.d.ts +38 -12
  28. three/src/geometries/ConeGeometry.d.ts +45 -10
  29. three/src/geometries/CylinderGeometry.d.ts +41 -19
  30. three/src/geometries/DodecahedronGeometry.d.ts +14 -5
  31. three/src/geometries/EdgesGeometry.d.ts +30 -8
  32. three/src/geometries/ExtrudeGeometry.d.ts +93 -12
  33. three/src/geometries/IcosahedronGeometry.d.ts +15 -5
  34. three/src/geometries/LatheGeometry.d.ts +41 -12
  35. three/src/geometries/OctahedronGeometry.d.ts +14 -5
  36. three/src/geometries/PlaneGeometry.d.ts +35 -12
  37. three/src/geometries/PolyhedronGeometry.d.ts +41 -12
  38. three/src/geometries/RingGeometry.d.ts +39 -16
  39. three/src/geometries/ShapeGeometry.d.ts +44 -4
  40. three/src/geometries/SphereGeometry.d.ts +43 -21
  41. three/src/geometries/TetrahedronGeometry.d.ts +14 -5
  42. three/src/geometries/TorusGeometry.d.ts +35 -13
  43. three/src/geometries/TorusKnotGeometry.d.ts +39 -16
  44. three/src/geometries/TubeGeometry.d.ts +63 -15
  45. three/src/geometries/WireframeGeometry.d.ts +30 -4
  46. three/src/helpers/ArrowHelper.d.ts +1 -1
  47. three/src/helpers/BoxHelper.d.ts +1 -1
  48. three/src/helpers/DirectionalLightHelper.d.ts +1 -1
  49. three/src/helpers/GridHelper.d.ts +1 -1
  50. three/src/helpers/HemisphereLightHelper.d.ts +1 -2
  51. three/src/helpers/PointLightHelper.d.ts +1 -1
  52. three/src/helpers/PolarGridHelper.d.ts +1 -1
  53. three/src/helpers/SpotLightHelper.d.ts +1 -1
  54. three/src/lights/AmbientLight.d.ts +1 -1
  55. three/src/lights/AmbientLightProbe.d.ts +1 -1
  56. three/src/lights/DirectionalLight.d.ts +1 -1
  57. three/src/lights/HemisphereLight.d.ts +1 -2
  58. three/src/lights/HemisphereLightProbe.d.ts +1 -1
  59. three/src/lights/PointLight.d.ts +1 -1
  60. three/src/lights/RectAreaLight.d.ts +1 -1
  61. three/src/lights/SpotLight.d.ts +1 -2
  62. three/src/materials/LineBasicMaterial.d.ts +1 -2
  63. three/src/materials/MeshBasicMaterial.d.ts +1 -2
  64. three/src/materials/MeshLambertMaterial.d.ts +1 -2
  65. three/src/materials/MeshMatcapMaterial.d.ts +1 -2
  66. three/src/materials/MeshPhongMaterial.d.ts +1 -2
  67. three/src/materials/MeshStandardMaterial.d.ts +1 -2
  68. three/src/materials/MeshToonMaterial.d.ts +1 -2
  69. three/src/materials/PointsMaterial.d.ts +1 -2
  70. three/src/materials/ShadowMaterial.d.ts +1 -2
  71. three/src/materials/SpriteMaterial.d.ts +1 -2
  72. three/src/math/Color.d.ts +2 -3
  73. three/src/math/ColorManagement.d.ts +2 -2
  74. three/src/objects/Bone.d.ts +30 -3
  75. three/src/objects/Group.d.ts +37 -1
  76. three/src/objects/InstancedMesh.d.ts +122 -3
  77. three/src/objects/LOD.d.ts +62 -18
  78. three/src/objects/Line.d.ts +67 -4
  79. three/src/objects/LineLoop.d.ts +26 -1
  80. three/src/objects/LineSegments.d.ts +21 -9
  81. three/src/objects/Mesh.d.ts +60 -4
  82. three/src/objects/Points.d.ts +39 -8
  83. three/src/objects/Skeleton.d.ts +89 -3
  84. three/src/objects/SkinnedMesh.d.ts +122 -3
  85. three/src/objects/Sprite.d.ts +51 -4
  86. three/src/renderers/WebGLRenderTarget.d.ts +9 -3
  87. three/src/renderers/WebGLRenderer.d.ts +1 -2
  88. three/src/scenes/Fog.d.ts +60 -9
  89. three/src/scenes/FogExp2.d.ts +41 -7
  90. three/src/scenes/Scene.d.ts +45 -22
  91. three/src/textures/CanvasTexture.d.ts +35 -13
  92. three/src/textures/CompressedArrayTexture.d.ts +39 -5
  93. three/src/textures/CompressedTexture.d.ts +49 -20
  94. three/src/textures/CubeTexture.d.ts +71 -18
  95. three/src/textures/Data3DTexture.d.ts +74 -10
  96. three/src/textures/DataArrayTexture.d.ts +83 -9
  97. three/src/textures/DataTexture.d.ts +81 -26
  98. three/src/textures/DepthTexture.d.ts +71 -15
  99. three/src/textures/FramebufferTexture.d.ts +57 -2
  100. three/src/textures/Source.d.ts +23 -13
  101. three/src/textures/Texture.d.ts +289 -73
  102. three/src/textures/VideoTexture.d.ts +69 -13
  103. three/src/textures/types.d.ts +9 -0
  104. three/src/utils.d.ts +0 -6
@@ -1,59 +1,96 @@
1
1
  import { Camera } from './Camera';
2
2
 
3
3
  /**
4
- * Camera with perspective projection.
5
- *
6
- * @source https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js
4
+ * Camera that uses {@link https://en.wikipedia.org/wiki/Perspective_(graphical) | perspective projection}.
5
+ * This projection mode is designed to mimic the way the human eye sees
6
+ * @remarks
7
+ * It is the most common projection mode used for rendering a 3D scene.
8
+ * @example
9
+ * ```typescript
10
+ * const camera = new THREE.PerspectiveCamera(45, width / height, 1, 1000);
11
+ * scene.add(camera);
12
+ * ```
13
+ * @see Example: {@link https://threejs.org/examples/#webgl_animation_skinning_blending | animation / skinning / blending }
14
+ * @see Example: {@link https://threejs.org/examples/#webgl_animation_skinning_morph | animation / skinning / morph }
15
+ * @see Example: {@link https://threejs.org/examples/#webgl_effects_stereo | effects / stereo }
16
+ * @see Example: {@link https://threejs.org/examples/#webgl_interactive_cubes | interactive / cubes }
17
+ * @see Example: {@link https://threejs.org/examples/#webgl_loader_collada_skinning | loader / collada / skinning }
18
+ * @see {@link https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera | Official Documentation}
19
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js | Source}
7
20
  */
8
21
  export class PerspectiveCamera extends Camera {
9
22
  /**
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.
23
+ * Creates a new {@link PerspectiveCamera}.
24
+ * @remarks Together these define the camera's {@link https://en.wikipedia.org/wiki/Viewing_frustum | viewing frustum}.
25
+ * @param fov Camera frustum vertical field of view. Default `50`.
26
+ * @param aspect Camera frustum aspect ratio. Default `1`.
27
+ * @param near Camera frustum near plane. Default `0.1`.
28
+ * @param far Camera frustum far plane. Default `2000`.
14
29
  */
15
30
  constructor(fov?: number, aspect?: number, near?: number, far?: number);
16
31
 
17
- type: 'PerspectiveCamera';
18
-
32
+ /**
33
+ * Read-only flag to check if a given object is of type {@link Camera}.
34
+ * @remarks This is a _constant_ value
35
+ * @defaultValue `true`
36
+ */
19
37
  readonly isPerspectiveCamera: true;
20
38
 
21
39
  /**
22
- * @default 1
40
+ * @override
41
+ * @defaultValue `PerspectiveCamera`
42
+ */
43
+ override readonly type: string | 'PerspectiveCamera';
44
+
45
+ /**
46
+ * Gets or sets the zoom factor of the camera.
47
+ * @defaultValue `1`
23
48
  */
24
49
  zoom: number;
25
50
 
26
51
  /**
27
52
  * Camera frustum vertical field of view, from bottom to top of view, in degrees.
28
- * @default 50
53
+ * @remarks Expects a `Float`
54
+ * @defaultValue `50`
29
55
  */
30
56
  fov: number;
31
57
 
32
58
  /**
33
- * Camera frustum aspect ratio, window width divided by window height.
34
- * @default 1
59
+ * Camera frustum aspect ratio, usually the canvas width / canvas height.
60
+ * @remarks Expects a `Float`
61
+ * @defaultValue `1`, _(square canvas)_.
35
62
  */
36
63
  aspect: number;
37
64
 
38
65
  /**
39
66
  * Camera frustum near plane.
40
- * @default 0.1
67
+ * @remarks The valid range is greater than `0` and less than the current value of the {@link far | .far} plane.
68
+ * @remarks Note that, unlike for the {@link THREE.OrthographicCamera | OrthographicCamera}, `0` is **not** a valid value for a {@link PerspectiveCamera |PerspectiveCamera's}. near plane.
69
+ * @defaultValue `0.1`
70
+ * @remarks Expects a `Float`
41
71
  */
42
72
  near: number;
43
73
 
44
74
  /**
45
75
  * Camera frustum far plane.
46
- * @default 2000
76
+ * @remarks Must be greater than the current value of {@link near | .near} plane.
77
+ * @remarks Expects a `Float`
78
+ * @defaultValue `2000`
47
79
  */
48
80
  far: number;
49
81
 
50
82
  /**
51
- * @default 10
83
+ * Object distance used for stereoscopy and depth-of-field effects.
84
+ * @remarks This parameter does not influence the projection matrix unless a {@link THREE.StereoCamera | StereoCamera} is being used.
85
+ * @remarks Expects a `Float`
86
+ * @defaultValue `10`
52
87
  */
53
88
  focus: number;
54
89
 
55
90
  /**
56
- * @default null
91
+ * Frustum window specification or null.
92
+ * This is set using the {@link setViewOffset | .setViewOffset} method and cleared using {@link clearViewOffset | .clearViewOffset}.
93
+ * @defaultValue `null`
57
94
  */
58
95
  view: null | {
59
96
  enabled: boolean;
@@ -66,69 +103,108 @@ export class PerspectiveCamera extends Camera {
66
103
  };
67
104
 
68
105
  /**
69
- * @default 35
106
+ * Film size used for the larger axis.
107
+ * This parameter does not influence the projection matrix unless {@link filmOffset | .filmOffset} is set to a nonzero value.
108
+ * @remarks Expects a `Float`
109
+ * @defaultValue `35`, _millimeters_.
70
110
  */
71
111
  filmGauge: number;
72
112
 
73
113
  /**
74
- * @default 0
114
+ * Horizontal off-center offset in the same unit as {@link filmGauge | .filmGauge}.
115
+ * @remarks Expects a `Float`
116
+ * @defaultValue `0`
75
117
  */
76
118
  filmOffset: number;
77
119
 
78
- setFocalLength(focalLength: number): void;
120
+ /**
121
+ * Returns the focal length of the current {@link .fov | fov} in respect to {@link filmGauge | .filmGauge}.
122
+ */
79
123
  getFocalLength(): number;
124
+
125
+ /**
126
+ * Sets the FOV by focal length in respect to the current {@link filmGauge | .filmGauge}.
127
+ * @remarks By default, the focal length is specified for a `35mm` (full frame) camera.
128
+ * @param focalLength Expects a `Float`
129
+ */
130
+ setFocalLength(focalLength: number): void;
131
+
132
+ /**
133
+ * Returns the current vertical field of view angle in degrees considering {@link zoom | .zoom}.
134
+ */
80
135
  getEffectiveFOV(): number;
136
+
137
+ /**
138
+ * Returns the width of the image on the film
139
+ * @remarks
140
+ * If {@link aspect | .aspect}. is greater than or equal to one (landscape format), the result equals {@link filmGauge | .filmGauge}.
141
+ */
81
142
  getFilmWidth(): number;
143
+
144
+ /**
145
+ * Returns the height of the image on the film
146
+ * @remarks
147
+ * If {@link aspect | .aspect}. is less than or equal to one (portrait format), the result equals {@link filmGauge | .filmGauge}.
148
+ */
82
149
  getFilmHeight(): number;
83
150
 
84
151
  /**
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;
152
+ * Sets an offset in a larger frustum.
153
+ * @remarks
154
+ * This is useful for multi-window or multi-monitor/multi-machine setups.
100
155
  *
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.
156
+ * For example, if you have 3x2 monitors and each monitor is _1920x1080_ and
157
+ * the monitors are in grid like this
158
+ * ```
159
+ * ┌───┬───┬───┐
160
+ * A │ B │ C
161
+ * ├───┼───┼───┤
162
+ * D │ E │ F │
163
+ * └───┴───┴───┘
164
+ * ```
165
+ * then for each monitor you would call it like this
166
+ * ```typescript
167
+ * const w = 1920;
168
+ * const h = 1080;
169
+ * const fullWidth = w * 3;
170
+ * const fullHeight = h * 2;
113
171
  *
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
172
+ * // Monitor - A
173
+ * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
174
+ * // Monitor - B
175
+ * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
176
+ * // Monitor - C
177
+ * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
178
+ * // Monitor - D
179
+ * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
180
+ * // Monitor - E
181
+ * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
182
+ * // Monitor - F
183
+ * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
184
+ * ```
185
+ * Note there is no reason monitors have to be the same size or in a grid.
186
+ * @param fullWidth Full width of multiview setup Expects a `Float`.
187
+ * @param fullHeight Full height of multiview setup Expects a `Float`.
188
+ * @param x Horizontal offset of subcamera Expects a `Float`.
189
+ * @param y Vertical offset of subcamera Expects a `Float`.
190
+ * @param width Width of subcamera Expects a `Float`.
191
+ * @param height Height of subcamera Expects a `Float`.
120
192
  */
121
193
  setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void;
194
+
195
+ /**
196
+ * Removes any offset set by the {@link setViewOffset | .setViewOffset} method.
197
+ */
122
198
  clearViewOffset(): void;
123
199
 
124
200
  /**
125
- * Updates the camera projection matrix. Must be called after change of parameters.
201
+ * Updates the camera projection matrix
202
+ * @remarks Must be called after any change of parameters.
126
203
  */
127
204
  updateProjectionMatrix(): void;
128
- toJSON(meta?: any): any;
129
205
 
130
206
  /**
131
- * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead.
207
+ * @deprecated Use {@link PerspectiveCamera.setFocalLength | .setFocalLength()} and {@link PerspectiveCamera.filmGauge | .filmGauge} instead.
132
208
  */
133
209
  setLens(focalLength: number, frameHeight?: number): void;
134
210
  }
@@ -1,23 +1,50 @@
1
1
  import { PerspectiveCamera } from './PerspectiveCamera';
2
2
  import { Camera } from './Camera';
3
3
 
4
+ /**
5
+ * Dual {@link PerspectiveCamera | PerspectiveCamera}s used for effects such as
6
+ * {@link https://en.wikipedia.org/wiki/Anaglyph_3D | 3D Anaglyph} or
7
+ * {@link https://en.wikipedia.org/wiki/parallax_barrier | Parallax Barrier}.
8
+ * @see Example: {@link https://threejs.org/examples/#webgl_effects_anaglyph | effects / anaglyph }
9
+ * @see Example: {@link https://threejs.org/examples/#webgl_effects_parallaxbarrier | effects / parallaxbarrier }
10
+ * @see Example: {@link https://threejs.org/examples/#webgl_effects_stereo | effects / stereo }
11
+ * @see {@link https://threejs.org/docs/index.html#api/en/cameras/StereoCamera | Official Documentation}
12
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/cameras/StereoCamera.js | Source}
13
+ */
4
14
  export class StereoCamera extends Camera {
5
15
  constructor();
6
16
 
7
17
  type: 'StereoCamera';
8
18
 
9
19
  /**
10
- * @default 1
20
+ * @remarks Expects a `Float`
21
+ * @defaultValue `1`
11
22
  */
12
23
  aspect: number;
13
24
 
14
25
  /**
15
- * @default 0.064
26
+ * @remarks Expects a `Float`
27
+ * @defaultValue `0.064`
16
28
  */
17
29
  eyeSep: number;
18
30
 
31
+ /**
32
+ * The Left camera.
33
+ * A {@link PerspectiveCamera } added to {@link THREE.PerspectiveCamera.layers | layer 1}
34
+ * @remarks Objects to be rendered by the **left** camera must also be added to this layer.
35
+ */
19
36
  cameraL: PerspectiveCamera;
37
+
38
+ /**
39
+ * The Right camera.
40
+ * A {@link PerspectiveCamera } added to {@link THREE.PerspectiveCamera.layers | layer 2}
41
+ * @remarks Objects to be rendered by the **right** camera must also be added to this layer.
42
+ */
20
43
  cameraR: PerspectiveCamera;
21
44
 
45
+ /**
46
+ * Update the stereo cameras based on the camera passed in.
47
+ * @param camera
48
+ */
22
49
  update(camera: PerspectiveCamera): void;
23
50
  }