@types/three 0.150.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 (74) 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/audio/Audio.d.ts +184 -20
  10. three/src/audio/AudioAnalyser.d.ts +42 -4
  11. three/src/audio/AudioContext.d.ts +12 -1
  12. three/src/audio/AudioListener.d.ts +76 -8
  13. three/src/audio/PositionalAudio.d.ts +86 -5
  14. three/src/cameras/ArrayCamera.d.ts +23 -2
  15. three/src/cameras/Camera.d.ts +42 -13
  16. three/src/cameras/CubeCamera.d.ts +49 -1
  17. three/src/cameras/OrthographicCamera.d.ts +77 -25
  18. three/src/cameras/PerspectiveCamera.d.ts +132 -56
  19. three/src/cameras/StereoCamera.d.ts +29 -2
  20. three/src/constants.d.ts +431 -26
  21. three/src/core/BufferGeometry.d.ts +5 -3
  22. three/src/core/Object3D.d.ts +17 -13
  23. three/src/core/Raycaster.d.ts +1 -0
  24. three/src/geometries/BoxGeometry.d.ts +39 -16
  25. three/src/geometries/CapsuleGeometry.d.ts +35 -12
  26. three/src/geometries/CircleGeometry.d.ts +38 -12
  27. three/src/geometries/ConeGeometry.d.ts +45 -10
  28. three/src/geometries/CylinderGeometry.d.ts +41 -19
  29. three/src/geometries/DodecahedronGeometry.d.ts +14 -5
  30. three/src/geometries/EdgesGeometry.d.ts +30 -8
  31. three/src/geometries/ExtrudeGeometry.d.ts +93 -12
  32. three/src/geometries/IcosahedronGeometry.d.ts +15 -5
  33. three/src/geometries/LatheGeometry.d.ts +41 -12
  34. three/src/geometries/OctahedronGeometry.d.ts +14 -5
  35. three/src/geometries/PlaneGeometry.d.ts +35 -12
  36. three/src/geometries/PolyhedronGeometry.d.ts +41 -12
  37. three/src/geometries/RingGeometry.d.ts +39 -16
  38. three/src/geometries/ShapeGeometry.d.ts +44 -4
  39. three/src/geometries/SphereGeometry.d.ts +43 -21
  40. three/src/geometries/TetrahedronGeometry.d.ts +14 -5
  41. three/src/geometries/TorusGeometry.d.ts +35 -13
  42. three/src/geometries/TorusKnotGeometry.d.ts +39 -16
  43. three/src/geometries/TubeGeometry.d.ts +63 -15
  44. three/src/geometries/WireframeGeometry.d.ts +30 -4
  45. three/src/math/ColorManagement.d.ts +2 -2
  46. three/src/objects/Bone.d.ts +30 -3
  47. three/src/objects/Group.d.ts +37 -1
  48. three/src/objects/InstancedMesh.d.ts +122 -3
  49. three/src/objects/LOD.d.ts +62 -18
  50. three/src/objects/Line.d.ts +67 -4
  51. three/src/objects/LineLoop.d.ts +26 -1
  52. three/src/objects/LineSegments.d.ts +21 -9
  53. three/src/objects/Mesh.d.ts +60 -4
  54. three/src/objects/Points.d.ts +39 -8
  55. three/src/objects/Skeleton.d.ts +89 -3
  56. three/src/objects/SkinnedMesh.d.ts +122 -3
  57. three/src/objects/Sprite.d.ts +51 -4
  58. three/src/renderers/WebGLRenderTarget.d.ts +9 -3
  59. three/src/scenes/Fog.d.ts +59 -7
  60. three/src/scenes/FogExp2.d.ts +41 -6
  61. three/src/scenes/Scene.d.ts +45 -22
  62. three/src/textures/CanvasTexture.d.ts +35 -13
  63. three/src/textures/CompressedArrayTexture.d.ts +39 -5
  64. three/src/textures/CompressedTexture.d.ts +49 -20
  65. three/src/textures/CubeTexture.d.ts +71 -18
  66. three/src/textures/Data3DTexture.d.ts +74 -10
  67. three/src/textures/DataArrayTexture.d.ts +83 -9
  68. three/src/textures/DataTexture.d.ts +81 -26
  69. three/src/textures/DepthTexture.d.ts +71 -15
  70. three/src/textures/FramebufferTexture.d.ts +57 -2
  71. three/src/textures/Source.d.ts +23 -13
  72. three/src/textures/Texture.d.ts +289 -73
  73. three/src/textures/VideoTexture.d.ts +69 -13
  74. three/src/textures/types.d.ts +9 -0
