@antv/l7-renderer 2.9.20 → 2.9.22

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.
Files changed (41) hide show
  1. package/es/index.js +5 -3
  2. package/es/regl/ReglAttribute.js +5 -8
  3. package/es/regl/ReglBuffer.js +9 -8
  4. package/es/regl/ReglElements.js +8 -8
  5. package/es/regl/ReglFramebuffer.js +8 -7
  6. package/es/regl/ReglModel.js +63 -42
  7. package/es/regl/ReglRenderbuffer.js +7 -7
  8. package/es/regl/ReglTexture2D.js +12 -10
  9. package/es/regl/constants.js +5 -2
  10. package/es/regl/index.js +43 -31
  11. package/lib/index.js +29 -13
  12. package/lib/regl/ReglAttribute.js +38 -48
  13. package/lib/regl/ReglBuffer.js +46 -52
  14. package/lib/regl/ReglElements.js +45 -51
  15. package/lib/regl/ReglFramebuffer.js +43 -58
  16. package/lib/regl/ReglModel.js +217 -283
  17. package/lib/regl/ReglRenderbuffer.js +42 -50
  18. package/lib/regl/ReglTexture2D.js +90 -122
  19. package/lib/regl/constants.js +168 -42
  20. package/lib/regl/index.js +204 -272
  21. package/package.json +12 -8
  22. package/es/index.js.map +0 -1
  23. package/es/regl/ReglAttribute.js.map +0 -1
  24. package/es/regl/ReglBuffer.js.map +0 -1
  25. package/es/regl/ReglElements.js.map +0 -1
  26. package/es/regl/ReglFramebuffer.js.map +0 -1
  27. package/es/regl/ReglModel.js.map +0 -1
  28. package/es/regl/ReglRenderbuffer.js.map +0 -1
  29. package/es/regl/ReglTexture2D.js.map +0 -1
  30. package/es/regl/constants.js.map +0 -1
  31. package/es/regl/index.js.map +0 -1
  32. package/lib/index.js.map +0 -1
  33. package/lib/regl/ReglAttribute.js.map +0 -1
  34. package/lib/regl/ReglBuffer.js.map +0 -1
  35. package/lib/regl/ReglElements.js.map +0 -1
  36. package/lib/regl/ReglFramebuffer.js.map +0 -1
  37. package/lib/regl/ReglModel.js.map +0 -1
  38. package/lib/regl/ReglRenderbuffer.js.map +0 -1
  39. package/lib/regl/ReglTexture2D.js.map +0 -1
  40. package/lib/regl/constants.js.map +0 -1
  41. package/lib/regl/index.js.map +0 -1
@@ -1,328 +1,262 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
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
7
23
  });
