1 | import { Rectangle } from '@pixi/math';
|
2 | import type { ColorSource } from '@pixi/color';
|
3 | import type { BUFFER_BITS } from '@pixi/constants';
|
4 | import type { ExtensionMetadata } from '@pixi/extensions';
|
5 | import type { MaskData } from '../mask/MaskData';
|
6 | import type { Renderer } from '../Renderer';
|
7 | import type { ISystem } from '../system/ISystem';
|
8 | import type { RenderTexture } from './RenderTexture';
|
9 | /**
|
10 | * System plugin to the renderer to manage render textures.
|
11 | *
|
12 | * Should be added after FramebufferSystem
|
13 | *
|
14 | * ### Frames
|
15 | *
|
16 | * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different
|
17 | * coordinate spaces used:
|
18 | *
|
19 | * | Frame | Description | Coordinate System |
|
20 | * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |
|
21 | * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |
|
22 | * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |
|
23 | * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |
|
24 | * @memberof PIXI
|
25 | */
|
26 | export declare class RenderTextureSystem implements ISystem {
|
27 | /** @ignore */
|
28 | static extension: ExtensionMetadata;
|
29 | /**
|
30 | * List of masks for the {@link PIXI.StencilSystem}.
|
31 | * @readonly
|
32 | */
|
33 | defaultMaskStack: Array<MaskData>;
|
34 | /**
|
35 | * Render texture currently bound. {@code null} if rendering to the canvas.
|
36 | * @readonly
|
37 | */
|
38 | current: RenderTexture | null;
|
39 | /**
|
40 | * The source frame for the render-target's projection mapping.
|
41 | *
|
42 | * See {@link PIXI.ProjectionSystem#sourceFrame} for more details
|
43 | */
|
44 | readonly sourceFrame: Rectangle;
|
45 | /**
|
46 | * The destination frame for the render-target's projection mapping.
|
47 | *
|
48 | * See {@link PIXI.ProjectionSystem#destinationFrame} for more details.
|
49 | */
|
50 | readonly destinationFrame: Rectangle;
|
51 | /**
|
52 | * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame
|
53 | * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on
|
54 | * the bottom-left).
|
55 | */
|
56 | readonly viewportFrame: Rectangle;
|
57 | private renderer;
|
58 | /**
|
59 | * @param renderer - The renderer this System works for.
|
60 | */
|
61 | constructor(renderer: Renderer);
|
62 | /**
|
63 | * Bind the current render texture.
|
64 | * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.
|
65 | * @param sourceFrame - Part of world that is mapped to the renderTexture.
|
66 | * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.
|
67 | */
|
68 | bind(renderTexture?: RenderTexture, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void;
|
69 | /**
|
70 | * Erases the render texture and fills the drawing area with a colour.
|
71 | * @param clearColor - The color as rgba, default to use the renderer backgroundColor
|
72 | * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks
|
73 | * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.
|
74 | */
|
75 | clear(clearColor?: ColorSource, mask?: BUFFER_BITS): void;
|
76 | resize(): void;
|
77 | /** Resets render-texture state. */
|
78 | reset(): void;
|
79 | destroy(): void;
|
80 | }
|