@antv/g-webgpu 1.7.32 → 1.7.34

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/dist/index.esm.js CHANGED
@@ -149,14 +149,9 @@ function _regeneratorRuntime() {
149
149
  };
150
150
  }
151
151
  function maybeInvokeDelegate(delegate, context) {
152
- var method = delegate.iterator[context.method];
153
- if (undefined === method) {
154
- if (context.delegate = null, "throw" === context.method) {
155
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
156
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
157
- }
158
- return ContinueSentinel;
159
- }
152
+ var methodName = context.method,
153
+ method = delegate.iterator[methodName];
154
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
160
155
  var record = tryCatch(method, delegate.iterator, context.arg);
161
156
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
162
157
  var info = record.arg;
package/dist/index.js CHANGED
@@ -170,14 +170,9 @@ function _regeneratorRuntime() {
170
170
  };
171
171
  }
172
172
  function maybeInvokeDelegate(delegate, context) {
173
- var method = delegate.iterator[context.method];
174
- if (undefined === method) {
175
- if (context.delegate = null, "throw" === context.method) {
176
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
177
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
178
- }
179
- return ContinueSentinel;
180
- }
173
+ var methodName = context.method,
174
+ method = delegate.iterator[methodName];
175
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
181
176
  var record = tryCatch(method, delegate.iterator, context.arg);
182
177
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
183
178
  var info = record.arg;
package/dist/index.umd.js CHANGED
@@ -139,14 +139,9 @@
139
139
  };
140
140
  }
141
141
  function maybeInvokeDelegate(delegate, context) {
142
- var method = delegate.iterator[context.method];
143
- if (undefined === method) {
144
- if (context.delegate = null, "throw" === context.method) {
145
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
146
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
147
- }
148
- return ContinueSentinel;
149
- }
142
+ var methodName = context.method,
143
+ method = delegate.iterator[methodName];
144
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
150
145
  var record = tryCatch(method, delegate.iterator, context.arg);
151
146
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
152
147
  var info = record.arg;
@@ -3189,14 +3184,9 @@
3189
3184
  };
3190
3185
  }
3191
3186
  function maybeInvokeDelegate(delegate, context) {
3192
- var method = delegate.iterator[context.method];
3193
- if (undefined === method) {
3194
- if (context.delegate = null, "throw" === context.method) {
3195
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
3196
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
3197
- }
3198
- return ContinueSentinel;
3199
- }
3187
+ var methodName = context.method,
3188
+ method = delegate.iterator[methodName];
3189
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
3200
3190
  var record = tryCatch(method, delegate.iterator, context.arg);
3201
3191
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
3202
3192
  var info = record.arg;
@@ -3402,7 +3392,7 @@
3402
3392
  descriptor.enumerable = descriptor.enumerable || false;
3403
3393
  descriptor.configurable = true;
3404
3394
  if ("value" in descriptor) descriptor.writable = true;
3405
- Object.defineProperty(target, descriptor.key, descriptor);
3395
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
3406
3396
  }
3407
3397
  }
3408
3398
  function _createClass(Constructor, protoProps, staticProps) {
@@ -3490,6 +3480,20 @@
3490
3480
  }
3491
3481
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3492
3482
  }
3483
+ function _toPrimitive(input, hint) {
3484
+ if (typeof input !== "object" || input === null) return input;
3485
+ var prim = input[Symbol.toPrimitive];
3486
+ if (prim !== undefined) {
3487
+ var res = prim.call(input, hint || "default");
3488
+ if (typeof res !== "object") return res;
3489
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3490
+ }
3491
+ return (hint === "string" ? String : Number)(input);
3492
+ }
3493
+ function _toPropertyKey(arg) {
3494
+ var key = _toPrimitive(arg, "string");
3495
+ return typeof key === "symbol" ? key : String(key);
3496
+ }
3493
3497
  var Renderable3D = function Renderable3D() {
3494
3498
  this.pickingId = void 0;
3495
3499
  this.encodedPickingColor = void 0;
@@ -13489,14 +13493,9 @@
13489
13493
  };
13490
13494
  }
