@types/three 0.149.0 → 0.150.1

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 (103) hide show
  1. three/README.md +2 -2
  2. three/build/three.d.cts +2 -0
  3. three/build/three.d.ts +2 -0
  4. three/build/three.module.d.ts +2 -0
  5. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  6. three/examples/jsm/controls/TransformControls.d.ts +1 -5
  7. three/examples/jsm/geometries/TextGeometry.d.ts +92 -15
  8. three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
  9. three/examples/jsm/libs/fflate.module.d.ts +1 -0
  10. three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
  11. three/examples/jsm/libs/stats.module.d.ts +2 -23
  12. three/examples/jsm/loaders/EXRLoader.d.ts +3 -2
  13. three/examples/jsm/misc/GPUComputationRenderer.d.ts +4 -2
  14. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
  15. three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
  16. three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
  17. three/index.d.ts +1 -1
  18. three/package.json +19 -4
  19. three/src/Three.d.ts +0 -1
  20. three/src/audio/Audio.d.ts +184 -20
  21. three/src/audio/AudioAnalyser.d.ts +42 -4
  22. three/src/audio/AudioContext.d.ts +12 -1
  23. three/src/audio/AudioListener.d.ts +76 -8
  24. three/src/audio/PositionalAudio.d.ts +86 -5
  25. three/src/cameras/ArrayCamera.d.ts +23 -2
  26. three/src/cameras/Camera.d.ts +42 -13
  27. three/src/cameras/CubeCamera.d.ts +49 -1
  28. three/src/cameras/OrthographicCamera.d.ts +77 -25
  29. three/src/cameras/PerspectiveCamera.d.ts +132 -56
  30. three/src/cameras/StereoCamera.d.ts +29 -2
  31. three/src/constants.d.ts +790 -245
  32. three/src/core/BufferAttribute.d.ts +456 -85
  33. three/src/core/BufferGeometry.d.ts +237 -67
  34. three/src/core/Clock.d.ts +28 -20
  35. three/src/core/EventDispatcher.d.ts +20 -4
  36. three/src/core/GLBufferAttribute.d.ts +102 -8
  37. three/src/core/InstancedBufferAttribute.d.ts +13 -24
  38. three/src/core/InstancedBufferGeometry.d.ts +22 -4
  39. three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
  40. three/src/core/InterleavedBuffer.d.ts +98 -14
  41. three/src/core/InterleavedBufferAttribute.d.ts +146 -7
  42. three/src/core/Layers.d.ts +61 -6
  43. three/src/core/Object3D.d.ts +244 -123
  44. three/src/core/Raycaster.d.ts +104 -27
  45. three/src/core/Uniform.d.ts +28 -11
  46. three/src/core/UniformsGroup.d.ts +10 -4
  47. three/src/extras/Earcut.d.ts +3 -4
  48. three/src/geometries/BoxGeometry.d.ts +39 -16
  49. three/src/geometries/CapsuleGeometry.d.ts +35 -12
  50. three/src/geometries/CircleGeometry.d.ts +38 -12
  51. three/src/geometries/ConeGeometry.d.ts +45 -10
  52. three/src/geometries/CylinderGeometry.d.ts +41 -19
  53. three/src/geometries/DodecahedronGeometry.d.ts +14 -5
  54. three/src/geometries/EdgesGeometry.d.ts +30 -8
  55. three/src/geometries/ExtrudeGeometry.d.ts +93 -12
  56. three/src/geometries/IcosahedronGeometry.d.ts +15 -5
  57. three/src/geometries/LatheGeometry.d.ts +41 -12
  58. three/src/geometries/OctahedronGeometry.d.ts +14 -5
  59. three/src/geometries/PlaneGeometry.d.ts +35 -12
  60. three/src/geometries/PolyhedronGeometry.d.ts +41 -12
  61. three/src/geometries/RingGeometry.d.ts +39 -16
  62. three/src/geometries/ShapeGeometry.d.ts +44 -4
  63. three/src/geometries/SphereGeometry.d.ts +43 -21
  64. three/src/geometries/TetrahedronGeometry.d.ts +14 -5
  65. three/src/geometries/TorusGeometry.d.ts +35 -13
  66. three/src/geometries/TorusKnotGeometry.d.ts +39 -16
  67. three/src/geometries/TubeGeometry.d.ts +63 -15
  68. three/src/geometries/WireframeGeometry.d.ts +30 -4
  69. three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
  70. three/src/math/Color.d.ts +157 -3
  71. three/src/math/ColorManagement.d.ts +13 -7
  72. three/src/objects/Bone.d.ts +30 -3
  73. three/src/objects/Group.d.ts +37 -1
  74. three/src/objects/InstancedMesh.d.ts +122 -3
  75. three/src/objects/LOD.d.ts +62 -18
  76. three/src/objects/Line.d.ts +67 -4
  77. three/src/objects/LineLoop.d.ts +26 -1
  78. three/src/objects/LineSegments.d.ts +21 -9
  79. three/src/objects/Mesh.d.ts +60 -4
  80. three/src/objects/Points.d.ts +39 -8
  81. three/src/objects/Skeleton.d.ts +89 -3
  82. three/src/objects/SkinnedMesh.d.ts +122 -3
  83. three/src/objects/Sprite.d.ts +51 -4
  84. three/src/renderers/WebGLRenderTarget.d.ts +9 -3
  85. three/src/renderers/WebGLRenderer.d.ts +2 -2
  86. three/src/scenes/Fog.d.ts +59 -7
  87. three/src/scenes/FogExp2.d.ts +41 -6
  88. three/src/scenes/Scene.d.ts +45 -22
  89. three/src/textures/CanvasTexture.d.ts +35 -13
  90. three/src/textures/CompressedArrayTexture.d.ts +39 -5
  91. three/src/textures/CompressedTexture.d.ts +49 -20
  92. three/src/textures/CubeTexture.d.ts +71 -18
  93. three/src/textures/Data3DTexture.d.ts +74 -10
  94. three/src/textures/DataArrayTexture.d.ts +83 -9
  95. three/src/textures/DataTexture.d.ts +81 -26
  96. three/src/textures/DepthTexture.d.ts +71 -15
  97. three/src/textures/FramebufferTexture.d.ts +57 -2
  98. three/src/textures/Source.d.ts +23 -13
  99. three/src/textures/Texture.d.ts +289 -73
  100. three/src/textures/VideoTexture.d.ts +69 -13
  101. three/src/textures/types.d.ts +9 -0
  102. three/src/utils.d.ts +5 -2
  103. three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
