@antv/l7-renderer 2.9.26-alpha.0 → 2.9.26-alpha.1

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.
package/es/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ */
4
+ import ReglRendererService from './regl';
5
+ export { ReglRendererService };
package/es/index.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ */
4
+ import ReglRendererService from "./regl";
5
+ export { ReglRendererService };
@@ -0,0 +1,16 @@
1
+ import { IAttribute, IAttributeInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#attributes
5
+ */
6
+ export default class ReglAttribute implements IAttribute {
7
+ private attribute;
8
+ private buffer;
9
+ constructor(gl: regl.Regl, options: IAttributeInitializationOptions);
10
+ get(): regl.Attribute;
11
+ updateBuffer(options: {
12
+ data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
13
+ offset: number;
14
+ }): void;
15
+ destroy(): void;
16
+ }
@@ -0,0 +1,51 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+
4
+ /**
5
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#attributes
6
+ */
7
+ var ReglAttribute = /*#__PURE__*/function () {
8
+ function ReglAttribute(gl, options) {
9
+ _classCallCheck(this, ReglAttribute);
10
+
11
+ var buffer = options.buffer,
12
+ offset = options.offset,
13
+ stride = options.stride,
14
+ normalized = options.normalized,
15
+ size = options.size,
16
+ divisor = options.divisor;
17
+ this.buffer = buffer;
18
+ this.attribute = {
19
+ buffer: buffer.get(),
20
+ offset: offset || 0,
21
+ stride: stride || 0,
22
+ normalized: normalized || false,
23
+ divisor: divisor || 0
24
+ };
25
+
26
+ if (size) {
27
+ this.attribute.size = size;
28
+ }
29
+ }
30
+
31
+ _createClass(ReglAttribute, [{
32
+ key: "get",
33
+ value: function get() {
34
+ return this.attribute;
35
+ }
36
+ }, {
37
+ key: "updateBuffer",
38
+ value: function updateBuffer(options) {
39
+ this.buffer.subData(options);
40
+ }
41
+ }, {
42
+ key: "destroy",
43
+ value: function destroy() {
44
+ this.buffer.destroy();
45
+ }
46
+ }]);
47
+
48
+ return ReglAttribute;
49
+ }();
50
+
51
+ export { ReglAttribute as default };
@@ -0,0 +1,16 @@
1
+ import { IBuffer, IBufferInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.Buffer
5
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#buffers
6
+ */
7
+ export default class ReglBuffer implements IBuffer {
8
+ private buffer;
9
+ constructor(reGl: regl.Regl, options: IBufferInitializationOptions);
10
+ get(): regl.Buffer;
11
+ destroy(): void;
12
+ subData({ data, offset, }: {
13
+ data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
14
+ offset: number;
15
+ }): void;
16
+ }
@@ -0,0 +1,47 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import { gl } from '@antv/l7-core';
4
+ import { dataTypeMap, usageMap } from "./constants";
5
+ /**
6
+ * adaptor for regl.Buffer
7
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#buffers
8
+ */
9
+
10
+ var ReglBuffer = /*#__PURE__*/function () {
11
+ function ReglBuffer(reGl, options) {
12
+ _classCallCheck(this, ReglBuffer);
13
+
14
+ var data = options.data,
15
+ usage = options.usage,
16
+ type = options.type;
17
+ this.buffer = reGl.buffer({
18
+ data: data,
19
+ usage: usageMap[usage || gl.STATIC_DRAW],
20
+ type: dataTypeMap[type || gl.UNSIGNED_BYTE] // length: 0,
21
+
22
+ });
23
+ }
24
+
25
+ _createClass(ReglBuffer, [{
26
+ key: "get",
27
+ value: function get() {
28
+ return this.buffer;
29
+ }
30
+ }, {
31
+ key: "destroy",
32
+ value: function destroy() {
33
+ this.buffer.destroy();
34
+ }
35
+ }, {
36
+ key: "subData",
37
+ value: function subData(_ref) {
38
+ var data = _ref.data,
39
+ offset = _ref.offset;
40
+ this.buffer.subdata(data, offset);
41
+ }
42
+ }]);
43
+
44
+ return ReglBuffer;
45
+ }();
46
+
47
+ export { ReglBuffer as default };
@@ -0,0 +1,14 @@
1
+ import { IElements, IElementsInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#elements
5
+ */
6
+ export default class ReglElements implements IElements {
7
+ private elements;
8
+ constructor(reGl: regl.Regl, options: IElementsInitializationOptions);
9
+ get(): regl.Elements;
10
+ subData({ data, }: {
11
+ data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
12
+ }): void;
13
+ destroy(): void;
14
+ }
@@ -0,0 +1,45 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import { gl } from '@antv/l7-core';
4
+ import { dataTypeMap, usageMap } from "./constants";
5
+ /**
6
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#elements
7
+ */
8
+
9
+ var ReglElements = /*#__PURE__*/function () {
10
+ function ReglElements(reGl, options) {
11
+ _classCallCheck(this, ReglElements);
12
+
13
+ var data = options.data,
14
+ usage = options.usage,
15
+ type = options.type,
16
+ count = options.count;
17
+ this.elements = reGl.elements({
18
+ data: data,
19
+ usage: usageMap[usage || gl.STATIC_DRAW],
20
+ type: dataTypeMap[type || gl.UNSIGNED_BYTE],
21
+ count: count
22
+ });
23
+ }
24
+
25
+ _createClass(ReglElements, [{
26
+ key: "get",
27
+ value: function get() {
28
+ return this.elements;
29
+ }
30
+ }, {
31
+ key: "subData",
32
+ value: function subData(_ref) {
33
+ var data = _ref.data;
34
+ this.elements.subdata(data);
35
+ }
36
+ }, {
37
+ key: "destroy",
38
+ value: function destroy() {// this.elements.destroy();
39
+ }
40
+ }]);
41
+
42
+ return ReglElements;
43
+ }();
44
+
45
+ export { ReglElements as default };
@@ -0,0 +1,16 @@
1
+ import { IFramebuffer, IFramebufferInitializationOptions } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.Framebuffer
5
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#framebuffers
6
+ */
7
+ export default class ReglFramebuffer implements IFramebuffer {
8
+ private framebuffer;
9
+ constructor(reGl: regl.Regl, options: IFramebufferInitializationOptions);
10
+ get(): regl.Framebuffer;
11
+ destroy(): void;
12
+ resize({ width, height }: {
13
+ width: number;
14
+ height: number;
15
+ }): void;
16
+ }
@@ -0,0 +1,59 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+
4
+ /**
5
+ * adaptor for regl.Framebuffer
6
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#framebuffers
7
+ */
8
+ var ReglFramebuffer = /*#__PURE__*/function () {
9
+ function ReglFramebuffer(reGl, options) {
10
+ _classCallCheck(this, ReglFramebuffer);
11
+
12
+ var width = options.width,
13
+ height = options.height,
14
+ color = options.color,
15
+ colors = options.colors,
16
+ depth = options.depth,
17
+ stencil = options.stencil;
18
+ var framebufferOptions = {
19
+ width: width,
20
+ height: height
21
+ };
22
+
23
+ if (Array.isArray(colors)) {
24
+ framebufferOptions.colors = colors.map(function (c) {
25
+ return c.get();
26
+ });
27
+ }
28
+
29
+ if (color && typeof color !== 'boolean') {
30
+ framebufferOptions.color = color.get();
31
+ } // TODO: depth & stencil
32
+
33
+
34
+ this.framebuffer = reGl.framebuffer(framebufferOptions);
35
+ }
36
+
37
+ _createClass(ReglFramebuffer, [{
38
+ key: "get",
39
+ value: function get() {
40
+ return this.framebuffer;
41
+ }
42
+ }, {
43
+ key: "destroy",
44
+ value: function destroy() {
45
+ this.framebuffer.destroy();
46
+ }
47
+ }, {
48
+ key: "resize",
49
+ value: function resize(_ref) {
50
+ var width = _ref.width,
51
+ height = _ref.height;
52
+ this.framebuffer.resize(width, height);
53
+ }
54
+ }]);
55
+
56
+ return ReglFramebuffer;
57
+ }();
58
+
59
+ export { ReglFramebuffer as default };
@@ -0,0 +1,49 @@
1
+ import { IAttribute, IElements, IModel, IModelDrawOptions, IModelInitializationOptions, IUniform } from '@antv/l7-core';
2
+ import regl from 'l7regl';
3
+ /**
4
+ * adaptor for regl.DrawCommand
5
+ */
6
+ export default class ReglModel implements IModel {
7
+ private reGl;
8
+ private destroyed;
9
+ private drawCommand;
10
+ private drawPickCommand;
11
+ private drawParams;
12
+ private options;
13
+ private uniforms;
14
+ constructor(reGl: regl.Regl, options: IModelInitializationOptions);
15
+ updateAttributesAndElements(attributes: {
16
+ [key: string]: IAttribute;
17
+ }, elements: IElements): void;
18
+ updateAttributes(attributes: {
19
+ [key: string]: IAttribute;
20
+ }): void;
21
+ addUniforms(uniforms: {
22
+ [key: string]: IUniform;
23
+ }): void;
24
+ draw(options: IModelDrawOptions, pick?: boolean): void;
25
+ destroy(): void;
26
+ /**
27
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
28
+ */
29
+ private initDepthDrawParams;
30
+ /**
31
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending
32
+ */
33
+ private initBlendDrawParams;
34
+ /**
35
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
36
+ */
37
+ private initStencilDrawParams;
38
+ /**
39
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
40
+ */
41
+ private initCullDrawParams;
42
+ /**
43
+ * 考虑结构体命名, eg:
44
+ * a: { b: 1 } -> 'a.b'
45
+ * a: [ { b: 1 } ] -> 'a[0].b'
46
+ */
47
+ private extractUniforms;
48
+ private extractUniformsRecursively;
49
+ }
@@ -0,0 +1,348 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/createClass";
5
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
+ import { gl } from '@antv/l7-core';
7
+ import { cloneDeep, isPlainObject, isTypedArray } from 'lodash';
8
+ import { blendEquationMap, blendFuncMap, cullFaceMap, depthFuncMap, primitiveMap, stencilFuncMap, stencilOpMap } from "./constants";
9
+
10
+ /**
11
+ * adaptor for regl.DrawCommand
12
+ */
13
+ var ReglModel = /*#__PURE__*/function () {
14
+ function ReglModel(reGl, options) {
15
+ _classCallCheck(this, ReglModel);
16
+
17
+ _defineProperty(this, "destroyed", false);
18
+
19
+ _defineProperty(this, "uniforms", {});
20
+
21
+ this.reGl = reGl;
22
+ var vs = options.vs,
23
+ fs = options.fs,
24
+ attributes = options.attributes,
25
+ uniforms = options.uniforms,
26
+ primitive = options.primitive,
27
+ count = options.count,
28
+ elements = options.elements,
29
+ depth = options.depth,
30
+ blend = options.blend,
31
+ stencil = options.stencil,
32
+ cull = options.cull,
33
+ instances = options.instances;
34
+ var reglUniforms = {};
35
+ this.options = options;
36
+
37
+ if (uniforms) {
38
+ this.uniforms = this.extractUniforms(uniforms);
39
+ Object.keys(uniforms).forEach(function (uniformName) {
40
+ // use regl prop API
41
+ // @ts-ignore
42
+ reglUniforms[uniformName] = reGl.prop(uniformName);
43
+ });
44
+ }
45
+
46
+ var reglAttributes = {};
47
+ Object.keys(attributes).forEach(function (name) {
48
+ reglAttributes[name] = attributes[name].get();
49
+ });
50
+ var drawParams = {
51
+ attributes: reglAttributes,
52
+ frag: fs,
53
+ uniforms: reglUniforms,
54
+ vert: vs,
55
+ blend: {},
56
+ primitive: primitiveMap[primitive === undefined ? gl.TRIANGLES : primitive]
57
+ };
58
+
59
+ if (instances) {
60
+ drawParams.instances = instances;
61
+ } // Tip:
62
+ // elements 中可能包含 count,此时不应传入
63
+ // count 和 elements 相比、count 优先
64
+
65
+
66
+ if (count) {
67
+ drawParams.count = count;
68
+ } else if (elements) {
69
+ drawParams.elements = elements.get();
70
+ }
71
+
72
+ this.initDepthDrawParams({
73
+ depth: depth
74
+ }, drawParams);
75
+ this.initBlendDrawParams({
76
+ blend: blend
77
+ }, drawParams);
78
+ this.initStencilDrawParams({
79
+ stencil: stencil
80
+ }, drawParams);
81
+ this.initCullDrawParams({
82
+ cull: cull
83
+ }, drawParams);
84
+ this.drawCommand = reGl(drawParams);
85
+ var pickDrawParams = cloneDeep(drawParams);
86
+ pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
87
+ enable: false
88
+ });
89
+ this.drawPickCommand = reGl(pickDrawParams);
90
+ this.drawParams = drawParams;
91
+ }
92
+
93
+ _createClass(ReglModel, [{
94
+ key: "updateAttributesAndElements",
95
+ value: function updateAttributesAndElements(attributes, elements) {
96
+ var reglAttributes = {};
97
+ Object.keys(attributes).forEach(function (name) {
98
+ reglAttributes[name] = attributes[name].get();
99
+ });
100
+ this.drawParams.attributes = reglAttributes;
101
+ this.drawParams.elements = elements.get();
102
+ this.drawCommand = this.reGl(this.drawParams);
103
+ var pickDrawParams = cloneDeep(this.drawParams);
104
+ pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
105
+ enable: false
106
+ });
107
+ this.drawPickCommand = this.reGl(pickDrawParams);
108
+ }
109
+ }, {
110
+ key: "updateAttributes",
111
+ value: function updateAttributes(attributes) {
112
+ var reglAttributes = {};
113
+ Object.keys(attributes).forEach(function (name) {
114
+ reglAttributes[name] = attributes[name].get();
115
+ });
116
+ this.drawParams.attributes = reglAttributes;
117
+ this.drawCommand = this.reGl(this.drawParams);
118
+ var pickDrawParams = cloneDeep(this.drawParams);
119
+ pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
120
+ enable: false
121
+ });
122
+ this.drawPickCommand = this.reGl(pickDrawParams);
123
+ }
124
+ }, {
125
+ key: "addUniforms",
126
+ value: function addUniforms(uniforms) {
127
+ this.uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(uniforms));
128
+ }
129
+ }, {
130
+ key: "draw",
131
+ value: function draw(options, pick) {
132
+ // console.log('options', this.drawParams)
133
+ if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
134
+ return;
135
+ }
136
+
137
+ var uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(options.uniforms || {}));
138
+
139
+ var reglDrawProps = {};
140
+ Object.keys(uniforms).forEach(function (uniformName) {
141
+ var type = _typeof(uniforms[uniformName]);
142
+
143
+ if (type === 'boolean' || type === 'number' || Array.isArray(uniforms[uniformName]) || // @ts-ignore
144
+ uniforms[uniformName].BYTES_PER_ELEMENT) {
145
+ reglDrawProps[uniformName] = uniforms[uniformName];
146
+ } else {
147
+ reglDrawProps[uniformName] = uniforms[uniformName].get();
148
+ }
149
+ }); // TODO: 在进行拾取操作的绘制中,不应该使用叠加模式 - picking 根据拾取的颜色作为判断的输入,而叠加模式会产生新的,在 id 序列中不存在的颜色
150
+
151
+ if (!pick) {
152
+ this.drawCommand(reglDrawProps);
153
+ } else {
154
+ this.drawPickCommand(reglDrawProps);
155
+ } // this.drawCommand(reglDrawProps);
156
+ // this.drawPickCommand(reglDrawProps);
157
+
158
+ }
159
+ }, {
160
+ key: "destroy",
161
+ value: function destroy() {
162
+ // @ts-ignore
163
+ this.drawParams.elements.destroy();
164
+
165
+ if (this.options.attributes) {
166
+ Object.values(this.options.attributes).forEach(function (attr) {
167
+ // @ts-ignore
168
+ attr.destroy();
169
+ });
170
+ }
171
+
172
+ this.destroyed = true;
173
+ }
174
+ /**
175
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
176
+ */
177
+
178
+ }, {
179
+ key: "initDepthDrawParams",
180
+ value: function initDepthDrawParams(_ref, drawParams) {
181
+ var depth = _ref.depth;
182
+
183
+ if (depth) {
184
+ drawParams.depth = {
185
+ enable: depth.enable === undefined ? true : !!depth.enable,
186
+ mask: depth.mask === undefined ? true : !!depth.mask,
187
+ func: depthFuncMap[depth.func || gl.LESS],
188
+ range: depth.range || [0, 1]
189
+ };
190
+ }
191
+ }
192
+ /**
193
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#blending
194
+ */
195
+
196
+ }, {
197
+ key: "initBlendDrawParams",
198
+ value: function initBlendDrawParams(_ref2, drawParams) {
199
+ var blend = _ref2.blend;
200
+
201
+ if (blend) {
202
+ var enable = blend.enable,
203
+ func = blend.func,
204
+ equation = blend.equation,
205
+ _blend$color = blend.color,
206
+ color = _blend$color === void 0 ? [0, 0, 0, 0] : _blend$color; // @ts-ignore
207
+
208
+ drawParams.blend = {
209
+ enable: !!enable,
210
+ func: {
211
+ srcRGB: blendFuncMap[func && func.srcRGB || gl.SRC_ALPHA],
212
+ srcAlpha: blendFuncMap[func && func.srcAlpha || gl.SRC_ALPHA],
213
+ dstRGB: blendFuncMap[func && func.dstRGB || gl.ONE_MINUS_SRC_ALPHA],
214
+ dstAlpha: blendFuncMap[func && func.dstAlpha || gl.ONE_MINUS_SRC_ALPHA]
215
+ },
216
+ equation: {
217
+ rgb: blendEquationMap[equation && equation.rgb || gl.FUNC_ADD],
218
+ alpha: blendEquationMap[equation && equation.alpha || gl.FUNC_ADD]
219
+ },
220
+ color: color
221
+ };
222
+ }
223
+ }
224
+ /**
225
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
226
+ */
227
+
228
+ }, {
229
+ key: "initStencilDrawParams",
230
+ value: function initStencilDrawParams(_ref3, drawParams) {
231
+ var stencil = _ref3.stencil;
232
+
233
+ if (stencil) {
234
+ var enable = stencil.enable,
235
+ _stencil$mask = stencil.mask,
236
+ mask = _stencil$mask === void 0 ? -1 : _stencil$mask,
237
+ _stencil$func = stencil.func,
238
+ func = _stencil$func === void 0 ? {
239
+ cmp: gl.ALWAYS,
240
+ ref: 0,
241
+ mask: -1
242
+ } : _stencil$func,
243
+ _stencil$opFront = stencil.opFront,
244
+ opFront = _stencil$opFront === void 0 ? {
245
+ fail: gl.KEEP,
246
+ zfail: gl.KEEP,
247
+ zpass: gl.KEEP
248
+ } : _stencil$opFront,
249
+ _stencil$opBack = stencil.opBack,
250
+ opBack = _stencil$opBack === void 0 ? {
251
+ fail: gl.KEEP,
252
+ zfail: gl.KEEP,
253
+ zpass: gl.KEEP
254
+ } : _stencil$opBack;
255
+ drawParams.stencil = {
256
+ enable: !!enable,
257
+ mask: mask,
258
+ func: _objectSpread(_objectSpread({}, func), {}, {
259
+ cmp: stencilFuncMap[func.cmp]
260
+ }),
261
+ opFront: {
262
+ fail: stencilOpMap[opFront.fail],
263
+ zfail: stencilOpMap[opFront.zfail],
264
+ zpass: stencilOpMap[opFront.zpass]
265
+ },
266
+ opBack: {
267
+ fail: stencilOpMap[opBack.fail],
268
+ zfail: stencilOpMap[opBack.zfail],
269
+ zpass: stencilOpMap[opBack.zpass]
270
+ }
271
+ };
272
+ }
273
+ }
274
+ /**
275
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
276
+ */
277
+
278
+ }, {
279
+ key: "initCullDrawParams",
280
+ value: function initCullDrawParams(_ref4, drawParams) {
281
+ var cull = _ref4.cull;
282
+
283
+ if (cull) {
284
+ var enable = cull.enable,
285
+ _cull$face = cull.face,
286
+ face = _cull$face === void 0 ? gl.BACK : _cull$face;
287
+ drawParams.cull = {
288
+ enable: !!enable,
289
+ face: cullFaceMap[face]
290
+ };
291
+ }
292
+ }
293
+ /**
294
+ * 考虑结构体命名, eg:
295
+ * a: { b: 1 } -> 'a.b'
296
+ * a: [ { b: 1 } ] -> 'a[0].b'
297
+ */
298
+
299
+ }, {
300
+ key: "extractUniforms",
301
+ value: function extractUniforms(uniforms) {
302
+ var _this = this;
303
+
304
+ var extractedUniforms = {};
305
+ Object.keys(uniforms).forEach(function (uniformName) {
306
+ _this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, '');
307
+ });
308
+ return extractedUniforms;
309
+ }
310
+ }, {
311
+ key: "extractUniformsRecursively",
312
+ value: function extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
313
+ var _this2 = this;
314
+
315
+ if (uniformValue === null || typeof uniformValue === 'number' || // u_A: 1
316
+ typeof uniformValue === 'boolean' || // u_A: false
317
+ Array.isArray(uniformValue) && typeof uniformValue[0] === 'number' || // u_A: [1, 2, 3]
318
+ isTypedArray(uniformValue) || // u_A: Float32Array
319
+ // @ts-ignore
320
+ uniformValue === '' || 'resize' in uniformValue) {
321
+ uniforms["".concat(prefix && prefix + '.').concat(uniformName)] = uniformValue;
322
+ return;
323
+ } // u_Struct.a.b.c
324
+
325
+
326
+ if (isPlainObject(uniformValue)) {
327
+ Object.keys(uniformValue).forEach(function (childName) {
328
+ _this2.extractUniformsRecursively(childName, // @ts-ignore
329
+ uniformValue[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName));
330
+ });
331
+ } // u_Struct[0].a
332
+
333
+
334
+ if (Array.isArray(uniformValue)) {
335
+ uniformValue.forEach(function (child, idx) {
336
+ Object.keys(child).forEach(function (childName) {
337
+ _this2.extractUniformsRecursively(childName, // @ts-ignore
338
+ child[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName, "[").concat(idx, "]"));
339
+ });
340
+ });
341
+ }
342
+ }
343
+ }]);
344
+
345
+ return ReglModel;
346
+ }();
347
+
348
+ export { ReglModel as default };