13491
13495
  function maybeInvokeDelegate(delegate, context) {
13492
- var method = delegate.iterator[context.method];
13493
- if (undefined === method) {
13494
- if (context.delegate = null, "throw" === context.method) {
13495
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
13496
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
13497
- }
13498
- return ContinueSentinel;
13499
- }
13496
+ var methodName = context.method,
13497
+ method = delegate.iterator[methodName];
13498
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
13500
13499
  var record = tryCatch(method, delegate.iterator, context.arg);
13501
13500
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
13502
13501
  var info = record.arg;
@@ -14008,14 +14007,9 @@
14008
14007
  };
14009
14008
  }
14010
14009
  function maybeInvokeDelegate(delegate, context) {
14011
- var method = delegate.iterator[context.method];
14012
- if (undefined === method) {
14013
- if (context.delegate = null, "throw" === context.method) {
14014
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
14015
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
14016
- }
14017
- return ContinueSentinel;
14018
- }
14010
+ var methodName = context.method,
14011
+ method = delegate.iterator[methodName];
14012
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
14019
14013
  var record = tryCatch(method, delegate.iterator, context.arg);
14020
14014
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
14021
14015
  var info = record.arg;
@@ -14650,14 +14644,9 @@
14650
14644
  };
14651
14645
  }
14652
14646
  function maybeInvokeDelegate(delegate, context) {
14653
- var method = delegate.iterator[context.method];
14654
- if (undefined === method) {
14655
- if (context.delegate = null, "throw" === context.method) {
14656
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
14657
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
14658
- }
14659
- return ContinueSentinel;
14660
- }
14647
+ var methodName = context.method,
14648
+ method = delegate.iterator[methodName];
14649
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
14661
14650
  var record = tryCatch(method, delegate.iterator, context.arg);
14662
14651
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
14663
14652
  var info = record.arg;
@@ -14869,6 +14858,111 @@
14869
14858
  };
14870
14859
  return _setPrototypeOf$4(o, p);
14871
14860
  }
14861
+
14862
+ /**
14863
+ * Common utilities
14864
+ * @module glMatrix
14865
+ */
14866
+ var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
14867
+ if (!Math.hypot) Math.hypot = function () {
14868
+ var y = 0,
14869
+ i = arguments.length;
14870
+ while (i--) {
14871
+ y += arguments[i] * arguments[i];
14872
+ }
14873
+ return Math.sqrt(y);
14874
+ };
14875
+
14876
+ /**
14877
+ * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
14878
+ * @module mat4
14879
+ */
14880
+
14881
+ /**
14882
+ * Creates a new identity mat4
14883
+ *
14884
+ * @returns {mat4} a new 4x4 matrix
14885
+ */
14886
+
14887
+ function create$3() {
14888
+ var out = new ARRAY_TYPE$1(16);
14889
+ if (ARRAY_TYPE$1 != Float32Array) {
14890
+ out[1] = 0;
14891
+ out[2] = 0;
14892
+ out[3] = 0;
14893
+ out[4] = 0;
14894
+ out[6] = 0;
14895
+ out[7] = 0;
14896
+ out[8] = 0;
14897
+ out[9] = 0;
14898
+ out[11] = 0;
14899
+ out[12] = 0;
14900
+ out[13] = 0;
14901
+ out[14] = 0;
14902
+ }
14903
+ out[0] = 1;
14904
+ out[5] = 1;
14905
+ out[10] = 1;
14906
+ out[15] = 1;
14907
+ return out;
14908
+ }
14909
+ /**
14910
+ * Set a mat4 to the identity matrix
14911
+ *
14912
+ * @param {mat4} out the receiving matrix
14913
+ * @returns {mat4} out
14914
+ */
14915
+
14916
+ function identity$1(out) {
14917
+ out[0] = 1;
14918
+ out[1] = 0;
14919
+ out[2] = 0;
14920
+ out[3] = 0;
14921
+ out[4] = 0;
14922
+ out[5] = 1;
14923
+ out[6] = 0;
14924
+ out[7] = 0;
14925
+ out[8] = 0;
14926
+ out[9] = 0;
14927
+ out[10] = 1;
14928
+ out[11] = 0;
14929
+ out[12] = 0;
14930
+ out[13] = 0;
14931
+ out[14] = 0;
14932
+ out[15] = 1;
14933
+ return out;
14934
+ }
14935
+ /**
14936
+ * Scales the mat4 by the dimensions in the given vec3 not using vectorization
14937
+ *
14938
+ * @param {mat4} out the receiving matrix
14939
+ * @param {ReadonlyMat4} a the matrix to scale
14940
+ * @param {ReadonlyVec3} v the vec3 to scale the matrix by
14941
+ * @returns {mat4} out
14942
+ **/
14943
+
14944
+ function scale(out, a, v) {
14945
+ var x = v[0],
14946
+ y = v[1],
14947
+ z = v[2];
14948
+ out[0] = a[0] * x;
14949
+ out[1] = a[1] * x;
14950
+ out[2] = a[2] * x;
14951
+ out[3] = a[3] * x;
14952
+ out[4] = a[4] * y;
14953
+ out[5] = a[5] * y;
14954
+ out[6] = a[6] * y;
14955
+ out[7] = a[7] * y;
14956
+ out[8] = a[8] * z;
14957
+ out[9] = a[9] * z;
14958
+ out[10] = a[10] * z;
14959
+ out[11] = a[11] * z;
14960
+ out[12] = a[12];
14961
+ out[13] = a[13];
14962
+ out[14] = a[14];
14963
+ out[15] = a[15];
14964
+ return out;
14965
+ }
14872
14966
  var ImagePool = /*#__PURE__*/function () {
14873
14967
  function ImagePool(canvasConfig) {
14874
14968
  this.canvasConfig = void 0;
@@ -14919,7 +15013,7 @@
14919
15013
  }
14920
15014
  });