@@ -3,23 +3,35 @@ import { Line } from './Line';
3
3
  import { BufferGeometry } from '../core/BufferGeometry';
4
4
 
5
5
  /**
6
- * @deprecated
6
+ * A series of lines drawn between pairs of vertices.
7
+ * @remarks
8
+ * This is nearly the same as {@link THREE.Line | Line},
9
+ * the only difference is that it is rendered using {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements | gl.LINES}
10
+ * instead of {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements | gl.LINE_STRIP}.
11
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/LineSegments | Official Documentation}
12
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/LineSegments.js | Source}
7
13
  */
8
- export const LineStrip: number;
9
- /**
10
- * @deprecated
11
- */
12
- export const LinePieces: number;
13
-
14
14
  export class LineSegments<
15
15
  TGeometry extends BufferGeometry = BufferGeometry,
16
16
  TMaterial extends Material | Material[] = Material | Material[],
17
17
  > extends Line<TGeometry, TMaterial> {
18
+ /**
19
+ * Create a new instance of {@link LineSegments}
20
+ * @param geometry Pair(s) of vertices representing each line segment(s). Default {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
21
+ * @param material Material for the line. Default {@link THREE.LineBasicMaterial | `new THREE.LineBasicMaterial()`}.
22
+ */
18
23
  constructor(geometry?: TGeometry, material?: TMaterial);
19
24
 
20
25
  /**
21
- * @default 'LineSegments'
26
+ * Read-only flag to check if a given object is of type {@link LineSegments}.
27
+ * @remarks This is a _constant_ value
28
+ * @defaultValue `true`
22
29
  */
23
- type: 'LineSegments' | string;
24
30
  readonly isLineSegments: true;
31
+
32
+ /**
33
+ * @override
34
+ * @defaultValue `LineSegments`
35
+ */
36
+ override readonly type: string | 'LineSegments';
25
37
  }
@@ -5,26 +5,82 @@ import { BufferGeometry } from '../core/BufferGeometry';
5
5
  import { Intersection } from '../core/Raycaster';
6
6
  import { Vector3 } from '../math/Vector3';
7
7
 
8
+ /**
9
+ * Class representing triangular {@link https://en.wikipedia.org/wiki/Polygon_mesh | polygon mesh} based objects.
10
+ * @remarks
11
+ * Also serves as a base for other classes such as {@link THREE.SkinnedMesh | SkinnedMesh}, {@link THREE.InstancedMesh | InstancedMesh}.
12
+ * @example
13
+ * ```typescript
14
+ * const geometry = new THREE.BoxGeometry(1, 1, 1);
15
+ * const material = new THREE.MeshBasicMaterial({
16
+ * color: 0xffff00
17
+ * });
18
+ * const {@link Mesh} = new THREE.Mesh(geometry, material);
19
+ * scene.add(mesh);
20
+ * ```
21
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/Mesh | Official Documentation}
22
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Mesh.js | Source}
23
+ */
8
24
  export class Mesh<
9
25
  TGeometry extends BufferGeometry = BufferGeometry,
10
26
  TMaterial extends Material | Material[] = Material | Material[],
