@types/three 0.149.0 → 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 (40) 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/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/nodes/shadernode/ShaderNode.d.ts +3 -4
  13. three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
  14. three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
  15. three/index.d.ts +1 -1
  16. three/package.json +19 -4
  17. three/src/Three.d.ts +0 -1
  18. three/src/constants.d.ts +394 -254
  19. three/src/core/BufferAttribute.d.ts +456 -85
  20. three/src/core/BufferGeometry.d.ts +235 -67
  21. three/src/core/Clock.d.ts +28 -20
  22. three/src/core/EventDispatcher.d.ts +20 -4
  23. three/src/core/GLBufferAttribute.d.ts +102 -8
  24. three/src/core/InstancedBufferAttribute.d.ts +13 -24
  25. three/src/core/InstancedBufferGeometry.d.ts +22 -4
  26. three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
  27. three/src/core/InterleavedBuffer.d.ts +98 -14
  28. three/src/core/InterleavedBufferAttribute.d.ts +146 -7
  29. three/src/core/Layers.d.ts +61 -6
  30. three/src/core/Object3D.d.ts +236 -119
  31. three/src/core/Raycaster.d.ts +103 -27
  32. three/src/core/Uniform.d.ts +28 -11
  33. three/src/core/UniformsGroup.d.ts +10 -4
  34. three/src/extras/Earcut.d.ts +3 -4
  35. three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
  36. three/src/math/Color.d.ts +157 -3
  37. three/src/math/ColorManagement.d.ts +13 -7
  38. three/src/renderers/WebGLRenderer.d.ts +2 -2
  39. three/src/utils.d.ts +5 -2
  40. three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
@@ -15,186 +15,216 @@ import { BufferGeometry } from './BufferGeometry';
15
15
  import { AnimationClip } from '../animation/AnimationClip';
16
16
 
17
17
  /**
18
- * Base class for scene graph objects
18
+ * This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space.
19
+ * @remarks Note that this can be used for grouping objects via the {@link THREE.Object3D.add | .add()} method which adds the object as a child,
20
+ * however it is better to use {@link THREE.Group | Group} for this.
21
+ * @see {@link https://threejs.org/docs/index.html#api/en/core/Object3D | Official Documentation}
22
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js | Source}
19
23
  */
20
24
  export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
25
+ /**
26
+ * This creates a new {@link Object3D} object.
27
+ */
21
28
  constructor();
22
29
 
23
30
  /**
24
- * Unique number of this object instance.
31
+ * Unique number for this object instance.
32
+ * @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
33
+ * @remarks Expects a `Integer`
25
34
  */
26
- id: number;
35
+ readonly id: number;
27
36
 
37
+ /**
38
+ * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
39
+ * @remarks This gets automatically assigned and shouldn't be edited.
40
+ */
28
41
  uuid: string;
29
42
 
30
43
  /**
31
44
  * Optional name of the object (doesn't need to be unique).
32
- * @default ''
45
+ * @defaultValue `''`
33
46
  */
34
47
  name: string;
35
48
 
36
49
  /**
37
- * @default 'Object3D'
50
+ * @defaultValue `Object3D`
38
51
  */
39
- type: string;
52
+ type: string; // TODO Replace for "Object3D" // TODO add readonly
40
53
 
41
54
  /**
42
- * Object's parent in the scene graph.
43
- * @default null
55
+ * Object's parent in the {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph}.
56
+ * @remarks An object can have at most one parent.
57
+ * @defaultValue `null`
44
58
  */
45
59
  parent: Object3D | null;
46
60
 
47
61
  /**
48
62
  * Array with object's children.
49
- * @default []
63
+ * @see {@link THREE.Object3DGroup | Group} for info on manually grouping objects.
64
+ * @defaultValue `[]`
50
65
  */
66
+
51
67
  children: Object3D[];
52
68
 
53
69
  /**
54
- * This is used by the {@link lookAt} method, for example, to determine the orientation of the result.
55
- *
56
- * Default is {@link Object3D.DEFAULT_UP} - that is, `( 0, 1, 0 )`.
57
- *
58
- * @default {@link Object3D.DEFAULT_UP}
70
+ * This is used by the {@link lookAt | lookAt} method, for example, to determine the orientation of the result.
71
+ * @defaultValue {@link DEFAULT_UP | Object3D.DEFAULT_UP} - that is `(0, 1, 0)`.
59
72
  */
