@types/three 0.148.1 → 0.150.0

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 (62) 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 +8 -3
  6. three/examples/jsm/controls/TrackballControls.d.ts +2 -2
  7. three/examples/jsm/controls/TransformControls.d.ts +4 -4
  8. three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
  9. three/examples/jsm/helpers/ViewHelper.d.ts +16 -0
  10. three/examples/jsm/libs/fflate.module.d.ts +1 -0
  11. three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
  12. three/examples/jsm/libs/stats.module.d.ts +2 -23
  13. three/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +1 -1
  14. three/examples/jsm/loaders/IFCLoader.d.ts +1 -0
  15. three/examples/jsm/loaders/USDZLoader.d.ts +1 -0
  16. three/examples/jsm/loaders/VOXLoader.d.ts +1 -1
  17. three/examples/jsm/nodes/loaders/NodeLoader.d.ts +1 -0
  18. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
  19. three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
  20. three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
  21. three/index.d.ts +1 -1
  22. three/package.json +19 -4
  23. three/src/Three.d.ts +1 -5
  24. three/src/constants.d.ts +395 -253
  25. three/src/core/BufferAttribute.d.ts +456 -85
  26. three/src/core/BufferGeometry.d.ts +241 -70
  27. three/src/core/Clock.d.ts +28 -20
  28. three/src/core/EventDispatcher.d.ts +20 -4
  29. three/src/core/GLBufferAttribute.d.ts +105 -7
  30. three/src/core/InstancedBufferAttribute.d.ts +13 -24
  31. three/src/core/InstancedBufferGeometry.d.ts +22 -4
  32. three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
  33. three/src/core/InterleavedBuffer.d.ts +98 -14
  34. three/src/core/InterleavedBufferAttribute.d.ts +146 -7
  35. three/src/core/Layers.d.ts +61 -6
  36. three/src/core/Object3D.d.ts +252 -119
  37. three/src/core/Raycaster.d.ts +103 -27
  38. three/src/core/Uniform.d.ts +30 -13
  39. three/src/core/UniformsGroup.d.ts +10 -4
  40. three/src/extras/Earcut.d.ts +3 -4
  41. three/src/helpers/CameraHelper.d.ts +43 -0
  42. three/src/lights/DirectionalLight.d.ts +3 -1
  43. three/src/lights/HemisphereLight.d.ts +3 -1
  44. three/src/lights/SpotLight.d.ts +3 -1
  45. three/src/loaders/CubeTextureLoader.d.ts +1 -1
  46. three/src/loaders/Loader.d.ts +1 -2
  47. three/src/materials/Material.d.ts +9 -2
  48. three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
  49. three/src/math/Color.d.ts +157 -3
  50. three/src/math/ColorManagement.d.ts +13 -7
  51. three/src/math/Euler.d.ts +2 -3
  52. three/src/objects/Mesh.d.ts +2 -2
  53. three/src/renderers/WebGLRenderer.d.ts +2 -2
  54. three/src/renderers/webgl/WebGLAttributes.d.ts +4 -3
  55. three/src/renderers/webgl/WebGLClipping.d.ts +3 -1
  56. three/src/renderers/webxr/WebXRManager.d.ts +2 -2
  57. three/src/textures/Data3DTexture.d.ts +2 -2
  58. three/src/utils.d.ts +5 -2
  59. three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
  60. three/src/renderers/WebGLMultisampleRenderTarget.d.ts +0 -6
  61. three/src/textures/DataTexture2DArray.d.ts +0 -6
  62. three/src/textures/DataTexture3D.d.ts +0 -6
@@ -1,4 +1,6 @@
1
1
  import { BufferAttribute } from './BufferAttribute';
2
+ import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
3
+ import { GLBufferAttribute } from './GLBufferAttribute';
2
4
  import { Box3 } from './../math/Box3';
3
5
  import { Sphere } from './../math/Sphere';
4
6
  import { Matrix4 } from './../math/Matrix4';
@@ -6,190 +8,359 @@ import { Quaternion } from './../math/Quaternion';
6
8
  import { Vector2 } from './../math/Vector2';
