@antv/l7-renderer 2.9.22-alpha.0 → 2.9.24

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.
@@ -58,14 +58,14 @@ var ReglModel = /*#__PURE__*/function () {
58
58
 
59
59
  if (instances) {
60
60
  drawParams.instances = instances;
61
- } // elements 中可能包含 count,此时不应传入
61
+ } // Tip:
62
+ // elements 中可能包含 count,此时不应传入
63
+ // count 和 elements 相比、count 优先
62
64
 
63
65
 
64
66
  if (count) {
65
67
  drawParams.count = count;
66
- }
67
-
68
- if (elements) {
68
+ } else if (elements) {
69
69
  drawParams.elements = elements.get();
70
70
  }
71
71
 
@@ -3,6 +3,7 @@
3
3
  * @see https://github.com/regl-project/regl/blob/gh-pages/API.md
4
4
  */
5
5
  import { IAttribute, IAttributeInitializationOptions, IBuffer, IBufferInitializationOptions, IClearOptions, IElements, IElementsInitializationOptions, IExtensions, IFramebuffer, IFramebufferInitializationOptions, IModel, IModelInitializationOptions, IReadPixelsOptions, IRenderConfig, IRendererService, ITexture2D, ITexture2DInitializationOptions } from '@antv/l7-core';
6
+ import regl from 'l7regl';
6
7
  import 'reflect-metadata';
7
8
  import ReglFramebuffer from './ReglFramebuffer';