60
73
  up: Vector3;
61
74
 
62
75
  /**
63
76
  * Object's local position.
64
- * @default new THREE.Vector3()
77
+ * @defaultValue `new THREE.Vector3()` - that is `(0, 0, 0)`.
65
78
  */
66
79
  readonly position: Vector3;
67
80
 
68
81
  /**
69
- * Object's local rotation (Euler angles), in radians.
70
- * @default new THREE.Euler()
82
+ * Object's local rotation ({@link https://en.wikipedia.org/wiki/Euler_angles | Euler angles}), in radians.
83
+ * @defaultValue `new THREE.Euler()` - that is `(0, 0, 0, Euler.DEFAULT_ORDER)`.
71
84
  */
72
85
  readonly rotation: Euler;
73
86
 
74
87
  /**
75
- * Object's local rotation as a Quaternion.
76
- * @default new THREE.Quaternion()
88
+ * Object's local rotation as a {@link THREE.Quaternion | Quaternion}.
89
+ * @defaultValue `new THREE.Quaternion()` - that is `(0, 0, 0, 1)`.
77
90
  */
78
91
  readonly quaternion: Quaternion;
79
92
 
80
93
  /**
81
- * Object's local scale.
82
- * @default new THREE.Vector3()
94
+ * The object's local scale.
95
+ * @defaultValue `new THREE.Vector3( 1, 1, 1 )`
83
96
  */
84
97
  readonly scale: Vector3;
85
98
 
86
99
  /**
87
- * @default new THREE.Matrix4()
100
+ * @defaultValue `new THREE.Matrix4()`
88
101
  */
89
102
  readonly modelViewMatrix: Matrix4;
90
103
 
91
104
  /**
92
- * @default new THREE.Matrix3()
105
+ * @defaultValue `new THREE.Matrix3()`
93
106
  */
94
107
  readonly normalMatrix: Matrix3;
95
108
 
96
109
  /**
97
- * Local transform.
98
- * @default new THREE.Matrix4()
110
+ * The local transform matrix.
111
+ * @defaultValue `new THREE.Matrix4()`
99
112
  */
100
113
  matrix: Matrix4;
101
114
 
102
115
  /**
103
- * The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.
104
- * @default new THREE.Matrix4()
116
+ * The global transform of the object.
117
+ * @remarks If the {@link Object3D} has no parent, then it's identical to the local transform {@link THREE.Object3D.matrix | .matrix}.
118
+ * @defaultValue `new THREE.Matrix4()`
105
119
  */
106
120
  matrixWorld: Matrix4;
107
121
 
108
122
  /**
109
123
  * When this is set, it calculates the matrix of position, (rotation or quaternion) and
110
- * scale every frame and also recalculates the matrixWorld property. Default is {@link Object3D.DEFAULT_MATRIX_AUTO_UPDATE} (true).
124
+ * scale every frame and also recalculates the matrixWorld property.
125
+ * @defaultValue {@link DEFAULT_MATRIX_AUTO_UPDATE} - that is `(true)`.
111
126
  */
112
127
  matrixAutoUpdate: boolean;
113
128
 
114
129
  /**
115
130
  * If set, then the renderer checks every frame if the object and its children need matrix updates.
116
131
  * When it isn't, then you have to maintain all matrices in the object and its children yourself.
117
- * Default is {@link Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE} (true).
132
+ * @defaultValue {@link DEFAULT_MATRIX_WORLD_AUTO_UPDATE} - that is `(true)`.
118
133
  */
119
134
  matrixWorldAutoUpdate: boolean;
120
135
 
121
136
  /**
122
137
  * When this is set, it calculates the matrixWorld in that frame and resets this property to false.
123
- * @default false
138
+ * @defaultValue `false`
124
139
  */
125
140
  matrixWorldNeedsUpdate: boolean;
126
141
 
127
142
  /**
128
- * @default new THREE.Layers()
143
+ * The layer membership of the object.
144
+ * @remarks The object is only visible if it has at least one layer in common with the {@link THREE.Object3DCamera | Camera} in use.
145
+ * @remarks This property can also be used to filter out unwanted objects in ray-intersection tests when using {@link THREE.Raycaster | Raycaster}.
146
+ * @defaultValue `new THREE.Layers()`
129
147
  */
130
148
  layers: Layers;
131
149
 
