|
1 | 1 | import { Texture } from './Texture.js';
|
2 | 2 |
|
| 3 | +/** |
| 4 | + * Creates a texture based on data in compressed form. |
| 5 | + * |
| 6 | + * These texture are usually loaded with {@link CompressedTextureLoader}. |
| 7 | + * |
| 8 | + * @augments Texture |
| 9 | + */ |
3 | 10 | class CompressedTexture extends Texture {
|
4 | 11 |
|
| 12 | + /** |
| 13 | + * Constructs a new compressed texture. |
| 14 | + * |
| 15 | + * @param {Array<Object>} mipmaps - This array holds for all mipmaps (including the bases mip) |
| 16 | + * the data and dimensions. |
| 17 | + * @param {number} width - The width of the texture. |
| 18 | + * @param {number} height - The height of the texture. |
| 19 | + * @param {number} [format=RGBAFormat] - The texture format. |
| 20 | + * @param {number} [type=UnsignedByteType] - The texture type. |
| 21 | + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. |
| 22 | + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. |
| 23 | + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. |
| 24 | + * @param {number} [magFilter=LinearFilter] - The mag filter value. |
| 25 | + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. |
| 26 | + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. |
| 27 | + * @param {string} [colorSpace=NoColorSpace] - The color space. |
| 28 | + */ |
5 | 29 | constructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace ) {
|
6 | 30 |
|
7 | 31 | super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace );
|
8 | 32 |
|
| 33 | + /** |
| 34 | + * This flag can be used for type testing. |
| 35 | + * |
| 36 | + * @type {boolean} |
| 37 | + * @readonly |
| 38 | + * @default true |
| 39 | + */ |
9 | 40 | this.isCompressedTexture = true;
|
10 | 41 |
|
| 42 | + /** |
| 43 | + * The image property of a compressed texture just defines its dimensions. |
| 44 | + * |
| 45 | + * @type {{width:number,height:number}} |
| 46 | + */ |
11 | 47 | this.image = { width: width, height: height };
|
12 |
| - this.mipmaps = mipmaps; |
13 | 48 |
|
14 |
| - // no flipping for cube textures |
15 |
| - // (also flipping doesn't work for compressed textures ) |
| 49 | + /** |
| 50 | + * This array holds for all mipmaps (including the bases mip) the data and dimensions. |
| 51 | + * |
| 52 | + * @type {Array<Object>} |
| 53 | + */ |
| 54 | + this.mipmaps = mipmaps; |
16 | 55 |
|
| 56 | + /** |
| 57 | + * If set to `true`, the texture is flipped along the vertical axis when |
| 58 | + * uploaded to the GPU. |
| 59 | + * |
| 60 | + * Overwritten and set to `false` by default since it is not possible to |
| 61 | + * flip compressed textures. |
| 62 | + * |
| 63 | + * @type {boolean} |
| 64 | + * @default false |
| 65 | + * @readonly |
| 66 | + */ |
17 | 67 | this.flipY = false;
|
18 | 68 |
|
19 |
| - // can't generate mipmaps for compressed textures |
20 |
| - // mips must be embedded in DDS files |
21 |
| - |
| 69 | + /** |
| 70 | + * Whether to generate mipmaps (if possible) for a texture. |
| 71 | + * |
| 72 | + * Overwritten and set to `false` by default since it is not |
| 73 | + * possible to generate mipmaps for compressed data. Mipmaps |
| 74 | + * must be embedded in the compressed texture file. |
| 75 | + * |
| 76 | + * @type {boolean} |
| 77 | + * @default false |
| 78 | + * @readonly |
| 79 | + */ |
22 | 80 | this.generateMipmaps = false;
|
23 | 81 |
|
24 | 82 | }
|
|
0 commit comments