File size: 4,390 Bytes
2b7aae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import { Vector2 } from './../math/Vector2';
import { Matrix3 } from './../math/Matrix3';
import { Source } from './Source';
import { EventDispatcher } from './../core/EventDispatcher';
import { Mapping, Wrapping, TextureFilter, PixelFormat, PixelFormatGPU, TextureDataType, TextureEncoding } from '../constants';

export class Texture extends EventDispatcher {
	/**
	 * @param [image]
	 * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
	 * @param [wrapS=THREE.ClampToEdgeWrapping]
	 * @param [wrapT=THREE.ClampToEdgeWrapping]
	 * @param [magFilter=THREE.LinearFilter]
	 * @param [minFilter=THREE.LinearMipmapLinearFilter]
	 * @param [format=THREE.RGBAFormat]
	 * @param [type=THREE.UnsignedByteType]
	 * @param [anisotropy=1]
	 * @param [encoding=THREE.LinearEncoding]
	 */
	constructor(
		image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
		mapping?: Mapping,
		wrapS?: Wrapping,
		wrapT?: Wrapping,
		magFilter?: TextureFilter,
		minFilter?: TextureFilter,
		format?: PixelFormat,
		type?: TextureDataType,
		anisotropy?: number,
		encoding?: TextureEncoding
	);

	id: number;
	uuid: string;

	/**
	 * @default ''
	 */
	name: string;
	sourceFile: string;

	/**
	 * The data definition of a texture. A reference to the data source can be shared across textures.
	 * This is often useful in context of spritesheets where multiple textures render the same data but with different texture transformations.
	 */
	source: Source;

	/**
	 * An image object, typically created using the {@link TextureLoader.load} method.
	 * This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
	 *
	 * To use video as a texture you need to have a playing HTML5
	 * video element as a source for your texture image and continuously update this texture
	 * as long as video is playing - the {@link VideoTexture} class handles this automatically.
	 */
	get image(): any;

	/**
	 * An image object, typically created using the {@link TextureLoader.load} method.
	 * This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.
	 *
	 * To use video as a texture you need to have a playing HTML5
	 * video element as a source for your texture image and continuously update this texture
	 * as long as video is playing - the {@link VideoTexture} class handles this automatically.
	 */
	set image(data: any);

	/**
	 * @default []
	 */
	mipmaps: any[]; // ImageData[] for 2D textures and CubeTexture[] for cube textures;

	/**
	 * @default THREE.Texture.DEFAULT_MAPPING
	 */
	mapping: Mapping;

	/**
	 * @default THREE.ClampToEdgeWrapping
	 */
	wrapS: Wrapping;

	/**
	 * @default THREE.ClampToEdgeWrapping
	 */
	wrapT: Wrapping;

	/**
	 * @default THREE.LinearFilter
	 */
	magFilter: TextureFilter;

	/**
	 * @default THREE.LinearMipmapLinearFilter
	 */
	minFilter: TextureFilter;

	/**
	 * @default 1
	 */
	anisotropy: number;

	/**
	 * @default THREE.RGBAFormat
	 */
	format: PixelFormat;

	internalFormat: PixelFormatGPU | null;

	/**
	 * @default THREE.UnsignedByteType
	 */
	type: TextureDataType;

	/**
	 * @default new THREE.Matrix3()
	 */
	matrix: Matrix3;

	/**
	 * @default true
	 */
	matrixAutoUpdate: boolean;

	/**
	 * @default new THREE.Vector2( 0, 0 )
	 */
	offset: Vector2;

	/**
	 * @default new THREE.Vector2( 1, 1 )
	 */
	repeat: Vector2;

	/**
	 * @default new THREE.Vector2( 0, 0 )
	 */
	center: Vector2;

	/**
	 * @default 0
	 */
	rotation: number;

	/**
	 * @default true
	 */
	generateMipmaps: boolean;

	/**
	 * @default false
	 */
	premultiplyAlpha: boolean;

	/**
	 * @default true
	 */
	flipY: boolean;

	/**
	 * @default 4
	 */
	unpackAlignment: number;

	/**
	 * @default THREE.LinearEncoding
	 */
	encoding: TextureEncoding;

	/**
	 * @default false
	 */
	isRenderTargetTexture: boolean;

	/**
	 * @default false
	 */
	needsPMREMUpdate: boolean;

	/**
	 * An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned.
	 * @default {}
	 */
	userData: any;

	/**
	 * @default 0
	 */
	version: number;
	set needsUpdate(value: boolean);
	readonly isTexture: true;

	onUpdate: () => void;
	static DEFAULT_IMAGE: any;
	static DEFAULT_MAPPING: any;

	clone(): this;
	copy(source: Texture): this;
	toJSON(meta: any): any;
	dispose(): void;
	transformUv(uv: Vector2): Vector2;
	updateMatrix(): void;
}