@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
@@ -1,26 +1,61 @@
1
+ import { ColorRepresentation } from '../utils';
1
2
  import { Color } from './../math/Color';
2
3
  import { FogBase } from './Fog';
4
+
3
5
  /**
4
- * This class contains the parameters that define linear fog, i.e., that grows exponentially denser with the distance.
6
+ * This class contains the parameters that define exponential squared fog, which gives a clear view near the camera and a faster than exponentially densening fog farther from the camera.
7
+ * @example
8
+ * ```typescript
9
+ * const scene = new THREE.Scene();
10
+ * scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
11
+ * ```
12
+ * @see Example: {@link https://threejs.org/examples/#webgl_geometry_terrain | webgl geometry terrain}
13
+ * @see {@link https://threejs.org/docs/index.html#api/en/scenes/FogExp2 | Official Documentation}
14
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/scenes/FogExp2.js | Source}
5
15
  */
6
16
  export class FogExp2 implements FogBase {
7
- constructor(hex: number | string, density?: number);
17
+ /**
18
+ * The color parameter is passed to the {@link THREE.Color | Color} constructor to set the color property
19
+ * @remarks Color can be a hexadecimal integer or a CSS-style string.
20
+ * @param color
21
+ * @param density Expects a `Float`
22
+ */
23
+ constructor(color: ColorRepresentation, density?: number);
24
+
25
+ /**
26
+ * Read-only flag to check if a given object is of type {@link FogExp2}.
27
+ * @remarks This is a _constant_ value
28
+ * @defaultValue `true`
29
+ */
30
+ readonly isFogExp2: true;
8
31
 
9
32
  /**
10
- * @default ''
33
+ * Optional name of the object
34
+ * @remarks _(doesn't need to be unique)_.
35
+ * @defaultValue `""`
11
36
  */
12
37
  name: string;
13
38
 
39
+ /**
40
+ * Fog color.
41
+ * @remarks If set to black, far away objects will be rendered black.
42
+ */
14
43
  color: Color;
15
44
 
16
45
  /**
17
46
  * Defines how fast the fog will grow dense.
18
- * @default 0.00025
47
+ * @defaultValue `0.00025`
48
+ * @remarks Expects a `Float`
19
49
  */
20
50
  density: number;
21
51
 
22
- readonly isFogExp2: true;
23
-
52
+ /**
53
+ * Returns a new {@link FogExp2} instance with the same parameters as this one.
54
+ */
24
55
  clone(): FogExp2;
56
+
57
+ /**
58
+ * Return {@link FogExp2} data in JSON format.
59
+ */
25
60
  toJSON(): any;
26
61
  }
@@ -1,60 +1,83 @@
1
- // https://threejs.org/docs/?q=scene#api/en/scenes/Scene
2
-
3
1
  import { FogBase } from './Fog';
4
2
  import { Material } from './../materials/Material';
5
3
  import { Object3D } from './../core/Object3D';
6
4
  import { Color } from '../math/Color';
7
5
  import { Texture } from '../textures/Texture';
8
- import { WebGLRenderer } from '../renderers/WebGLRenderer';
9
- import { Camera } from '../cameras/Camera';
10
-
11
- // Scenes /////////////////////////////////////////////////////////////////////
6
+ import { CubeTexture } from '../Three';
12
7
 
13
8
  /**
14
- * Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.
9
+ * Scenes allow you to set up what and where is to be rendered by three.js
10
+ * @remarks
11
+ * This is where you place objects, lights and cameras.
12
+ * @see Example: {@link https://threejs.org/examples/#webgl_multiple_scenes_comparison | webgl multiple scenes comparison}
13
+ * @see {@link https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene | Manual: Creating a scene}
14
+ * @see {@link https://threejs.org/docs/index.html#api/en/scenes/Scene | Official Documentation}
15
+ * @see {@link https://github.com/mrdoob/three.js/blob/master/src/scenes/Scene.js | Source}
15
16
  */
16
17
  export class Scene extends Object3D {
18
+ /**
19
+ * Create a new {@link Scene} object.
20
+ */
17
21
  constructor();
18
22
 
23
+ /**
24
+ * Read-only flag to check if a given object is of type {@link Scene}.
25
+ * @remarks This is a _constant_ value
26
+ * @defaultValue `true`
27
+ */
28
+ readonly isScene: true;
29
+
30
+ /**
31
+ * @defaultValue `Scene`
32
+ */
19
33
  type: 'Scene';
20
34
 
21
35
  /**
22
- * A fog instance defining the type of fog that affects everything rendered in the scene. Default is null.
23
- * @default null
36
+ * A {@link Fog | fog} instance defining the type of fog that affects everything rendered in the scene.
37
+ * @defaultValue `null`
24
38
  */
25
39
  fog: FogBase | null;
26
40
 
27
41
  /**
28
- * Sets the blurriness of the background. Only influences environment maps assigned to Scene.background. Valid input is a float between 0 and 1.
29
- *
30
- * @default 0
42
+ * Sets the blurriness of the background. Only influences environment maps assigned to {@link THREE.Scene.background | Scene.background}.
43
+ * @defaultValue `0`
44
+ * @remarks Expects a `Float` between `0` and `1`.
31
45
  */
32
46
  backgroundBlurriness: number;
33
47
 
34
48
  /**
35
49
  * Attenuates the color of the background. Only applies to background textures.
36
- *
37
- * @default 1
50
+ * @defaultValue `1`
51
+ * @remarks Expects a `Float`
38
52
  */
39
53
  backgroundIntensity: number;
40
54
 
41
55
  /**
42
- * If not null, it will force everything in the scene to be rendered with that material. Default is null.
43
- * @default null
56
+ * Forces everything in the {@link Scene} to be rendered with the defined material.
57
+ * @defaultValue `null`
44
58
  */
45
59
  overrideMaterial: Material | null;
46
60
 
47
61
  /**
48
- * @default null
62
+ * Defines the background of the scene.
63
+ * @remarks Valid inputs are:
64
+ * - A {@link THREE.Color | Color} for defining a uniform colored background.
65
+ * - A {@link THREE.Texture | Texture} for defining a (flat) textured background.
66
+ * - Texture cubes ({@link THREE.CubeTexture | CubeTexture}) or equirectangular textures for defining a skybox.</li>
67
+ * @defaultValue `null`
49
68
  */
50
- background: null | Color | Texture;
69
+ background: Color | Texture | CubeTexture | null;
51
70
 
52
71
  /**
53
- * @default null
72
+ * Sets the environment map for all physical materials in the scene.
73
+ * However, it's not possible to overwrite an existing texture assigned to {@link THREE.MeshStandardMaterial.envMap | MeshStandardMaterial.envMap}.
74
+ * @defaultValue `null`
54
75
  */
55
- environment: null | Texture;
56
-
57
- readonly isScene: true;
76
+ environment: Texture | null;
58
77
 
78
+ /**
79
+ * Convert the {@link Scene} to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
80
+ * @param meta Object containing metadata such as textures or images for the scene.
81
+ */
59
82
  toJSON(meta?: any): any;
60
83
  }
@@ -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 {};