@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.
- three/README.md +2 -2
- three/build/three.d.cts +2 -0
- three/build/three.d.ts +2 -0
- three/build/three.module.d.ts +2 -0
- three/examples/jsm/controls/OrbitControls.d.ts +5 -0
- three/examples/jsm/controls/TransformControls.d.ts +1 -5
- three/examples/jsm/geometries/TextGeometry.d.ts +92 -15
- three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
- three/examples/jsm/libs/fflate.module.d.ts +1 -0
- three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
- three/examples/jsm/libs/stats.module.d.ts +2 -23
- three/examples/jsm/loaders/EXRLoader.d.ts +3 -2
- three/examples/jsm/misc/GPUComputationRenderer.d.ts +4 -2
- three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
- three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
- three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
- three/index.d.ts +1 -1
- three/package.json +19 -4
- three/src/Three.d.ts +0 -1
- three/src/audio/Audio.d.ts +184 -20
- three/src/audio/AudioAnalyser.d.ts +42 -4
- three/src/audio/AudioContext.d.ts +12 -1
- three/src/audio/AudioListener.d.ts +76 -8
- three/src/audio/PositionalAudio.d.ts +86 -5
- three/src/cameras/ArrayCamera.d.ts +23 -2
- three/src/cameras/Camera.d.ts +42 -13
- three/src/cameras/CubeCamera.d.ts +49 -1
- three/src/cameras/OrthographicCamera.d.ts +77 -25
- three/src/cameras/PerspectiveCamera.d.ts +132 -56
- three/src/cameras/StereoCamera.d.ts +29 -2
- three/src/constants.d.ts +790 -245
- three/src/core/BufferAttribute.d.ts +456 -85
- three/src/core/BufferGeometry.d.ts +237 -67
- three/src/core/Clock.d.ts +28 -20
- three/src/core/EventDispatcher.d.ts +20 -4
- three/src/core/GLBufferAttribute.d.ts +102 -8
- three/src/core/InstancedBufferAttribute.d.ts +13 -24
- three/src/core/InstancedBufferGeometry.d.ts +22 -4
- three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
- three/src/core/InterleavedBuffer.d.ts +98 -14
- three/src/core/InterleavedBufferAttribute.d.ts +146 -7
- three/src/core/Layers.d.ts +61 -6
- three/src/core/Object3D.d.ts +244 -123
- three/src/core/Raycaster.d.ts +104 -27
- three/src/core/Uniform.d.ts +28 -11
- three/src/core/UniformsGroup.d.ts +10 -4
- three/src/extras/Earcut.d.ts +3 -4
- three/src/geometries/BoxGeometry.d.ts +39 -16
- three/src/geometries/CapsuleGeometry.d.ts +35 -12
- three/src/geometries/CircleGeometry.d.ts +38 -12
- three/src/geometries/ConeGeometry.d.ts +45 -10
- three/src/geometries/CylinderGeometry.d.ts +41 -19
- three/src/geometries/DodecahedronGeometry.d.ts +14 -5
- three/src/geometries/EdgesGeometry.d.ts +30 -8
- three/src/geometries/ExtrudeGeometry.d.ts +93 -12
- three/src/geometries/IcosahedronGeometry.d.ts +15 -5
- three/src/geometries/LatheGeometry.d.ts +41 -12
- three/src/geometries/OctahedronGeometry.d.ts +14 -5
- three/src/geometries/PlaneGeometry.d.ts +35 -12
- three/src/geometries/PolyhedronGeometry.d.ts +41 -12
- three/src/geometries/RingGeometry.d.ts +39 -16
- three/src/geometries/ShapeGeometry.d.ts +44 -4
- three/src/geometries/SphereGeometry.d.ts +43 -21
- three/src/geometries/TetrahedronGeometry.d.ts +14 -5
- three/src/geometries/TorusGeometry.d.ts +35 -13
- three/src/geometries/TorusKnotGeometry.d.ts +39 -16
- three/src/geometries/TubeGeometry.d.ts +63 -15
- three/src/geometries/WireframeGeometry.d.ts +30 -4
- three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
- three/src/math/Color.d.ts +157 -3
- three/src/math/ColorManagement.d.ts +13 -7
- three/src/objects/Bone.d.ts +30 -3
- three/src/objects/Group.d.ts +37 -1
- three/src/objects/InstancedMesh.d.ts +122 -3
- three/src/objects/LOD.d.ts +62 -18
- three/src/objects/Line.d.ts +67 -4
- three/src/objects/LineLoop.d.ts +26 -1
- three/src/objects/LineSegments.d.ts +21 -9
- three/src/objects/Mesh.d.ts +60 -4
- three/src/objects/Points.d.ts +39 -8
- three/src/objects/Skeleton.d.ts +89 -3
- three/src/objects/SkinnedMesh.d.ts +122 -3
- three/src/objects/Sprite.d.ts +51 -4
- three/src/renderers/WebGLRenderTarget.d.ts +9 -3
- three/src/renderers/WebGLRenderer.d.ts +2 -2
- three/src/scenes/Fog.d.ts +59 -7
- three/src/scenes/FogExp2.d.ts +41 -6
- three/src/scenes/Scene.d.ts +45 -22
- three/src/textures/CanvasTexture.d.ts +35 -13
- three/src/textures/CompressedArrayTexture.d.ts +39 -5
- three/src/textures/CompressedTexture.d.ts +49 -20
- three/src/textures/CubeTexture.d.ts +71 -18
- three/src/textures/Data3DTexture.d.ts +74 -10
- three/src/textures/DataArrayTexture.d.ts +83 -9
- three/src/textures/DataTexture.d.ts +81 -26
- three/src/textures/DepthTexture.d.ts +71 -15
- three/src/textures/FramebufferTexture.d.ts +57 -2
- three/src/textures/Source.d.ts +23 -13
- three/src/textures/Texture.d.ts +289 -73
- three/src/textures/VideoTexture.d.ts +69 -13
- three/src/textures/types.d.ts +9 -0
- three/src/utils.d.ts +5 -2
- three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
three/src/scenes/Scene.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
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.
|
|
23
|
-
* @
|
|
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
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
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
|
-
* @
|
|
50
|
+
* @defaultValue `1`
|
|
51
|
+
* @remarks Expects a `Float`
|
|
38
52
|
*/
|
|
39
53
|
backgroundIntensity: number;
|
|
40
54
|
|
|
41
55
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
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
|
-
*
|
|
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:
|
|
69
|
+
background: Color | Texture | CubeTexture | null;
|
|
51
70
|
|
|
52
71
|
/**
|
|
53
|
-
*
|
|
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:
|
|
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 {
|
|
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
|
-
* @
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
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?:
|
|
23
|
-
minFilter?:
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
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
|
-
* @
|
|
14
|
-
* @param width
|
|
15
|
-
* @
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
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
|
|
38
|
+
format: CompressedPixelFormat,
|
|
31
39
|
type?: TextureDataType,
|
|
32
40
|
mapping?: Mapping,
|
|
33
41
|
wrapS?: Wrapping,
|
|
34
42
|
wrapT?: Wrapping,
|
|
35
|
-
magFilter?:
|
|
36
|
-
minFilter?:
|
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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 {
|
|
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
|
-
* @
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
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?:
|
|
48
|
+
mapping?: CubeTextureMapping,
|
|
20
49
|
wrapS?: Wrapping,
|
|
21
50
|
wrapT?: Wrapping,
|
|
22
|
-
magFilter?:
|
|
23
|
-
minFilter?:
|
|
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
|
-
|
|
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
|
-
* @
|
|
67
|
+
* An image object, typically created using the {@link THREE.CubeTextureLoader.load | CubeTextureLoader.load()} method.
|
|
68
|
+
* @see {@link Texture.image}
|
|
34
69
|
*/
|
|
35
|
-
|
|
70
|
+
get image(): any;
|
|
71
|
+
set image(data: any);
|
|
36
72
|
|
|
37
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
* @
|
|
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
|
-
|
|
51
|
+
readonly isData3DTexture: true;
|
|
11
52
|
|
|
12
53
|
/**
|
|
13
|
-
*
|
|
54
|
+
* Overridden with a record type holding data, width and height and depth.
|
|
55
|
+
* @override
|
|
14
56
|
*/
|
|
15
|
-
|
|
57
|
+
get image(): Texture3DImageData;
|
|
58
|
+
set image(data: Texture3DImageData);
|
|
16
59
|
|
|
17
60
|
/**
|
|
18
|
-
* @
|
|
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
|
-
* @
|
|
79
|
+
* @override
|
|
80
|
+
* @defaultValue `false`
|
|
24
81
|
*/
|
|
25
82
|
flipY: boolean;
|
|
26
83
|
|
|
27
84
|
/**
|
|
28
|
-
* @
|
|
85
|
+
* @override
|
|
86
|
+
* @defaultValue `false`
|
|
29
87
|
*/
|
|
30
88
|
generateMipmaps: boolean;
|
|
31
89
|
|
|
32
|
-
|
|
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 {
|
|
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
|
-
* @
|
|
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
|
-
|
|
69
|
+
get image(): Texture3DImageData;
|
|
70
|
+
set image(data: Texture3DImageData);
|
|
11
71
|
|
|
12
72
|
/**
|
|
13
|
-
* @
|
|
73
|
+
* @override
|
|
74
|
+
* @defaultValue {@link THREE.NearestFilter}
|
|
14
75
|
*/
|
|
15
|
-
|
|
76
|
+
magFilter: MagnificationTextureFilter;
|
|
16
77
|
|
|
17
78
|
/**
|
|
18
|
-
* @
|
|
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
|
-
* @
|
|
91
|
+
* @override
|
|
92
|
+
* @defaultValue `false`
|
|
24
93
|
*/
|
|
25
94
|
flipY: boolean;
|
|
26
95
|
|
|
27
96
|
/**
|
|
28
|
-
* @
|
|
97
|
+
* @override
|
|
98
|
+
* @defaultValue `false`
|
|
29
99
|
*/
|
|
30
100
|
generateMipmaps: boolean;
|
|
31
101
|
|
|
32
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @override
|
|
104
|
+
* @defaultValue `1`
|
|
105
|
+
*/
|
|
106
|
+
unpackAlignment: number;
|
|
33
107
|
}
|