7
9
  import { Vector3 } from './../math/Vector3';
8
10
  import { EventDispatcher } from './EventDispatcher';
9
- import { InterleavedBufferAttribute } from './InterleavedBufferAttribute';
10
11
  import { BuiltinShaderAttributeName } from '../constants';
12
+ import * as BufferGeometryUtils from '../../examples/jsm/utils/BufferGeometryUtils';
11
13
 
12
14
  /**
13
- * This is a superefficent class for geometries because it saves all data in buffers.
14
- * It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the necessary buffer calculations.
15
- * 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,
16
28
  *
17
- * 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}
18
45
  */
19
46
  export class BufferGeometry extends EventDispatcher {
20
47
  /**
21
- * This creates a new BufferGeometry. It also sets several properties to an default value.
48
+ * This creates a new {@link THREE.BufferGeometry | BufferGeometry} object.
22
49
  */
23
50
  constructor();
24
51
 
25
52
  /**
26
- * Unique number of this buffergeometry instance
53
+ * Unique number for this {@link THREE.BufferGeometry | BufferGeometry} instance.
54
+ * @remarks Expects a `Integer`
27
55
  */
28
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
+ */
29
62
  uuid: string;
30
63
 
31
64
  /**
32
- * @default ''
65
+ * Optional name for this {@link THREE.BufferGeometry | BufferGeometry} instance.
66
+ * @defaultValue `''`
33
67
  */
34
68
  name: string;
35
69
 
36
70
  /**
37
- * @default 'BufferGeometry'
71
+ * @defaultValue `BufferGeometry`
38
72
  */
39
- type: string;
73
+ type: string; // TODO Replace for "BufferGeometry" // TODO add readonly
40
74
 
41
75
  /**
42
- * @default null
76
+ * Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles".
77
+ * Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
78
+ * If this attribute is not set, the {@link THREE.WebGLRenderer | renderer} assumes that each three contiguous positions represent a single triangle.
79
+ * @defaultValue `null`
43
80
  */
44
81
  index: BufferAttribute | null;
45
82
 
46
83
  /**
47
- * @default {}
84
+ * 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,
85
+ * use {@link setAttribute | .setAttribute} and {@link getAttribute | .getAttribute} to access attributes of this geometry.
86
+ * @defaultValue `{}`
48
87
  */
49
88
  attributes: {
50
- [name: string]: BufferAttribute | InterleavedBufferAttribute;
89
+ [name: string]: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute; // TODO Replace for 'Record<>'
51
90
  };
52
91
 
53
92
  /**
54
- * @default {}
93
+ * Hashmap of {@link THREE.BufferAttribute | BufferAttributes} holding details of the geometry's morph targets.
94
+ * @remarks
95
+ * Once the geometry has been rendered, the morph attribute data cannot be changed.
96
+ * You will have to call {@link dispose | .dispose}(), and create a new instance of {@link THREE.BufferGeometry | BufferGeometry}.
97
+ * @defaultValue `{}`
55
98
  */
56
99
  morphAttributes: {
57
- [name: string]: Array<BufferAttribute | InterleavedBufferAttribute>;
100
+ [name: string]: Array<BufferAttribute | InterleavedBufferAttribute>; // TODO Replace for 'Record<>'
58
101
  };
59
102
 
60
103
  /**
61
- * @default false
104
+ * 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.
105
+ * @defaultValue `false`
62
106
  */
63
107
  morphTargetsRelative: boolean;
64
108
 
65
109
  /**
66
- * @default []
110
+ * 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.
111
+ * @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.
112
+ * @remarks Use {@link addGroup | .addGroup} to add groups, rather than modifying this array directly.
113
+ * @defaultValue `[]`
67
114
  */
68
- groups: Array<{ start: number; count: number; materialIndex?: number | undefined }>;
115
+ groups: Array<{
116
+ /**
117
+ * Specifies the first element in this draw call – the first vertex for non-indexed geometry, otherwise the first triangle index.
118
+ * @remarks Expects a `Integer`
119
+ */
120
+ start: number;
121
+ /**
122
+ * Specifies how many vertices (or indices) are included.
123
+ * @remarks Expects a `Integer`
124
+ */
125
+ count: number;
126
+ /**
127
+ * Specifies the material array index to use.
128
+ * @remarks Expects a `Integer`
129
+ */
130
+ materialIndex?: number | undefined;
131
+ }>;
69
132
 
70
133
  /**
71
- * @default null
134
+ * Bounding box for the bufferGeometry, which can be calculated with {@link computeBoundingBox | .computeBoundingBox()}.
135
+ * @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
136
+ * @defaultValue `null`
72
137
  */
73
138
  boundingBox: Box3 | null;
74
139
 
75
140
  /**
76
- * @default null
141
+ * Bounding sphere for the {@link THREE.BufferGeometry | BufferGeometry}, which can be calculated with {@link computeBoundingSphere | .computeBoundingSphere()}.
142
+ * @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
143
+ * @defaultValue `null`
77
144
  */
78
145
  boundingSphere: Sphere | null;
79
146
 
80
147
  /**
81
- * @default { start: 0, count: Infinity }
148
+ * Determines the part of the geometry to render. This should not be set directly, instead use {@link setDrawRange | .setDrawRange(...)}.
149
+ * @remarks For non-indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of vertices to render.
150
+ * @remarks For indexed {@link THREE.BufferGeometry | BufferGeometry}, count is the number of indices to render.
151
+ * @defaultValue `{ start: 0, count: Infinity }`
82
152
  */
83
153
  drawRange: { start: number; count: number };
84
154
 
85
155
  /**
86
- * @default {}
156
+ * 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.
157
+ * @defaultValue `{}`
87
158
  */
88
159
  userData: { [key: string]: any };
160
+
161
+ /**
162
+ * Read-only flag to check if a given object is of type {@link BufferGeometry}.
163
+ * @remarks This is a _constant_ value
164
+ * @defaultValue `true`
165
+ */
89
166
  readonly isBufferGeometry: true;
90
167
 
168
+ /**
169
+ * Return the {@link index | .index} buffer.
170
+ */
91
171
  getIndex(): BufferAttribute | null;
92
- setIndex(index: BufferAttribute | number[] | null): BufferGeometry;
93
172
 
173
+ /**
174
+ * Set the {@link THREE.BufferGeometry.index | .index} buffer.
175
+ * @param index
176
+ */
177
+ setIndex(index: BufferAttribute | number[] | null): this;
178
+
179
+ /**
180
+ * Sets an {@link attributes | attribute} to this geometry with the specified name.
181
+ * @remarks
182
+ * Use this rather than the attributes property, because an internal hashmap of {@link attributes | .attributes} is maintained to speed up iterating over attributes.
183
+ * @param name
184
+ * @param attribute
185
+ */
94
186
  setAttribute(
95
187
  name: BuiltinShaderAttributeName | (string & {}),
96
- attribute: BufferAttribute | InterleavedBufferAttribute,
97
- ): BufferGeometry;
98
- getAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferAttribute | InterleavedBufferAttribute;
188
+ attribute: BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute,
189
+ ): this;
190
+
191
+ /**
192
+ * Returns the {@link attributes | attribute} with the specified name.
193
+ * @param name
194
+ */
195
+ getAttribute(
196
+ name: BuiltinShaderAttributeName | (string & {}),
197
+ ): BufferAttribute | InterleavedBufferAttribute | GLBufferAttribute;
198
+
199
+ /**
200
+ * Deletes the {@link attributes | attribute} with the specified name.
201
+ * @param name
202
+ */
99
203
  deleteAttribute(name: BuiltinShaderAttributeName | (string & {})): BufferGeometry;