14921
15015
  };
14922
- _proto.getOrCreatePatternSync = function getOrCreatePatternSync(pattern, context, callback) {
15016
+ _proto.getOrCreatePatternSync = function getOrCreatePatternSync(pattern, context, $offscreenCanvas, dpr, callback) {
14923
15017
  var patternKey = this.generatePatternKey(pattern);
14924
15018
  if (patternKey && this.patternCache[patternKey]) {
14925
15019
  return this.patternCache[patternKey];
@@ -14928,17 +15022,29 @@
14928
15022
  repetition = pattern.repetition,
14929
15023
  transform = pattern.transform;
14930
15024
  var src;
15025
+ var needScaleWithDPR = false;
14931
15026
  // Image URL
14932
15027
  if (isString(image)) {
14933
15028
  src = this.getImageSync(image, callback);
15029
+ } else if ($offscreenCanvas) {
15030
+ src = $offscreenCanvas;
15031
+ needScaleWithDPR = true;
14934
15032
  } else {
14935
15033
  src = image;
14936
15034
  }
14937
15035
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/createPattern
14938
15036
  var canvasPattern = src && context.createPattern(src, repetition);
14939
- // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform
14940
- if (transform) {
14941
- var mat = gLite.parsedTransformToMat4(gLite.parseTransform(transform));
15037
+ if (canvasPattern) {
15038
+ var mat;
15039
+ // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform
15040
+ if (transform) {
15041
+ mat = gLite.parsedTransformToMat4(gLite.parseTransform(transform));
15042
+ } else {
15043
+ mat = identity$1(create$3());
15044
+ }
15045
+ if (needScaleWithDPR) {
15046
+ scale(mat, mat, [1 / dpr, 1 / dpr, 1]);
15047
+ }
14942
15048
  canvasPattern.setTransform({
14943
15049
  a: mat[0],
14944
15050
  b: mat[1],
@@ -15017,6 +15123,8 @@
15017
15123
  // only generate cache for Image
15018
15124
  if (isString(image)) {
15019
15125
  return "pattern-" + image + "-" + repetition;
15126
+ } else if (image instanceof gLite.Rect) {
15127
+ return "pattern-" + image.entity + "-" + repetition;
15020
15128
  }
15021
15129
  };
15022
15130
  return ImagePool;
@@ -15241,14 +15349,9 @@
15241
15349
  };
15242
15350
  }
15243
15351
  function maybeInvokeDelegate(delegate, context) {
15244
- var method = delegate.iterator[context.method];
15245
- if (undefined === method) {
15246
- if (context.delegate = null, "throw" === context.method) {
15247
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
15248
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
15249
- }
15250
- return ContinueSentinel;
15251
- }
15352
+ var methodName = context.method,
15353
+ method = delegate.iterator[methodName];
15354
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
15252
15355
  var record = tryCatch(method, delegate.iterator, context.arg);
15253
15356
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
15254
15357
  var info = record.arg;