1 | ;
|
2 | var constants = require("@pixi/constants"), Program = require("../shader/Program.js"), Shader = require("../shader/Shader.js"), State = require("../state/State.js"), defaultFilter$1 = require("./defaultFilter.frag.js"), defaultFilter = require("./defaultFilter.vert.js");
|
3 | const _Filter = class _Filter2 extends Shader.Shader {
|
4 | /**
|
5 | * @param vertexSrc - The source of the vertex shader.
|
6 | * @param fragmentSrc - The source of the fragment shader.
|
7 | * @param uniforms - Custom uniforms to use to augment the built-in ones.
|
8 | */
|
9 | constructor(vertexSrc, fragmentSrc, uniforms) {
|
10 | const program = Program.Program.from(
|
11 | vertexSrc || _Filter2.defaultVertexSrc,
|
12 | fragmentSrc || _Filter2.defaultFragmentSrc
|
13 | );
|
14 | super(program, uniforms), this.padding = 0, this.resolution = _Filter2.defaultResolution, this.multisample = _Filter2.defaultMultisample, this.enabled = !0, this.autoFit = !0, this.state = new State.State();
|
15 | }
|
16 | /**
|
17 | * Applies the filter
|
18 | * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from
|
19 | * @param {PIXI.RenderTexture} input - The input render target.
|
20 | * @param {PIXI.RenderTexture} output - The target to output to.
|
21 | * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.
|
22 | * @param {object} [_currentState] - It's current state of filter.
|
23 | * There are some useful properties in the currentState :
|
24 | * target, filters, sourceFrame, destinationFrame, renderTarget, resolution
|
25 | */
|
26 | apply(filterManager, input, output, clearMode, _currentState) {
|
27 | filterManager.applyFilter(this, input, output, clearMode);
|
28 | }
|
29 | /**
|
30 | * Sets the blend mode of the filter.
|
31 | * @default PIXI.BLEND_MODES.NORMAL
|
32 | */
|
33 | get blendMode() {
|
34 | return this.state.blendMode;
|
35 | }
|
36 | set blendMode(value) {
|
37 | this.state.blendMode = value;
|
38 | }
|
39 | /**
|
40 | * The resolution of the filter. Setting this to be lower will lower the quality but
|
41 | * increase the performance of the filter.
|
42 | * If set to `null` or `0`, the resolution of the current render target is used.
|
43 | * @default PIXI.Filter.defaultResolution
|
44 | */
|
45 | get resolution() {
|
46 | return this._resolution;
|
47 | }
|
48 | set resolution(value) {
|
49 | this._resolution = value;
|
50 | }
|
51 | /**
|
52 | * The default vertex shader source
|
53 | * @readonly
|
54 | */
|
55 | static get defaultVertexSrc() {
|
56 | return defaultFilter.default;
|
57 | }
|
58 | /**
|
59 | * The default fragment shader source
|
60 | * @readonly
|
61 | */
|
62 | static get defaultFragmentSrc() {
|
63 | return defaultFilter$1.default;
|
64 | }
|
65 | };
|
66 | _Filter.defaultResolution = 1, /**
|
67 | * Default filter samples for any filter.
|
68 | * @static
|
69 | * @type {PIXI.MSAA_QUALITY|null}
|
70 | * @default PIXI.MSAA_QUALITY.NONE
|
71 | */
|
72 | _Filter.defaultMultisample = constants.MSAA_QUALITY.NONE;
|
73 | let Filter = _Filter;
|
74 | exports.Filter = Filter;
|
75 | //# sourceMappingURL=Filter.js.map
|