@antv/l7-renderer 2.16.1 → 2.16.2

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.
@@ -3,50 +3,48 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
4
  import { gl } from '@antv/l7-core';
5
5
  import { colorSpaceMap, dataTypeMap, filterMap, formatMap, mipmapMap, wrapModeMap } from "./constants";
6
+
6
7
  /**
7
8
  * adaptor for regl.Buffer
8
9
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#buffers
9
10
  */
10
-
11
11
  var ReglTexture2D = /*#__PURE__*/function () {
12
12
  function ReglTexture2D(reGl, options) {
13
13
  _classCallCheck(this, ReglTexture2D);
14
-
15
14
  _defineProperty(this, "isDestroy", false);
16
-
17
15
  var data = options.data,
18
- _options$type = options.type,
19
- type = _options$type === void 0 ? gl.UNSIGNED_BYTE : _options$type,
20
- width = options.width,
21
- height = options.height,
22
- _options$flipY = options.flipY,
23
- flipY = _options$flipY === void 0 ? false : _options$flipY,
24
- _options$format = options.format,
25
- format = _options$format === void 0 ? gl.RGBA : _options$format,
26
- _options$mipmap = options.mipmap,
27
- mipmap = _options$mipmap === void 0 ? false : _options$mipmap,
28
- _options$wrapS = options.wrapS,
29
- wrapS = _options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapS,
30
- _options$wrapT = options.wrapT,
31
- wrapT = _options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapT,
32
- _options$aniso = options.aniso,
33
- aniso = _options$aniso === void 0 ? 0 : _options$aniso,
34
- _options$alignment = options.alignment,
35
- alignment = _options$alignment === void 0 ? 1 : _options$alignment,
36
- _options$premultiplyA = options.premultiplyAlpha,
37
- premultiplyAlpha = _options$premultiplyA === void 0 ? false : _options$premultiplyA,
38
- _options$mag = options.mag,
39
- mag = _options$mag === void 0 ? gl.NEAREST : _options$mag,
40
- _options$min = options.min,
41
- min = _options$min === void 0 ? gl.NEAREST : _options$min,
42
- _options$colorSpace = options.colorSpace,
43
- colorSpace = _options$colorSpace === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _options$colorSpace,
44
- _options$x = options.x,
45
- x = _options$x === void 0 ? 0 : _options$x,
46
- _options$y = options.y,
47
- y = _options$y === void 0 ? 0 : _options$y,
48
- _options$copy = options.copy,
49
- copy = _options$copy === void 0 ? false : _options$copy;
16
+ _options$type = options.type,
17
+ type = _options$type === void 0 ? gl.UNSIGNED_BYTE : _options$type,
18
+ width = options.width,
19
+ height = options.height,
20
+ _options$flipY = options.flipY,
21
+ flipY = _options$flipY === void 0 ? false : _options$flipY,
22
+ _options$format = options.format,
23
+ format = _options$format === void 0 ? gl.RGBA : _options$format,
24
+ _options$mipmap = options.mipmap,
25
+ mipmap = _options$mipmap === void 0 ? false : _options$mipmap,
26
+ _options$wrapS = options.wrapS,
27
+ wrapS = _options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapS,
28
+ _options$wrapT = options.wrapT,
29
+ wrapT = _options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapT,
30
+ _options$aniso = options.aniso,
31
+ aniso = _options$aniso === void 0 ? 0 : _options$aniso,
32
+ _options$alignment = options.alignment,
33
+ alignment = _options$alignment === void 0 ? 1 : _options$alignment,
34
+ _options$premultiplyA = options.premultiplyAlpha,
35
+ premultiplyAlpha = _options$premultiplyA === void 0 ? false : _options$premultiplyA,
36
+ _options$mag = options.mag,
37
+ mag = _options$mag === void 0 ? gl.NEAREST : _options$mag,
38
+ _options$min = options.min,
39
+ min = _options$min === void 0 ? gl.NEAREST : _options$min,
40
+ _options$colorSpace = options.colorSpace,
41
+ colorSpace = _options$colorSpace === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _options$colorSpace,
42
+ _options$x = options.x,
43
+ x = _options$x === void 0 ? 0 : _options$x,
44
+ _options$y = options.y,
45
+ y = _options$y === void 0 ? 0 : _options$y,
46
+ _options$copy = options.copy,
47
+ copy = _options$copy === void 0 ? false : _options$copy;
50
48
  this.width = width;
51
49
  this.height = height;
52
50
  var textureOptions = {
@@ -70,21 +68,17 @@ var ReglTexture2D = /*#__PURE__*/function () {
70
68
  y: y,
71
69
  copy: copy
72
70
  };
73
-
74
71
  if (data) {
75
72
  // @ts-ignore
76
73
  textureOptions.data = data;
77
74
  }
78
-
79
75
  if (typeof mipmap === 'number') {
80
76
  textureOptions.mipmap = mipmapMap[mipmap];
81
77
  } else if (typeof mipmap === 'boolean') {
82
78
  textureOptions.mipmap = mipmap;
83
79
  }
84
-
85
80
  this.texture = reGl.texture(textureOptions);
86
81
  }
87
-
88
82
  _createClass(ReglTexture2D, [{
89
83
  key: "get",
90
84
  value: function get() {
@@ -106,7 +100,7 @@ var ReglTexture2D = /*#__PURE__*/function () {
106
100
  key: "resize",
107
101
  value: function resize(_ref) {
108
102
  var width = _ref.width,
109
- height = _ref.height;
103
+ height = _ref.height;
110
104
  this.texture.resize(width, height);
111
105
  this.width = width;
112
106
  this.height = height;
@@ -121,15 +115,11 @@ var ReglTexture2D = /*#__PURE__*/function () {
121
115
  value: function destroy() {
122
116
  if (!this.isDestroy) {
123
117
  var _this$texture;
124
-
125
118
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
126
119
  }
127
-
128
120
  this.isDestroy = true;
129
121
  }
130
122
  }]);
131
-
132
123
  return ReglTexture2D;
133
124
  }();
134
-
135
125
  export { ReglTexture2D as default };
@@ -1,7 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
-
3
2
  var _primitiveMap, _usageMap, _dataTypeMap, _formatMap, _mipmapMap, _filterMap, _wrapModeMap, _colorSpaceMap, _depthFuncMap, _blendEquationMap, _blendFuncMap, _stencilFuncMap, _stencilOpMap, _cullFaceMap;
4
-
5
3
  /**
6
4
  * @desc 由于 regl 使用大量字符串而非 WebGL 常量,因此需要映射
7
5
  */
package/es/regl/index.js CHANGED
@@ -2,15 +2,13 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
-
6
5
  var _dec, _class;
7
-
8
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
-
10
7
  /**
11
8
  * render w/ regl
12
9
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md
13
10
  */
11
+
14
12
  import { isMini } from '@antv/l7-utils';
15
13
  import { injectable } from 'inversify';
16
14
  import regl from 'l7regl';
@@ -21,55 +19,45 @@ import ReglElements from "./ReglElements";
21
19
  import ReglFramebuffer from "./ReglFramebuffer";
22
20
  import ReglModel from "./ReglModel";
23
21
  import ReglTexture2D from "./ReglTexture2D";
22
+
24
23
  /**
25
24
  * regl renderer
26
25
  */
27
-
28
26
  var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
29
27
  function ReglRendererService() {
30
28
  var _this = this;
31
-
32
29
  _classCallCheck(this, ReglRendererService);
33
-
34
30
  _defineProperty(this, "createModel", function (options) {
35
31
  return new ReglModel(_this.gl, options);
36
32
  });
37
-
38
33
  _defineProperty(this, "createAttribute", function (options) {
39
34
  return new ReglAttribute(_this.gl, options);
40
35
  });
41
-
42
36
  _defineProperty(this, "createBuffer", function (options) {
43
37
  return new ReglBuffer(_this.gl, options);
44
38
  });
45
-
46
39
  _defineProperty(this, "createElements", function (options) {
47
40
  return new ReglElements(_this.gl, options);
48
41
  });
49
-
50
42
  _defineProperty(this, "createTexture2D", function (options) {
51
43
  return new ReglTexture2D(_this.gl, options);
52
44
  });
53
-
54
45
  _defineProperty(this, "createFramebuffer", function (options) {
55
46
  return new ReglFramebuffer(_this.gl, options);
56
47
  });
57
-
58
48
  _defineProperty(this, "useFramebuffer", function (framebuffer, drawCommands) {
59
49
  _this.gl({
60
50
  framebuffer: framebuffer ? framebuffer.get() : null
61
51
  })(drawCommands);
62
52
  });
63
-
64
53
  _defineProperty(this, "clear", function (options) {
65
54
  var _this$gl;
66
-
67
55
  // @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clear-the-draw-buffer
68
56
  var color = options.color,
69
- depth = options.depth,
70
- stencil = options.stencil,
71
- _options$framebuffer = options.framebuffer,
72
- framebuffer = _options$framebuffer === void 0 ? null : _options$framebuffer;
57
+ depth = options.depth,
58
+ stencil = options.stencil,
59
+ _options$framebuffer = options.framebuffer,
60
+ framebuffer = _options$framebuffer === void 0 ? null : _options$framebuffer;
73
61
  var reglClearOptions = {
74
62
  color: color,
75
63
  depth: depth,
@@ -78,158 +66,135 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
78
66
  reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
79
67
  (_this$gl = _this.gl) === null || _this$gl === void 0 ? void 0 : _this$gl.clear(reglClearOptions);
80
68
  });
81
-
82
69
  _defineProperty(this, "viewport", function (_ref) {
83
70
  var x = _ref.x,
84
- y = _ref.y,
85
- width = _ref.width,
86
- height = _ref.height;
87
-
71
+ y = _ref.y,
72
+ width = _ref.width,
73
+ height = _ref.height;
88
74
  // use WebGL context directly
89
75
  // @see https://github.com/regl-project/regl/blob/gh-pages/API.md#unsafe-escape-hatch
90
76
  _this.gl._gl.viewport(x, y, width, height);
91
-
92
77
  _this.width = width;
93
78
  _this.height = height;
94
-
95
79
  _this.gl._refresh();
96
80
  });
97
-
98
81
  _defineProperty(this, "readPixels", function (options) {
99
82
  var framebuffer = options.framebuffer,
100
- x = options.x,
101
- y = options.y,
102
- width = options.width,
103
- height = options.height;
83
+ x = options.x,
84
+ y = options.y,
85
+ width = options.width,
86
+ height = options.height;
104
87
  var readPixelsOptions = {
105
88
  x: x,
106
89
  y: y,
107
90
  width: width,
108
91
  height: height
109
92
  };
110
-
111
93
  if (framebuffer) {
112
94
  readPixelsOptions.framebuffer = framebuffer.get();
113
95
  }
114
-
115
96
  return _this.gl.read(readPixelsOptions);
116
97
  });
117
-
118
98
  _defineProperty(this, "getViewportSize", function () {
119
99
  return {
120
100
  width: _this.gl._gl.drawingBufferWidth,
121
101
  height: _this.gl._gl.drawingBufferHeight
122
102
  };
123
103
  });
124
-
125
104
  _defineProperty(this, "getContainer", function () {
126
105
  if (isMini) {
127
106
  return _this.canvas;
128
107
  } else {
129
108
  var _this$canvas;
130
-
131
109
  return (_this$canvas = _this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.parentElement;
132
110
  }
133
111
  });
134
-
135
112
  _defineProperty(this, "getCanvas", function () {
136
113
  // return this.$container?.getElementsByTagName('canvas')[0] || null;
137
114
  return _this.canvas;
138
115
  });
139
-
140
116
  _defineProperty(this, "getGLContext", function () {
141
117
  return _this.gl._gl;
142
118
  });
143
-
144
119
  _defineProperty(this, "destroy", function () {
145
120
  var _this$gl2, _this$gl2$_gl, _this$gl2$_gl$getExte;
146
-
147
121
  // this.canvas = null 清除对 webgl 实例的引用
148
122
  // @ts-ignore
149
- _this.canvas = null; // make sure release webgl context
123
+ _this.canvas = null;
150
124
 
151
- (_this$gl2 = _this.gl) === null || _this$gl2 === void 0 ? void 0 : (_this$gl2$_gl = _this$gl2._gl) === null || _this$gl2$_gl === void 0 ? void 0 : (_this$gl2$_gl$getExte = _this$gl2$_gl.getExtension('WEBGL_lose_context')) === null || _this$gl2$_gl$getExte === void 0 ? void 0 : _this$gl2$_gl$getExte.loseContext(); // @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clean-up
152
-
153
- _this.gl.destroy(); // @ts-ignore
125
+ // make sure release webgl context
126
+ (_this$gl2 = _this.gl) === null || _this$gl2 === void 0 ? void 0 : (_this$gl2$_gl = _this$gl2._gl) === null || _this$gl2$_gl === void 0 ? void 0 : (_this$gl2$_gl$getExte = _this$gl2$_gl.getExtension('WEBGL_lose_context')) === null || _this$gl2$_gl$getExte === void 0 ? void 0 : _this$gl2$_gl$getExte.loseContext();
154
127
 
128
+ // @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clean-up
129
+ _this.gl.destroy();
155
130
 
131
+ // @ts-ignore
156
132
  _this.gl = null;
157
133
  });
158
134
  }
159
-
160
135
  _createClass(ReglRendererService, [{
161
136
  key: "init",
162
137
  value: function () {
163
138
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, cfg, gl) {
164
139
  var _this2 = this;
165
-
166
140
  return _regeneratorRuntime.wrap(function _callee$(_context) {
167
- while (1) {
168
- switch (_context.prev = _context.next) {
169
- case 0:
170
- // this.$container = $container;
171
- this.canvas = canvas;
172
-
173
- if (!gl) {
174
- _context.next = 5;
175
- break;
176
- }
177
-
178
- this.gl = gl;
179
- _context.next = 8;
141
+ while (1) switch (_context.prev = _context.next) {
142
+ case 0:
143
+ // this.$container = $container;
144
+ this.canvas = canvas;
145
+ if (!gl) {
146
+ _context.next = 5;
180
147
  break;
181
-
182
- case 5:
183
- _context.next = 7;
184
- return new Promise(function (resolve, reject) {
185
- regl({
186
- canvas: _this2.canvas,
187
- attributes: {
188
- alpha: true,
189
- // use TAA instead of MSAA
190
- // @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
191
- antialias: cfg.antialias,
192
- premultipliedAlpha: true,
193
- preserveDrawingBuffer: cfg.preserveDrawingBuffer,
194
- stencil: cfg.stencil
195
- },
196
- // TODO: use extensions
197
- extensions: ['OES_element_index_uint', 'OES_standard_derivatives', // wireframe
198
- 'ANGLE_instanced_arrays' // VSM shadow map
199
- ],
200
- optionalExtensions: ['oes_texture_float_linear', 'OES_texture_float', 'EXT_texture_filter_anisotropic', 'EXT_blend_minmax', 'WEBGL_depth_texture', 'WEBGL_lose_context'],
201
- profile: true,
202
- onDone: function onDone(err, r) {
203
- if (err || !r) {
204
- reject(err);
205
- } // @ts-ignore
206
-
207
-
208
- resolve(r);
148
+ }
149
+ this.gl = gl;
150
+ _context.next = 8;
151
+ break;
152
+ case 5:
153
+ _context.next = 7;
154
+ return new Promise(function (resolve, reject) {
155
+ regl({
156
+ canvas: _this2.canvas,
157
+ attributes: {
158
+ alpha: true,
159
+ // use TAA instead of MSAA
160
+ // @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
161
+ antialias: cfg.antialias,
162
+ premultipliedAlpha: true,
163
+ preserveDrawingBuffer: cfg.preserveDrawingBuffer,
164
+ stencil: cfg.stencil
165
+ },
166
+ // TODO: use extensions
167
+ extensions: ['OES_element_index_uint', 'OES_standard_derivatives',
168
+ // wireframe
169
+ 'ANGLE_instanced_arrays' // VSM shadow map
170
+ ],
171
+
172
+ optionalExtensions: ['oes_texture_float_linear', 'OES_texture_float', 'EXT_texture_filter_anisotropic', 'EXT_blend_minmax', 'WEBGL_depth_texture', 'WEBGL_lose_context'],
173
+ profile: true,
174
+ onDone: function onDone(err, r) {
175
+ if (err || !r) {
176
+ reject(err);
209
177
  }
210
- });
178
+ // @ts-ignore
179
+ resolve(r);
180
+ }
211
181
  });
212
-
213
- case 7:
214
- this.gl = _context.sent;
215
-
216
- case 8:
217
- this.extensionObject = {
218
- OES_texture_float: this.testExtension('OES_texture_float')
219
- };
220
-
221
- case 9:
222
- case "end":
223
- return _context.stop();
224
- }
182
+ });
183
+ case 7:
184
+ this.gl = _context.sent;
185
+ case 8:
186
+ this.extensionObject = {
187
+ OES_texture_float: this.testExtension('OES_texture_float')
188
+ };
189
+ case 9:
190
+ case "end":
191
+ return _context.stop();
225
192
  }
226
193
  }, _callee, this);
227
194
  }));
228
-
229
195
  function init(_x, _x2, _x3) {
230
196
  return _init.apply(this, arguments);
231
197
  }
232
-
233
198
  return init;
234
199
  }()
235
200
  }, {
@@ -245,7 +210,8 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
245
210
  }
246
211
  }, {
247
212
  key: "setState",
248
- value: // TODO: 临时方法
213
+ value:
214
+ // TODO: 临时方法
249
215
  function setState() {
250
216
  this.gl({
251
217
  cull: {
@@ -264,7 +230,6 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
264
230
  },
265
231
  framebuffer: null
266
232
  });
267
-
268
233
  this.gl._refresh();
269
234
  }
270
235
  }, {
@@ -287,7 +252,6 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
287
252
  },
288
253
  framebuffer: null
289
254
  });
290
-
291
255
  this.gl._refresh();
292
256
  }
293
257
  }, {
@@ -307,7 +271,6 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
307
271
  return this.isDirty;
308
272
  }
309
273
  }]);
310
-
311
274
  return ReglRendererService;
312
275
  }()) || _class);