132
150
  /**
133
- * Object gets rendered if true.
134
- * @default true
151
+ * Object gets rendered if `true`.
152
+ * @defaultValue `true`
135
153
  */
136
154
  visible: boolean;
137
155
 
138
156
  /**
139
- * Gets rendered into shadow map.
140
- * @default false
157
+ * Whether the object gets rendered into shadow map.
158
+ * @defaultValue `false`
141
159
  */
142
160
  castShadow: boolean;
143
161
 
144
162
  /**
145
- * Material gets baked in shadow receiving.
146
- * @default false
163
+ * Whether the material receives shadows.
164
+ * @defaultValue `false`
147
165
  */
148
166
  receiveShadow: boolean;
149
167
 
150
168
  /**
151
169
  * When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object.
152
- * If set to false the object gets rendered every frame even if it is not in the frustum of the camera.
153
- * @default true
170
+ * If set to `false` the object gets rendered every frame even if it is not in the frustum of the camera.
171
+ * @defaultValue `true`
154
172
  */
155
173
  frustumCulled: boolean;
156
174
 
157
175
  /**
158
- * Overrides the default rendering order of scene graph objects, from lowest to highest renderOrder.
159
- * Opaque and transparent objects remain sorted independently though.
160
- * When this property is set for an instance of Group, all descendants objects will be sorted and rendered together.
161
- * @default 0
176
+ * This value allows the default rendering order of {@link https://en.wikipedia.org/wiki/Scene_graph | scene graph}
177
+ * objects to be overridden although opaque and transparent objects remain sorted independently.
178
+ * @remarks When this property is set for an instance of {@link Group | Group}, all descendants objects will be sorted and rendered together.
179
+ * @remarks Sorting is from lowest to highest renderOrder.
180
+ * @defaultValue `0`
162
181
  */
163
182
  renderOrder: number;
164
183
 
165
184
  /**
166
- * Array with animation clips.
167
- * @default []
185
+ * Array with object's animation clips.
186
+ * @defaultValue `[]`
168
187
  */
169
188
  animations: AnimationClip[];
170
189
 
171
190
  /**
172
- * An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.
173
- * @default {}
191
+ * An object that can be used to store custom data about the {@link Object3D}.
192
+ * @remarks It should not hold references to _functions_ as these **will not** be cloned.
193
+ * @default `{}`
174
194
  */
175
- userData: { [key: string]: any };
195
+ userData: { [key: string]: any }; // TODO Replace this to a Record?
176
196
 
177
197
  /**
178
- * Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes.
179
- * When shadow-casting with a DirectionalLight or SpotLight, if you are (a) modifying vertex positions in
180
- * the vertex shader, (b) using a displacement map, (c) using an alpha map with alphaTest, or (d) using a
181
- * transparent texture with alphaTest, you must specify a customDepthMaterial for proper shadows.
198
+ * Custom depth material to be used when rendering to the depth map.
199
+ * @remarks Can only be used in context of meshes.
200
+ * @remarks When shadow-casting with a {@link THREE.DirectionalLight | DirectionalLight} or {@link THREE.SpotLight | SpotLight},
201
+ * if you are modifying vertex positions in the vertex shader you must specify a customDepthMaterial for proper shadows.
202
+ * @defaultValue `undefined`
182
203
  */
183
- customDepthMaterial: Material;
204
+ customDepthMaterial?: Material | undefined;
184
205
 
185
206
  /**
186
- * Same as customDepthMaterial, but used with PointLight.
207
+ * Same as {@link customDepthMaterial}, but used with {@link THREE.Object3DPointLight | PointLight}.
208
+ * @defaultValue `undefined`
187
209
  */
188
- customDistanceMaterial: Material;
210
+ customDistanceMaterial?: Material | undefined;
189
211
 
190
212
  /**
191
- * Used to check whether this or derived classes are Object3Ds. Default is true.
192
- * You should not change this, as it is used internally for optimisation.
213
+ * Flag to check if a given object is of type {@link Object3D}.
214
+ * @remarks This is a _constant_ value
215
+ * @defaultValue `true`
193
216
  */
194
217
  readonly isObject3D: true;
195
218
 
196
219
  /**
197
- * Calls before rendering object
220
+ * An optional callback that is executed immediately before a 3D object is rendered.
221
+ * @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
222
+ * @remarks Please notice that this callback is only executed for `renderable` 3D objects.
223
+ * Meaning 3D objects which define their visual appearance with geometries and materials like
224
+ * instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}.
225
+ * Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone}
226
+ * are not renderable and thus this callback is not executed for such objects.
227
+ * @defaultValue `() => {}`
198
228
  */
