@types/three 0.150.0 → 0.150.2

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 (104) 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/Three.d.ts +0 -1
  10. three/src/audio/Audio.d.ts +184 -20
  11. three/src/audio/AudioAnalyser.d.ts +42 -4
  12. three/src/audio/AudioContext.d.ts +12 -1
  13. three/src/audio/AudioListener.d.ts +76 -8
  14. three/src/audio/PositionalAudio.d.ts +86 -5
  15. three/src/cameras/ArrayCamera.d.ts +23 -2
  16. three/src/cameras/Camera.d.ts +42 -13
  17. three/src/cameras/CubeCamera.d.ts +49 -1
  18. three/src/cameras/OrthographicCamera.d.ts +77 -25
  19. three/src/cameras/PerspectiveCamera.d.ts +132 -56
  20. three/src/cameras/StereoCamera.d.ts +29 -2
  21. three/src/constants.d.ts +431 -26
  22. three/src/core/BufferGeometry.d.ts +5 -3
  23. three/src/core/Object3D.d.ts +17 -13
  24. three/src/core/Raycaster.d.ts +1 -0
  25. three/src/geometries/BoxGeometry.d.ts +39 -16
  26. three/src/geometries/CapsuleGeometry.d.ts +35 -12
  27. three/src/geometries/CircleGeometry.d.ts +38 -12
  28. three/src/geometries/ConeGeometry.d.ts +45 -10
  29. three/src/geometries/CylinderGeometry.d.ts +41 -19
  30. three/src/geometries/DodecahedronGeometry.d.ts +14 -5
  31. three/src/geometries/EdgesGeometry.d.ts +30 -8
  32. three/src/geometries/ExtrudeGeometry.d.ts +93 -12
  33. three/src/geometries/IcosahedronGeometry.d.ts +15 -5
  34. three/src/geometries/LatheGeometry.d.ts +41 -12
  35. three/src/geometries/OctahedronGeometry.d.ts +14 -5
  36. three/src/geometries/PlaneGeometry.d.ts +35 -12
  37. three/src/geometries/PolyhedronGeometry.d.ts +41 -12
  38. three/src/geometries/RingGeometry.d.ts +39 -16
  39. three/src/geometries/ShapeGeometry.d.ts +44 -4
  40. three/src/geometries/SphereGeometry.d.ts +43 -21
  41. three/src/geometries/TetrahedronGeometry.d.ts +14 -5
  42. three/src/geometries/TorusGeometry.d.ts +35 -13
  43. three/src/geometries/TorusKnotGeometry.d.ts +39 -16
  44. three/src/geometries/TubeGeometry.d.ts +63 -15
  45. three/src/geometries/WireframeGeometry.d.ts +30 -4
  46. three/src/helpers/ArrowHelper.d.ts +1 -1
  47. three/src/helpers/BoxHelper.d.ts +1 -1
  48. three/src/helpers/DirectionalLightHelper.d.ts +1 -1
  49. three/src/helpers/GridHelper.d.ts +1 -1
  50. three/src/helpers/HemisphereLightHelper.d.ts +1 -2
  51. three/src/helpers/PointLightHelper.d.ts +1 -1
  52. three/src/helpers/PolarGridHelper.d.ts +1 -1
  53. three/src/helpers/SpotLightHelper.d.ts +1 -1
  54. three/src/lights/AmbientLight.d.ts +1 -1
  55. three/src/lights/AmbientLightProbe.d.ts +1 -1
  56. three/src/lights/DirectionalLight.d.ts +1 -1
  57. three/src/lights/HemisphereLight.d.ts +1 -2
  58. three/src/lights/HemisphereLightProbe.d.ts +1 -1
  59. three/src/lights/PointLight.d.ts +1 -1
  60. three/src/lights/RectAreaLight.d.ts +1 -1
  61. three/src/lights/SpotLight.d.ts +1 -2
  62. three/src/materials/LineBasicMaterial.d.ts +1 -2
  63. three/src/materials/MeshBasicMaterial.d.ts +1 -2
  64. three/src/materials/MeshLambertMaterial.d.ts +1 -2
  65. three/src/materials/MeshMatcapMaterial.d.ts +1 -2
  66. three/src/materials/MeshPhongMaterial.d.ts +1 -2
  67. three/src/materials/MeshStandardMaterial.d.ts +1 -2
  68. three/src/materials/MeshToonMaterial.d.ts +1 -2
  69. three/src/materials/PointsMaterial.d.ts +1 -2
  70. three/src/materials/ShadowMaterial.d.ts +1 -2
  71. three/src/materials/SpriteMaterial.d.ts +1 -2
  72. three/src/math/Color.d.ts +2 -3
  73. three/src/math/ColorManagement.d.ts +2 -2
  74. three/src/objects/Bone.d.ts +30 -3
  75. three/src/objects/Group.d.ts +37 -1
  76. three/src/objects/InstancedMesh.d.ts +122 -3
  77. three/src/objects/LOD.d.ts +62 -18
  78. three/src/objects/Line.d.ts +67 -4
  79. three/src/objects/LineLoop.d.ts +26 -1
  80. three/src/objects/LineSegments.d.ts +21 -9
  81. three/src/objects/Mesh.d.ts +60 -4
  82. three/src/objects/Points.d.ts +39 -8
  83. three/src/objects/Skeleton.d.ts +89 -3
  84. three/src/objects/SkinnedMesh.d.ts +122 -3
  85. three/src/objects/Sprite.d.ts +51 -4
  86. three/src/renderers/WebGLRenderTarget.d.ts +9 -3
  87. three/src/renderers/WebGLRenderer.d.ts +1 -2
  88. three/src/scenes/Fog.d.ts +60 -9
  89. three/src/scenes/FogExp2.d.ts +41 -7
  90. three/src/scenes/Scene.d.ts +45 -22
  91. three/src/textures/CanvasTexture.d.ts +35 -13
  92. three/src/textures/CompressedArrayTexture.d.ts +39 -5
  93. three/src/textures/CompressedTexture.d.ts +49 -20
  94. three/src/textures/CubeTexture.d.ts +71 -18
  95. three/src/textures/Data3DTexture.d.ts +74 -10
  96. three/src/textures/DataArrayTexture.d.ts +83 -9
  97. three/src/textures/DataTexture.d.ts +81 -26
  98. three/src/textures/DepthTexture.d.ts +71 -15
  99. three/src/textures/FramebufferTexture.d.ts +57 -2
  100. three/src/textures/Source.d.ts +23 -13
  101. three/src/textures/Texture.d.ts +289 -73
  102. three/src/textures/VideoTexture.d.ts +69 -13
  103. three/src/textures/types.d.ts +9 -0
  104. three/src/utils.d.ts +0 -6