11
27
  > extends Object3D {
28
+ /**
29
+ * Create a new instance of {@link Mesh}
30
+ * @param geometry An instance of {@link THREE.BufferGeometry | BufferGeometry}. Default {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
31
+ * @param material A single or an array of {@link THREE.Material | Material}. Default {@link THREE.MeshBasicMaterial | `new THREE.MeshBasicMaterial()`}.
32
+ */
12
33
  constructor(geometry?: TGeometry, material?: TMaterial);
13
34
 
35
+ /**
36
+ * Read-only flag to check if a given object is of type {@link Mesh}.
37
+ * @remarks This is a _constant_ value
38
+ * @defaultValue `true`
39
+ */
40
+ readonly isMesh: true;
41
+
42
+ /**
43
+ * @override
44
+ * @defaultValue `Mesh`
45
+ */
46
+ override readonly type: string | 'Mesh';
47
+
48
+ /**
49
+ * An instance of {@link THREE.BufferGeometry | BufferGeometry} (or derived classes), defining the object's structure.
50
+ * @defaultValue {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
51
+ */
14
52
  geometry: TGeometry;
53
+
54
+ /**
55
+ * An instance of material derived from the {@link THREE.Material | Material} base class or an array of materials, defining the object's appearance.
56
+ * @defaultValue {@link THREE.MeshBasicMaterial | `new THREE.MeshBasicMaterial()`}.
57
+ */
15
58
  material: TMaterial;
59
+
60
+ /**
61
+ * An array of weights typically from `0-1` that specify how much of the morph is applied.
62
+ * @defaultValue `undefined`, _but reset to a blank array by {@link updateMorphTargets | .updateMorphTargets()}._
63
+ */
16
64
  morphTargetInfluences?: number[] | undefined;
65
+
66
+ /**
67
+ * A dictionary of morphTargets based on the `morphTarget.name` property.
68
+ * @defaultValue `undefined`, _but rebuilt by {@link updateMorphTargets | .updateMorphTargets()}._
69
+ *
70
+ */
17
71
  morphTargetDictionary?: { [key: string]: number } | undefined;
18
- readonly isMesh: true;
19
- type: string;
20
72
 
73
+ /**
74
+ * Updates the morphTargets to have no influence on the object
75
+ * @remarks Resets the {@link morphTargetInfluences} and {@link morphTargetDictionary} properties.
76
+ */
21
77
  updateMorphTargets(): void;
22
78
 
23
79
  /**
24
80
  * Get the local-space position of the vertex at the given index,
25
81
  * taking into account the current animation state of both morph targets and skinning.
82
+ * @param index Expects a `Integer`
83
+ * @param target
26
84
  */
27
85
  getVertexPosition(index: number, target: Vector3): Vector3;
28
-
29
- raycast(raycaster: Raycaster, intersects: Intersection[]): void;
30
86
  }
@@ -5,33 +5,64 @@ import { BufferGeometry } from '../core/BufferGeometry';
5
5
  import { Intersection } from '../core/Raycaster';
6
6
 
7
7
  /**
8
- * A class for displaying points. The points are rendered by the WebGLRenderer using gl.POINTS.
8
+ * A class for displaying {@link Points}
9
+ * @remarks
10
+ * The {@link Points} are rendered by the {@link THREE.WebGLRenderer | WebGLRenderer} using {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements | gl.POINTS}.
11
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/Points | Official Documentation}
12
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Points.js | Source}
9
13
  */
10
14
  export class Points<
11
15
  TGeometry extends BufferGeometry = BufferGeometry,
12
16
  TMaterial extends Material | Material[] = Material | Material[],