199
229
  onBeforeRender: (
200
230
  renderer: WebGLRenderer,
@@ -206,7 +236,14 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
206
236
  ) => void;
207
237
 
208
238
  /**
209
- * Calls after rendering object
239
+ * An optional callback that is executed immediately after a 3D object is rendered.
240
+ * @remarks This function is called with the following parameters: renderer, scene, camera, geometry, material, group.
241
+ * @remarks Please notice that this callback is only executed for `renderable` 3D objects.
242
+ * Meaning 3D objects which define their visual appearance with geometries and materials like
243
+ * instances of {@link THREE.Object3DMesh | Mesh}, {@link THREE.Object3DLine | Line}, {@link THREE.Object3DPoints | Points} or {@link THREE.Object3DSprite | Sprite}.
244
+ * Instances of {@link THREE.Object3DObject3D | Object3D}, {@link THREE.Object3DGroup | Group} or {@link THREE.Object3DBone | Bone}
245
+ * are not renderable and thus this callback is not executed for such objects.
246
+ * @defaultValue `() => {}`
210
247
  */
211
248
  onAfterRender: (
212
249
  renderer: WebGLRenderer,
@@ -218,146 +255,165 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
218
255
  ) => void;
219
256
 
220
257
  /**
221
- * The default {@link up} direction for objects, also used as the default position for {@link DirectionalLight},
222
- * {@link HemisphereLight} and {@link Spotlight} (which creates lights shining from the top down).
223
- *
224
- * Set to ( 0, 1, 0 ) by default.
258
+ * The default {@link up} direction for objects, also used as the default position for {@link THREE.DirectionalLight | DirectionalLight},
259
+ * {@link THREE.HemisphereLight | HemisphereLight} and {@link THREE.Spotlight | Spotlight} (which creates lights shining from the top down).
260
+ * @defaultValue `new THREE.Vector3( 0, 1, 0)`
225
261
  */
226
262
  static DEFAULT_UP: Vector3;
227
263
 
228
264
  /**
229
265
  * The default setting for {@link matrixAutoUpdate} for newly created Object3Ds.
266
+ * @defaultValue `true`
230
267
  */
231
268
  static DEFAULT_MATRIX_AUTO_UPDATE: boolean;
232
269
 
233
270
  /**
234
271
  * The default setting for {@link matrixWorldAutoUpdate} for newly created Object3Ds.
272
+ * @defaultValue `true`
235
273
  */
236
274
  static DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean;
237
275
 
238
276
  /**
239
277
  * Applies the matrix transform to the object and updates the object's position, rotation and scale.
278
+ * @param matrix
240
279
  */
241
280
  applyMatrix4(matrix: Matrix4): void;
242
281
 
243
282
  /**
244
283
  * Applies the rotation represented by the quaternion to the object.
284
+ * @param quaternion
245
285
  */
246
286
  applyQuaternion(quaternion: Quaternion): this;
247
287
 
248
288
  /**
249
- * axis -- A normalized vector in object space.
250
- * angle -- angle in radians
289
+ * Calls {@link THREE.Quaternion.setFromAxisAngle | setFromAxisAngle}({@link axis}, {@link angle}) on the {@link quaternion | .quaternion}.
251
290
  * @param axis A normalized vector in object space.
252
- * @param angle angle in radians
291
+ * @param angle Angle in radians. Expects a `Float`
253
292
  */
254
293
  setRotationFromAxisAngle(axis: Vector3, angle: number): void;
255
294
 
256
295
  /**
257
- * Calls setRotationFromEuler(euler) on the .quaternion.
296
+ * Calls {@link THREE.Quaternion.setFromEuler | setFromEuler}({@link euler}) on the {@link quaternion | .quaternion}.
258
297
  * @param euler Euler angle specifying rotation amount.
259
298
  */
260
299
  setRotationFromEuler(euler: Euler): void;
261
300
 
262
301
  /**
263
- * Calls setFromRotationMatrix(m) on the .quaternion.
264
- *
265
- * Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
266
- * @param m rotate the quaternion by the rotation component of the matrix.
302
+ * Calls {@link THREE.Quaternion.setFromRotationMatrix | setFromRotationMatrix}({@link m}) on the {@link quaternion | .quaternion}.
303
+ * @remarks Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).
304
+ * @param m Rotate the quaternion by the rotation component of the matrix.
267
305
  */
