UNPKG

3.59 kBTypeScriptView Raw
1import { MSAA_QUALITY } from '@pixi/constants';
2import { RenderTexture } from './RenderTexture';
3import type { ISize } from '@pixi/math';
4import type { IBaseTextureOptions } from '../textures/BaseTexture';
5/**
6 * Texture pool, used by FilterSystem and plugins.
7 *
8 * Stores collection of temporary pow2 or screen-sized renderTextures
9 *
10 * If you use custom RenderTexturePool for your filters, you can use methods
11 * `getFilterTexture` and `returnFilterTexture` same as in
12 * @memberof PIXI
13 */
14export declare class RenderTexturePool {
15 textureOptions: IBaseTextureOptions;
16 /**
17 * Allow renderTextures of the same size as screen, not just pow2
18 *
19 * Automatically sets to true after `setScreenSize`
20 * @default false
21 */
22 enableFullScreen: boolean;
23 texturePool: {
24 [x in string | number]: RenderTexture[];
25 };
26 private _pixelsWidth;
27 private _pixelsHeight;
28 /**
29 * @param textureOptions - options that will be passed to BaseRenderTexture constructor
30 * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.
31 */
32 constructor(textureOptions?: IBaseTextureOptions);
33 /**
34 * Creates texture with params that were specified in pool constructor.
35 * @param realWidth - Width of texture in pixels.
36 * @param realHeight - Height of texture in pixels.
37 * @param multisample - Number of samples of the framebuffer.
38 */
39 createTexture(realWidth: number, realHeight: number, multisample?: MSAA_QUALITY): RenderTexture;
40 /**
41 * Gets a Power-of-Two render texture or fullScreen texture
42 * @param minWidth - The minimum width of the render texture.
43 * @param minHeight - The minimum height of the render texture.
44 * @param resolution - The resolution of the render texture.
45 * @param multisample - Number of samples of the render texture.
46 * @returns The new render texture.
47 */
48 getOptimalTexture(minWidth: number, minHeight: number, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture;
49 /**
50 * Gets extra texture of the same size as input renderTexture
51 *
52 * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`
53 * @param input - renderTexture from which size and resolution will be copied
54 * @param resolution - override resolution of the renderTexture
55 * It overrides, it does not multiply
56 * @param multisample - number of samples of the renderTexture
57 */
58 getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture;
59 /**
60 * Place a render texture back into the pool.
61 * @param renderTexture - The renderTexture to free
62 */
63 returnTexture(renderTexture: RenderTexture): void;
64 /**
65 * Alias for returnTexture, to be compliant with FilterSystem interface.
66 * @param renderTexture - The renderTexture to free
67 */
68 returnFilterTexture(renderTexture: RenderTexture): void;
69 /**
70 * Clears the pool.
71 * @param destroyTextures - Destroy all stored textures.
72 */
73 clear(destroyTextures?: boolean): void;
74 /**
75 * If screen size was changed, drops all screen-sized textures,
76 * sets new screen size, sets `enableFullScreen` to true
77 *
78 * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`
79 * @param size - Initial size of screen.
80 */
81 setScreenSize(size: ISize): void;
82 /**
83 * Key that is used to store fullscreen renderTextures in a pool
84 * @readonly
85 */
86 static SCREEN_KEY: number;
87}