13
17
  > extends Object3D {
14
18
  /**
15
- * @param geometry An instance of BufferGeometry.
16
- * @param material An instance of Material (optional).
19
+ * Create a new instance of {@link Points}
20
+ * @param geometry An instance of {@link THREE.BufferGeometry | BufferGeometry}. Default {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
21
+ * @param material A single or an array of {@link THREE.Material | Material}. Default {@link THREE.PointsMaterial | `new THREE.PointsMaterial()`}.
17
22
  */
18
23
  constructor(geometry?: TGeometry, material?: TMaterial);
19
24
 
20
- type: 'Points';
25
+ /**
26
+ * Read-only flag to check if a given object is of type {@link Points}.
27
+ * @remarks This is a _constant_ value
28
+ * @defaultValue `true`
29
+ */
30
+ readonly isPoints: true;
31
+
32
+ /**
33
+ * @override
34
+ * @defaultValue `Points`
35
+ */
36
+ override readonly type: string | 'Points';
37
+
38
+ /**
39
+ * An array of weights typically from `0-1` that specify how much of the morph is applied.
40
+ * @defaultValue `undefined`, _but reset to a blank array by {@link updateMorphTargets | .updateMorphTargets()}._
41
+ */
21
42
  morphTargetInfluences?: number[] | undefined;
43
+
44
+ /**
45
+ * A dictionary of morphTargets based on the `morphTarget.name` property.
46
+ * @defaultValue `undefined`, _but rebuilt by {@link updateMorphTargets | .updateMorphTargets()}._
47
+ *
48
+ */
22
49
  morphTargetDictionary?: { [key: string]: number } | undefined;
23
- readonly isPoints: true;
24
50
 
25
51
  /**
26
- * An instance of BufferGeometry, where each vertex designates the position of a particle in the system.
52
+ * An instance of {@link THREE.BufferGeometry | BufferGeometry} (or derived classes), defining the object's structure.
53
+ * @remarks each vertex designates the position of a particle in the system.
27
54
  */
28
55
  geometry: TGeometry;
29
56
 
30
57
  /**
31
- * An instance of Material, defining the object's appearance. Default is a PointsMaterial with randomised colour.
58
+ * An instance of {@link THREE.Material | Material}, defining the object's appearance.
59
+ * @defaultValue {@link THREE.PointsMaterial | `new THREE.PointsMaterial()`}, _with randomised colour_.
32
60
  */
33
61
  material: TMaterial;
34
62
 
35
- raycast(raycaster: Raycaster, intersects: Intersection[]): void;
63
+ /**
64
+ * Updates the morphTargets to have no influence on the object
65
+ * @remarks Resets the {@link morphTargetInfluences} and {@link morphTargetDictionary} properties.
66
+ */
36
67
  updateMorphTargets(): void;
37
68
  }
@@ -2,28 +2,114 @@ import { Bone } from './Bone';
2
2
  import { Matrix4 } from './../math/Matrix4';
3
3
  import { DataTexture } from './../textures/DataTexture';
4
4
 
5
+ /**
6
+ * Use an array of {@link Bone | bones} to create a {@link Skeleton} that can be used by a {@link THREE.SkinnedMesh | SkinnedMesh}.
7
+ * @example
8
+ * ```typescript
9
+ * // Create a simple "arm"
10
+ * const bones = [];
11
+ * const shoulder = new THREE.Bone();
12
+ * const elbow = new THREE.Bone();
13
+ * const hand = new THREE.Bone();
14
+ * shoulder.add(elbow);
15
+ * elbow.add(hand);
16
+ * bones.push(shoulder);
17
+ * bones.push(elbow);
18
+ * bones.push(hand);
19
+ * shoulder.position.y = -5;
20
+ * elbow.position.y = 0;
21
+ * hand.position.y = 5;
22
+ * const armSkeleton = new THREE.Skeleton(bones);
23
+ * See the[page: SkinnedMesh] page
24
+ * for an example of usage with standard[page: BufferGeometry].
25
+ * ```
26
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/Skeleton | Official Documentation}
27
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Skeleton.js | Source}
28
+ */
5
29
  export class Skeleton {
30
+ /**
31
+ * Creates a new Skeleton.
32
+ * @param bones The array of {@link THREE.Bone | bones}. Default `[]`.
33
+ * @param boneInverses An array of {@link THREE.Matrix4 | Matrix4s}. Default `[]`.
34
+ */
6
35
  constructor(bones: Bone[], boneInverses?: Matrix4[]);
7
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
+ */
8
41
  uuid: string;
42
+
43
+ /**
44
+ * The array of {@link THREE.Bone | Bones}.
45
+ * @remarks Note this is a copy of the original array, not a reference, so you can modify the original array without effecting this one.
46
+ */
9
47
  bones: Bone[];
48
+
49
+ /**
50
+ * An array of {@link Matrix4 | Matrix4s} that represent the inverse of the {@link THREE.Matrix4 | matrixWorld} of the individual bones.
51
+ */
10
52
  boneInverses: Matrix4[];
53
+
54
+ /**
55
+ * The array buffer holding the bone data when using a vertex texture.
56
+ */
11
57
  boneMatrices: Float32Array;
58
+
59
+ /**
60
+ * The {@link THREE.DataTexture | DataTexture} holding the bone data when using a vertex texture.
61
+ */
12
62
  boneTexture: null | DataTexture;
63
+
64
+ /**
65
+ * The size of the {@link boneTexture | .boneTexture}.
66
+ * @remarks Expects a `Integer`
67
+ */
13
68
  boneTextureSize: number;
69
+
14
70
  frame: number;
15
71
 
16
72
  init(): void;
73
+
74
+ /**
75
+ * Generates the {@link boneInverses} array if not provided in the constructor.
76
+ */
17
77
  calculateInverses(): void;
78
+
79
+ /**
80
+ * Computes an instance of {@link THREE.DataTexture | DataTexture} in order to pass the bone data more efficiently to the shader
81
+ * @remarks
82
+ * The texture is assigned to {@link boneTexture}.
83
+ */
18
84
  computeBoneTexture(): this;
85
+
86
+ /**
87
+ * Returns the skeleton to the base pose.
88
+ */
19
89
  pose(): void;
90
+
91
+ /**
92
+ * Updates the {@link boneMatrices} and {@link boneTexture} after changing the bones
93
+ * @remarks
94
+ * This is called automatically by the {@link THREE.WebGLRenderer | WebGLRenderer} if the {@link Skeleton} is used with a {@link THREE.SkinnedMesh | SkinnedMesh}.
95
+ */
20
96
  update(): void;
97
+
98
+ /**
99
+ * Returns a clone of this {@link Skeleton} object.
100
+ */
21
101
  clone(): Skeleton;
102
+
103
+ /**
104
+ * Searches through the skeleton's bone array and returns the first with a matching name.
105
+ * @param name String to match to the Bone's {@link THREE.Bone.name | .name} property.
106
+ */
22
107
  getBoneByName(name: string): undefined | Bone;
23
- dispose(): void;
24
108
 
25
109
  /**
26
- * @deprecated This property has been removed completely.
110
+ * Frees the GPU-related resources allocated by this instance
111
+ * @remarks
112
+ * Call this method whenever this instance is no longer used in your app.
27
113
  */
28
- useVertexTexture: boolean;
114
+ dispose(): void;
29
115
  }
