UNPKG

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