204
+
205
+ /**
206
+ * Returns true if the {@link attributes | attribute} with the specified name exists.
207
+ * @param name
208
+ */
100
209
  hasAttribute(name: BuiltinShaderAttributeName | (string & {})): boolean;
101
210
 
211
+ /**
212
+ * Adds a group to this geometry
213
+ * @see the {@link BufferGeometry.groups | groups} property for details.
214
+ * @param start
215
+ * @param count
216
+ * @param materialIndex
217
+ */
102
218
  addGroup(start: number, count: number, materialIndex?: number): void;
219
+
220
+ /**
221
+ * Clears all groups.
222
+ */
103
223
  clearGroups(): void;
104
224
 
225
+ /**
226
+ * Set the {@link drawRange | .drawRange} property
227
+ * @remarks For non-indexed BufferGeometry, count is the number of vertices to render
228
+ * @remarks For indexed BufferGeometry, count is the number of indices to render.
229
+ * @param start
230
+ * @param count is the number of vertices or indices to render. Expects a `Integer`
231
+ */
105
232
  setDrawRange(start: number, count: number): void;
106
233
 
107
234
  /**
108
- * Bakes matrix transform directly into vertex coordinates.
235
+ * Applies the matrix transform to the geometry.
236
+ * @param matrix
109
237
  */