268
306
  setRotationFromMatrix(m: Matrix4): void;
269
307
 
270
308
  /**
271
- * Copy the given quaternion into .quaternion.
272
- * @param q normalized Quaternion
309
+ * Copy the given {@link THREE.Quaternion | Quaternion} into {@link quaternion | .quaternion}.
310
+ * @param q Normalized Quaternion.
273
311
  */
274
312
  setRotationFromQuaternion(q: Quaternion): void;
275
313
 
276
314
  /**
277
- * Rotate an object along an axis in object space. The axis is assumed to be normalized.
278
- * @param axis A normalized vector in object space.
279
- * @param angle The angle in radians.
315
+ * Rotate an object along an axis in object space.
316
+ * @remarks The axis is assumed to be normalized.
317
+ * @param axis A normalized vector in object space.
318
+ * @param angle The angle in radians. Expects a `Float`
280
319
  */
281
320
  rotateOnAxis(axis: Vector3, angle: number): this;
282
321
 
283
322
  /**
284
- * Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent.
285
- * @param axis A normalized vector in object space.
286
- * @param angle The angle in radians.
323
+ * Rotate an object along an axis in world space.
324
+ * @remarks The axis is assumed to be normalized
325
+ * @remarks Method Assumes no rotated parent.
326
+ * @param axis A normalized vector in world space.
327
+ * @param angle The angle in radians. Expects a `Float`
287
328
  */
288
329
  rotateOnWorldAxis(axis: Vector3, angle: number): this;
289
330
 
290
331
  /**
291
- * Rotates the object around x axis in local space.
292
- * @param angle the angle to rotate in radians.
332
+ * Rotates the object around _x_ axis in local space.
333
+ * @param rad The angle to rotate in radians. Expects a `Float`
293
334
  */
294
335
  rotateX(angle: number): this;
295
336
 
296
337
  /**
297
- * Rotates the object around y axis in local space.
298
- * @param angle the angle to rotate in radians.
338
+ * Rotates the object around _y_ axis in local space.
339
+ * @param rad The angle to rotate in radians. Expects a `Float`
299
340
  */
300
341
  rotateY(angle: number): this;
301
342
 
302
343
  /**
303
- * Rotates the object around z axis in local space.
304
- * @param angle the angle to rotate in radians.
344
+ * Rotates the object around _z_ axis in local space.
345
+ * @param rad The angle to rotate in radians. Expects a `Float`
305
346
  */
306
347
  rotateZ(angle: number): this;
307
348
 
308
349
  /**
309
- * Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
310
- * @param axis A normalized vector in object space.
311
- * @param distance The distance to translate.
350
+ * Translate an object by distance along an axis in object space
351
+ * @remarks The axis is assumed to be normalized.
352
+ * @param axis A normalized vector in object space.
353
+ * @param distance The distance to translate. Expects a `Float`
312
354
  */
313
355
  translateOnAxis(axis: Vector3, distance: number): this;
314
356
 
315
357
  /**
316
- * Translates object along x axis by distance.
317
- * @param distance Distance.
358
+ * Translates object along x axis in object space by {@link distance} units.
359
+ * @param distance Expects a `Float`
318
360
  */
319
361
  translateX(distance: number): this;
320
362
 
321
363
  /**
322
- * Translates object along y axis by distance.
323
- * @param distance Distance.
364
+ * Translates object along _y_ axis in object space by {@link distance} units.
365
+ * @param distance Expects a `Float`
324
366
  */
325
367
  translateY(distance: number): this;
326
368
 
327
369
  /**
328
- * Translates object along z axis by distance.
329
- * @param distance Distance.
370
+ * Translates object along _z_ axis in object space by {@link distance} units.
371
+ * @param distance Expects a `Float`
330
372
  */
331
373
  translateZ(distance: number): this;
332
374
 
333
375
  /**
334
- * Updates the vector from local space to world space.
335
- * @param vector A local vector.
376
+ * Converts the vector from this object's local space to world space.
377
+ * @param vector A vector representing a position in this object's local space.
336
378
  */
337
379
  localToWorld(vector: Vector3): Vector3;
338
380
 
339
381
  /**
340
- * Updates the vector from world space to local space.
341
- * @param vector A world vector.
382
+ * Converts the vector from world space to this object's local space.
383
+ * @param vector A vector representing a position in world space.
342
384
  */