@@ -1,30 +1,52 @@
1
1
  import { OffscreenCanvas, Texture } from './Texture';
2
- import { Mapping, Wrapping, TextureFilter, PixelFormat, TextureDataType } from '../constants';
2
+ import {
3
+ Mapping,
4
+ Wrapping,
5
+ PixelFormat,
6
+ TextureDataType,
7
+ MagnificationTextureFilter,
8
+ MinificationTextureFilter,
9
+ } from '../constants';
3
10
 
11
+ /**
12
+ * Creates a texture from a {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas | canvas element}.
13
+ * @remarks
14
+ * This is almost the same as the base {@link Texture | Texture} class,
15
+ * except that it sets {@link Texture.needsUpdate | needsUpdate} to `true` immediately.
16
+ * @see {@link THREE.Texture | Texture}
17
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/CanvasTexture | Official Documentation}
18
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CanvasTexture.js | Source}
19
+ */
4
20
  export class CanvasTexture extends Texture {
5
21
  /**
6
- * @param canvas
7
- * @param [format=THREE.RGBAFormat]
8
- * @param [type=THREE.UnsignedByteType]
9
- * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
10
- * @param [wrapS=THREE.ClampToEdgeWrapping]
11
- * @param [wrapT=THREE.ClampToEdgeWrapping]
12
- * @param [magFilter=THREE.LinearFilter]
13
- * @param [minFilter=THREE.LinearMipmapLinearFilter]
14
- * @param [anisotropy=1]
15
- * @param [encoding=THREE.LinearEncoding]
22
+ * This creates a new {@link THREE.CanvasTexture | CanvasTexture} object.
23
+ * @param canvas The HTML canvas element from which to load the texture.
24
+ * @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
25
+ * @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
26
+ * @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
27
+ * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
28
+ * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearMipmapLinearFilter}
29
+ * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
30
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
31
+ * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
32
+ * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
16
33
  */
17
34
  constructor(
18
35
  canvas: TexImageSource | OffscreenCanvas,
19
36
  mapping?: Mapping,
20
37
  wrapS?: Wrapping,
21
38
  wrapT?: Wrapping,
22
- magFilter?: TextureFilter,
23
- minFilter?: TextureFilter,
39
+ magFilter?: MagnificationTextureFilter,
40
+ minFilter?: MinificationTextureFilter,
24
41
  format?: PixelFormat,
25
42
  type?: TextureDataType,
26
43
  anisotropy?: number,
27
44
  );
28
45
 
46
+ /**
47
+ * Read-only flag to check if a given object is of type {@link CanvasTexture}.
48
+ * @remarks This is a _constant_ value
49
+ * @defaultValue `true`
50
+ */
29
51
  readonly isCanvasTexture: true;
30
52
  }
