UNPKG

2.26 kBTypeScriptView Raw
1import { ObjectRenderer } from './ObjectRenderer';
2import type { ExtensionMetadata } from '@pixi/extensions';
3import type { Renderer } from '../Renderer';
4import type { ISystem } from '../system/ISystem';
5import type { BaseTexture } from '../textures/BaseTexture';
6import type { BatchTextureArray } from './BatchTextureArray';
7/**
8 * System plugin to the renderer to manage batching.
9 * @memberof PIXI
10 */
11export declare class BatchSystem implements ISystem {
12 /** @ignore */
13 static extension: ExtensionMetadata;
14 /** An empty renderer. */
15 readonly emptyRenderer: ObjectRenderer;
16 /** The currently active ObjectRenderer. */
17 currentRenderer: ObjectRenderer;
18 private renderer;
19 /**
20 * @param renderer - The renderer this System works for.
21 */
22 constructor(renderer: Renderer);
23 /**
24 * Changes the current renderer to the one given in parameter
25 * @param objectRenderer - The object renderer to use.
26 */
27 setObjectRenderer(objectRenderer: ObjectRenderer): void;
28 /**
29 * This should be called if you wish to do some custom rendering
30 * It will basically render anything that may be batched up such as sprites
31 */
32 flush(): void;
33 /** Reset the system to an empty renderer */
34 reset(): void;
35 /**
36 * Handy function for batch renderers: copies bound textures in first maxTextures locations to array
37 * sets actual _batchLocation for them
38 * @param arr - arr copy destination
39 * @param maxTextures - number of copied elements
40 */
41 copyBoundTextures(arr: BaseTexture[], maxTextures: number): void;
42 /**
43 * Assigns batch locations to textures in array based on boundTextures state.
44 * All textures in texArray should have `_batchEnabled = _batchId`,
45 * and their count should be less than `maxTextures`.
46 * @param texArray - textures to bound
47 * @param boundTextures - current state of bound textures
48 * @param batchId - marker for _batchEnabled param of textures in texArray
49 * @param maxTextures - number of texture locations to manipulate
50 */
51 boundArray(texArray: BatchTextureArray, boundTextures: Array<BaseTexture>, batchId: number, maxTextures: number): void;
52 /**
53 * @ignore
54 */
55 destroy(): void;
56}