343
385
  worldToLocal(vector: Vector3): Vector3;
344
386
 
345
387
  /**
346
- * Optionally, the x, y and z components of the world space position.
347
388
  * Rotates the object to face a point in world space.
348
- * This method does not support objects having non-uniformly-scaled parent(s).
349
- * @param vector A world vector to look at.
389
+ * @remarks This method does not support objects having non-uniformly-scaled parent(s).
390
+ * @param vector A vector representing a position in world space to look at.
350
391
  */
351
392
  lookAt(vector: Vector3): void;
393
+ /**
394
+ * Rotates the object to face a point in world space.
395
+ * @remarks This method does not support objects having non-uniformly-scaled parent(s).
396
+ * @param x Expects a `Float`
397
+ * @param y Expects a `Float`
398
+ * @param z Expects a `Float`
399
+ */
352
400
  lookAt(x: number, y: number, z: number): void;
353
401
 
354
402
  /**
355
- * Adds object as child of this object.
403
+ * Adds another {@link Object3D} as child of this {@link Object3D}.
404
+ * @remarks An arbitrary number of objects may be added
405
+ * @remarks Any current parent on an {@link object} passed in here will be removed, since an {@link Object3D} can have at most one parent.
406
+ * @see {@link attach}
407
+ * @see {@link THREE.Group | Group} for info on manually grouping objects.
408
+ * @param object
356
409
  */
357
410
  add(...object: Object3D[]): this;
358
411
 
359
412
  /**
360
- * Removes object as child of this object.
413
+ * Removes a {@link Object3D} as child of this {@link Object3D}.
414
+ * @remarks An arbitrary number of objects may be removed.
415
+ * @see {@link THREE.Group | Group} for info on manually grouping objects.
416
+ * @param object
361
417
  */
362
418
  remove(...object: Object3D[]): this;
363
419
 
@@ -372,19 +428,26 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
372
428
  clear(): this;
373
429
 
374
430
  /**
375
- * Adds object as a child of this, while maintaining the object's world transform.
431
+ * Adds a {@link Object3D} as a child of this, while maintaining the object's world transform.
432
+ * @remarks Note: This method does not support scene graphs having non-uniformly-scaled nodes(s).
433
+ * @see {@link add}
434
+ * @param object
376
435
  */
377
436
  attach(object: Object3D): this;
378
437
 
379
438
  /**
380
- * Searches through the object's children and returns the first with a matching id.
381
- * @param id Unique number of the object instance
439
+ * Searches through an object and its children, starting with the object itself, and returns the first with a matching id.
440
+ * @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
441
+ * @see {@link id}
442
+ * @param id Unique number of the object instance. Expects a `Integer`
382
443
  */
383
444
  getObjectById(id: number): Object3D | undefined;
384
445
 
385
446
  /**
386
- * Searches through the object's children and returns the first with a matching name.
387
- * @param name String to match to the children's Object3d.name property.
447
+ * Searches through an object and its children, starting with the object itself, and returns the first with a matching name.
448
+ * @remarks Note that for most objects the name is an empty string by default
449
+ * @remarks You will have to set it manually to make use of this method.
450
+ * @param name String to match to the children's Object3D.name property.
388
451
  */
389
452
  getObjectByName(name: string): Object3D | undefined;
390
453
 
@@ -399,24 +462,66 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
399
462
 
400
463
  /**
401
464
  * Searches through an object and its children, starting with the object itself,
402
- * and returns all the objects with a property that matches the value given.
403
- *
404
- * @param name - the property name to search for.
405
- * @param value - value of the given property.
465
+ * and returns the first with a property that matches the value given.
466
+ * @param name The property name to search for.
467
+ * @param value Value of the given property.
406
468
  */
407
469
  getObjectsByProperty(name: string, value: any): Object3D[];
408
470
 
471
+ /**
472
+ * Returns a vector representing the position of the object in world space.
473
+ * @param target The result will be copied into this Vector3.
474
+ */
409
475
  getWorldPosition(target: Vector3): Vector3;
476
+
477
+ /**
478
+ * Returns a quaternion representing the rotation of the object in world space.
479
+ * @param target The result will be copied into this Quaternion.
480
+ */
410
481
  getWorldQuaternion(target: Quaternion): Quaternion;