@@ -5,21 +5,140 @@ import { Skeleton } from './Skeleton';
5
5
  import { Mesh } from './Mesh';
6
6
  import { BufferGeometry } from '../core/BufferGeometry';
7
7
 
8
+ /**
9
+ * A mesh that has a {@link THREE.Skeleton | Skeleton} with {@link Bone | bones} that can then be used to animate the vertices of the geometry.
10
+ * @remarks
11
+ * {@link SkinnedMesh} can only be used with WebGL 2 or
12
+ * With WebGL 1 `OES_texture_float` and vertex textures support is required.
13
+ * @example
14
+ * ```typescript
15
+ * const geometry = new THREE.CylinderGeometry(5, 5, 5, 5, 15, 5, 30);
16
+ * // create the skin indices and skin weights manually
17
+ * // (typically a loader would read this data from a 3D model for you)
18
+ * const position = geometry.attributes.position;
19
+ * const vertex = new THREE.Vector3();
20
+ * const skinIndices = [];
21
+ * const skinWeights = [];
22
+ * for (let i = 0; i & lt; position.count; i++) {
23
+ * vertex.fromBufferAttribute(position, i);
24
+ * // compute skinIndex and skinWeight based on some configuration data
25
+ * const y = (vertex.y + sizing.halfHeight);
26
+ * const skinIndex = Math.floor(y / sizing.segmentHeight);
27
+ * const skinWeight = (y % sizing.segmentHeight) / sizing.segmentHeight;
28
+ * skinIndices.push(skinIndex, skinIndex + 1, 0, 0);
29
+ * skinWeights.push(1 - skinWeight, skinWeight, 0, 0);
30
+ * }
31
+ * geometry.setAttribute('skinIndex', new THREE.Uint16BufferAttribute(skinIndices, 4));
32
+ * geometry.setAttribute('skinWeight', new THREE.Float32BufferAttribute(skinWeights, 4));
33
+ * // create skinned mesh and skeleton
34
+ * const mesh = new THREE.SkinnedMesh(geometry, material);
35
+ * const skeleton = new THREE.Skeleton(bones);
36
+ * // see example from THREE.Skeleton
37
+ * const rootBone = skeleton.bones[0];
38
+ * mesh.add(rootBone);
39
+ * // bind the skeleton to the mesh
40
+ * mesh.bind(skeleton);
41
+ * // move the bones and manipulate the model
42
+ * skeleton.bones[0].rotation.x = -0.1;
43
+ * skeleton.bones[1].rotation.x = 0.2;
44
+ * ```
45
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/SkinnedMesh | Official Documentation}
46
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/SkinnedMesh.js | Source}
47
+ */
8
48
  export class SkinnedMesh<