@@ -1,17 +1,51 @@
1
1
  import { CompressedPixelFormat, TextureDataType, Wrapping } from '../constants';
2
2
  import { CompressedTexture } from './CompressedTexture.js';
3
3
 
4
+ /**
5
+ * Creates an texture 2D array based on data in compressed form, for example from a
6
+ * {@link https://en.wikipedia.org/wiki/DirectDraw_Surface | DDS} file.
7
+ * @remarks For use with the {@link THREE.CompressedTextureLoader | CompressedTextureLoader}.
8
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/CompressedArrayTexture | Official Documentation}
9
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedArrayTexture.js | Source}
10
+ */
4
11
  export class CompressedArrayTexture extends CompressedTexture {
5
- isCompressedArrayTexture: true;
6
-
7
- wrapR: Wrapping;
8
-
12
+ /**
13
+ * Create a new instance of {@link CompressedArrayTexture}
14
+ * @param mipmaps The mipmaps array should contain objects with data, width and height.
15
+ * The mipmaps should be of the correct {@link format} and {@link type}. See {@link THREE.mipmaps}.
16
+ * @param width The width of the biggest mipmap.
17
+ * @param height The height of the biggest mipmap.
18
+ * @param depth The number of layers of the 2D array texture
19
+ * @param format The format used in the mipmaps. See {@link THREE.CompressedPixelFormat}.
20
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
21
+ */
9
22
  constructor(
10
23
  mipmaps: ImageData[],
11
24
  width: number,
12
25
  height: number,
13
26
  depth: number,
14
- format?: CompressedPixelFormat,
27
+ format: CompressedPixelFormat,
15
28
  type?: TextureDataType,
16
29
  );
30
+
31
+ /**
32
+ * Read-only flag to check if a given object is of type {@link CompressedArrayTexture}.
33
+ * @remarks This is a _constant_ value
34
+ * @defaultValue `true`
35
+ */
36
+ readonly isCompressedArrayTexture: true;
37
+
38
+ /**
39
+ * Overridden with a object containing width and height.
40
+ * @override
41
+ */
42
+ get image(): { width: number; height: number; depth: number };
43
+ set image(value: { width: number; height: number; depth: number });
44
+
45
+ /**
46
+ * This defines how the texture is wrapped in the depth direction.
47
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
48
+ * @defaultValue {@link THREE.ClampToEdgeWrapping}
49
+ */
50
+ wrapR: Wrapping;
17
51
  }
@@ -2,56 +2,85 @@ import { Texture } from './Texture';
2
2
  import {
3
3
  Mapping,
4
4
  Wrapping,
5
- TextureFilter,
6
5
  CompressedPixelFormat,
7
6
  TextureDataType,
8
7
  TextureEncoding,
8
+ MagnificationTextureFilter,
9
+ MinificationTextureFilter,
9
10
  } from '../constants';
10
11
 
