UNPKG

3.49 kBTypeScriptView Raw
1import { Vector2 } from './../math/Vector2';
2import { Matrix3 } from './../math/Matrix3';
3import { EventDispatcher } from './../core/EventDispatcher';
4import {
5 Mapping,
6 Wrapping,
7 TextureFilter,
8 PixelFormat,
9 PixelFormatGPU,
10 TextureDataType,
11 TextureEncoding,
12} from '../constants';
13
14export class Texture extends EventDispatcher {
15 /**
16 * @param [image]
17 * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
18 * @param [wrapS=THREE.ClampToEdgeWrapping]
19 * @param [wrapT=THREE.ClampToEdgeWrapping]
20 * @param [magFilter=THREE.LinearFilter]
21 * @param [minFilter=THREE.LinearMipmapLinearFilter]
22 * @param [format=THREE.RGBAFormat]
23 * @param [type=THREE.UnsignedByteType]
24 * @param [anisotropy=1]
25 * @param [encoding=THREE.LinearEncoding]
26 */
27 constructor(
28 image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
29 mapping?: Mapping,
30 wrapS?: Wrapping,
31 wrapT?: Wrapping,
32 magFilter?: TextureFilter,
33 minFilter?: TextureFilter,
34 format?: PixelFormat,
35 type?: TextureDataType,
36 anisotropy?: number,
37 encoding?: TextureEncoding,
38 );
39
40 id: number;
41 uuid: string;
42
43 /**
44 * @default ''
45 */
46 name: string;
47 sourceFile: string;
48
49 /**
50 * @default THREE.Texture.DEFAULT_IMAGE
51 */
52 image: any; // HTMLImageElement or ImageData or { width: number, height: number } in some children;
53
54 /**
55 * @default []
56 */
57 mipmaps: any[]; // ImageData[] for 2D textures and CubeTexture[] for cube textures;
58
59 /**
60 * @default THREE.Texture.DEFAULT_MAPPING
61 */
62 mapping: Mapping;
63
64 /**
65 * @default THREE.ClampToEdgeWrapping
66 */
67 wrapS: Wrapping;
68
69 /**
70 * @default THREE.ClampToEdgeWrapping
71 */
72 wrapT: Wrapping;
73
74 /**
75 * @default THREE.LinearFilter
76 */
77 magFilter: TextureFilter;
78
79 /**
80 * @default THREE.LinearMipmapLinearFilter
81 */
82 minFilter: TextureFilter;
83
84 /**
85 * @default 1
86 */
87 anisotropy: number;
88
89 /**
90 * @default THREE.RGBAFormat
91 */
92 format: PixelFormat;
93
94 internalFormat: PixelFormatGPU | null;
95
96 /**
97 * @default THREE.UnsignedByteType
98 */
99 type: TextureDataType;
100
101 /**
102 * @default new THREE.Matrix3()
103 */
104 matrix: Matrix3;
105
106 /**
107 * @default true
108 */
109 matrixAutoUpdate: boolean;
110
111 /**
112 * @default new THREE.Vector2( 0, 0 )
113 */
114 offset: Vector2;
115
116 /**
117 * @default new THREE.Vector2( 1, 1 )
118 */
119 repeat: Vector2;
120
121 /**
122 * @default new THREE.Vector2( 0, 0 )
123 */
124 center: Vector2;
125
126 /**
127 * @default 0
128 */
129 rotation: number;
130
131 /**
132 * @default true
133 */
134 generateMipmaps: boolean;
135
136 /**
137 * @default false
138 */
139 premultiplyAlpha: boolean;
140
141 /**
142 * @default true
143 */
144 flipY: boolean;
145
146 /**
147 * @default 4
148 */
149 unpackAlignment: number;
150
151 /**
152 * @default THREE.LinearEncoding
153 */
154 encoding: TextureEncoding;
155
156 /**
157 * @default false
158 */
159 isRenderTargetTexture: boolean;
160
161 /**
162 * @default 0
163 */
164 version: number;
165 needsUpdate: boolean;
166 readonly isTexture: true;
167
168 onUpdate: () => void;
169 static DEFAULT_IMAGE: any;
170 static DEFAULT_MAPPING: any;
171
172 clone(): this;
173 copy(source: Texture): this;
174 toJSON(meta: any): any;
175 dispose(): void;
176 transformUv(uv: Vector2): Vector2;
177 updateMatrix(): void;
178}