482
+
483
+ /**
484
+ * Returns a vector of the scaling factors applied to the object for each axis in world space.
485
+ * @param target The result will be copied into this Vector3.
486
+ */
411
487
  getWorldScale(target: Vector3): Vector3;
488
+
489
+ /**
490
+ * Returns a vector representing the direction of object's positive z-axis in world space.
491
+ * @param target The result will be copied into this Vector3.
492
+ */
412
493
  getWorldDirection(target: Vector3): Vector3;
413
494
 
495
+ /**
496
+ * Abstract (empty) method to get intersections between a casted ray and this object
497
+ * @remarks Subclasses such as {@link THREE.Mesh | Mesh}, {@link THREE.Line | Line}, and {@link THREE.Points | Points} implement this method in order to use raycasting.
498
+ * @see {@link THREE.Raycaster | Raycaster}
499
+ * @param raycaster
500
+ * @param intersects
501
+ * @defaultValue `() => {}`
502
+ */
414
503
  raycast(raycaster: Raycaster, intersects: Intersection[]): void;
415
504
 
505
+ /**
506
+ * Executes the callback on this object and all descendants.
507
+ * @remarks Note: Modifying the scene graph inside the callback is discouraged.
508
+ * @param callback A function with as first argument an {@link Object3D} object.
509
+ */
416
510
  traverse(callback: (object: Object3D) => any): void;
417
511
 
512
+ /**
513
+ * Like traverse, but the callback will only be executed for visible objects
514
+ * @remarks Descendants of invisible objects are not traversed.
515
+ * @remarks Note: Modifying the scene graph inside the callback is discouraged.
516
+ * @param callback A function with as first argument an {@link Object3D} object.
517
+ */
418
518
  traverseVisible(callback: (object: Object3D) => any): void;
419
519
 
520
+ /**
521
+ * Executes the callback on all ancestors.
522
+ * @remarks Note: Modifying the scene graph inside the callback is discouraged.
523
+ * @param callback A function with as first argument an {@link Object3D} object.
524
+ */
420
525
  traverseAncestors(callback: (object: Object3D) => any): void;
421
526
 
422
527
  /**
@@ -425,25 +530,37 @@ export class Object3D<E extends BaseEvent = Event> extends EventDispatcher<E> {
425
530
  updateMatrix(): void;
426
531
 
427
532
  /**
428
- * Updates global transform of the object and its children.
533
+ * Updates the global transform of the object.
534
+ * And will update the object descendants if {@link matrixWorldNeedsUpdate | .matrixWorldNeedsUpdate} is set to true or if the {@link force} parameter is set to `true`.
535
+ * @param force A boolean that can be used to bypass {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate}, to recalculate the world matrix of the object and descendants on the current frame.
536
+ * Useful if you cannot wait for the renderer to update it on the next frame, assuming {@link matrixWorldAutoUpdate | .matrixWorldAutoUpdate} set to `true`.
429
537
  */
430
538
  updateMatrixWorld(force?: boolean): void;
431
539
 
432
540
  /**
433
541
  * Updates the global transform of the object.
434
- * @param updateParents recursively updates global transform of ancestors.
435
- * @param updateChildren recursively updates global transform of descendants.
542
+ * @param updateParents Recursively updates global transform of ancestors.
543
+ * @param updateChildren Recursively updates global transform of descendants.
436
544
  */
437
545
  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
438
546
 
547
+ /**
548
+ * Convert the object to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
549
+ * @param meta Object containing metadata such as materials, textures or images for the object.
550
+ */
439
551
  toJSON(meta?: { geometries: any; materials: any; textures: any; images: any }): any;
440
552
 
553
+ /**
554
+ * Returns a clone of this object and optionally all descendants.
555
+ * @param recursive If true, descendants of the object are also cloned. Default `true`
556
+ */
441
557
  clone(recursive?: boolean): this;
442
558
 
443
559
  /**
444
- *
445
- * @param object
446
- * @param recursive
560
+ * Copy the given object into this object
561
+ * @remarks Note: event listeners and user-defined callbacks ({@link onAfterRender | .onAfterRender} and {@link onBeforeRender | .onBeforeRender}) are not copied.
562
+ * @param source
563
+ * @param recursive If true, descendants of the object are also copied. Default `true`
447
564
  */
448
- copy(source: this, recursive?: boolean): this;
565
+ copy(source: Object3D, recursive?: boolean): this;
449
566
  }