@antv/l7-renderer 2.18.2 → 2.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglBuffer.ts
20
+ var ReglBuffer_exports = {};
21
+ __export(ReglBuffer_exports, {
22
+ default: () => ReglBuffer
23
+ });
24
+ module.exports = __toCommonJS(ReglBuffer_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_constants = require("./constants");
27
+ var ReglBuffer = class {
28
+ constructor(reGl, options) {
29
+ this.isDestroyed = false;
30
+ const { data, usage, type } = options;
31
+ this.buffer = reGl.buffer({
32
+ data,
33
+ usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
34
+ type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE]
35
+ // length: 0,
36
+ });
37
+ }
38
+ get() {
39
+ return this.buffer;
40
+ }
41
+ destroy() {
42
+ if (!this.isDestroyed) {
43
+ this.buffer.destroy();
44
+ }
45
+ this.isDestroyed = true;
46
+ }
47
+ subData({
48
+ data,
49
+ offset
50
+ }) {
51
+ this.buffer.subdata(data, offset);
52
+ }
53
+ };
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglElements.ts
20
+ var ReglElements_exports = {};
21
+ __export(ReglElements_exports, {
22
+ default: () => ReglElements
23
+ });
24
+ module.exports = __toCommonJS(ReglElements_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_constants = require("./constants");
27
+ var ReglElements = class {
28
+ constructor(reGl, options) {
29
+ const { data, usage, type, count } = options;
30
+ this.elements = reGl.elements({
31
+ data,
32
+ usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
33
+ type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE],
34
+ count
35
+ });
36
+ }
37
+ get() {
38
+ return this.elements;
39
+ }
40
+ subData({
41
+ data
42
+ }) {
43
+ this.elements.subdata(data);
44
+ }
45
+ destroy() {
46
+ }
47
+ };
@@ -0,0 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglFramebuffer.ts
20
+ var ReglFramebuffer_exports = {};
21
+ __export(ReglFramebuffer_exports, {
22
+ default: () => ReglFramebuffer
23
+ });
24
+ module.exports = __toCommonJS(ReglFramebuffer_exports);
25
+ var ReglFramebuffer = class {
26
+ constructor(reGl, options) {
27
+ const { width, height, color, colors } = options;
28
+ const framebufferOptions = {
29
+ width,
30
+ height
31
+ };
32
+ if (Array.isArray(colors)) {
33
+ framebufferOptions.colors = colors.map(
34
+ (c) => c.get()
35
+ );
36
+ }
37
+ if (color && typeof color !== "boolean") {
38
+ framebufferOptions.color = color.get();
39
+ }
40
+ this.framebuffer = reGl.framebuffer(framebufferOptions);
41
+ }
42
+ get() {
43
+ return this.framebuffer;
44
+ }
45
+ destroy() {
46
+ this.framebuffer.destroy();
47
+ }
48
+ resize({ width, height }) {
49
+ this.framebuffer.resize(width, height);
50
+ }
51
+ };
@@ -0,0 +1,305 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglModel.ts
20
+ var ReglModel_exports = {};
21
+ __export(ReglModel_exports, {
22
+ default: () => ReglModel
23
+ });
24
+ module.exports = __toCommonJS(ReglModel_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_l7_utils = require("@antv/l7-utils");
27
+ var import_constants = require("./constants");
28
+ var { isPlainObject, isTypedArray } = import_l7_utils.lodashUtil;
29
+ var ReglModel = class {
30
+ constructor(reGl, options) {
31
+ this.destroyed = false;
32
+ this.uniforms = {};
33
+ this.reGl = reGl;
34
+ const {
35
+ vs,
36
+ fs,
37
+ attributes,
38
+ uniforms,
39
+ primitive,
40
+ count,
41
+ elements,
42
+ depth,
43
+ cull,
44
+ instances
45
+ } = options;
46
+ const reglUniforms = {};
47
+ this.options = options;
48
+ if (uniforms) {
49
+ this.uniforms = this.extractUniforms(uniforms);
50
+ Object.keys(uniforms).forEach((uniformName) => {
51
+ reglUniforms[uniformName] = reGl.prop(uniformName);
52
+ });
53
+ }
54
+ const reglAttributes = {};
55
+ Object.keys(attributes).forEach((name) => {
56
+ reglAttributes[name] = attributes[name].get();
57
+ });
58
+ const drawParams = {
59
+ attributes: reglAttributes,
60
+ frag: fs,
61
+ uniforms: reglUniforms,
62
+ vert: vs,
63
+ // @ts-ignore
64
+ colorMask: reGl.prop("colorMask"),
65
+ lineWidth: 1,
66
+ blend: {
67
+ // @ts-ignore
68
+ enable: reGl.prop("blend.enable"),
69
+ // @ts-ignore
70
+ func: reGl.prop("blend.func"),
71
+ // @ts-ignore
72
+ equation: reGl.prop("blend.equation"),
73
+ // @ts-ignore
74
+ color: reGl.prop("blend.color")
75
+ },
76
+ stencil: {
77
+ // @ts-ignore
78
+ enable: reGl.prop("stencil.enable"),
79
+ // @ts-ignore
80
+ mask: reGl.prop("stencil.mask"),
81
+ // @ts-ignore
82
+ func: reGl.prop("stencil.func"),
83
+ // @ts-ignore
84
+ opFront: reGl.prop("stencil.opFront"),
85
+ // @ts-ignore
86
+ opBack: reGl.prop("stencil.opBack")
87
+ },
88
+ primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
89
+ };
90
+ if (instances) {
91
+ drawParams.instances = instances;
92
+ }
93
+ if (count) {
94
+ drawParams.count = count;
95
+ } else if (elements) {
96
+ drawParams.elements = elements.get();
97
+ }
98
+ this.initDepthDrawParams({ depth }, drawParams);
99
+ this.initCullDrawParams({ cull }, drawParams);
100
+ this.drawCommand = reGl(drawParams);
101
+ this.drawParams = drawParams;
102
+ }
103
+ updateAttributesAndElements(attributes, elements) {
104
+ const reglAttributes = {};
105
+ Object.keys(attributes).forEach((name) => {
106
+ reglAttributes[name] = attributes[name].get();
107
+ });
108
+ this.drawParams.attributes = reglAttributes;
109
+ this.drawParams.elements = elements.get();
110
+ this.drawCommand = this.reGl(this.drawParams);
111
+ }
112
+ updateAttributes(attributes) {
113
+ const reglAttributes = {};
114
+ Object.keys(attributes).forEach((name) => {
115
+ reglAttributes[name] = attributes[name].get();
116
+ });
117
+ this.drawParams.attributes = reglAttributes;
118
+ this.drawCommand = this.reGl(this.drawParams);
119
+ }
120
+ addUniforms(uniforms) {
121
+ this.uniforms = {
122
+ ...this.uniforms,
123
+ ...this.extractUniforms(uniforms)
124
+ };
125
+ }
126
+ draw(options, pick) {
127
+ if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
128
+ return;
129
+ }
130
+ const uniforms = {
131
+ ...this.uniforms,
132
+ ...this.extractUniforms(options.uniforms || {})
133
+ };
134
+ const reglDrawProps = {};
135
+ Object.keys(uniforms).forEach((uniformName) => {
136
+ const type = typeof uniforms[uniformName];
137
+ if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || // @ts-ignore
138
+ uniforms[uniformName].BYTES_PER_ELEMENT) {
139
+ reglDrawProps[uniformName] = uniforms[uniformName];
140
+ } else {
141
+ reglDrawProps[uniformName] = uniforms[uniformName].get();
142
+ }
143
+ });
144
+ reglDrawProps.blend = pick ? this.getBlendDrawParams({
145
+ blend: { enable: false }
146
+ }) : this.getBlendDrawParams(options);
147
+ reglDrawProps.stencil = this.getStencilDrawParams(options);
148
+ reglDrawProps.colorMask = this.getColorMaskDrawParams(options, pick);
149
+ this.drawCommand(reglDrawProps);
150
+ }
151
+ destroy() {
152
+ var _a, _b;
153
+ (_b = (_a = this.drawParams) == null ? void 0 : _a.elements) == null ? void 0 : _b.destroy();
154
+ if (this.options.attributes) {
155
+ Object.values(this.options.attributes).forEach((attr) => {
156
+ attr == null ? void 0 : attr.destroy();
157
+ });
158
+ }
159
+ this.destroyed = true;
160
+ }
161
+ /**
162
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
163
+ */
164
+ initDepthDrawParams({ depth }, drawParams) {
165
+ if (depth) {
166
+ drawParams.depth = {
167
+ enable: depth.enable === void 0 ? true : !!depth.enable,
168
+ mask: depth.mask === void 0 ? true : !!depth.mask,
169
+ func: import_constants.depthFuncMap[depth.func || import_l7_core.gl.LESS],
170
+ range: depth.range || [0, 1]
171
+ };
172
+ }
173
+ }
174
+ getBlendDrawParams({
175
+ blend
176
+ }) {
177
+ const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
178
+ return {
179
+ enable: !!enable,
180
+ func: {
181
+ srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
182
+ srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
183
+ dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
184
+ dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
185
+ },
186
+ equation: {
187
+ rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
188
+ alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
189
+ },
190
+ color
191
+ };
192
+ }
193
+ /**
194
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
195
+ */
196
+ getStencilDrawParams({
197
+ stencil
198
+ }) {
199
+ const {
200
+ enable,
201
+ mask = -1,
202
+ func = {
203
+ cmp: import_l7_core.gl.ALWAYS,
204
+ ref: 0,
205
+ mask: -1
206
+ },
207
+ opFront = {
208
+ fail: import_l7_core.gl.KEEP,
209
+ zfail: import_l7_core.gl.KEEP,
210
+ zpass: import_l7_core.gl.KEEP
211
+ },
212
+ opBack = {
213
+ fail: import_l7_core.gl.KEEP,
214
+ zfail: import_l7_core.gl.KEEP,
215
+ zpass: import_l7_core.gl.KEEP
216
+ }
217
+ } = stencil || {};
218
+ return {
219
+ enable: !!enable,
220
+ mask,
221
+ func: {
222
+ ...func,
223
+ cmp: import_constants.stencilFuncMap[func.cmp]
224
+ },
225
+ opFront: {
226
+ fail: import_constants.stencilOpMap[opFront.fail],
227
+ zfail: import_constants.stencilOpMap[opFront.zfail],
228
+ zpass: import_constants.stencilOpMap[opFront.zpass]
229
+ },
230
+ opBack: {
231
+ fail: import_constants.stencilOpMap[opBack.fail],
232
+ zfail: import_constants.stencilOpMap[opBack.zfail],
233
+ zpass: import_constants.stencilOpMap[opBack.zpass]
234
+ }
235
+ };
236
+ }
237
+ getColorMaskDrawParams({ stencil }, pick) {
238
+ const colorMask = (stencil == null ? void 0 : stencil.enable) && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true];
239
+ return colorMask;
240
+ }
241
+ /**
242
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
243
+ */
244
+ initCullDrawParams({ cull }, drawParams) {
245
+ if (cull) {
246
+ const { enable, face = import_l7_core.gl.BACK } = cull;
247
+ drawParams.cull = {
248
+ enable: !!enable,
249
+ face: import_constants.cullFaceMap[face]
250
+ };
251
+ }
252
+ }
253
+ /**
254
+ * 考虑结构体命名, eg:
255
+ * a: { b: 1 } -> 'a.b'
256
+ * a: [ { b: 1 } ] -> 'a[0].b'
257
+ */
258
+ extractUniforms(uniforms) {
259
+ const extractedUniforms = {};
260
+ Object.keys(uniforms).forEach((uniformName) => {
261
+ this.extractUniformsRecursively(
262
+ uniformName,
263
+ uniforms[uniformName],
264
+ extractedUniforms,
265
+ ""
266
+ );
267
+ });
268
+ return extractedUniforms;
269
+ }
270
+ extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
271
+ if (uniformValue === null || typeof uniformValue === "number" || // u_A: 1
272
+ typeof uniformValue === "boolean" || // u_A: false
273
+ Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || // u_A: [1, 2, 3]
274
+ isTypedArray(uniformValue) || // u_A: Float32Array
275
+ // @ts-ignore
276
+ uniformValue === "" || "resize" in uniformValue) {
277
+ uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
278
+ return;
279
+ }
280
+ if (isPlainObject(uniformValue)) {
281
+ Object.keys(uniformValue).forEach((childName) => {
282
+ this.extractUniformsRecursively(
283
+ childName,
284
+ // @ts-ignore
285
+ uniformValue[childName],
286
+ uniforms,
287
+ `${prefix && prefix + "."}${uniformName}`
288
+ );
289
+ });
290
+ }
291
+ if (Array.isArray(uniformValue)) {
292
+ uniformValue.forEach((child, idx) => {
293
+ Object.keys(child).forEach((childName) => {
294
+ this.extractUniformsRecursively(
295
+ childName,
296
+ // @ts-ignore
297
+ child[childName],
298
+ uniforms,
299
+ `${prefix && prefix + "."}${uniformName}[${idx}]`
300
+ );
301
+ });
302
+ });
303
+ }
304
+ }
305
+ };
@@ -0,0 +1,44 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglRenderbuffer.ts
20
+ var ReglRenderbuffer_exports = {};
21
+ __export(ReglRenderbuffer_exports, {
22
+ default: () => ReglRenderbuffer
23
+ });
24
+ module.exports = __toCommonJS(ReglRenderbuffer_exports);
25
+ var import_constants = require("./constants");
26
+ var ReglRenderbuffer = class {
27
+ constructor(reGl, options) {
28
+ const { width, height, format } = options;
29
+ this.renderbuffer = reGl.renderbuffer({
30
+ width,
31
+ height,
32
+ format: import_constants.formatMap[format]
33
+ });
34
+ }
35
+ get() {
36
+ return this.renderbuffer;
37
+ }
38
+ destroy() {
39
+ this.renderbuffer.destroy();
40
+ }
41
+ resize({ width, height }) {
42
+ this.renderbuffer.resize(width, height);
43
+ }
44
+ };
@@ -0,0 +1,107 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/regl/ReglTexture2D.ts
20
+ var ReglTexture2D_exports = {};
21
+ __export(ReglTexture2D_exports, {
22
+ default: () => ReglTexture2D
23
+ });
24
+ module.exports = __toCommonJS(ReglTexture2D_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_constants = require("./constants");
27
+ var ReglTexture2D = class {
28
+ constructor(reGl, options) {
29
+ this.isDestroy = false;
30
+ const {
31
+ data,
32
+ type = import_l7_core.gl.UNSIGNED_BYTE,
33
+ width,
34
+ height,
35
+ flipY = false,
36
+ format = import_l7_core.gl.RGBA,
37
+ mipmap = false,
38
+ wrapS = import_l7_core.gl.CLAMP_TO_EDGE,
39
+ wrapT = import_l7_core.gl.CLAMP_TO_EDGE,
40
+ aniso = 0,
41
+ alignment = 1,
42
+ premultiplyAlpha = false,
43
+ mag = import_l7_core.gl.NEAREST,
44
+ min = import_l7_core.gl.NEAREST,
45
+ colorSpace = import_l7_core.gl.BROWSER_DEFAULT_WEBGL,
46
+ x = 0,
47
+ y = 0,
48
+ copy = false
49
+ } = options;
50
+ this.width = width;
51
+ this.height = height;
52
+ const textureOptions = {
53
+ width,
54
+ height,
55
+ // @ts-ignore
56
+ type: import_constants.dataTypeMap[type],
57
+ format: import_constants.formatMap[format],
58
+ wrapS: import_constants.wrapModeMap[wrapS],
59
+ wrapT: import_constants.wrapModeMap[wrapT],
60
+ // @ts-ignore
61
+ mag: import_constants.filterMap[mag],
62
+ min: import_constants.filterMap[min],
63
+ alignment,
64
+ flipY,
65
+ colorSpace: import_constants.colorSpaceMap[colorSpace],
66
+ premultiplyAlpha,
67
+ aniso,
68
+ // copy pixels from current bind framebuffer
69
+ x,
70
+ y,
71
+ copy
72
+ };
73
+ if (data) {
74
+ textureOptions.data = data;
75
+ }
76
+ if (typeof mipmap === "number") {
77
+ textureOptions.mipmap = import_constants.mipmapMap[mipmap];
78
+ } else if (typeof mipmap === "boolean") {
79
+ textureOptions.mipmap = mipmap;
80
+ }
81
+ this.texture = reGl.texture(textureOptions);
82
+ }
83
+ get() {
84
+ return this.texture;
85
+ }
86
+ update(props = {}) {
87
+ this.texture(props);
88
+ }
89
+ bind() {
90
+ this.texture._texture.bind();
91
+ }
92
+ resize({ width, height }) {
93
+ this.texture.resize(width, height);
94
+ this.width = width;
95
+ this.height = height;
96
+ }
97
+ getSize() {
98
+ return [this.width, this.height];
99
+ }
100
+ destroy() {
101
+ var _a;
102
+ if (!this.isDestroy) {
103
+ (_a = this.texture) == null ? void 0 : _a.destroy();
104
+ }
105
+ this.isDestroy = true;
106
+ }
107
+ };