12
+ /**
13
+ * Creates a texture based on data in compressed form, for example from a {@link https://en.wikipedia.org/wiki/DirectDraw_Surface | DDS} file.
14
+ * @remarks For use with the {@link THREE.CompressedTextureLoader | CompressedTextureLoader}.
15
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/CompressedTexture | Official Documentation}
16
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedTexture.js | Source}
17
+ */
11
18
  export class CompressedTexture extends Texture {
12
19
  /**
13
- * @param mipmaps
14
- * @param width
15
- * @param height
16
- * @param [format=THREE.RGBAFormat]
17
- * @param [type=THREE.UnsignedByteType]
18
- * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
19
- * @param [wrapS=THREE.ClampToEdgeWrapping]
20
- * @param [wrapT=THREE.ClampToEdgeWrapping]
21
- * @param [magFilter=THREE.LinearFilter]
22
- * @param [minFilter=THREE.LinearMipmapLinearFilter]
23
- * @param [anisotropy=1]
24
- * @param [encoding=THREE.LinearEncoding]
20
+ * This creates a new {@link THREE.CompressedTexture | CompressedTexture} object.
21
+ * @param mipmaps The mipmaps array should contain objects with data, width and height.
22
+ * The mipmaps should be of the correct {@link format} and {@link type}. See {@link THREE.mipmaps}.
23
+ * @param width The width of the biggest mipmap.
24
+ * @param height The height of the biggest mipmap.
25
+ * @param format The format used in the mipmaps. See {@link THREE.CompressedPixelFormat}.
26
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
27
+ * @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
28
+ * @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
29
+ * @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
30
+ * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
31
+ * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearMipmapLinearFilter}
32
+ * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
25
33
  */
26
34
  constructor(
27
35
  mipmaps: ImageData[],
28
36
  width: number,
29
37
  height: number,
30
- format?: CompressedPixelFormat,
38
+ format: CompressedPixelFormat,
31
39
  type?: TextureDataType,
32
40
  mapping?: Mapping,
33
41
  wrapS?: Wrapping,
34
42
  wrapT?: Wrapping,
35
- magFilter?: TextureFilter,
36
- minFilter?: TextureFilter,
43
+ magFilter?: MagnificationTextureFilter,
44
+ minFilter?: MinificationTextureFilter,
37
45
  anisotropy?: number,
38
46
  encoding?: TextureEncoding,
39
47
  );
40
48
 
49
+ /**
50
+ * Read-only flag to check if a given object is of type {@link CompressedTexture}.
51
+ * @remarks This is a _constant_ value
52
+ * @defaultValue `true`
53
+ */
54
+ readonly isCompressedTexture: true;
55
+
56
+ /**
57
+ * Overridden with a object containing width and height.
58
+ * @override
59
+ */
41
60
  get image(): { width: number; height: number };
42
61
  set image(value: { width: number; height: number });
43
62
 
63
+ /**
64
+ * The mipmaps array should contain objects with data, width and height. The mipmaps should be of the correct {@link format} and {@link type}.
65
+ */
44
66
  mipmaps: ImageData[];
45
67
 
46
68
  /**
47
- * @default false
69
+ * @override
70
+ * @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
71
+ * @see {@link THREE.CompressedPixelFormat}
72
+ */
73
+ format: CompressedPixelFormat;
74
+
75
+ /**
76
+ * @override No flipping for cube textures. (also flipping doesn't work for compressed textures)
77
+ * @defaultValue `false`
48
78
  */
49
79
  flipY: boolean;
50
80
 
51
81
  /**
52
- * @default false
82
+ * @override Can't generate mipmaps for compressed textures. mips must be embedded in DDS files
83
+ * @defaultValue `false`
53
84
  */
54
85
  generateMipmaps: boolean;
55
-
56
- readonly isCompressedTexture: true;
57
86
  }
@@ -1,38 +1,91 @@
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
+ CubeTextureMapping,
11
+ } from '../constants';
3
12
 
