UNPKG

1.05 kBJavaScriptView Raw
1"use strict";
2class AbstractMaskSystem {
3 /**
4 * @param renderer - The renderer this System works for.
5 */
6 constructor(renderer) {
7 this.renderer = renderer, this.maskStack = [], this.glConst = 0;
8 }
9 /** Gets count of masks of certain type. */
10 getStackLength() {
11 return this.maskStack.length;
12 }
13 /**
14 * Changes the mask stack that is used by this System.
15 * @param {PIXI.MaskData[]} maskStack - The mask stack
16 */
17 setMaskStack(maskStack) {
18 const { gl } = this.renderer, curStackLen = this.getStackLength();
19 this.maskStack = maskStack;
20 const newStackLen = this.getStackLength();
21 newStackLen !== curStackLen && (newStackLen === 0 ? gl.disable(this.glConst) : (gl.enable(this.glConst), this._useCurrent()));
22 }
23 /**
24 * Setup renderer to use the current mask data.
25 * @private
26 */
27 _useCurrent() {
28 }
29 /** Destroys the mask stack. */
30 destroy() {
31 this.renderer = null, this.maskStack = null;
32 }
33}
34exports.AbstractMaskSystem = AbstractMaskSystem;
35//# sourceMappingURL=AbstractMaskSystem.js.map