UNPKG

2.92 kBTypeScriptView Raw
1import { Runner } from '@pixi/runner';
2import { BaseTexture } from '../textures/BaseTexture';
3import { MSAA_QUALITY } from '@pixi/constants';
4import type { GLFramebuffer } from './GLFramebuffer';
5/**
6 * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses
7 * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.
8 *
9 * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.
10 * @memberof PIXI
11 */
12export declare class Framebuffer {
13 /** Width of framebuffer in pixels. */
14 width: number;
15 /** Height of framebuffer in pixels. */
16 height: number;
17 /**
18 * Desired number of samples for antialiasing. 0 means AA should not be used.
19 *
20 * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.
21 * Antialiasing is the same as for main buffer with renderer `antialias: true` options.
22 * Seriously affects GPU memory consumption and GPU performance.
23 * @example
24 * import { MSAA_QUALITY } from 'pixi.js';
25 *
26 * renderTexture.framebuffer.multisample = MSAA_QUALITY.HIGH;
27 * // ...
28 * renderer.render(myContainer, { renderTexture });
29 * renderer.framebuffer.blit(); // Copies data from MSAA framebuffer to texture
30 * @default PIXI.MSAA_QUALITY.NONE
31 */
32 multisample: MSAA_QUALITY;
33 stencil: boolean;
34 depth: boolean;
35 dirtyId: number;
36 dirtyFormat: number;
37 dirtySize: number;
38 depthTexture: BaseTexture;
39 colorTextures: Array<BaseTexture>;
40 glFramebuffers: {
41 [key: string]: GLFramebuffer;
42 };
43 disposeRunner: Runner;
44 /**
45 * @param width - Width of the frame buffer
46 * @param height - Height of the frame buffer
47 */
48 constructor(width: number, height: number);
49 /**
50 * Reference to the colorTexture.
51 * @readonly
52 */
53 get colorTexture(): BaseTexture;
54 /**
55 * Add texture to the colorTexture array.
56 * @param index - Index of the array to add the texture to
57 * @param texture - Texture to add to the array
58 */
59 addColorTexture(index?: number, texture?: BaseTexture): this;
60 /**
61 * Add a depth texture to the frame buffer.
62 * @param texture - Texture to add.
63 */
64 addDepthTexture(texture?: BaseTexture): this;
65 /** Enable depth on the frame buffer. */
66 enableDepth(): this;
67 /** Enable stencil on the frame buffer. */
68 enableStencil(): this;
69 /**
70 * Resize the frame buffer
71 * @param width - Width of the frame buffer to resize to
72 * @param height - Height of the frame buffer to resize to
73 */
74 resize(width: number, height: number): void;
75 /** Disposes WebGL resources that are connected to this geometry. */
76 dispose(): void;
77 /** Destroys and removes the depth texture added to this framebuffer. */
78 destroyDepthTexture(): void;
79}