13
+ /**
14
+ * Creates a cube texture made up of six images.
15
+ * @remarks
16
+ * {@link CubeTexture} is almost equivalent in functionality and usage to {@link Texture}.
17
+ * The only differences are that the images are an array of _6_ images as opposed to a single image,
18
+ * and the mapping options are {@link THREE.CubeReflectionMapping} (default) or {@link THREE.CubeRefractionMapping}
19
+ * @example
20
+ * ```typescript
21
+ * const loader = new THREE.CubeTextureLoader();
22
+ * loader.setPath('textures/cube/pisa/');
23
+ * const textureCube = loader.load(['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']);
24
+ * const material = new THREE.MeshBasicMaterial({
25
+ * color: 0xffffff,
26
+ * envMap: textureCube
27
+ * });
28
+ * ```
29
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/CubeTexture | Official Documentation}
30
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/CubeTexture.js | Source}
31
+ */
4
32
  export class CubeTexture extends Texture {
5
33
  /**
6
- * @param [images=[]]
7
- * @param [mapping=THREE.CubeReflectionMapping]
8
- * @param [wrapS=THREE.ClampToEdgeWrapping]
9
- * @param [wrapT=THREE.ClampToEdgeWrapping]
10
- * @param [magFilter=THREE.LinearFilter]
11
- * @param [minFilter=THREE.LinearMipmapLinearFilter]
12
- * @param [format=THREE.RGBAFormat]
13
- * @param [type=THREE.UnsignedByteType]
14
- * @param [anisotropy=1]
15
- * @param [encoding=THREE.LinearEncoding]
34
+ * This creates a new {@link THREE.CubeTexture | CubeTexture} object.
35
+ * @param images
36
+ * @param mapping See {@link CubeTexture.mapping | .mapping}. Default {@link THREE.CubeReflectionMapping}
37
+ * @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
38
+ * @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
39
+ * @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
40
+ * @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearMipmapLinearFilter}
41
+ * @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
42
+ * @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
43
+ * @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
44
+ * @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
16
45
  */
17
46
  constructor(
18
47
  images?: any[], // HTMLImageElement or HTMLCanvasElement
19
- mapping?: Mapping,
48
+ mapping?: CubeTextureMapping,
20
49
  wrapS?: Wrapping,
21
50
  wrapT?: Wrapping,
22
- magFilter?: TextureFilter,
23
- minFilter?: TextureFilter,
51
+ magFilter?: MagnificationTextureFilter,
52
+ minFilter?: MinificationTextureFilter,
24
53
  format?: PixelFormat,
25
54
  type?: TextureDataType,
26
55
  anisotropy?: number,
27
56
  encoding?: TextureEncoding,
28
57
  );
29
58
 
30
- images: any; // returns and sets the value of Texture.image in the codde ?
59
+ /**
60
+ * Read-only flag to check if a given object is of type {@link CubeTexture}.
61
+ * @remarks This is a _constant_ value
62
+ * @defaultValue `true`
63
+ */
64
+ readonly isCubeTexture: true;
31
65
 
32
66
  /**
33
- * @default false
67
+ * An image object, typically created using the {@link THREE.CubeTextureLoader.load | CubeTextureLoader.load()} method.
68
+ * @see {@link Texture.image}
34
69
  */
35
- flipY: boolean;
70
+ get image(): any;
71
+ set image(data: any);
36
72
 
37
- readonly isCubeTexture: true;
73
+ /**
74
+ * An image object, typically created using the {@link THREE.CubeTextureLoader.load | CubeTextureLoader.load()} method.
75
+ * @see {@link Texture.image}
76
+ */
77
+ get images(): any;
78
+ set images(data: any);
79
+
80
+ /**
81
+ * @inheritDoc
82
+ * @defaultValue {@link THREE.CubeReflectionMapping}
83
+ */
84
+ mapping: CubeTextureMapping;
85
+
86
+ /**
87
+ * @inheritDoc
88
+ * @defaultValue `false`
89
+ */
90
+ flipY: boolean;
38
91
  }
@@ -1,33 +1,97 @@
1
1
  import { Texture } from './Texture';
2
- import { TextureFilter, Wrapping } from '../constants';
2
+ import { MagnificationTextureFilter, MinificationTextureFilter, Wrapping } from '../constants';
3
+ import { Texture3DImageData } from './types';
3
4
 
