1 | class AbstractMaskSystem {
|
2 | constructor(renderer) {
|
3 | this.renderer = renderer;
|
4 | this.maskStack = [];
|
5 | this.glConst = 0;
|
6 | }
|
7 | getStackLength() {
|
8 | return this.maskStack.length;
|
9 | }
|
10 | setMaskStack(maskStack) {
|
11 | const { gl } = this.renderer;
|
12 | const curStackLen = this.getStackLength();
|
13 | this.maskStack = maskStack;
|
14 | const newStackLen = this.getStackLength();
|
15 | if (newStackLen !== curStackLen) {
|
16 | if (newStackLen === 0) {
|
17 | gl.disable(this.glConst);
|
18 | } else {
|
19 | gl.enable(this.glConst);
|
20 | this._useCurrent();
|
21 | }
|
22 | }
|
23 | }
|
24 | _useCurrent() {
|
25 | }
|
26 | destroy() {
|
27 | this.renderer = null;
|
28 | this.maskStack = null;
|
29 | }
|
30 | }
|
31 |
|
32 | export { AbstractMaskSystem };
|
33 |
|