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