9
49
  TGeometry extends BufferGeometry = BufferGeometry,
10
50
  TMaterial extends Material | Material[] = Material | Material[],
11
51
  > extends Mesh<TGeometry, TMaterial> {
52
+ /**
53
+ * Create a new instance of {@link SkinnedMesh}
54
+ * @param geometry An instance of {@link THREE.BufferGeometry | BufferGeometry}. Default {@link THREE.BufferGeometry | `new THREE.BufferGeometry()`}.
55
+ * @param material A single or an array of {@link THREE.Material | Material}. Default {@link THREE.MeshBasicMaterial | `new THREE.MeshBasicMaterial()`}.
56
+ */
12
57
  constructor(geometry?: TGeometry, material?: TMaterial, useVertexTexture?: boolean);
13
58
 
14
- bindMode: string;
59
+ /**
60
+ * Read-only flag to check if a given object is of type {@link SkinnedMesh}.
61
+ * @remarks This is a _constant_ value
62
+ * @defaultValue `true`
63
+ */
64
+ readonly isSkinnedMesh: true;
65
+
66
+ /**
67
+ * @override
68
+ * @defaultValue `SkinnedMesh`
69
+ */
70
+ override readonly type: string | 'SkinnedMesh';
71
+
72
+ /**
73
+ * Either `attached` or `detached`.
74
+ * - `attached` uses the {@link THREE.SkinnedMesh.matrixWorld | SkinnedMesh.matrixWorld} property for the base transform matrix of the bones.
75
+ * - `detached` uses the {@link THREE.SkinnedMesh.bindMatrix | SkinnedMesh.bindMatrix}.
76
+ * @defaultValue `attached`.
77
+ */
78
+ bindMode: 'attached' | 'detached';
79
+
80
+ /**
81
+ * The base matrix that is used for the bound bone transforms.
82
+ */
15
83
  bindMatrix: Matrix4;
84
+ /**
85
+ * The base matrix that is used for resetting the bound bone transforms.
86
+ */
16
87
  bindMatrixInverse: Matrix4;
88
+
89
+ /**
90
+ * {@link THREE.Skeleton | Skeleton} representing the bone hierarchy of the skinned mesh.
91
+ */
17
92
  skeleton: Skeleton;
18
- readonly isSkinnedMesh: true;
19
93
 
94
+ /**
95
+ * Bind a skeleton to the skinned mesh
96
+ * @remarks
97
+ * The bindMatrix gets saved to .bindMatrix property and the .bindMatrixInverse gets calculated.
98
+ * @param skeleton {@link THREE.Skeleton | Skeleton} created from a {@link Bone | Bones} tree.
99
+ * @param bindMatrix {@link THREE.Matrix4 | Matrix4} that represents the base transform of the skeleton.
100
+ */
20
101
  bind(skeleton: Skeleton, bindMatrix?: Matrix4): void;
102
+
103
+ /**
104
+ * This method sets the skinned mesh in the rest pose (resets the pose).
105
+ */
21
106
  pose(): void;
107
+
108
+ /**
109
+ * Normalizes the skin weights.
110
+ */
22
111
  normalizeSkinWeights(): void;
23
- updateMatrixWorld(force?: boolean): void;
112
+
113
+ /////////////////////////////////////////////////
114
+ // FUTURE - r151
115
+ /////////////////////////////////////////////////
116
+ // /**
117
+ // * Applies the bone transform associated with the given index to the given position vector
118
+ // * @remarks Returns the updated vector.
119
+ // * @param index Expects a `Integer`
120
+ // * @param vector
121
+ // */
122
+ // applyBoneTransform(index: number, vector: Vector3): Vector3;
123
+
124
+ // /**
125
+ // * @deprecated {@link THREE.SkinnedMesh}: {@link boneTransform | .boneTransform()} was renamed to {@link applyBoneTransform | .applyBoneTransform()} in **r151**.
126
+ // */
127
+ // boneTransform(index: number, target: Vector3): Vector3;
128
+ /////////////////////////////////////////////////
129
+
130
+ /**
131
+ * Applies the bone transform associated with the given index to the given position vector.
132
+ * Calculates the position of the vertex at the given index relative to the current bone transformations.
133
+ * Target vector must be initialized with the vertex coordinates prior to the transformation:
134
+ * ```typescript
135
+ * const target = new THREE.Vector3();
136
+ * target.fromBufferAttribute( mesh.geometry.attributes.position, index );
137
+ * mesh.boneTransform( index, target );
138
+ * ```
139
+ * @remarks Returns the updated vector.
140
+ * @param index Expects a `Integer`
141
+ * @param vector
142
+ */
24
143
  boneTransform(index: number, target: Vector3): Vector3;
25
144
  }
@@ -5,16 +5,63 @@ import { Intersection } from '../core/Raycaster';
5
5
  import { SpriteMaterial } from '../materials/Materials';
6
6
  import { BufferGeometry } from '../core/BufferGeometry';
7
7
 
8
+ /**
9
+ * A {@link Sprite} is a plane that always faces towards the camera, generally with a partially transparent texture applied.
10
+ * @remarks Sprites do not cast shadows, setting `castShadow = true` will have no effect.
11
+ * @example
12
+ * ```typescript
13
+ * const map = new THREE.TextureLoader().load('sprite.png');
14
+ * const material = new THREE.SpriteMaterial({
15
+ * map: map
16
+ * });
17
+ * const {@link Sprite} = new THREE.Sprite(material);
18
+ * scene.add(sprite);
19
+ * ```
20
+ * @see {@link https://threejs.org/docs/index.html#api/en/objects/Sprite | Official Documentation}
21
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/objects/Sprite.js | Source}
22
+ */
8
23
  export class Sprite extends Object3D {
24
+ /**
25
+ * Creates a new Sprite.
26
+ * @param material An instance of {@link THREE.SpriteMaterial | SpriteMaterial}. Default {@link THREE.SpriteMaterial | `new SpriteMaterial()`}, _with white color_.
27
+ */
9
28
  constructor(material?: SpriteMaterial);
10
29
 
11
- type: 'Sprite';
30
+ /**
31
+ * Read-only flag to check if a given object is of type {@link Sprite}.
32
+ * @remarks This is a _constant_ value
33
+ * @defaultValue `true`
34
+ */
12
35
  readonly isSprite: true;
13
36
 
37
+ /**
38
+ * @override
39
+ * @defaultValue `Sprite`
40
+ */
41
+ override readonly type: string | 'Sprite';
42
+
43
+ /**
44
+ * Whether the object gets rendered into shadow map.
45
+ * No effect in {@link Sprite}.
46
+ * @ignore
47
+ * @hidden
48
+ * @defaultValue `false`
49
+ */
50
+ override castShadow: false;
51
+
14
52
  geometry: BufferGeometry;
53
+
54
+ /**
55
+ * An instance of {@link THREE.SpriteMaterial | SpriteMaterial}, defining the object's appearance.
56
+ * @defaultValue {@link THREE.SpriteMaterial | `new SpriteMaterial()`}, _with white color_.
57
+ */
15
58
  material: SpriteMaterial;
16
- center: Vector2;
17
59
 
18
- raycast(raycaster: Raycaster, intersects: Intersection[]): void;
19
- copy(source: this): this;
60
+ /**
61
+ * The sprite's anchor point, and the point around which the {@link Sprite} rotates.
62
+ * A value of (0.5, 0.5) corresponds to the midpoint of the sprite.
63
+ * A value of (0, 0) corresponds to the lower left corner of the sprite.
64
+ * @defaultValue {@link THREE.Vector2 | `new Vector2(0.5, 0.5)`}.
65
+ */
66
+ center: Vector2;
20
67
  }
@@ -2,13 +2,19 @@ import { Vector4 } from './../math/Vector4';
2
2
  import { Texture } from './../textures/Texture';
3
3
  import { DepthTexture } from './../textures/DepthTexture';
4
4
  import { EventDispatcher } from './../core/EventDispatcher';
5
- import { Wrapping, TextureFilter, TextureDataType, TextureEncoding } from '../constants';
5
+ import {
6
+ Wrapping,
7
+ TextureDataType,
8
+ TextureEncoding,
9
+ MinificationTextureFilter,
10
+ MagnificationTextureFilter,
11
+ } from '../constants';
6
12
 