8
9
  /**
@@ -16,7 +17,7 @@ export default class ReglRendererService implements IRendererService {
16
17
  private width;
17
18
  private height;
18
19
  private isDirty;
19
- init(canvas: HTMLCanvasElement, cfg: IRenderConfig): Promise<void>;
20
+ init(canvas: HTMLCanvasElement, cfg: IRenderConfig, gl?: regl.Regl): Promise<void>;
20
21
  getPointSizeRange(): any;
21
22
  testExtension(name: string): boolean;
22
23
  createModel: (options: IModelInitializationOptions) => IModel;
package/es/regl/index.js CHANGED
@@ -160,7 +160,7 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
160
160
  _createClass(ReglRendererService, [{
161
161
  key: "init",
162
162
  value: function () {
163
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, cfg) {
163
+ var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, cfg, gl) {
164
164
  var _this2 = this;
165
165
 
166
166
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -168,9 +168,19 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
168
168
  switch (_context.prev = _context.next) {
169
169
  case 0:
170
170
  // this.$container = $container;
171
- this.canvas = canvas; // tslint:disable-next-line:typedef
171
+ this.canvas = canvas;
172
172
 
173
- _context.next = 3;
173
+ if (!gl) {
174
+ _context.next = 5;
175
+ break;
176
+ }
177
+
178
+ this.gl = gl;
179
+ _context.next = 8;
180
+ break;
181
+
182
+ case 5:
183
+ _context.next = 7;
174
184
  return new Promise(function (resolve, reject) {
175
185
  regl({
176
186
  canvas: _this2.canvas,
@@ -200,13 +210,15 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
200
210
  });
201
211
  });
202
212
 
203
- case 3:
213
+ case 7:
204
214
  this.gl = _context.sent;
215
+
216
+ case 8:
205
217
  this.extensionObject = {
206
218
  OES_texture_float: this.testExtension('OES_texture_float')
207
219
  };
208
220
 
209
- case 5:
221
+ case 9:
210
222
  case "end":
211
223
  return _context.stop();
212
224
  }
@@ -214,7 +226,7 @@ var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/funct
214
226
  }, _callee, this);
215
227
  }));
216
228
 
217
- function init(_x, _x2) {
229
+ function init(_x, _x2, _x3) {
218
230
  return _init.apply(this, arguments);
219
231
  }
220
232
 
@@ -69,8 +69,7 @@ var ReglModel = class {
69
69
  }
70
70
  if (count) {
71
71
  drawParams.count = count;
72
- }
73
- if (elements) {
72
+ } else if (elements) {
74
73
  drawParams.elements = elements.get();
75
74
  }
76
75
  this.initDepthDrawParams({ depth }, drawParams);
package/lib/regl/index.js CHANGED
@@ -120,39 +120,43 @@ var ReglRendererService = class {
120
120
  this.gl = null;
121
121
  };
122
122
  }
123
- async init(canvas, cfg) {
123
+ async init(canvas, cfg, gl) {
124
124
  this.canvas = canvas;
125
- this.gl = await new Promise((resolve, reject) => {
126
- (0, import_l7regl.default)({
127
- canvas: this.canvas,
128
- attributes: {
129
- alpha: true,
130
- antialias: cfg.antialias,
131
- premultipliedAlpha: true,
132
- preserveDrawingBuffer: cfg.preserveDrawingBuffer,
133
- stencil: cfg.stencil
134
- },
135
- extensions: [
136
- "OES_element_index_uint",
137
- "OES_standard_derivatives",
138
- "ANGLE_instanced_arrays"
139
- ],
140
- optionalExtensions: [
141
- "oes_texture_float_linear",
142
- "OES_texture_float",
143
- "EXT_texture_filter_anisotropic",
144
- "EXT_blend_minmax",
145
- "WEBGL_depth_texture"
146
- ],
147
- profile: true,
148
- onDone: (err, r) => {
149
- if (err || !r) {
150
- reject(err);
125
+ if (gl) {
126
+ this.gl = gl;
127
+ } else {
128
+ this.gl = await new Promise((resolve, reject) => {
129
+ (0, import_l7regl.default)({
130
+ canvas: this.canvas,
131
+ attributes: {
132
+ alpha: true,
133
+ antialias: cfg.antialias,
134
+ premultipliedAlpha: true,
135
+ preserveDrawingBuffer: cfg.preserveDrawingBuffer,
136
+ stencil: cfg.stencil
137
+ },
138
+ extensions: [
139
+ "OES_element_index_uint",
140
+ "OES_standard_derivatives",
141
+ "ANGLE_instanced_arrays"
142
+ ],
143
+ optionalExtensions: [
144
+ "oes_texture_float_linear",
145
+ "OES_texture_float",
146
+ "EXT_texture_filter_anisotropic",
147
+ "EXT_blend_minmax",
148
+ "WEBGL_depth_texture"
149
+ ],
150
+ profile: true,
151
+ onDone: (err, r) => {
152
+ if (err || !r) {
153
+ reject(err);
154
+ }
155
+ resolve(r);
151
156
  }
152
- resolve(r);
153
- }
157
+ });
154
158
  });
155
- });
159
+ }
156
160
  this.extensionObject = {
157
161
  OES_texture_float: this.testExtension("OES_texture_float")
158
162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-renderer",
3
- "version": "2.9.22-alpha.0",
3
+ "version": "2.9.24",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,19 +25,19 @@
25
25
  "author": "xiaoiver",
26
26
  "license": "ISC",
27
27
  "devDependencies": {
28
- "gl": "^4.4.0"
28
+ "@antv/l7-test-utils": "2.9.24",
29
+ "gl": "^5.0.3"
29
30
  },
30
31
  "dependencies": {
31
- "@antv/l7-core": "2.9.22-alpha.0",
32
- "@antv/l7-utils": "2.9.22-alpha.0",
32
+ "@antv/l7-core": "2.9.24",
33
+ "@antv/l7-utils": "2.9.24",
33
34
  "@babel/runtime": "^7.7.7",
34
- "gl": "^4.4.0",
35
35
  "inversify": "^5.0.1",
36
36
  "l7regl": "^0.0.20",
37
37
  "lodash": "^4.17.15",
38
38
  "reflect-metadata": "^0.1.13"
39
39
  },
40
- "gitHead": "df0d36c7370eaa2712be99e81b558cfb4f1d8322",
40
+ "gitHead": "0d84d477dc449e4541bdcaabbb29e6765d37b079",
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  }