5
+ /**
6
+ * Creates a three-dimensional texture from raw data, with parameters to divide it into width, height, and depth
7
+ * @remarks Compatible only with {@link WebGL2RenderingContext | WebGL 2 Rendering Context}.
8
+ * @example
9
+ * ```typescript
10
+ * This creates a[name] with repeating data, 0 to 255
11
+ * // create a buffer with some data
12
+ * const sizeX = 64;
13
+ * const sizeY = 64;
14
+ * const sizeZ = 64;
15
+ * const data = new Uint8Array(sizeX * sizeY * sizeZ);
16
+ * let i = 0;
17
+ * for (let z = 0; z & lt; sizeZ; z++) {
18
+ * for (let y = 0; y & lt; sizeY; y++) {
19
+ * for (let x = 0; x & lt; sizeX; x++) {
20
+ * data[i] = i % 256;
21
+ * i++;
22
+ * }
23
+ * }
24
+ * }
25
+ * // use the buffer to create the texture
26
+ * const texture = new THREE.Data3DTexture(data, sizeX, sizeY, sizeZ);
27
+ * texture.needsUpdate = true;
28
+ * ```
29
+ * @see Example: {@link https://threejs.org/examples/#webgl2_materials_texture3d | WebGL2 / materials / texture3d}
30
+ * @see Example: {@link https://threejs.org/examples/#webgl2_materials_texture3d_partialupdate | WebGL2 / materials / texture3d / partialupdate}
31
+ * @see Example: {@link https://threejs.org/examples/#webgl2_volume_cloud | WebGL2 / volume / cloud}
32
+ * @see Example: {@link https://threejs.org/examples/#webgl2_volume_perlin | WebGL2 / volume / perlin}
33
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/Data3DTexture | Official Documentation}
34
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/Data3DTexture.js | Source}
35
+ */
4
36
  export class Data3DTexture extends Texture {
5
- constructor(data: BufferSource, width: number, height: number, depth: number);
37
+ /**
38
+ * Create a new instance of {@link Data3DTexture}
39
+ * @param data {@link https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView | ArrayBufferView} of the texture. Default `null`.
40
+ * @param width Width of the texture. Default `1`.
41
+ * @param height Height of the texture. Default `1`.
42
+ * @param depth Depth of the texture. Default `1`.
43
+ */
44
+ constructor(data?: BufferSource | null, width?: number, height?: number, depth?: number);
6
45
 
7
46
  /**
8
- * @default THREE.NearestFilter
47
+ * Read-only flag to check if a given object is of type {@link Data3DTexture}.
48
+ * @remarks This is a _constant_ value
49
+ * @defaultValue `true`
9
50
  */
10
- magFilter: TextureFilter;
51
+ readonly isData3DTexture: true;
11
52
 
12
53
  /**
13
- * @default THREE.NearestFilter
54
+ * Overridden with a record type holding data, width and height and depth.
55
+ * @override
14
56
  */
15
- minFilter: TextureFilter;
57
+ get image(): Texture3DImageData;
58
+ set image(data: Texture3DImageData);
16
59
 
17
60
  /**
18
- * @default THREE.ClampToEdgeWrapping
61
+ * @override
62
+ * @defaultValue {@link THREE.NearestFilter}
63
+ */
64
+ magFilter: MagnificationTextureFilter;
65
+
66
+ /**
67
+ * @override
68
+ * @defaultValue {@link THREE.NearestFilter}
69
+ */
70
+ minFilter: MinificationTextureFilter;
71
+
72
+ /**
73
+ * @override
74
+ * @defaultValue {@link THREE.ClampToEdgeWrapping}
19
75
  */
20
76
  wrapR: Wrapping;
21
77
 
22
78
  /**
23
- * @default false
79
+ * @override
80
+ * @defaultValue `false`
24
81
  */
25
82
  flipY: boolean;
26
83
 
27
84
  /**
28
- * @default false
85
+ * @override
86
+ * @defaultValue `false`
29
87
  */
30
88
  generateMipmaps: boolean;
31
89
 
32
- readonly isData3DTexture: true;
90
+ /**
91
+ * @override
92
+ * @defaultValue `1`
93
+ */
94
+ unpackAlignment: number;
33
95
  }
96
+
97
+ export {};
@@ -1,33 +1,107 @@
1
1
  import { Texture } from './Texture';
2
- import { TextureFilter } from '../constants';
2
+ import { MagnificationTextureFilter, MinificationTextureFilter } from '../constants';
3
+ import { Texture3DImageData } from './types';
3
4
 
