UNPKG

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