313
276
  export { ReglRendererService as default };
package/lib/index.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -47,5 +47,3 @@ var ReglAttribute = class {
47
47
  this.buffer.destroy();
48
48
  }
49
49
  };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {});
@@ -31,6 +31,7 @@ var ReglBuffer = class {
31
31
  data,
32
32
  usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
33
33
  type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE]
34
+ // length: 0,
34
35
  });
35
36
  }
36
37
  get() {
@@ -46,5 +47,3 @@ var ReglBuffer = class {
46
47
  this.buffer.subdata(data, offset);
47
48
  }
48
49
  };
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {});
@@ -45,5 +45,3 @@ var ReglElements = class {
45
45
  destroy() {
46
46
  }
47
47
  };
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {});
@@ -49,5 +49,3 @@ var ReglFramebuffer = class {
49
49
  this.framebuffer.resize(width, height);
50
50
  }
51
51
  };
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {});
@@ -59,18 +59,29 @@ var ReglModel = class {
59
59
  frag: fs,
60
60
  uniforms: reglUniforms,
61
61
  vert: vs,
62
+ // @ts-ignore
62
63
  colorMask: reGl.prop("colorMask"),
64
+ lineWidth: 1,
63
65
  blend: {
66
+ // @ts-ignore
64
67
  enable: reGl.prop("blend.enable"),
68
+ // @ts-ignore
65
69
  func: reGl.prop("blend.func"),
70
+ // @ts-ignore
66
71
  equation: reGl.prop("blend.equation"),
72
+ // @ts-ignore
67
73
  color: reGl.prop("blend.color")
68
74
  },
69
75
  stencil: {
76
+ // @ts-ignore
70
77
  enable: reGl.prop("stencil.enable"),
78
+ // @ts-ignore
71
79
  mask: reGl.prop("stencil.mask"),
80
+ // @ts-ignore
72
81
  func: reGl.prop("stencil.func"),
82
+ // @ts-ignore
73
83
  opFront: reGl.prop("stencil.opFront"),
84
+ // @ts-ignore
74
85
  opBack: reGl.prop("stencil.opBack")
75
86
  },
76
87
  primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
@@ -122,7 +133,8 @@ var ReglModel = class {
122
133
  const reglDrawProps = {};
123
134
  Object.keys(uniforms).forEach((uniformName) => {
124
135
  const type = typeof uniforms[uniformName];
125
- if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
136
+ if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || // @ts-ignore
137
+ uniforms[uniformName].BYTES_PER_ELEMENT) {
126
138
  reglDrawProps[uniformName] = uniforms[uniformName];
127
139
  } else {
128
140
  reglDrawProps[uniformName] = uniforms[uniformName].get();
@@ -145,6 +157,9 @@ var ReglModel = class {
145
157
  }
146
158
  this.destroyed = true;
147
159
  }
160
+ /**
161
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#depth-buffer
162
+ */
148
163
  initDepthDrawParams({ depth }, drawParams) {
149
164
  if (depth) {
150
165
  drawParams.depth = {
@@ -174,6 +189,9 @@ var ReglModel = class {
174
189
  color
175
190
  };
176
191
  }
192
+ /**
193
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
194
+ */
177
195
  getStencilDrawParams({
178
196
  stencil
179
197
  }) {
@@ -219,6 +237,9 @@ var ReglModel = class {
219
237
  const colorMask = (stencil == null ? void 0 : stencil.enable) && stencil.opFront && !pick ? [false, false, false, false] : [true, true, true, true];
220
238
  return colorMask;
221
239
  }
240
+ /**
241
+ * @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
242
+ */
222
243
  initCullDrawParams({ cull }, drawParams) {
223
244
  if (cull) {
224
245
  const { enable, face = import_l7_core.gl.BACK } = cull;
@@ -228,6 +249,11 @@ var ReglModel = class {
228
249
  };
229
250
  }
230
251
  }
252
+ /**
253
+ * 考虑结构体命名, eg:
254
+ * a: { b: 1 } -> 'a.b'
255
+ * a: [ { b: 1 } ] -> 'a[0].b'
256
+ */
231
257
  extractUniforms(uniforms) {
232
258
  const extractedUniforms = {};
233
259
  Object.keys(uniforms).forEach((uniformName) => {
@@ -241,7 +267,12 @@ var ReglModel = class {
241
267
  return extractedUniforms;
242
268
  }
243
269
  extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
244
- 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) {
270
+ if (uniformValue === null || typeof uniformValue === "number" || // u_A: 1
271
+ typeof uniformValue === "boolean" || // u_A: false
272
+ Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || // u_A: [1, 2, 3]
273
+ (0, import_lodash.isTypedArray)(uniformValue) || // u_A: Float32Array
274
+ // @ts-ignore
275
+ uniformValue === "" || "resize" in uniformValue) {
245
276
  uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
246
277
  return;
247
278
  }
@@ -249,6 +280,7 @@ var ReglModel = class {
249
280
  Object.keys(uniformValue).forEach((childName) => {
250
281
  this.extractUniformsRecursively(
251
282
  childName,
283
+ // @ts-ignore
252
284
  uniformValue[childName],
253
285
  uniforms,
254
286
  `${prefix && prefix + "."}${uniformName}`
@@ -260,6 +292,7 @@ var ReglModel = class {
260
292
  Object.keys(child).forEach((childName) => {
261
293
  this.extractUniformsRecursively(
262
294
  childName,
295
+ // @ts-ignore
263
296
  child[childName],
264
297
  uniforms,
265
298
  `${prefix && prefix + "."}${uniformName}[${idx}]`
@@ -269,5 +302,3 @@ var ReglModel = class {
269
302
  }
270
303
  }
271
304
  };
272
- // Annotate the CommonJS export names for ESM import in node:
273
- 0 && (module.exports = {});
@@ -42,5 +42,3 @@ var ReglRenderbuffer = class {
42
42
  this.renderbuffer.resize(width, height);
43
43
  }
44
44
  };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {});
@@ -52,10 +52,12 @@ var ReglTexture2D = class {
52
52
  const textureOptions = {
53
53
  width,
54
54
  height,
55
+ // @ts-ignore
55
56
  type: import_constants.dataTypeMap[type],
56
57
  format: import_constants.formatMap[format],
57
58
  wrapS: import_constants.wrapModeMap[wrapS],
58
59
  wrapT: import_constants.wrapModeMap[wrapT],
60
+ // @ts-ignore
59
61
  mag: import_constants.filterMap[mag],
60
62
  min: import_constants.filterMap[min],
61
63
  alignment,
@@ -63,6 +65,7 @@ var ReglTexture2D = class {
63
65
  colorSpace: import_constants.colorSpaceMap[colorSpace],
64
66
  premultiplyAlpha,
65
67
  aniso,
68
+ // copy pixels from current bind framebuffer
66
69
  x,
67
70
  y,
68
71
  copy
@@ -102,5 +105,3 @@ var ReglTexture2D = class {
102
105
  this.isDestroy = true;
103
106
  }
104
107
  };
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {});