@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
@@ -1,20 +1,56 @@
1
1
  import { Texture } from './Texture';
2
- import { Mapping, Wrapping, TextureFilter, PixelFormat, TextureDataType, TextureEncoding } from '../constants';
2
+ import {
3
+ Mapping,
4
+ Wrapping,
5
+ PixelFormat,
6
+ TextureDataType,
7
+ TextureEncoding,
8
+ MagnificationTextureFilter,
9
+ MinificationTextureFilter,
10
+ } from '../constants';
11
+ import { TextureImageData } from './types';
3
12
 
13
+ /**
14
+ * Creates a texture directly from raw data, width and height.
15
+ * @example
16
+ * ```typescript
17
+ * // create a buffer with color data
18
+ * const width = 512;
19
+ * const height = 512;
20
+ * const size = width * height;
21
+ * const data = new Uint8Array(4 * size);
22
+ * const color = new THREE.Color(0xffffff);
23
+ * const r = Math.floor(color.r * 255);
24
+ * const g = Math.floor(color.g * 255);
25
+ * const b = Math.floor(color.b * 255);
26
+ * for (let i = 0; i & lt; size; i++) {
27
+ * const stride = i * 4;
28
+ * data[stride] = r;
29
+ * data[stride + 1] = g;
30
+ * data[stride + 2] = b;
31
+ * data[stride + 3] = 255;
32
+ * }
33
+ * // used the buffer to create a [name]
34
+ * const texture = new THREE.DataTexture(data, width, height);
35
+ * texture.needsUpdate = true;
36
+ * ```
37
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/DataTexture | Official Documentation}
38
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DataTexture.js | Source}
39
+ */
4
40
  export class DataTexture extends Texture {
5
41
  /**
6
- * @param data
7
- * @param width
8
- * @param height
9
- * @param [format=THREE.RGBAFormat]
10
- * @param [type=THREE.UnsignedByteType]
11
- * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
12
- * @param [wrapS=THREE.ClampToEdgeWrapping]
13
- * @param [wrapT=THREE.ClampToEdgeWrapping]
14
- * @param [magFilter=THREE.NearestFilter]
15
- * @param [minFilter=THREE.NearestFilter]
16
- * @param [anisotropy=1]
17
- * @param [encoding=THREE.LinearEncoding]
42
+ * @param data {@link https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView | ArrayBufferView} of the texture. Default `null`.
43
+ * @param width Width of the texture. Default `1`.
44
+ * @param height Height of the texture. Default `1`.
45
+ * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
46
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
47
+ * @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
48
+ * @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
49
+ * @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
50
+ * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.NearestFilter}
51
+ * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.NearestFilter}
52
+ * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
53
+ * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
18
54
  */
19
55
  constructor(
20
56
  data?: BufferSource | null,
@@ -25,34 +61,53 @@ export class DataTexture extends Texture {
25
61
  mapping?: Mapping,
26
62
  wrapS?: Wrapping,
27
63
  wrapT?: Wrapping,
28
- magFilter?: TextureFilter,
29
- minFilter?: TextureFilter,
64
+ magFilter?: MagnificationTextureFilter,
65
+ minFilter?: MinificationTextureFilter,
30
66
  anisotropy?: number,
31
67
  encoding?: TextureEncoding,
32
68
  );
33
69
 
34
- get image(): ImageData;
35
- set image(value: ImageData);
70
+ /**
71
+ * Read-only flag to check if a given object is of type {@link DataTexture}.
72
+ * @remarks This is a _constant_ value
73
+ * @defaultValue `true`
74
+ */
75
+ readonly isDataTexture: true;
36
76
 
37
77
  /**
38
- * @default false
78
+ * Overridden with a record type holding data, width and height and depth.
79
+ * @override
39
80
  */
40
- flipY: boolean;
81
+ get image(): TextureImageData;
82
+ set image(value: TextureImageData);
41
83
 
42
84
  /**
43
- * @default false
85
+ * @override
86
+ * @defaultValue {@link THREE.NearestFilter}
44
87
  */
45
- generateMipmaps: boolean;
88
+ magFilter: MagnificationTextureFilter;
46
89
 
47
90
  /**
48
- * @default 1
91
+ * @override
92
+ * @defaultValue {@link THREE.NearestFilter}
49
93
  */
50
- unpackAlignment: number;
94
+ minFilter: MinificationTextureFilter;
51
95
 
52
96
  /**
53
- * @default THREE.DepthFormat
97
+ * @override
98
+ * @defaultValue `false`
54
99
  */
55
- format: PixelFormat;
100
+ flipY: boolean;
56
101
 
57
- readonly isDataTexture: true;
102
+ /**
103
+ * @override
104
+ * @defaultValue `false`
105
+ */
106
+ generateMipmaps: boolean;
107
+
108
+ /**
109
+ * @override
110
+ * @defaultValue `1`
111
+ */
112
+ unpackAlignment: number;
58
113
  }
@@ -1,17 +1,35 @@
1
1
  import { Texture } from './Texture';
2
- import { Mapping, Wrapping, TextureFilter, TextureDataType } from '../constants';
2
+ import {
3
+ Mapping,
4
+ Wrapping,
5
+ TextureDataType,
6
+ DeepTexturePixelFormat,
7
+ MagnificationTextureFilter,
8
+ MinificationTextureFilter,
9
+ } from '../constants';
3
10
 
11
+ /**
12
+ * This class can be used to automatically save the depth information of a rendering into a texture
13
+ * @remarks
14
+ * When using a **WebGL1** rendering context, {@link DepthTexture} requires support for the
15
+ * {@link https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/ | WEBGL_depth_texture} extension.
16
+ * @see Example: {@link https://threejs.org/examples/#webgl_depth_texture | depth / texture}
17
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/DepthTexture | Official Documentation}
18
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DepthTexture.js | Source}
19
+ */
4
20
  export class DepthTexture extends Texture {
5
21
  /**
6
- * @param width
7
- * @param height
8
- * @param type
9
- * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
10
- * @param [wrapS=THREE.ClampToEdgeWrapping]
11
- * @param [wrapT=THREE.ClampToEdgeWrapping]
12
- * @param [magFilter=THREE.NearestFilter]
13
- * @param [minFilter=THREE.NearestFilter]
14
- * @param [anisotropy=1]
22
+ * Create a new instance of {@link DepthTexture}
23
+ * @param width Width of the texture.
24
+ * @param height Height of the texture.
25
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType} or {@link THREE.UnsignedInt248Type}
26
+ * @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
27
+ * @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
28
+ * @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
29
+ * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.NearestFilter}
30
+ * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.NearestFilter}
31
+ * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
32
+ * @param format See {@link DepthTexture.format | .format}. Default {@link THREE.DepthFormat}
15
33
  */
16
34
  constructor(
17
35
  width: number,
@@ -20,23 +38,61 @@ export class DepthTexture extends Texture {
20
38
  mapping?: Mapping,
21
39
  wrapS?: Wrapping,
22
40
  wrapT?: Wrapping,
23
- magFilter?: TextureFilter,
24
- minFilter?: TextureFilter,
41
+ magFilter?: MagnificationTextureFilter,
42
+ minFilter?: MinificationTextureFilter,
25
43
  anisotropy?: number,
44
+ format?: DeepTexturePixelFormat,
26
45
  );
27
46
 
47
+ /**
48
+ * Read-only flag to check if a given object is of type {@link DepthTexture}.
49
+ * @remarks This is a _constant_ value
50
+ * @defaultValue `true`
51
+ */
52
+ readonly isDepthTexture: true;
53
+
54
+ /**
55
+ * Overridden with a record type holding width and height.
56
+ * @override
57
+ */
28
58
  get image(): { width: number; height: number };
29
59
  set image(value: { width: number; height: number });
30
60
 
31
61
  /**
32
- * @default false
62
+ * @override
63
+ * @defaultValue `false`
33
64
  */
34
65
  flipY: boolean;
35
66
 
36
67
  /**
37
- * @default false
68
+ * @override
69
+ * @defaultValue {@link THREE.NearestFilter}
70
+ */
71
+ magFilter: MagnificationTextureFilter;
72
+
73
+ /**
74
+ * @override
75
+ * @defaultValue {@link THREE.NearestFilter}
76
+ */
77
+ minFilter: MinificationTextureFilter;
78
+
79
+ /**
80
+ * @override Depth textures do not use mipmaps.
81
+ * @defaultValue `false`
38
82
  */
39
83
  generateMipmaps: boolean;
40
84
 
41
- readonly isDepthTexture: true;
85
+ /**
86
+ * @override
87
+ * @see {@link Texture.format | Texture.format}
88
+ * @defaultValue {@link THREE.DepthFormat}.
89
+ */
90
+ format: DeepTexturePixelFormat;
91
+
92
+ /**
93
+ * @override
94
+ * @defaultValue {@link THREE.UnsignedByteType} when {@link format | .format} === {@link THREE.DepthFormat}
95
+ * @defaultValue {@link THREE.UnsignedInt248Type} when {@link format | .format} === {@link THREE.DepthStencilFormat}
96
+ */
97
+ type: TextureDataType;
42
98
  }
@@ -1,8 +1,63 @@
1
1
  import { Texture } from './Texture';
2
- import { PixelFormat } from '../constants';
2
+ import { MagnificationTextureFilter, MinificationTextureFilter, PixelFormat } from '../constants';
3
3
 
4
+ /**
5
+ * This class can only be used in combination with {@link THREE.WebGLRenderer.copyFramebufferToTexture | WebGLRenderer.copyFramebufferToTexture()}.
6
+ * @example
7
+ * ```typescript
8
+ * const pixelRatio = window.devicePixelRatio;
9
+ * const textureSize = 128 * pixelRatio;
10
+ *
11
+ * // instantiate a framebuffer texture
12
+ * const frameTexture = new FramebufferTexture( textureSize, textureSize, RGBAFormat );
13
+ *
14
+ * // calculate start position for copying part of the frame data
15
+ * const vector = new Vector2();
16
+ * vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
17
+ * vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
18
+ *
19
+ * // render the scene
20
+ * renderer.clear();
21
+ * renderer.render( scene, camera );
22
+ *
23
+ * // copy part of the rendered frame into the framebuffer texture
24
+ * renderer.copyFramebufferToTexture( vector, frameTexture );
25
+ * ```
26
+ * @see Example: {@link https://threejs.org/examples/#webgl_framebuffer_texture | webgl_framebuffer_texture}
27
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/FramebufferTexture | Official Documentation}
28
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/FramebufferTexture.js | Source}
29
+ */
4
30
  export class FramebufferTexture extends Texture {
31
+ /**
32
+ * Create a new instance of {@link FramebufferTexture}
33
+ * @param width The width of the texture.
34
+ * @param height The height of the texture.
35
+ * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}.
36
+ */
37
+ constructor(width: number, height: number, format: PixelFormat);
38
+
39
+ /**
40
+ * Read-only flag to check if a given object is of type {@link FramebufferTexture}.
41
+ * @remarks This is a _constant_ value
42
+ * @defaultValue `true`
43
+ */
5
44
  readonly isFramebufferTexture: true;
6
45
 
7
- constructor(width: number, height: number, format: PixelFormat);
46
+ /**
47
+ * @override
48
+ * @defaultValue {@link THREE.NearestFilter}
49
+ */
50
+ magFilter: MagnificationTextureFilter;
51
+
52
+ /**
53
+ * @override
54
+ * @defaultValue {@link THREE.NearestFilter}
55
+ */
56
+ minFilter: MinificationTextureFilter;
57
+
58
+ /**
59
+ * @override
60
+ * @defaultValue `false`
61
+ */
62
+ generateMipmaps: boolean;
8
63
  }
@@ -1,39 +1,49 @@
1
1
  /**
2
- * Represents the data source of a texture.
2
+ * Represents the data {@link Source} of a texture.
3
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/Source | Official Documentation}
4
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js | Source}
3
5
  */
4
6
  export class Source {
5
7
  /**
6
- * @param [data] The data definition of a texture. default is **null**.
8
+ * Create a new instance of {@link Source}
9
+ * @param data The data definition of a texture. Default `null`
7
10
  */
8
11
  constructor(data: any);
9
12
 
10
13
  /**
11
- * The actual data of a texture. The type of this property depends on the texture that uses this instance.
14
+ * Flag to check if a given object is of type {@link Source}.
15
+ * @remarks This is a _constant_ value
16
+ * @defaultValue `true`
17
+ */
18
+ readonly isSource: true;
19
+
20
+ /**
21
+ * The actual data of a texture.
22
+ * @remarks The type of this property depends on the texture that uses this instance.
12
23
  */
13
24
  data: any;
14
25
 
15
26
  /**
16
- * Set this to **true** to trigger a data upload to the GPU next time the source is used.
27
+ * Set this to `true` to trigger a data upload to the GPU next time the {@link Source} is used.
17
28
  */
18
29
  set needsUpdate(value: boolean);
19
30
 
20
31
  /**
21
- * [UUID](http://en.wikipedia.org/wiki/Universally_unique_identifier) of this object instance.
22
- * This gets automatically assigned, so this shouldn't be edited.
32
+ * {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
33
+ * @remarks This gets automatically assigned and shouldn't be edited.
23
34
  */
24
35
  uuid: string;
25
36
 
26
37
  /**
27
- * This starts at **0** and counts how many times [property:Boolean needsUpdate] is set to **true**.
38
+ * This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
39
+ * @remarks Expects a `Integer`
40
+ * @defaultValue `0`
28
41
  */
29
42
  version: number;
30
43
 
31
44
  /**
32
- * Convert the data source to three.js [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
33
- *
34
- * @param [meta] optional object containing metadata.
45
+ * Convert the data {@link Source} to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
46
+ * @param meta Optional object containing metadata.
35
47
  */
36
- toJSON(meta: any): any;
37
-
38
- readonly isTexture: true;
48
+ toJSON(meta?: string | {}): {};
39
49
  }