UNPKG

3.82 kBTypeScriptView Raw
1import { SAMPLER_TYPES } from '@pixi/constants';
2import { BaseTexture } from './BaseTexture';
3import { GLTexture } from './GLTexture';
4import type { ExtensionMetadata } from '@pixi/extensions';
5import type { IRenderingContext } from '../IRenderer';
6import type { Renderer } from '../Renderer';
7import type { ISystem } from '../system/ISystem';
8import type { Texture } from './Texture';
9/**
10 * System plugin to the renderer to manage textures.
11 * @memberof PIXI
12 */
13export declare class TextureSystem implements ISystem {
14 /** @ignore */
15 static extension: ExtensionMetadata;
16 /**
17 * Bound textures.
18 * @readonly
19 */
20 boundTextures: BaseTexture[];
21 /**
22 * List of managed textures.
23 * @readonly
24 */
25 managedTextures: Array<BaseTexture>;
26 /** Whether glTexture with int/uint sampler type was uploaded. */
27 protected hasIntegerTextures: boolean;
28 protected CONTEXT_UID: number;
29 protected gl: IRenderingContext;
30 protected internalFormats: {
31 [type: number]: {
32 [format: number]: number;
33 };
34 };
35 protected samplerTypes: Record<number, SAMPLER_TYPES>;
36 protected webGLVersion: number;
37 /**
38 * BaseTexture value that shows that we don't know what is bound.
39 * @readonly
40 */
41 protected unknownTexture: BaseTexture;
42 /**
43 * Did someone temper with textures state? We'll overwrite them when we need to unbind something.
44 * @private
45 */
46 protected _unknownBoundTextures: boolean;
47 /**
48 * Current location.
49 * @readonly
50 */
51 currentLocation: number;
52 emptyTextures: {
53 [key: number]: GLTexture;
54 };
55 private renderer;
56 /**
57 * @param renderer - The renderer this system works for.
58 */
59 constructor(renderer: Renderer);
60 /** Sets up the renderer context and necessary buffers. */
61 contextChange(): void;
62 /**
63 * Bind a texture to a specific location
64 *
65 * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`
66 * @param texture - Texture to bind
67 * @param [location=0] - Location to bind at
68 */
69 bind(texture: Texture | BaseTexture, location?: number): void;
70 /** Resets texture location and bound textures Actual `bind(null, i)` calls will be performed at next `unbind()` call */
71 reset(): void;
72 /**
73 * Unbind a texture.
74 * @param texture - Texture to bind
75 */
76 unbind(texture?: BaseTexture): void;
77 /**
78 * Ensures that current boundTextures all have FLOAT sampler type,
79 * see {@link PIXI.SAMPLER_TYPES} for explanation.
80 * @param maxTextures - number of locations to check
81 */
82 ensureSamplerType(maxTextures: number): void;
83 /**
84 * Initialize a texture
85 * @private
86 * @param texture - Texture to initialize
87 */
88 initTexture(texture: BaseTexture): GLTexture;
89 initTextureType(texture: BaseTexture, glTexture: GLTexture): void;
90 /**
91 * Update a texture
92 * @private
93 * @param {PIXI.BaseTexture} texture - Texture to initialize
94 */
95 updateTexture(texture: BaseTexture): void;
96 /**
97 * Deletes the texture from WebGL
98 * @private
99 * @param texture - the texture to destroy
100 * @param [skipRemove=false] - Whether to skip removing the texture from the TextureManager.
101 */
102 destroyTexture(texture: BaseTexture | Texture, skipRemove?: boolean): void;
103 /**
104 * Update texture style such as mipmap flag
105 * @private
106 * @param {PIXI.BaseTexture} texture - Texture to update
107 */
108 updateTextureStyle(texture: BaseTexture): void;
109 /**
110 * Set style for texture
111 * @private
112 * @param texture - Texture to update
113 * @param glTexture
114 */
115 setStyle(texture: BaseTexture, glTexture: GLTexture): void;
116 destroy(): void;
117}