@@ -9,190 +9,360 @@ import { Vector2 } from './../math/Vector2';
9
9
  import { Vector3 } from './../math/Vector3';
10
10
  import { EventDispatcher } from './EventDispatcher';
11
11
  import { BuiltinShaderAttributeName } from '../constants';
12
+ import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUtils';
12
13
 
13
14
  /**
14
- * This is a superefficent class for geometries because it saves all data in buffers.
15
- * It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the necessary buffer calculations.
16
- * It is mainly interesting when working with static objects.
15
+ * A representation of mesh, line, or point geometry
16
+ * Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU.
17
+ * @remarks
18
+ * To read and edit data in BufferGeometry attributes, see {@link THREE.BufferAttribute | BufferAttribute} documentation.
19
+ * @example
20
+ * ```typescript
21
+ * const geometry = new THREE.BufferGeometry();
22
+ * // create a simple square shape. We duplicate the top left and bottom right
23
+ * // vertices because each vertex needs to appear once per triangle.
24
+ * const vertices = new Float32Array([
25
+ * -1.0, -1.0, 1.0,
26
+ * 1.0, -1.0, 1.0,
27
+ * 1.0, 1.0, 1.0,
17
28
  *
18
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js|src/core/BufferGeometry.js}
29
+ * 1.0, 1.0, 1.0,
30
+ * -1.0, 1.0, 1.0,
31
+ * -1.0, -1.0, 1.0]);
32
+ * // itemSize = 3 because there are 3 values (components) per vertex
33
+ * geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
34
+ * const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
35
+ * const mesh = new THREE.Mesh(geometry, material);
36
+ * ```
37
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry | Mesh with non-indexed faces}
38
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_indexed | Mesh with indexed faces}
39
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines | Lines}
40
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_lines_indexed | Indexed Lines}
41
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_custom_attributes_particles | Particles}
42
+ * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_rawshader | Raw Shaders}
43
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/BufferGeometry | Official Documentation}
44
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js | Source}
19
45
  */