5
+ /**
6
+ * Creates an array of textures directly from raw data, width and height and depth
7
+ * @remarks Compatible only with {@link WebGL2RenderingContext | WebGL 2 Rendering Context}.
8
+ * @example
9
+ * ```typescript
10
+ * This creates a[name] where each texture has a different color.
11
+ * // create a buffer with color data
12
+ * const width = 512;
13
+ * const height = 512;
14
+ * const depth = 100;
15
+ * const size = width * height;
16
+ * const data = new Uint8Array(4 * size * depth);
17
+ * for (let i = 0; i & lt; depth; i++) {
18
+ * const color = new THREE.Color(Math.random(), Math.random(), Math.random());
19
+ * const r = Math.floor(color.r * 255);
20
+ * const g = Math.floor(color.g * 255);
21
+ * const b = Math.floor(color.b * 255);
22
+ * for (let j = 0; j & lt; size; j++) {
23
+ * const stride = (i * size + j) * 4;
24
+ * data[stride] = r;
25
+ * data[stride + 1] = g;
26
+ * data[stride + 2] = b;
27
+ * data[stride + 3] = 255;
28
+ * }
29
+ * }
30
+ * // used the buffer to create a [name]
31
+ * const texture = new THREE.DataArrayTexture(data, width, height, depth);
32
+ * texture.needsUpdate = true;
33
+ * ```
34
+ * @see Example: {@link https://threejs.org/examples/#webgl2_materials_texture2darray | WebGL2 / materials / texture2darray}
35
+ * @see Example: {@link https://threejs.org/examples/#webgl2_rendertarget_texture2darray | WebGL2 / rendertarget / texture2darray}
36
+ * @see {@link https://threejs.org/docs/index.html#api/en/textures/DataArrayTexture | Official Documentation}
37
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/DataArrayTexture.js | Source}
38
+ */
4
39
  export class DataArrayTexture extends Texture {
40
+ /**
41
+ * This creates a new {@link THREE.DataArrayTexture | DataArrayTexture} object.
42
+ * @remarks The interpretation of the data depends on {@link format} and {@link type}.
43
+ * @remarks If the {@link type} is {@link THREE.UnsignedByteType}, a {@link Uint8Array} will be useful for addressing the texel data
44
+ * @remarks If the {@link format} is {@link THREE.RGBAFormat}, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity).
45
+ * @remarks For the packed {@link type | types}, {@link THREE.UnsignedShort4444Type} and {@link THREE.UnsignedShort5551Type}
46
+ * all color components of one texel can be addressed as bitfields within an integer element of a {@link Uint16Array}.
47
+ * @remarks In order to use the {@link type | types} {@link THREE.FloatType} and {@link THREE.HalfFloatType},
48
+ * the WebGL implementation must support the respective extensions _OES_texture_float_ and _OES_texture_half_float_
49
+ * @remarks In order to use {@link THREE.LinearFilter} for component-wise, bilinear interpolation of the texels based on these types,
50
+ * the WebGL extensions _OES_texture_float_linear_ or _OES_texture_half_float_linear_ must also be present.
51
+ * @param data {@link https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView | ArrayBufferView} of the texture. Default `null`.
52
+ * @param width Width of the texture. Default `1`.
53
+ * @param height Height of the texture. Default `1`.
54
+ * @param depth Depth of the texture. Default `1`.
55
+ */
5
56
  constructor(data?: BufferSource, width?: number, height?: number, depth?: number);
6
57
 
7
58
  /**
8
- * @default THREE.NearestFilter
59
+ * Read-only flag to check if a given object is of type {@link DataArrayTexture}.
60
+ * @remarks This is a _constant_ value
61
+ * @defaultValue `true`
62
+ */
63
+ readonly isDataArrayTexture: true;
64
+
65
+ /**
66
+ * Overridden with a record type holding data, width and height and depth.
67
+ * @override
9
68
  */
10
- magFilter: TextureFilter;
69
+ get image(): Texture3DImageData;
70
+ set image(data: Texture3DImageData);
11
71
 
12
72
  /**
13
- * @default THREE.NearestFilter
73
+ * @override
74
+ * @defaultValue {@link THREE.NearestFilter}
14
75
  */
15
- minFilter: TextureFilter;
76
+ magFilter: MagnificationTextureFilter;
16
77
 
17
78
  /**
18
- * @default THREE.ClampToEdgeWrapping
79
+ * @override
80
+ * @defaultValue {@link THREE.NearestFilter}
81
+ */
82
+ minFilter: MinificationTextureFilter;
83
+
84
+ /**
85
+ * @override
86
+ * @defaultValue {@link THREE.ClampToEdgeWrapping}
19
87
  */
20
88
  wrapR: boolean;
21
89
 
22
90
  /**
23
- * @default false
91
+ * @override
92
+ * @defaultValue `false`
24
93
  */
25
94
  flipY: boolean;
26
95
 
27
96
  /**
28
- * @default false
97
+ * @override
98
+ * @defaultValue `false`
29
99
  */
30
100
  generateMipmaps: boolean;
31
101
 
32
- readonly isDataArrayTexture: true;
102
+ /**
103
+ * @override
104
+ * @defaultValue `1`
105
+ */
106
+ unpackAlignment: number;
33
107
  }