7
13
  export interface WebGLRenderTargetOptions {
8
14
  wrapS?: Wrapping | undefined;
9
15
  wrapT?: Wrapping | undefined;
10
- magFilter?: TextureFilter | undefined;
11
- minFilter?: TextureFilter | undefined;
16
+ magFilter?: MagnificationTextureFilter | undefined;
17
+ minFilter?: MinificationTextureFilter | undefined;
12
18
  format?: number | undefined; // RGBAFormat;
13
19
  type?: TextureDataType | undefined; // UnsignedByteType;
14
20
  anisotropy?: number | undefined; // 1;
three/src/scenes/Fog.d.ts CHANGED
@@ -2,42 +2,94 @@ import { ColorRepresentation } from '../utils';
2
2
  import { Color } from './../math/Color';
3
3
 
4
4
  export interface FogBase {
5
+ /**
6
+ * Optional name of the `Fog` object
7
+ * @remarks _(doesn't need to be unique)_.
8
+ * @defaultValue `""`
9
+ */
5
10
  name: string;
11
+
12
+ /**
13
+ * Fog color.
14
+ * @remarks If set to black, far away objects will be rendered black.
15
+ */
6
16
  color: Color;
17
+
18
+ /**
19
+ * Returns a new Fog instance with the same parameters as this one.
20
+ */
7
21
  clone(): FogBase;
22
+
23
+ /**
24
+ * Return Fog data in JSON format.
25
+ */
8
26
  toJSON(): any;
9
27
  }
10
28
 
11
29
  /**
12
30
  * This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance.
31
+ * @example
32
+ * ```typescript
33
+ * const scene = new THREE.Scene();
34
+ * scene.fog = new THREE.Fog(0xcccccc, 10, 15);
35
+ * ```
36
+ * @see {@link https://threejs.org/docs/index.html#api/en/scenes/Fog | Official Documentation}
37
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/scenes/Fog.js | Source}
13
38
  */
14
39
  export class Fog implements FogBase {
40
+ /**
41
+ * The color parameter is passed to the {@link THREE.Color | Color} constructor to set the color property
42
+ * @remarks
43
+ * Color can be a hexadecimal integer or a CSS-style string.
44
+ * @param color
45
+ * @param near Expects a `Float`
46
+ * @param far Expects a `Float`
47
+ */
15
48
  constructor(color: ColorRepresentation, near?: number, far?: number);
16
49
 
17
50
  /**
18
- * @default ''
51
+ * Read-only flag to check if a given object is of type {@link Fog}.
52
+ * @remarks This is a _constant_ value
53
+ * @defaultValue `true`
54
+ */
55
+ readonly isFog: true;
56
+
57
+ /**
58
+ * Optional name of the object
59
+ * @remarks _(doesn't need to be unique)_.
60
+ * @defaultValue `""`
19
61
  */
20
62
  name: string;
21
63
 
22
64
  /**
23
65
  * Fog color.
66
+ * @remarks If set to black, far away objects will be rendered black.
24
67
  */
25
68
  color: Color;
26
69
 
27
70
  /**
28
- * The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog.
29
- * @default 1
71
+ * The minimum distance to start applying fog.
72
+ * @remarks Objects that are less than **near** units from the active camera won't be affected by fog.
73
+ * @defaultValue `1`
74
+ * @remarks Expects a `Float`
30
75
  */
31
76
  near: number;
32
77
 
33
78
  /**
34
- * The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog.
35
- * @default 1000
79
+ * The maximum distance at which fog stops being calculated and applied.
80
+ * @remarks Objects that are more than **far** units away from the active camera won't be affected by fog.
81
+ * @defaultValue `1000`
82
+ * @remarks Expects a `Float`
36
83
  */
37
84
  far: number;
38
85
 
39
- readonly isFog: true;
40
-
86
+ /**
87
+ * Returns a new {@link Fog} instance with the same parameters as this one.
88
+ */
41
89
  clone(): Fog;
90
+
91
+ /**
92
+ * Return {@link Fog} data in JSON format.
93
+ */
42
94
  toJSON(): any;
43
95
  }