20
46
  export class BufferGeometry extends EventDispatcher {
21
47
  /**
22
- * This creates a new BufferGeometry. It also sets several properties to an default value.
48
+ * This creates a new {@link THREE.BufferGeometry | BufferGeometry} object.
23
49
  */
24
50
  constructor();
25
51
 
26
52
  /**
27
- * Unique number of this buffergeometry instance
53
+ * Unique number for this {@link THREE.BufferGeometry | BufferGeometry} instance.
54
+ * @remarks Expects a `Integer`
28
55
  */
29
56
  id: number;
57
+
58
+ /**
59
+ * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
60
+ * @remarks This gets automatically assigned and shouldn't be edited.
61
+ */
30
62
  uuid: string;
31
63
 
32
64
  /**
33
- * @default ''
65
+ * Optional name for this {@link THREE.BufferGeometry | BufferGeometry} instance.
66
+ * @defaultValue `''`
34
67
  */
35
68
  name: string;
36
69
 
37
70
  /**
38
- * @default 'BufferGeometry'
71
+ * A Read-only _string_ to check if `this` object type.
72
+ * @remarks Sub-classes will update this value.
73
+ * @defaultValue `BufferGeometry`
39
74
  */
40
- type: string;
75
+ readonly type: string | 'BufferGeometry';
41
76
 
42
77
  /**
43
- * @default null
78
+ * Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles".
79
+ * Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
80
+ * If this attribute is not set, the {@link THREE.WebGLRenderer | renderer} assumes that each three contiguous positions represent a single triangle.
81
+ * @defaultValue `null`
44
82
  */
45
83
  index: BufferAttribute | null;
46
84
 
47
85
  /**
48
- * @default {}
86
+ * This hashmap has as id the name of the attribute to be set and as value the {@link THREE.BufferAttribute | buffer} to set it to. Rather than accessing this property directly,
87
+ * use {@link setAttribute | .setAttribute} and {@link getAttribute | .getAttribute} to access attributes of this geometry.
88
+ * @defaultValue `{}`
49
89
  */
50
90
  attributes: {
51
- [name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
91
+ [name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; // TODO Replace for 'Record<>'
52
92
  };
53
93
 
54
94
  /**
55
- * @default {}
95
+ * Hashmap of {@link THREE.BufferAttribute | BufferAttributes} holding details of the geometry's morph targets.
96
+ * @remarks
97
+ * Once the geometry has been rendered, the morph attribute data cannot be changed.
98
+ * You will have to call {@link dispose | .dispose}(), and create a new instance of {@link THREE.BufferGeometry | BufferGeometry}.
99
+ * @defaultValue `{}`
56
100
  */
57
101
  morphAttributes: {
58
- [name: string]: Array<BufferAttribute | InterleavedBufferAttribute>;
102
+ [name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; // TODO Replace for 'Record<>'
59
103
  };
60
104
 
61
105
  /**
62
- * @default false
106
+ * Used to control the morph target behavior; when set to true, the morph target data is treated as relative offsets, rather than as absolute positions/normals.
107
+ * @defaultValue `false`
63
108
  */
64
109
  morphTargetsRelative: boolean;
65
110
 
66
111
  /**
67
- * @default []
112
+ * Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. This allows an array of materials to be used with the geometry.
113
+ * @remarks Every vertex and index must belong to exactly one group — groups must not share vertices or indices, and must not leave vertices or indices unused.
114
+ * @remarks Use {@link addGroup | .addGroup} to add groups, rather than modifying this array directly.
115
+ * @defaultValue `[]`
68
116
  */
69
- groups: Array<{ start: number; count: number; materialIndex?: number | undefined }>;
117
+ groups: Array<{
118
+ /**
119
+ * Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index.
120
+ * @remarks Expects a `Integer`
121
+ */
122
+ start: number;
123
+ /**
124
+ * Specifies how many vertices (or indices) are included.
125
+ * @remarks Expects a `Integer`
126
+ */
127
+ count: number;
128
+ /**
129
+ * Specifies the material array index to use.
130
+ * @remarks Expects a `Integer`
131
+ */
132
+ materialIndex?: number | undefined;
133
+ }>;
70
134
 
71
135
  /**
72
- * @default null
136
+ * Bounding box for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
137
+ * @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
138
+ * @defaultValue `null`
73
139
  */
74
140
  boundingBox: Box3 | null;
75
141
 
76
142
  /**
77
- * @default null
143
+ * Bounding sphere for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}.
144
+ * @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
145
+ * @defaultValue `null`
78
146
  */
79
147
  boundingSphere: Sphere | null;
80
148
 
81
149
  /**
82
- * @default { start: 0, count: Infinity }
150
+ * Determines the part of the geometry to render. This should not be set directly, instead use {@link setDrawRange | .setDrawRange(...)}.
151
+ * @remarks For non-indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of vertices to render.
152
+ * @remarks For indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of indices to render.
153
+ * @defaultValue `{ start: 0, count: Infinity }`
83
154
  */
84
155
  drawRange: { start: number; count: number };
85
156
 
86
157
  /**
87
- * @default {}
158
+ * An object that can be used to store custom data about the BufferGeometry. It should not hold references to functions as these will not be cloned.
159
+ * @defaultValue `{}`
88
160
  */
89
161
  userData: { [key: string]: any };
162
+
163
+ /**
164
+ * Read-only flag to check if a given object is of type {@link BufferGeometry}.
165
+ * @remarks This is a _constant_ value
166
+ * @defaultValue `true`
167
+ */
90
168
  readonly isBufferGeometry: true;
91
169
 
170
+ /**
171
+ * Return the {@link index | .index} buffer.
172
+ */
92
173
  getIndex(): BufferAttribute | null;
93
- setIndex(index: BufferAttribute | number[] | null): BufferGeometry;
94
174
 
175
+ /**
176
+ * Set the {@link THREE.BufferGeometry.index | .index} buffer.
177
+ * @param index
178
+ */
179
+ setIndex(index: BufferAttribute | number[] | null): this;
180
+
181
+ /**
182
+ * Sets an {@link attributes | attribute} to this geometry with the specified name.
183
+ * @remarks
184
+ * Use this rather than the attributes property, because an internal hashmap of {@link attributes | .attributes} is maintained to speed up iterating over attributes.
185
+ * @param name
186
+ * @param attribute
187
+ */
95
188
  setAttribute(
96
189
  name: BuiltinShaderAttributeName | (string & {}),
97
190
  attribute: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute,
98
- ): BufferGeometry;
191
+ ): this;
192
+
193
+ /**
194
+ * Returns the {@link attributes | attribute} with the specified name.
195
+ * @param name
196
+ */
99
197
  getAttribute(
100
198
  name: BuiltinShaderAttributeName | (string & {}),
101
199
  ): BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
200
+
201
+ /**
202
+ * Deletes the {@link attributes | attribute} with the specified name.
203
+ * @param name
204
+ */
102
205
  deleteAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferGeometry;
206
+
207
+ /**
208
+ * Returns true if the {@link attributes | attribute} with the specified name exists.
209
+ * @param name
210
+ */
103
211
  hasAttribute(name: BuiltinShaderAttributeName | (string & {})): boolean;
104
212
 
213
+ /**
214
+ * Adds a group to this geometry
215
+ * @see the {@link BufferGeometry.groups | groups} property for details.
216
+ * @param start
217
+ * @param count
218
+ * @param materialIndex
219
+ */
105
220
  addGroup(start: number, count: number, materialIndex?: number): void;
221
+
222
+ /**
223
+ * Clears all groups.
224
+ */
106
225
  clearGroups(): void;
107
226
 
227
+ /**
228
+ * Set the {@link drawRange | .drawRange} property
229
+ * @remarks For non-indexed BufferGeometry, count is the number of vertices to render
230
+ * @remarks For indexed BufferGeometry, count is the number of indices to render.
231
+ * @param start
232
+ * @param count is the number of vertices or indices to render. Expects a `Integer`
233
+ */
108
234
  setDrawRange(start: number, count: number): void;
109
235
 
110
236
  /**
111
- * Bakes matrix transform directly into vertex coordinates.
237
+ * Applies the matrix transform to the geometry.
238
+ * @param matrix
239
+ */
240
+ applyMatrix4(matrix: Matrix4): this;
241
+
242
+ /**
243
+ * Applies the rotation represented by the quaternion to the geometry.
244
+ * @param quaternion
112
245
  */
113
- applyMatrix4(matrix: Matrix4): BufferGeometry;
114
- applyQuaternion(q: Quaternion): BufferGeometry;
246
+ applyQuaternion(quaternion: Quaternion): this;
115
247
 
116
- rotateX(angle: number): BufferGeometry;
117
- rotateY(angle: number): BufferGeometry;
118
- rotateZ(angle: number): BufferGeometry;
119
- translate(x: number, y: number, z: number): BufferGeometry;
120
- scale(x: number, y: number, z: number): BufferGeometry;
121
- lookAt(v: Vector3): void;
248
+ /**
249
+ * Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop.
250
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
251
+ * @param angle radians. Expects a `Float`
252
+ */
253
+ rotateX(angle: number): this;
122
254
 
123
- center(): BufferGeometry;
255
+ /**
256
+ * Rotate the geometry about the Y axis.
257
+ * @remarks This is typically done as a one time operation, and not during a loop.
258
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
259
+ * @param angle radians. Expects a `Float`
260
+ */
261
+ rotateY(angle: number): this;
124
262
 
125
- setFromPoints(points: Vector3[] | Vector2[]): BufferGeometry;
263
+ /**
264
+ * Rotate the geometry about the Z axis.
265
+ * @remarks This is typically done as a one time operation, and not during a loop.
266
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
267
+ * @param angle radians. Expects a `Float`
268
+ */
269
+ rotateZ(angle: number): this;
126
270
 
127
271
  /**
128
- * Computes bounding box of the geometry, updating Geometry.boundingBox attribute.
129
- * Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.
272
+ * Translate the geometry.
273
+ * @remarks This is typically done as a one time operation, and not during a loop.
274
+ * @remarks Use {@link THREE.Object3D.position | Object3D.position} for typical real-time mesh rotation.
275
+ * @param x Expects a `Float`
276
+ * @param y Expects a `Float`
277
+ * @param z Expects a `Float`
130
278
  */
131
- computeBoundingBox(): void;
279
+ translate(x: number, y: number, z: number): this;
132
280
 
133
281
  /**
134
- * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute.
135
- * Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null.
282
+ * Scale the geometry data.
283
+ * @remarks This is typically done as a one time operation, and not during a loop.
284
+ * @remarks Use {@link THREE.Object3D.scale | Object3D.scale} for typical real-time mesh scaling.
285
+ * @param x Expects a `Float`
286
+ * @param y Expects a `Float`
287
+ * @param z Expects a `Float`
136
288
  */
137
- computeBoundingSphere(): void;
289
+ scale(x: number, y: number, z: number): this;
138
290
 
139
291
  /**
140
- * Computes and adds tangent attribute to this geometry.
292
+ * Rotates the geometry to face a point in space.
293
+ * @remarks This is typically done as a one time operation, and not during a loop.
294
+ * @remarks Use {@link THREE.Object3D.lookAt | Object3D.lookAt} for typical real-time mesh usage.
295
+ * @param vector A world vector to look at.
141
296
  */
142
- computeTangents(): void;
297
+ lookAt(vector: Vector3): this;
143
298
 
144
299
  /**
145
- * Computes vertex normals by averaging face normals.
300
+ * Center the geometry based on the bounding box.
146
301
  */
147
- computeVertexNormals(): void;
302
+ center(): this;
148
303
 
149
- normalizeNormals(): void;
304
+ /**
305
+ * Sets the attributes for this BufferGeometry from an array of points.
306
+ * @param points
307
+ */
308
+ setFromPoints(points: Vector3[] | Vector2[]): this;
150
309
 
151
- toNonIndexed(): BufferGeometry;
310
+ /**
311
+ * Computes bounding box of the geometry, updating {@link boundingBox | .boundingBox} attribute.
312
+ * @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
313
+ */
314
+ computeBoundingBox(): void;
152
315
 
153
- toJSON(): any;
154
- clone(): BufferGeometry;
155
- copy(source: BufferGeometry): this;
316
+ /**
317
+ * Computes bounding sphere of the geometry, updating {@link boundingSphere | .boundingSphere} attribute.
318
+ * @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
319
+ */
320
+ computeBoundingSphere(): void;
156
321
 
157
322
  /**
158
- * Disposes the object from memory.
159
- * You need to call this when you want the bufferGeometry removed while the application is running.
323
+ * Calculates and adds a tangent attribute to this geometry.
324
+ * The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined
325
+ * @remarks
326
+ * When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
327
+ * {@link BufferGeometryUtils.computeMikkTSpaceTangents} instead.
160
328
  */
161
- dispose(): void;
329
+ computeTangents(): void;
162
330
 
163
331
  /**
164
- * @deprecated Use {@link BufferGeometry#groups .groups} instead.
332
+ * Computes vertex normals by averaging face normals.
165
333
  */
166
- drawcalls: any;
334
+ computeVertexNormals(): void;
167
335
 
168
336
  /**
169
- * @deprecated Use {@link BufferGeometry#groups .groups} instead.
337
+ * Every normal vector in a geometry will have a magnitude of 1
338
+ * @remarks This will correct lighting on the geometry surfaces.
170
339
  */
171
- offsets: any;
340
+ normalizeNormals(): void;
172
341
 
173
342
  /**
174
- * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead.
343
+ * Return a non-index version of an indexed BufferGeometry.
175
344
  */
176
- addIndex(index: any): void;
345
+ toNonIndexed(): BufferGeometry;
177
346
 
178
347
  /**
179
- * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead.
348
+ * Convert the buffer geometry to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
180
349
  */
181
- addDrawCall(start: any, count: any, indexOffset?: any): void;
350
+ toJSON(): {};
182
351
 
183
352
  /**
184
- * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead.
353
+ * Creates a clone of this BufferGeometry
185
354
  */
186
- clearDrawCalls(): void;
355
+ clone(): this;
187
356
 
188
357
  /**
189
- * @deprecated Use {@link BufferGeometry#setAttribute .setAttribute()} instead.
358
+ * Copies another BufferGeometry to this BufferGeometry.
359
+ * @param source
190
360
  */
191
- addAttribute(name: string, attribute: BufferAttribute | InterleavedBufferAttribute): BufferGeometry;
192
- addAttribute(name: any, array: any, itemSize: any): any;
361
+ copy(source: BufferGeometry): this;
193
362
 
194
363
  /**
195
- * @deprecated Use {@link BufferGeometry#deleteAttribute .deleteAttribute()} instead.
364
+ * Frees the GPU-related resources allocated by this instance.
365
+ * @remarks Call this method whenever this instance is no longer used in your app.
196
366
  */
197
- removeAttribute(name: string): BufferGeometry;
367
+ dispose(): void;
198
368
  }
three/src/core/Clock.d.ts CHANGED
@@ -1,64 +1,72 @@
1
1
  /**
2
- * Object for keeping track of time.
3
- *
4
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js|src/core/Clock.js}
2
+ * Object for keeping track of time
3
+ * @remarks
4
+ * This uses {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | performance.now} if it is available,
5
+ * otherwise it reverts to the less accurate {@link https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now | Date.now}.
6
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/Clock | Official Documentation}
7
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js | Source}
5
8
  */
6
9
  export class Clock {
7
10
  /**
8
- * @param [autoStart=true] Automatically start the clock.
11
+ * Create a new instance of {@link THREE.Clock | Clock}
12
+ * @param autoStart - Whether to automatically start the clock when {@link getDelta | .getDelta()} is called for the first time. Default `true`
9
13
  */
10
14
  constructor(autoStart?: boolean);
11
15
 
12
16
  /**
13
- * If set, starts the clock automatically when the first update is called.
14
- * @default true
17
+ * If set, starts the clock automatically when {@link getDelta | .getDelta()} is called for the first time.
18
+ * @defaultValue `true`
15
19
  */
16
20
  autoStart: boolean;
17
21
 
18
22
  /**
19
- * When the clock is running, It holds the starttime of the clock.
20
- * This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
21
- * @default 0
23
+ * Holds the time at which the clock's {@link start | .start()} method was last called.
24
+ * @defaultValue `0`
22
25
  */
23
26
  startTime: number;
24
27
 
25
28
  /**
26
- * When the clock is running, It holds the previous time from a update.
27
- * This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
28
- * @default 0
29
+ * Holds the time at which the clock's {@link start | .start()}, {@link getElapsedTime | .getElapsedTime()} or {@link getDelta | .getDelta()} methods were last called.
30
+ * @defaultValue `0`
29
31
  */
30
32
  oldTime: number;
31
33
 
32
34
  /**
33
- * When the clock is running, It holds the time elapsed between the start of the clock to the previous update.
34
- * This parameter is in seconds of three decimal places.
35
- * @default 0
35
+ * Keeps track of the total time that the clock has been running.
36
+ * @defaultValue `0`
36
37
  */
37
38
  elapsedTime: number;
38
39
 
39
40
  /**
40
- * This property keeps track whether the clock is running or not.
41
- * @default false
41
+ * Whether the clock is running or not.
42
+ * @defaultValue `false`
42
43
  */
43
44
  running: boolean;
44
45
 
45
46
  /**
46
47
  * Starts clock.
48
+ * @remarks
49
+ * Also sets the {@link startTime | .startTime} and {@link oldTime | .oldTime} to the current time,
50
+ * sets {@link elapsedTime | .elapsedTime} to `0` and {@link running | .running} to `true`.
47
51
  */
48
52
  start(): void;
49
53
 
50
54
  /**
51
- * Stops clock.
55
+ * Stops clock and sets {@link oldTime | oldTime} to the current time.
52
56
  */
53
57
  stop(): void;
54
58
 
55
59
  /**
56
- * Get the seconds passed since the clock started.
60
+ * Get the seconds passed since the clock started and sets {@link oldTime | .oldTime} to the current time.
61
+ * @remarks
62
+ * If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock.
57
63
  */
58
64
  getElapsedTime(): number;
59
65
 
60
66
  /**
61
- * Get the seconds passed since the last call to this method.
67
+ * Get the seconds passed since the time {@link oldTime | .oldTime} was set and sets {@link oldTime | .oldTime} to the current time.
68
+ * @remarks
69
+ * If {@link autoStart | .autoStart} is `true` and the clock is not running, also starts the clock.
62
70
  */
63
71
  getDelta(): number;
64
72
  }
@@ -13,12 +13,28 @@ export type EventListener<E, T, U> = (event: E & { type: T } & { target: U }) =>
13
13
 
14
14
  /**
15
15
  * JavaScript events for custom objects
16
- *
17
- * @source src/core/EventDispatcher.js
16
+ * @example
17
+ * ```typescript
18
+ * // Adding events to a custom object
19
+ * class Car extends EventDispatcher {
20
+ * start() {
21
+ * this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } );
22
+ * }
23
+ * };
24
+ * // Using events with the custom object
25
+ * const car = new Car();
26
+ * car.addEventListener( 'start', ( event ) => {
27
+ * alert( event.message );
28
+ * } );
29
+ * car.start();
30
+ * ```
31
+ * @see {@link https://github.com/mrdoob/eventdispatcher.js | mrdoob EventDispatcher on GitHub}
32
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/EventDispatcher | Official Documentation}
33
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/EventDispatcher.js | Source}
18
34
  */
19
35
  export class EventDispatcher<E extends BaseEvent = Event> {
20
36
  /**
21
- * Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object.
37
+ * Creates {@link THREE.EventDispatcher | EventDispatcher} object.
22
38
  */
23
39
  constructor();
24
40
 
@@ -45,7 +61,7 @@ export class EventDispatcher<E extends BaseEvent = Event> {
45
61
 
46
62
  /**
47
63
  * Fire an event type.
48
- * @param type The type of event that gets fired.
64
+ * @param event The event that gets fired.
49
65
  */
50
66
  dispatchEvent(event: E): void;
51
67
  }