8
- exports.default = void 0;
9
-
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
- var _isTypedArray2 = _interopRequireDefault(require("lodash/isTypedArray"));
19
-
20
- var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
21
-
22
- var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _constants = require("./constants");
27
-
28
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
-
30
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
-
32
- var ReglModel = function () {
33
- function ReglModel(reGl, options) {
34
- (0, _classCallCheck2.default)(this, ReglModel);
35
- (0, _defineProperty2.default)(this, "reGl", void 0);
36
- (0, _defineProperty2.default)(this, "destroyed", false);
37
- (0, _defineProperty2.default)(this, "drawCommand", void 0);
38
- (0, _defineProperty2.default)(this, "drawPickCommand", void 0);
39
- (0, _defineProperty2.default)(this, "drawParams", void 0);
40
- (0, _defineProperty2.default)(this, "options", void 0);
41
- (0, _defineProperty2.default)(this, "uniforms", {});
24
+ module.exports = __toCommonJS(ReglModel_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_lodash = require("lodash");
27
+ var import_constants = require("./constants");
28
+ var ReglModel = class {
29
+ constructor(reGl, options) {
30
+ this.destroyed = false;
31
+ this.uniforms = {};
42
32
  this.reGl = reGl;
43
- var vs = options.vs,
44
- fs = options.fs,
45
- attributes = options.attributes,
46
- uniforms = options.uniforms,
47
- primitive = options.primitive,
48
- count = options.count,
49
- elements = options.elements,
50
- depth = options.depth,
51
- blend = options.blend,
52
- stencil = options.stencil,
53
- cull = options.cull,
54
- instances = options.instances;
55
- var reglUniforms = {};
33
+ const {
34
+ vs,
35
+ fs,
36
+ attributes,
37
+ uniforms,
38
+ primitive,
39
+ count,
40
+ elements,
41
+ depth,
42
+ blend,
43
+ stencil,
44
+ cull,
45
+ instances
46
+ } = options;
47
+ const reglUniforms = {};
56
48
  this.options = options;
57
-
58
49
  if (uniforms) {
59
50
  this.uniforms = this.extractUniforms(uniforms);
60
- Object.keys(uniforms).forEach(function (uniformName) {
51
+ Object.keys(uniforms).forEach((uniformName) => {
61
52
  reglUniforms[uniformName] = reGl.prop(uniformName);
62
53
  });
63
54
  }
64
-
65
- var reglAttributes = {};
66
- Object.keys(attributes).forEach(function (name) {
55
+ const reglAttributes = {};
56
+ Object.keys(attributes).forEach((name) => {
67
57
  reglAttributes[name] = attributes[name].get();
68
58
  });
69
- var drawParams = {
59
+ const drawParams = {
70
60
  attributes: reglAttributes,
71
61
  frag: fs,
72
62
  uniforms: reglUniforms,
73
63
  vert: vs,
74
64
  blend: {},
75
- primitive: _constants.primitiveMap[primitive === undefined ? _l7Core.gl.TRIANGLES : primitive]
65
+ primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
76
66
  };
77
-
78
67
  if (instances) {
79
68
  drawParams.instances = instances;
80
69
  }
81
-
82
70
  if (count) {
83
71
  drawParams.count = count;
84
72
  }
85
-
86
73
  if (elements) {
87
74
  drawParams.elements = elements.get();
88
75
  }
89
-
90
- this.initDepthDrawParams({
91
- depth: depth
92
- }, drawParams);
93
- this.initBlendDrawParams({
94
- blend: blend
95
- }, drawParams);
96
- this.initStencilDrawParams({
97
- stencil: stencil
98
- }, drawParams);
99
- this.initCullDrawParams({
100
- cull: cull
101
- }, drawParams);
76
+ this.initDepthDrawParams({ depth }, drawParams);
77
+ this.initBlendDrawParams({ blend }, drawParams);
78
+ this.initStencilDrawParams({ stencil }, drawParams);
79
+ this.initCullDrawParams({ cull }, drawParams);
102
80
  this.drawCommand = reGl(drawParams);
103
- var pickDrawParams = (0, _cloneDeep2.default)(drawParams);
104
- pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
81
+ const pickDrawParams = (0, import_lodash.cloneDeep)(drawParams);
82
+ pickDrawParams.blend = {
83
+ ...pickDrawParams.blend,
105
84
  enable: false
106
- });
85
+ };
107
86
  this.drawPickCommand = reGl(pickDrawParams);
108
87
  this.drawParams = drawParams;
109
88
  }
110
-
111
- (0, _createClass2.default)(ReglModel, [{
112
- key: "updateAttributesAndElements",
113
- value: function updateAttributesAndElements(attributes, elements) {
114
- var reglAttributes = {};
115
- Object.keys(attributes).forEach(function (name) {
116
- reglAttributes[name] = attributes[name].get();
117
- });
118
- this.drawParams.attributes = reglAttributes;
119
- this.drawParams.elements = elements.get();
120
- this.drawCommand = this.reGl(this.drawParams);
121
- var pickDrawParams = (0, _cloneDeep2.default)(this.drawParams);
122
- pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
123
- enable: false
124
- });
125
- this.drawPickCommand = this.reGl(pickDrawParams);
126
- }
127
- }, {
128
- key: "updateAttributes",
129
- value: function updateAttributes(attributes) {
130
- var reglAttributes = {};
131
- Object.keys(attributes).forEach(function (name) {
132
- reglAttributes[name] = attributes[name].get();
133
- });
134
- this.drawParams.attributes = reglAttributes;
135
- this.drawCommand = this.reGl(this.drawParams);
136
- var pickDrawParams = (0, _cloneDeep2.default)(this.drawParams);
137
- pickDrawParams.blend = _objectSpread(_objectSpread({}, pickDrawParams.blend), {}, {
138
- enable: false
139
- });
140
- this.drawPickCommand = this.reGl(pickDrawParams);
141
- }
142
- }, {
143
- key: "addUniforms",
144
- value: function addUniforms(uniforms) {
145
- this.uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(uniforms));
89
+ updateAttributesAndElements(attributes, elements) {
90
+ const reglAttributes = {};
91
+ Object.keys(attributes).forEach((name) => {
92
+ reglAttributes[name] = attributes[name].get();
93
+ });
94
+ this.drawParams.attributes = reglAttributes;
95
+ this.drawParams.elements = elements.get();
96
+ this.drawCommand = this.reGl(this.drawParams);
97
+ const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
98
+ pickDrawParams.blend = {
99
+ ...pickDrawParams.blend,
100
+ enable: false
101
+ };
102
+ this.drawPickCommand = this.reGl(pickDrawParams);
103
+ }
104
+ updateAttributes(attributes) {
105
+ const reglAttributes = {};
106
+ Object.keys(attributes).forEach((name) => {
107
+ reglAttributes[name] = attributes[name].get();
108
+ });
109
+ this.drawParams.attributes = reglAttributes;
110
+ this.drawCommand = this.reGl(this.drawParams);
111
+ const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
112
+ pickDrawParams.blend = {
113
+ ...pickDrawParams.blend,
114
+ enable: false
115
+ };
116
+ this.drawPickCommand = this.reGl(pickDrawParams);
117
+ }
118
+ addUniforms(uniforms) {
119
+ this.uniforms = {
120
+ ...this.uniforms,
121
+ ...this.extractUniforms(uniforms)
122
+ };
123
+ }
124
+ draw(options, pick) {
125
+ if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
126
+ return;
146
127
  }
147
- }, {
148
- key: "draw",
149
- value: function draw(options, pick) {
150
- if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
151
- return;
152
- }
153
-
154
- var uniforms = _objectSpread(_objectSpread({}, this.uniforms), this.extractUniforms(options.uniforms || {}));
155
-
156
- var reglDrawProps = {};
157
- Object.keys(uniforms).forEach(function (uniformName) {
158
- var type = (0, _typeof2.default)(uniforms[uniformName]);
159
-
160
- if (type === 'boolean' || type === 'number' || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
161
- reglDrawProps[uniformName] = uniforms[uniformName];
162
- } else {
163
- reglDrawProps[uniformName] = uniforms[uniformName].get();
164
- }
165
- });
166
-
167
- if (!pick) {
168
- this.drawCommand(reglDrawProps);
128
+ const uniforms = {
129
+ ...this.uniforms,
130
+ ...this.extractUniforms(options.uniforms || {})
131
+ };
132
+ const reglDrawProps = {};
133
+ Object.keys(uniforms).forEach((uniformName) => {
134
+ const type = typeof uniforms[uniformName];
135
+ if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
136
+ reglDrawProps[uniformName] = uniforms[uniformName];
169
137
  } else {
170
- this.drawPickCommand(reglDrawProps);
138
+ reglDrawProps[uniformName] = uniforms[uniformName].get();
171
139
  }
140
+ });
141
+ if (!pick) {
142
+ this.drawCommand(reglDrawProps);
143
+ } else {
144
+ this.drawPickCommand(reglDrawProps);
172
145
  }
173
- }, {
174
- key: "destroy",
175
- value: function destroy() {
176
- this.drawParams.elements.destroy();
177
-
178
- if (this.options.attributes) {
179
- Object.values(this.options.attributes).forEach(function (attr) {
180
- attr.destroy();
181
- });
182
- }
183
-
184
- this.destroyed = true;
146
+ }
147
+ destroy() {
148
+ this.drawParams.elements.destroy();
149
+ if (this.options.attributes) {
150
+ Object.values(this.options.attributes).forEach((attr) => {
151
+ attr.destroy();
152
+ });
185
153
  }
186
- }, {
187
- key: "initDepthDrawParams",
188
- value: function initDepthDrawParams(_ref, drawParams) {
189
- var depth = _ref.depth;
190
-
191
- if (depth) {
192
- drawParams.depth = {
193
- enable: depth.enable === undefined ? true : !!depth.enable,
194
- mask: depth.mask === undefined ? true : !!depth.mask,
195
- func: _constants.depthFuncMap[depth.func || _l7Core.gl.LESS],
196
- range: depth.range || [0, 1]
197
- };
198
- }
154
+ this.destroyed = true;
155
+ }
156
+ initDepthDrawParams({ depth }, drawParams) {
157
+ if (depth) {
158
+ drawParams.depth = {
159
+ enable: depth.enable === void 0 ? true : !!depth.enable,
160
+ mask: depth.mask === void 0 ? true : !!depth.mask,
161
+ func: import_constants.depthFuncMap[depth.func || import_l7_core.gl.LESS],
162
+ range: depth.range || [0, 1]
163
+ };
199
164
  }
200
- }, {
201
- key: "initBlendDrawParams",
202
- value: function initBlendDrawParams(_ref2, drawParams) {
203
- var blend = _ref2.blend;
204
-
205
- if (blend) {
206
- var enable = blend.enable,
207
- func = blend.func,
208
- equation = blend.equation,
209
- _blend$color = blend.color,
210
- color = _blend$color === void 0 ? [0, 0, 0, 0] : _blend$color;
211
- drawParams.blend = {
212
- enable: !!enable,
213
- func: {
214
- srcRGB: _constants.blendFuncMap[func && func.srcRGB || _l7Core.gl.SRC_ALPHA],
215
- srcAlpha: _constants.blendFuncMap[func && func.srcAlpha || _l7Core.gl.SRC_ALPHA],
216
- dstRGB: _constants.blendFuncMap[func && func.dstRGB || _l7Core.gl.ONE_MINUS_SRC_ALPHA],
217
- dstAlpha: _constants.blendFuncMap[func && func.dstAlpha || _l7Core.gl.ONE_MINUS_SRC_ALPHA]
218
- },
219
- equation: {
220
- rgb: _constants.blendEquationMap[equation && equation.rgb || _l7Core.gl.FUNC_ADD],
221
- alpha: _constants.blendEquationMap[equation && equation.alpha || _l7Core.gl.FUNC_ADD]
222
- },
223
- color: color
224
- };
225
- }
165
+ }
166
+ initBlendDrawParams({ blend }, drawParams) {
167
+ if (blend) {
168
+ const { enable, func, equation, color = [0, 0, 0, 0] } = blend;
169
+ drawParams.blend = {
170
+ enable: !!enable,
171
+ func: {
172
+ srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
173
+ srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
174
+ dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
175
+ dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
176
+ },
177
+ equation: {
178
+ rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
179
+ alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
180
+ },
181
+ color
182
+ };
226
183
  }
227
- }, {
228
- key: "initStencilDrawParams",
229
- value: function initStencilDrawParams(_ref3, drawParams) {
230
- var stencil = _ref3.stencil;
231
-
232
- if (stencil) {
233
- var enable = stencil.enable,
234
- _stencil$mask = stencil.mask,
235
- mask = _stencil$mask === void 0 ? -1 : _stencil$mask,
236
- _stencil$func = stencil.func,
237
- func = _stencil$func === void 0 ? {
238
- cmp: _l7Core.gl.ALWAYS,
184
+ }
185
+ initStencilDrawParams({ stencil }, drawParams) {
186
+ if (stencil) {
187
+ const {
188
+ enable,
189
+ mask = -1,
190
+ func = {
191
+ cmp: import_l7_core.gl.ALWAYS,
239
192
  ref: 0,
240
193
  mask: -1
241
- } : _stencil$func,
242
- _stencil$opFront = stencil.opFront,
243
- opFront = _stencil$opFront === void 0 ? {
244
- fail: _l7Core.gl.KEEP,
245
- zfail: _l7Core.gl.KEEP,
246
- zpass: _l7Core.gl.KEEP
247
- } : _stencil$opFront,
248
- _stencil$opBack = stencil.opBack,
249
- opBack = _stencil$opBack === void 0 ? {
250
- fail: _l7Core.gl.KEEP,
251
- zfail: _l7Core.gl.KEEP,
252
- zpass: _l7Core.gl.KEEP
253
- } : _stencil$opBack;
254
- drawParams.stencil = {
255
- enable: !!enable,
256
- mask: mask,
257
- func: _objectSpread(_objectSpread({}, func), {}, {
258
- cmp: _constants.stencilFuncMap[func.cmp]
259
- }),
260
- opFront: {
261
- fail: _constants.stencilOpMap[opFront.fail],
262
- zfail: _constants.stencilOpMap[opFront.zfail],
263
- zpass: _constants.stencilOpMap[opFront.zpass]
264
- },
265
- opBack: {
266
- fail: _constants.stencilOpMap[opBack.fail],
267
- zfail: _constants.stencilOpMap[opBack.zfail],
268
- zpass: _constants.stencilOpMap[opBack.zpass]
269
- }
270
- };
271
- }
194
+ },
195
+ opFront = {
196
+ fail: import_l7_core.gl.KEEP,
197
+ zfail: import_l7_core.gl.KEEP,
198
+ zpass: import_l7_core.gl.KEEP
199
+ },
200
+ opBack = {
201
+ fail: import_l7_core.gl.KEEP,
202
+ zfail: import_l7_core.gl.KEEP,
203
+ zpass: import_l7_core.gl.KEEP
204
+ }
205
+ } = stencil;
206
+ drawParams.stencil = {
207
+ enable: !!enable,
208
+ mask,
209
+ func: {
210
+ ...func,
211
+ cmp: import_constants.stencilFuncMap[func.cmp]
212
+ },
213
+ opFront: {
214
+ fail: import_constants.stencilOpMap[opFront.fail],
215
+ zfail: import_constants.stencilOpMap[opFront.zfail],
216
+ zpass: import_constants.stencilOpMap[opFront.zpass]
217
+ },
218
+ opBack: {
219
+ fail: import_constants.stencilOpMap[opBack.fail],
220
+ zfail: import_constants.stencilOpMap[opBack.zfail],
221
+ zpass: import_constants.stencilOpMap[opBack.zpass]
222
+ }
223
+ };
272
224
  }
273
- }, {
274
- key: "initCullDrawParams",
275
- value: function initCullDrawParams(_ref4, drawParams) {
276
- var cull = _ref4.cull;
277
-
278
- if (cull) {
279
- var enable = cull.enable,
280
- _cull$face = cull.face,
281
- face = _cull$face === void 0 ? _l7Core.gl.BACK : _cull$face;
282
- drawParams.cull = {
283
- enable: !!enable,
284
- face: _constants.cullFaceMap[face]
285
- };
286
- }
225
+ }
226
+ initCullDrawParams({ cull }, drawParams) {
227
+ if (cull) {
228
+ const { enable, face = import_l7_core.gl.BACK } = cull;
229
+ drawParams.cull = {
230
+ enable: !!enable,
231
+ face: import_constants.cullFaceMap[face]
232
+ };
287
233
  }
288
- }, {
289
- key: "extractUniforms",
290
- value: function extractUniforms(uniforms) {
291
- var _this = this;
292
-
293
- var extractedUniforms = {};
294
- Object.keys(uniforms).forEach(function (uniformName) {
295
- _this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, '');
234
+ }
235
+ extractUniforms(uniforms) {
236
+ const extractedUniforms = {};
237
+ Object.keys(uniforms).forEach((uniformName) => {
238
+ this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
239
+ });
240
+ return extractedUniforms;
241
+ }
242
+ extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
243
+ if (uniformValue === null || typeof uniformValue === "number" || typeof uniformValue === "boolean" || Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || (0, import_lodash.isTypedArray)(uniformValue) || uniformValue === "" || "resize" in uniformValue) {
244
+ uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
245
+ return;
246
+ }
247
+ if ((0, import_lodash.isPlainObject)(uniformValue)) {
248
+ Object.keys(uniformValue).forEach((childName) => {
249
+ this.extractUniformsRecursively(childName, uniformValue[childName], uniforms, `${prefix && prefix + "."}${uniformName}`);
296
250
  });
297
- return extractedUniforms;
298
251
  }
299
- }, {
300
- key: "extractUniformsRecursively",
301
- value: function extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
302
- var _this2 = this;
303
-
304
- if (uniformValue === null || typeof uniformValue === 'number' || typeof uniformValue === 'boolean' || Array.isArray(uniformValue) && typeof uniformValue[0] === 'number' || (0, _isTypedArray2.default)(uniformValue) || uniformValue === '' || 'resize' in uniformValue) {
305
- uniforms["".concat(prefix && prefix + '.').concat(uniformName)] = uniformValue;
306
- return;
307
- }
308
-
309
- if ((0, _isPlainObject2.default)(uniformValue)) {
310
- Object.keys(uniformValue).forEach(function (childName) {
311
- _this2.extractUniformsRecursively(childName, uniformValue[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName));
312
- });
313
- }
314
-
315
- if (Array.isArray(uniformValue)) {
316
- uniformValue.forEach(function (child, idx) {
317
- Object.keys(child).forEach(function (childName) {
318
- _this2.extractUniformsRecursively(childName, child[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName, "[").concat(idx, "]"));
319
- });
252
+ if (Array.isArray(uniformValue)) {
253
+ uniformValue.forEach((child, idx) => {
254
+ Object.keys(child).forEach((childName) => {
255
+ this.extractUniformsRecursively(childName, child[childName], uniforms, `${prefix && prefix + "."}${uniformName}[${idx}]`);
320
256
  });
321
- }
257
+ });
322
258
  }
323
- }]);
324
- return ReglModel;
325
- }();
326
-
327
- exports.default = ReglModel;
328
- //# sourceMappingURL=ReglModel.js.map
259
+ }
260
+ };
261
+ // Annotate the CommonJS export names for ESM import in node:
262
+ 0 && (module.exports = {});
@@ -1,54 +1,46 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
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
7
23
  });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- var _constants = require("./constants");
17
-
18
- var ReglRenderbuffer = function () {
19
- function ReglRenderbuffer(reGl, options) {
20
- (0, _classCallCheck2.default)(this, ReglRenderbuffer);
21
- (0, _defineProperty2.default)(this, "renderbuffer", void 0);
22
- var width = options.width,
23
- height = options.height,
24
- format = options.format;
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;
25
29
  this.renderbuffer = reGl.renderbuffer({
26
- width: width,
27
- height: height,
28
- format: _constants.formatMap[format]
30
+ width,
31
+ height,
32
+ format: import_constants.formatMap[format]
29
33
  });
30
34
  }
31
-
32
- (0, _createClass2.default)(ReglRenderbuffer, [{
33
- key: "get",
34
- value: function get() {
35
- return this.renderbuffer;
36
- }
37
- }, {
38
- key: "destroy",
39
- value: function destroy() {
40
- this.renderbuffer.destroy();
41
- }
42
- }, {
43
- key: "resize",
44
- value: function resize(_ref) {
45
- var width = _ref.width,
46
- height = _ref.height;
47
- this.renderbuffer.resize(width, height);
48
- }
49
- }]);
50
- return ReglRenderbuffer;
51
- }();
52
-
53
- exports.default = ReglRenderbuffer;
54
- //# sourceMappingURL=ReglRenderbuffer.js.map
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
+ };
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {});