@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/textures/Texture.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// https://threejs.org/docs/?q=texture#api/en/textures/Texture
|
|
2
|
-
|
|
3
1
|
import { Vector2 } from './../math/Vector2';
|
|
4
2
|
import { Matrix3 } from './../math/Matrix3';
|
|
5
3
|
import { Source } from './Source';
|
|
@@ -7,213 +5,431 @@ import { EventDispatcher } from './../core/EventDispatcher';
|
|
|
7
5
|
import {
|
|
8
6
|
Mapping,
|
|
9
7
|
Wrapping,
|
|
10
|
-
TextureFilter,
|
|
11
8
|
PixelFormat,
|
|
12
9
|
PixelFormatGPU,
|
|
13
10
|
TextureDataType,
|
|
14
11
|
TextureEncoding,
|
|
12
|
+
MagnificationTextureFilter,
|
|
13
|
+
MinificationTextureFilter,
|
|
14
|
+
AnyPixelFormat,
|
|
15
|
+
AnyMapping,
|
|
15
16
|
} from '../constants';
|
|
16
17
|
|
|
17
18
|
/** Shim for OffscreenCanvas. */
|
|
18
19
|
// tslint:disable-next-line:no-empty-interface
|
|
19
20
|
export interface OffscreenCanvas extends EventTarget {}
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Create a {@link Texture} to apply to a surface or as a reflection or refraction map.
|
|
24
|
+
* @remarks
|
|
25
|
+
* After the initial use of a texture, its **dimensions**, {@link format}, and {@link type} cannot be changed
|
|
26
|
+
* Instead, call {@link dispose | .dispose()} on the {@link Texture} and instantiate a new {@link Texture}.
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // load a texture, set wrap mode to repeat
|
|
30
|
+
* const texture = new THREE.TextureLoader().load("textures/water.jpg");
|
|
31
|
+
* texture.wrapS = THREE.RepeatWrapping;
|
|
32
|
+
* texture.wrapT = THREE.RepeatWrapping;
|
|
33
|
+
* texture.repeat.set(4, 4);
|
|
34
|
+
* ```
|
|
35
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_materials_texture_filters | webgl materials texture filters}
|
|
36
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
37
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/textures/Texture | Official Documentation}
|
|
38
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/Textures/Texture.js | Source}
|
|
39
|
+
*/
|
|
21
40
|
export class Texture extends EventDispatcher {
|
|
22
41
|
/**
|
|
23
|
-
* @
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
42
|
+
* This creates a new {@link THREE.Texture | Texture} object.
|
|
43
|
+
* @param image See {@link Texture.image | .image}. Default {@link THREE.Texture.DEFAULT_IMAGE}
|
|
44
|
+
* @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
|
|
45
|
+
* @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
|
|
46
|
+
* @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
|
|
47
|
+
* @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
|
|
48
|
+
* @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearMipmapLinearFilter}
|
|
49
|
+
* @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
|
|
50
|
+
* @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
|
|
51
|
+
* @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
|
|
52
|
+
* @param encoding See {@link Texture.encoding | .encoding}. Default {@link THREE.LinearEncoding}
|
|
33
53
|
*/
|
|
34
54
|
constructor(
|
|
35
55
|
image?: TexImageSource | OffscreenCanvas,
|
|
36
56
|
mapping?: Mapping,
|
|
37
57
|
wrapS?: Wrapping,
|
|
38
58
|
wrapT?: Wrapping,
|
|
39
|
-
magFilter?:
|
|
40
|
-
minFilter?:
|
|
59
|
+
magFilter?: MagnificationTextureFilter,
|
|
60
|
+
minFilter?: MinificationTextureFilter,
|
|
41
61
|
format?: PixelFormat,
|
|
42
62
|
type?: TextureDataType,
|
|
43
63
|
anisotropy?: number,
|
|
44
64
|
encoding?: TextureEncoding,
|
|
45
65
|
);
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Read-only flag to check if a given object is of type {@link Texture}.
|
|
69
|
+
* @remarks This is a _constant_ value
|
|
70
|
+
* @defaultValue `true`
|
|
71
|
+
*/
|
|
72
|
+
readonly isTexture: true;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Unique number for this {@link Texture} instance.
|
|
76
|
+
* @remarks Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object.
|
|
77
|
+
* @remarks Expects a `Integer`
|
|
78
|
+
*/
|
|
79
|
+
readonly id: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* {@link http://en.wikipedia.org/wiki/Universally_unique_identifier | UUID} of this object instance.
|
|
83
|
+
* @remarks This gets automatically assigned and shouldn't be edited.
|
|
84
|
+
*/
|
|
48
85
|
uuid: string;
|
|
49
86
|
|
|
50
87
|
/**
|
|
51
|
-
*
|
|
88
|
+
* Optional name of the object
|
|
89
|
+
* @remarks _(doesn't need to be unique)_.
|
|
90
|
+
* @defaultValue `""`
|
|
52
91
|
*/
|
|
53
92
|
name: string;
|
|
54
|
-
sourceFile: string;
|
|
55
93
|
|
|
56
94
|
/**
|
|
57
95
|
* The data definition of a texture. A reference to the data source can be shared across textures.
|
|
58
|
-
* This is often useful in context of spritesheets where multiple textures render the same data
|
|
96
|
+
* This is often useful in context of spritesheets where multiple textures render the same data
|
|
97
|
+
* but with different {@link Texture} transformations.
|
|
59
98
|
*/
|
|
60
99
|
source: Source;
|
|
61
100
|
|
|
62
101
|
/**
|
|
63
|
-
* An image object, typically created using the {@link TextureLoader.load} method.
|
|
64
|
-
* This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* as long as video is playing - the {@link VideoTexture} class handles this automatically.
|
|
102
|
+
* An image object, typically created using the {@link THREE.TextureLoader.load | TextureLoader.load()} method.
|
|
103
|
+
* @remarks This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
|
|
104
|
+
* @remarks To use video as a {@link Texture} you need to have a playing HTML5 video element as a source
|
|
105
|
+
* for your {@link Texture} image and continuously update this {@link Texture}
|
|
106
|
+
* as long as video is playing - the {@link THREE.VideoTexture | VideoTexture} class handles this automatically.
|
|
69
107
|
*/
|
|
70
108
|
get image(): any;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* An image object, typically created using the {@link TextureLoader.load} method.
|
|
74
|
-
* This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
|
|
75
|
-
*
|
|
76
|
-
* To use video as a texture you need to have a playing HTML5
|
|
77
|
-
* video element as a source for your texture image and continuously update this texture
|
|
78
|
-
* as long as video is playing - the {@link VideoTexture} class handles this automatically.
|
|
79
|
-
*/
|
|
80
109
|
set image(data: any);
|
|
81
110
|
|
|
82
111
|
/**
|
|
83
|
-
*
|
|
112
|
+
* Array of user-specified mipmaps
|
|
113
|
+
* @defaultValue `[]`
|
|
84
114
|
*/
|
|
85
115
|
mipmaps: any[]; // ImageData[] for 2D textures and CubeTexture[] for cube textures;
|
|
86
116
|
|
|
87
117
|
/**
|
|
88
|
-
*
|
|
118
|
+
* How the image is applied to the object.
|
|
119
|
+
* @remarks All {@link Texture} types except {@link THREE.CubeTexture} expect the _values_ be {@link THREE.Mapping}
|
|
120
|
+
* @remarks {@link CubeTexture} expect the _values_ be {@link THREE.CubeTextureMapping}
|
|
121
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
122
|
+
* @defaultValue _value of_ {@link THREE.Texture.DEFAULT_MAPPING}
|
|
89
123
|
*/
|
|
90
|
-
mapping:
|
|
124
|
+
mapping: AnyMapping;
|
|
91
125
|
|
|
92
126
|
/**
|
|
93
|
-
* @
|
|
127
|
+
* This defines how the {@link Texture} is wrapped *horizontally* and corresponds to **U** in UV mapping.
|
|
128
|
+
* @remarks for **WEBGL1** - tiling of images in textures only functions if image dimensions are powers of two
|
|
129
|
+
* (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
|
|
130
|
+
* Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
|
|
131
|
+
* **WEBGL2** does not have this limitation.
|
|
132
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
133
|
+
* @see {@link wrapT}
|
|
134
|
+
* @see {@link repeat}
|
|
135
|
+
* @defaultValue {@link THREE.ClampToEdgeWrapping}
|
|
94
136
|
*/
|
|
95
137
|
wrapS: Wrapping;
|
|
96
138
|
|
|
97
139
|
/**
|
|
98
|
-
* @
|
|
140
|
+
* This defines how the {@link Texture} is wrapped *vertically* and corresponds to **V** in UV mapping.
|
|
141
|
+
* @remarks for **WEBGL1** - tiling of images in textures only functions if image dimensions are powers of two
|
|
142
|
+
* (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
|
|
143
|
+
* Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL1, not three.js.
|
|
144
|
+
* **WEBGL2** does not have this limitation.
|
|
145
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
146
|
+
* @see {@link wrapS}
|
|
147
|
+
* @see {@link repeat}
|
|
148
|
+
* @defaultValue {@link THREE.ClampToEdgeWrapping}
|
|
99
149
|
*/
|
|
100
150
|
wrapT: Wrapping;
|
|
101
151
|
|
|
102
152
|
/**
|
|
103
|
-
* @
|
|
153
|
+
* How the {@link Texture} is sampled when a texel covers more than one pixel.
|
|
154
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
155
|
+
* @see {@link minFilter}
|
|
156
|
+
* @see {@link THREE.MagnificationTextureFilter}
|
|
157
|
+
* @defaultValue {@link THREE.LinearFilter}
|
|
104
158
|
*/
|
|
105
|
-
magFilter:
|
|
159
|
+
magFilter: MagnificationTextureFilter;
|
|
106
160
|
|
|
107
161
|
/**
|
|
108
|
-
* @
|
|
162
|
+
* How the {@link Texture} is sampled when a texel covers less than one pixel.
|
|
163
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
164
|
+
* @see {@link magFilter}
|
|
165
|
+
* @see {@link THREE.MinificationTextureFilter}
|
|
166
|
+
* @defaultValue {@link THREE.LinearMipmapLinearFilter}
|
|
109
167
|
*/
|
|
110
|
-
minFilter:
|
|
168
|
+
minFilter: MinificationTextureFilter;
|
|
111
169
|
|
|
112
170
|
/**
|
|
113
|
-
*
|
|
171
|
+
* The number of samples taken along the axis through the pixel that has the highest density of texels.
|
|
172
|
+
* @remarks A higher value gives a less blurry result than a basic mipmap, at the cost of more {@link Texture} samples being used.
|
|
173
|
+
* @remarks Use {@link THREE.WebGLCapabilities.getMaxAnisotropy() | renderer.capabilities.getMaxAnisotropy()} to find the maximum valid anisotropy value for the GPU;
|
|
174
|
+
* @remarks This value is usually a power of 2.
|
|
175
|
+
* @default _value of_ {@link THREE.Texture.DEFAULT_ANISOTROPY}. That is normally `1`.
|
|
114
176
|
*/
|
|
115
177
|
anisotropy: number;
|
|
116
178
|
|
|
117
179
|
/**
|
|
118
|
-
*
|
|
180
|
+
* These define how elements of a 2D texture, or texels, are read by shaders.
|
|
181
|
+
* @remarks All {@link Texture} types except {@link THREE.DeepTexture} and {@link THREE.CompressedPixelFormat} expect the _values_ be {@link THREE.PixelFormat}
|
|
182
|
+
* @remarks {@link DeepTexture} expect the _values_ be {@link THREE.CubeTextureMapping}
|
|
183
|
+
* @remarks {@link CompressedPixelFormat} expect the _values_ be {@link THREE.CubeTextureMapping}
|
|
184
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
185
|
+
* @see {@link THREE.PixelFormat}
|
|
186
|
+
* @defaultValue {@link THREE.RGBAFormat}.
|
|
119
187
|
*/
|
|
120
|
-
format:
|
|
121
|
-
|
|
122
|
-
internalFormat: PixelFormatGPU | null;
|
|
188
|
+
format: AnyPixelFormat;
|
|
123
189
|
|
|
124
190
|
/**
|
|
125
|
-
* @
|
|
191
|
+
* This must correspond to the {@link Texture.format | .format}.
|
|
192
|
+
* @remarks {@link THREE.UnsignedByteType}, is the type most used by Texture formats.
|
|
193
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
194
|
+
* @see {@link THREE.TextureDataType}
|
|
195
|
+
* @defaultValue {@link THREE.UnsignedByteType}
|
|
126
196
|
*/
|
|
127
197
|
type: TextureDataType;
|
|
128
198
|
|
|
129
199
|
/**
|
|
130
|
-
*
|
|
200
|
+
* The GPU Pixel Format allows the developer to specify how the data is going to be stored on the GPU.
|
|
201
|
+
* @remarks Compatible only with {@link WebGL2RenderingContext | WebGL 2 Rendering Context}.
|
|
202
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
203
|
+
* @defaultValue The default value is obtained using a combination of {@link Texture.format | .format} and {@link Texture.type | .type}.
|
|
204
|
+
*/
|
|
205
|
+
internalFormat: PixelFormatGPU | null;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The uv-transform matrix for the texture.
|
|
209
|
+
* @remarks
|
|
210
|
+
* When {@link Texture.matrixAutoUpdate | .matrixAutoUpdate} property is `true`.
|
|
211
|
+
* Will be updated by the renderer from the properties:
|
|
212
|
+
* - {@link Texture.offset | .offset}
|
|
213
|
+
* - {@link Texture.repeat | .repeat}
|
|
214
|
+
* - {@link Texture.rotation | .rotation}
|
|
215
|
+
* - {@link Texture.center | .center}
|
|
216
|
+
* @remarks
|
|
217
|
+
* When {@link Texture.matrixAutoUpdate | .matrixAutoUpdate} property is `false`.
|
|
218
|
+
* This matrix may be set manually.
|
|
219
|
+
* @see {@link matrixAutoUpdate | .matrixAutoUpdate}
|
|
220
|
+
* @defaultValue `new THREE.Matrix3()`
|
|
131
221
|
*/
|
|
132
222
|
matrix: Matrix3;
|
|
133
223
|
|
|
134
224
|
/**
|
|
135
|
-
* @
|
|
225
|
+
* Whether is to update the texture's uv-transform {@link matrix | .matrix}.
|
|
226
|
+
* @remarks Set this to `false` if you are specifying the uv-transform {@link matrix} directly.
|
|
227
|
+
* @see {@link matrix | .matrix}
|
|
228
|
+
* @defaultValue `true`
|
|
136
229
|
*/
|
|
137
230
|
matrixAutoUpdate: boolean;
|
|
138
231
|
|
|
139
232
|
/**
|
|
140
|
-
*
|
|
233
|
+
* How much a single repetition of the texture is offset from the beginning, in each direction **U** and **V**.
|
|
234
|
+
* @remarks Typical range is `0.0` to `1.0`.
|
|
235
|
+
* @remarks
|
|
236
|
+
* The below texture types share the `first` uv channel in the engine.
|
|
237
|
+
* The offset (and repeat) setting is evaluated according to the following priorities and then shared by those textures:
|
|
238
|
+
* - color map
|
|
239
|
+
* - specular map
|
|
240
|
+
* - displacement map
|
|
241
|
+
* - normal map
|
|
242
|
+
* - bump map
|
|
243
|
+
* - roughness map
|
|
244
|
+
* - metalness map
|
|
245
|
+
* - alpha map
|
|
246
|
+
* - emissive map
|
|
247
|
+
* - clearcoat map
|
|
248
|
+
* - clearcoat normal map
|
|
249
|
+
* - clearcoat roughnessMap map
|
|
250
|
+
* @remarks
|
|
251
|
+
* The below {@link Texture} types share the `second` uv channel in the engine.
|
|
252
|
+
* The offset (and repeat) setting is evaluated according to the following priorities and then shared by those textures:
|
|
253
|
+
* - ao map
|
|
254
|
+
* - light map
|
|
255
|
+
* @defaultValue `new THREE.Vector2(0, 0)`
|
|
141
256
|
*/
|
|
142
257
|
offset: Vector2;
|
|
143
258
|
|
|
144
259
|
/**
|
|
145
|
-
*
|
|
260
|
+
* How many times the texture is repeated across the surface, in each direction **U** and **V**.
|
|
261
|
+
* @remarks
|
|
262
|
+
* If repeat is set greater than `1` in either direction, the corresponding *Wrap* parameter should
|
|
263
|
+
* also be set to {@link THREE.RepeatWrapping} or {@link THREE.MirroredRepeatWrapping} to achieve the desired tiling effect.
|
|
264
|
+
* @remarks
|
|
265
|
+
* Setting different repeat values for textures is restricted in the same way like {@link .offset | .offset}.
|
|
266
|
+
* @see {@link wrapS}
|
|
267
|
+
* @see {@link wrapT}
|
|
268
|
+
* @defaultValue `new THREE.Vector2( 1, 1 )`
|
|
146
269
|
*/
|
|
147
270
|
repeat: Vector2;
|
|
148
271
|
|
|
149
272
|
/**
|
|
150
|
-
*
|
|
273
|
+
* The point around which rotation occurs.
|
|
274
|
+
* @remarks A value of `(0.5, 0.5)` corresponds to the center of the texture.
|
|
275
|
+
* @defaultValue `new THREE.Vector2( 0, 0 )`, _lower left._
|
|
151
276
|
*/
|
|
152
277
|
center: Vector2;
|
|
153
278
|
|
|
154
279
|
/**
|
|
155
|
-
*
|
|
280
|
+
* How much the texture is rotated around the center point, in radians.
|
|
281
|
+
* @remarks Positive values are counter-clockwise.
|
|
282
|
+
* @defaultValue `0`
|
|
156
283
|
*/
|
|
157
284
|
rotation: number;
|
|
158
285
|
|
|
159
286
|
/**
|
|
160
|
-
*
|
|
287
|
+
* Whether to generate mipmaps, _(if possible)_ for a texture.
|
|
288
|
+
* @remarks Set this to false if you are creating mipmaps manually.
|
|
289
|
+
* @defaultValue true
|
|
161
290
|
*/
|
|
162
291
|
generateMipmaps: boolean;
|
|
163
292
|
|
|
164
293
|
/**
|
|
165
|
-
*
|
|
294
|
+
* If set to `true`, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU.
|
|
295
|
+
* @remarks
|
|
296
|
+
* Note that this property has no effect for {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap | ImageBitmap}.
|
|
297
|
+
* You need to configure on bitmap creation instead. See {@link THREE.ImageBitmapLoader | ImageBitmapLoader}.
|
|
298
|
+
* @see {@link THREE.ImageBitmapLoader | ImageBitmapLoader}.
|
|
299
|
+
* @defaultValue `false`
|
|
166
300
|
*/
|
|
167
301
|
premultiplyAlpha: boolean;
|
|
168
302
|
|
|
169
303
|
/**
|
|
170
|
-
*
|
|
304
|
+
* If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU.
|
|
305
|
+
* @remarks
|
|
306
|
+
* Note that this property has no effect for {@link https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap | ImageBitmap}.
|
|
307
|
+
* You need to configure on bitmap creation instead. See {@link THREE.ImageBitmapLoader | ImageBitmapLoader}.
|
|
308
|
+
* @see {@link THREE.ImageBitmapLoader | ImageBitmapLoader}.
|
|
309
|
+
* @defaultValue `true`
|
|
171
310
|
*/
|
|
172
311
|
flipY: boolean;
|
|
173
312
|
|
|
174
313
|
/**
|
|
175
|
-
*
|
|
314
|
+
* Specifies the alignment requirements for the start of each pixel row in memory.
|
|
315
|
+
* @remarks
|
|
316
|
+
* The allowable values are:
|
|
317
|
+
* - `1` (byte-alignment)
|
|
318
|
+
* - `2` (rows aligned to even-numbered bytes)
|
|
319
|
+
* - `4` (word-alignment)
|
|
320
|
+
* - `8` (rows start on double-word boundaries).
|
|
321
|
+
* @see {@link http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml | glPixelStorei} for more information.
|
|
322
|
+
* @defaultValue `4`
|
|
176
323
|
*/
|
|
177
|
-
unpackAlignment: number;
|
|
324
|
+
unpackAlignment: number; // TODO Fix typing to only allow the expected values.
|
|
178
325
|
|
|
179
326
|
/**
|
|
180
|
-
* @
|
|
327
|
+
* The {@link Textures | {@link Texture} constants} page for details of other formats.
|
|
328
|
+
* @remarks
|
|
329
|
+
* Values of {@link encoding} !== {@link THREE.LinearEncoding} are only supported on _map_, _envMap_ and _emissiveMap_.
|
|
330
|
+
* @remarks
|
|
331
|
+
* Note that if this value is changed on a texture after the material has been used, it is necessary to trigger a {@link THREE.Material.needsUpdate} for this value to be realized in the shader.
|
|
332
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/constants/Textures | Texture Constants}
|
|
333
|
+
* @see {@link THREE.TextureDataType}
|
|
334
|
+
* @defaultValue {@link THREE.LinearEncoding}
|
|
181
335
|
*/
|
|
182
336
|
encoding: TextureEncoding;
|
|
183
337
|
|
|
184
338
|
/**
|
|
185
|
-
*
|
|
339
|
+
* Indicates whether a texture belongs to a render target or not
|
|
340
|
+
* @defaultValue `false`
|
|
186
341
|
*/
|
|
187
342
|
isRenderTargetTexture: boolean;
|
|
188
343
|
|
|
189
344
|
/**
|
|
190
|
-
* @
|
|
345
|
+
* Indicates whether this texture should be processed by {@link THREE.PMREMGenerator} or not.
|
|
346
|
+
* @remarks Only relevant for render target textures.
|
|
347
|
+
* @defaultValue `false`
|
|
191
348
|
*/
|
|
192
349
|
needsPMREMUpdate: boolean;
|
|
193
350
|
|
|
194
351
|
/**
|
|
195
|
-
* An object that can be used to store custom data about the
|
|
196
|
-
* @
|
|
352
|
+
* An object that can be used to store custom data about the texture.
|
|
353
|
+
* @remarks It should not hold references to functions as these will not be cloned.
|
|
354
|
+
* @defaultValue `{}`
|
|
197
355
|
*/
|
|
198
356
|
userData: any;
|
|
199
357
|
|
|
200
358
|
/**
|
|
201
|
-
* @
|
|
359
|
+
* This starts at `0` and counts how many times {@link needsUpdate | .needsUpdate} is set to `true`.
|
|
360
|
+
* @remarks Expects a `Integer`
|
|
361
|
+
* @defaultValue `0`
|
|
202
362
|
*/
|
|
203
363
|
version: number;
|
|
204
|
-
set needsUpdate(value: boolean);
|
|
205
|
-
readonly isTexture: true;
|
|
206
364
|
|
|
207
|
-
|
|
365
|
+
/**
|
|
366
|
+
* Set this to `true` to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
|
|
367
|
+
*/
|
|
368
|
+
set needsUpdate(value: boolean);
|
|
208
369
|
|
|
370
|
+
/**
|
|
371
|
+
* The Global default value for {@link anisotropy | .anisotropy}.
|
|
372
|
+
* @defaultValue `1`.
|
|
373
|
+
*/
|
|
209
374
|
static DEFAULT_ANISOTROPY: number;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* The Global default value for {@link Texture.image | .image}.
|
|
378
|
+
* @defaultValue `null`.
|
|
379
|
+
*/
|
|
210
380
|
static DEFAULT_IMAGE: any;
|
|
211
|
-
static DEFAULT_MAPPING: any;
|
|
212
381
|
|
|
382
|
+
/**
|
|
383
|
+
* The Global default value for {@link mapping | .mapping}.
|
|
384
|
+
* @defaultValue {@link THREE.UVMapping}
|
|
385
|
+
*/
|
|
386
|
+
static DEFAULT_MAPPING: Mapping;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* A callback function, called when the texture is updated _(e.g., when needsUpdate has been set to true and then the texture is used)_.
|
|
390
|
+
*/
|
|
391
|
+
onUpdate: () => void;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Transform the **UV** based on the value of this texture's
|
|
395
|
+
* {@link offset | .offset},
|
|
396
|
+
* {@link repeat | .repeat},
|
|
397
|
+
* {@link wrapS | .wrapS},
|
|
398
|
+
* {@link wrapT | .wrapT} and
|
|
399
|
+
* {@link flipY | .flipY} properties.
|
|
400
|
+
* @param uv
|
|
401
|
+
*/
|
|
402
|
+
transformUv(uv: Vector2): Vector2;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Update the texture's **UV-transform** {@link matrix | .matrix} from the texture properties
|
|
406
|
+
* {@link offset | .offset},
|
|
407
|
+
* {@link repeat | .repeat},
|
|
408
|
+
* {@link rotation | .rotation} and
|
|
409
|
+
* {@link center | .center}.
|
|
410
|
+
*/
|
|
411
|
+
updateMatrix(): void;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Make copy of the texture
|
|
415
|
+
* @remarks Note this is not a **"deep copy"**, the image is shared
|
|
416
|
+
* @remarks
|
|
417
|
+
* Besides, cloning a texture does not automatically mark it for a texture upload
|
|
418
|
+
* You have to set {@link needsUpdate | .needsUpdate} to `true` as soon as it's image property (the data source) is fully loaded or ready.
|
|
419
|
+
*/
|
|
213
420
|
clone(): this;
|
|
421
|
+
|
|
214
422
|
copy(source: Texture): this;
|
|
215
|
-
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Convert the texture to three.js {@link https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 | JSON Object/Scene format}.
|
|
426
|
+
* @param meta Optional object containing metadata.
|
|
427
|
+
*/
|
|
428
|
+
toJSON(meta?: string | {}): {};
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Frees the GPU-related resources allocated by this instance
|
|
432
|
+
* @remarks Call this method whenever this instance is no longer used in your app.
|
|
433
|
+
*/
|
|
216
434
|
dispose(): void;
|
|
217
|
-
transformUv(uv: Vector2): Vector2;
|
|
218
|
-
updateMatrix(): void;
|
|
219
435
|
}
|
|
@@ -1,34 +1,90 @@
|
|
|
1
1
|
import { 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 for use with a video.
|
|
13
|
+
* @remarks
|
|
14
|
+
* Note: After the initial use of a texture, the video cannot be changed
|
|
15
|
+
* Instead, call {@link dispose | .dispose()} on the texture and instantiate a new one.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // assuming you have created a HTML video element with id="video"
|
|
19
|
+
* const video = document.getElementById('video');
|
|
20
|
+
* const texture = new THREE.VideoTexture(video);
|
|
21
|
+
* ```
|
|
22
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_materials_video | materials / video}
|
|
23
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_materials_video_webcam | materials / video / webcam}
|
|
24
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_video_kinect | video / kinect}
|
|
25
|
+
* @see Example: {@link https://threejs.org/examples/#webgl_video_panorama_equirectangular | video / panorama / equirectangular}
|
|
26
|
+
* @see Example: {@link https://threejs.org/examples/#webxr_vr_video | vr / video}
|
|
27
|
+
* @see {@link https://threejs.org/docs/index.html#api/en/textures/VideoTexture | Official Documentation}
|
|
28
|
+
* @see {@link https://github.com/mrdoob/three.js/blob/master/src/textures/VideoTexture.js | Source}
|
|
29
|
+
*/
|
|
4
30
|
export class VideoTexture extends Texture {
|
|
5
31
|
/**
|
|
6
|
-
* @
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
32
|
+
* Create a new instance of {@link VideoTexture}
|
|
33
|
+
* @param video The video element to use as the texture.
|
|
34
|
+
* @param mapping See {@link Texture.mapping | .mapping}. Default {@link THREE.Texture.DEFAULT_MAPPING}
|
|
35
|
+
* @param wrapS See {@link Texture.wrapS | .wrapS}. Default {@link THREE.ClampToEdgeWrapping}
|
|
36
|
+
* @param wrapT See {@link Texture.wrapT | .wrapT}. Default {@link THREE.ClampToEdgeWrapping}
|
|
37
|
+
* @param magFilter See {@link Texture.magFilter | .magFilter}. Default {@link THREE.LinearFilter}
|
|
38
|
+
* @param minFilter See {@link Texture.minFilter | .minFilter}. Default {@link THREE.LinearFilter}
|
|
39
|
+
* @param format See {@link Texture.format | .format}. Default {@link THREE.RGBAFormat}
|
|
40
|
+
* @param type See {@link Texture.type | .type}. Default {@link THREE.UnsignedByteType}
|
|
41
|
+
* @param anisotropy See {@link Texture.anisotropy | .anisotropy}. Default {@link THREE.Texture.DEFAULT_ANISOTROPY}
|
|
15
42
|
*/
|
|
16
43
|
constructor(
|
|
17
44
|
video: HTMLVideoElement,
|
|
18
45
|
mapping?: Mapping,
|
|
19
46
|
wrapS?: Wrapping,
|
|
20
47
|
wrapT?: Wrapping,
|
|
21
|
-
magFilter?:
|
|
22
|
-
minFilter?:
|
|
48
|
+
magFilter?: MagnificationTextureFilter,
|
|
49
|
+
minFilter?: MinificationTextureFilter,
|
|
23
50
|
format?: PixelFormat,
|
|
24
51
|
type?: TextureDataType,
|
|
25
52
|
anisotropy?: number,
|
|
26
53
|
);
|
|
27
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Read-only flag to check if a given object is of type {@link VideoTexture}.
|
|
57
|
+
* @remarks This is a _constant_ value
|
|
58
|
+
* @defaultValue `true`
|
|
59
|
+
*/
|
|
28
60
|
readonly isVideoTexture: true;
|
|
29
61
|
|
|
30
62
|
/**
|
|
31
|
-
* @
|
|
63
|
+
* @override
|
|
64
|
+
* @defaultValue {@link THREE.LinearFilter}
|
|
65
|
+
*/
|
|
66
|
+
magFilter: MagnificationTextureFilter;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @override
|
|
70
|
+
* @defaultValue {@link THREE.LinearFilter}
|
|
71
|
+
*/
|
|
72
|
+
minFilter: MinificationTextureFilter;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @override
|
|
76
|
+
* @defaultValue `false`
|
|
32
77
|
*/
|
|
33
78
|
generateMipmaps: boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @override
|
|
82
|
+
* You will **not** need to set this manually here as it is handled by the {@link update | update()} method.
|
|
83
|
+
*/
|
|
84
|
+
set needsUpdate(value: boolean);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* This is called automatically and sets {@link needsUpdate | .needsUpdate } to `true` every time a new frame is available.
|
|
88
|
+
*/
|
|
89
|
+
update(): void;
|
|
34
90
|
}
|
three/src/utils.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { Color } from './math/Color';
|
|
1
|
+
import { Color, ColorKeyword } from './math/Color';
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type ColorModelString = `${'rgb' | 'hsl'}(${string})`;
|
|
4
|
+
export type HexColorString = `#${string}`;
|
|
5
|
+
|
|
6
|
+
export type ColorRepresentation = Color | ColorKeyword | ColorModelString | HexColorString | number;
|