110
- applyMatrix4(matrix: Matrix4): BufferGeometry;
111
- applyQuaternion(q: Quaternion): BufferGeometry;
238
+ applyMatrix4(matrix: Matrix4): this;
112
239
 
113
- rotateX(angle: number): BufferGeometry;
114
- rotateY(angle: number): BufferGeometry;
115
- rotateZ(angle: number): BufferGeometry;
116
- translate(x: number, y: number, z: number): BufferGeometry;
117
- scale(x: number, y: number, z: number): BufferGeometry;
118
- lookAt(v: Vector3): void;
240
+ /**
241
+ * Applies the rotation represented by the quaternion to the geometry.
242
+ * @param quaternion
243
+ */
244
+ applyQuaternion(quaternion: Quaternion): this;
119
245
 
120
- center(): BufferGeometry;
246
+ /**
247
+ * Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop.
248
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
249
+ * @param angle radians. Expects a `Float`
250
+ */
251
+ rotateX(angle: number): this;
121
252
 
122
- setFromPoints(points: Vector3[] | Vector2[]): BufferGeometry;
253
+ /**
254
+ * Rotate the geometry about the Y axis.
255
+ * @remarks This is typically done as a one time operation, and not during a loop.
256
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
257
+ * @param angle radians. Expects a `Float`
258
+ */
259
+ rotateY(angle: number): this;
123
260
 
124
261
  /**
125
- * Computes bounding box of the geometry, updating Geometry.boundingBox attribute.
126
- * Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are null.
262
+ * Rotate the geometry about the Z axis.
263
+ * @remarks This is typically done as a one time operation, and not during a loop.
264
+ * @remarks Use {@link THREE.Object3D.rotation | Object3D.rotation} for typical real-time mesh rotation.
265
+ * @param angle radians. Expects a `Float`
127
266
  */
128
- computeBoundingBox(): void;
267
+ rotateZ(angle: number): this;
129
268
 
130
269
  /**
131
- * Computes bounding sphere of the geometry, updating Geometry.boundingSphere attribute.
132
- * Bounding spheres aren't' computed by default. They need to be explicitly computed, otherwise they are null.
270
+ * Translate the geometry.
271
+ * @remarks This is typically done as a one time operation, and not during a loop.
272
+ * @remarks Use {@link THREE.Object3D.position | Object3D.position} for typical real-time mesh rotation.
273
+ * @param x Expects a `Float`
274
+ * @param y Expects a `Float`
275
+ * @param z Expects a `Float`
133
276
  */
134
- computeBoundingSphere(): void;
277
+ translate(x: number, y: number, z: number): this;
135
278
 
136
279
  /**
137
- * Computes and adds tangent attribute to this geometry.
280
+ * Scale the geometry data.
281
+ * @remarks This is typically done as a one time operation, and not during a loop.
282
+ * @remarks Use {@link THREE.Object3D.scale | Object3D.scale} for typical real-time mesh scaling.
283
+ * @param x Expects a `Float`
284
+ * @param y Expects a `Float`
285
+ * @param z Expects a `Float`
138
286
  */
139
- computeTangents(): void;
287
+ scale(x: number, y: number, z: number): this;
140
288
 
141
289
  /**
142
- * Computes vertex normals by averaging face normals.
290
+ * Rotates the geometry to face a point in space.
291
+ * @remarks This is typically done as a one time operation, and not during a loop.
292
+ * @remarks Use {@link THREE.Object3D.lookAt | Object3D.lookAt} for typical real-time mesh usage.
293
+ * @param vector A world vector to look at.
143
294
  */
144
- computeVertexNormals(): void;
295
+ lookAt(vector: Vector3): this;
145
296
 
146
- normalizeNormals(): void;
297
+ /**
298
+ * Center the geometry based on the bounding box.
299
+ */
300
+ center(): this;
147
301
 
148
- toNonIndexed(): BufferGeometry;
302
+ /**
303
+ * Sets the attributes for this BufferGeometry from an array of points.
304
+ * @param points
305
+ */
306
+ setFromPoints(points: Vector3[] | Vector2[]): this;
149
307
 
150
- toJSON(): any;
151
- clone(): BufferGeometry;
152
- copy(source: BufferGeometry): this;
308
+ /**
309
+ * Computes bounding box of the geometry, updating {@link boundingBox | .boundingBox} attribute.
310
+ * @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
311
+ */
312
+ computeBoundingBox(): void;
153
313
 
154
314
  /**
155
- * Disposes the object from memory.
156
- * You need to call this when you want the bufferGeometry removed while the application is running.
315
+ * Computes bounding sphere of the geometry, updating {@link boundingSphere | .boundingSphere} attribute.
316
+ * @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
157
317
  */
158
- dispose(): void;
318
+ computeBoundingSphere(): void;
319
+
320
+ /**
321
+ * Calculates and adds a tangent attribute to this geometry.
322
+ * The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined
323
+ * @remarks
324
+ * When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
325
+ * {@link BufferGeometryUtils.computeMikkTSpaceTangents} instead.
326
+ */
327
+ computeTangents(): void;
159
328
 
160
329
  /**
161
- * @deprecated Use {@link BufferGeometry#groups .groups} instead.
330
+ * Computes vertex normals by averaging face normals.
162
331
  */
163
- drawcalls: any;
332
+ computeVertexNormals(): void;
164
333
 
165
334
  /**
166
- * @deprecated Use {@link BufferGeometry#groups .groups} instead.
335
+ * Every normal vector in a geometry will have a magnitude of 1
336
+ * @remarks This will correct lighting on the geometry surfaces.
167
337
  */
168
- offsets: any;
338
+ normalizeNormals(): void;
169
339
 
170
340
  /**
171
- * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead.
341
+ * Return a non-index version of an indexed BufferGeometry.
172
342
  */
173
- addIndex(index: any): void;
343
+ toNonIndexed(): BufferGeometry;
174
344
 
175
345
  /**
176
- * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead.
346
+ * Convert the buffer geometry to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
177
347
  */
178
- addDrawCall(start: any, count: any, indexOffset?: any): void;
348
+ toJSON(): {};
179
349
 
180
350
  /**
181
- * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead.
351
+ * Creates a clone of this BufferGeometry
182
352
  */
183
- clearDrawCalls(): void;
353
+ clone(): BufferGeometry;
184
354
 
185
355
  /**
186
- * @deprecated Use {@link BufferGeometry#setAttribute .setAttribute()} instead.
356
+ * Copies another BufferGeometry to this BufferGeometry.
357
+ * @param source
187
358
  */
188
- addAttribute(name: string, attribute: BufferAttribute | InterleavedBufferAttribute): BufferGeometry;
189
- addAttribute(name: any, array: any, itemSize: any): any;
359
+ copy(source: BufferGeometry): this;
190
360
 
191
361
  /**
192
- * @deprecated Use {@link BufferGeometry#deleteAttribute .deleteAttribute()} instead.
362
+ * Frees the GPU-related resources allocated by this instance.
363
+ * @remarks Call this method whenever this instance is no longer used in your app.
193
364
  */
194
- removeAttribute(name: string): BufferGeometry;
365
+ dispose(): void;
195
366
  }
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
  }