@galacean/engine 1.2.0-alpha.0 → 1.2.0-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/dist/browser.js CHANGED
@@ -37,7 +37,7 @@
37
37
  FrustumFace[FrustumFace[/** Bottom face */ "Bottom"] = 4] = "Bottom";
38
38
  FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
39
39
  })(exports.FrustumFace || (exports.FrustumFace = {}));
40
- function _defineProperties$4(target, props) {
40
+ function _defineProperties$3(target, props) {
41
41
  for(var i = 0; i < props.length; i++){
42
42
  var descriptor = props[i];
43
43
  descriptor.enumerable = descriptor.enumerable || false;
@@ -46,14 +46,14 @@
46
46
  Object.defineProperty(target, descriptor.key, descriptor);
47
47
  }
48
48
  }
49
- function _create_class$4(Constructor, protoProps, staticProps) {
50
- if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
51
- if (staticProps) _defineProperties$4(Constructor, staticProps);
49
+ function _create_class$3(Constructor, protoProps, staticProps) {
50
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
51
+ if (staticProps) _defineProperties$3(Constructor, staticProps);
52
52
  return Constructor;
53
53
  }
54
54
  /**
55
55
  * Common utility methods for math operations.
56
- */ var MathUtil$1 = /*#__PURE__*/ function() {
56
+ */ var MathUtil = /*#__PURE__*/ function() {
57
57
  var MathUtil = function MathUtil() {};
58
58
  /**
59
59
  * Clamps the specified value.
@@ -97,13 +97,13 @@
97
97
  return MathUtil;
98
98
  }();
99
99
  (function() {
100
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil$1.zeroTolerance = 1e-6;
100
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
101
101
  })();
102
102
  (function() {
103
- /** The conversion factor that radian to degree. */ MathUtil$1.radToDegreeFactor = 180 / Math.PI;
103
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
104
104
  })();
105
105
  (function() {
106
- /** The conversion factor that degree to radian. */ MathUtil$1.degreeToRadFactor = Math.PI / 180;
106
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
107
107
  })();
108
108
  /**
109
109
  * Describes a 3D-vector.
@@ -405,7 +405,7 @@
405
405
  * @param right - The second vector to compare
406
406
  * @returns True if the specified vectors are equals, false otherwise
407
407
  */ Vector3.equals = function equals(left, right) {
408
- return MathUtil$1.equals(left._x, right._x) && MathUtil$1.equals(left._y, right._y) && MathUtil$1.equals(left._z, right._z);
408
+ return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y) && MathUtil.equals(left._z, right._z);
409
409
  };
410
410
  /**
411
411
  * Performs a linear interpolation between two vectors.
@@ -459,7 +459,7 @@
459
459
  */ Vector3.normalize = function normalize(a, out) {
460
460
  var _x = a._x, _y = a._y, _z = a._z;
461
461
  var len = Math.sqrt(_x * _x + _y * _y + _z * _z);
462
- if (len > MathUtil$1.zeroTolerance) {
462
+ if (len > MathUtil.zeroTolerance) {
463
463
  len = 1 / len;
464
464
  out.set(_x * len, _y * len, _z * len);
465
465
  }
@@ -562,7 +562,7 @@
562
562
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
563
563
  out._onValueChanged && out._onValueChanged();
564
564
  };
565
- _create_class$4(Vector3, [
565
+ _create_class$3(Vector3, [
566
566
  {
567
567
  key: "x",
568
568
  get: /**
@@ -958,7 +958,7 @@
958
958
  * @returns The distance from ray to plane if intersecting, -1 otherwise
959
959
  */ CollisionUtil.intersectsRayAndPlane = function intersectsRayAndPlane(ray, plane) {
960
960
  var normal = plane.normal;
961
- var zeroTolerance = MathUtil$1.zeroTolerance;
961
+ var zeroTolerance = MathUtil.zeroTolerance;
962
962
  var dir = Vector3.dot(normal, ray.direction);
963
963
  // Parallel
964
964
  if (Math.abs(dir) < zeroTolerance) {
@@ -980,7 +980,7 @@
980
980
  * @param box - The box
981
981
  * @returns The distance from ray to box if intersecting, -1 otherwise
982
982
  */ CollisionUtil.intersectsRayAndBox = function intersectsRayAndBox(ray, box) {
983
- var zeroTolerance = MathUtil$1.zeroTolerance;
983
+ var zeroTolerance = MathUtil.zeroTolerance;
984
984
  var origin = ray.origin, direction = ray.direction;
985
985
  var min = box.min, max = box.max;
986
986
  var dirX = direction.x;
@@ -1137,37 +1137,37 @@
1137
1137
  * @returns The containment type
1138
1138
  */ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
1139
1139
  var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
1140
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1140
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1141
1141
  return exports.ContainmentType.Intersects;
1142
1142
  } else if (distance < 0) {
1143
1143
  return exports.ContainmentType.Disjoint;
1144
1144
  }
1145
1145
  distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
1146
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1146
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1147
1147
  return exports.ContainmentType.Intersects;
1148
1148
  } else if (distance < 0) {
1149
1149
  return exports.ContainmentType.Disjoint;
1150
1150
  }
1151
1151
  distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
1152
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1152
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1153
1153
  return exports.ContainmentType.Intersects;
1154
1154
  } else if (distance < 0) {
1155
1155
  return exports.ContainmentType.Disjoint;
1156
1156
  }
1157
1157
  distance = CollisionUtil.distancePlaneAndPoint(frustum.right, point);
1158
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1158
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1159
1159
  return exports.ContainmentType.Intersects;
1160
1160
  } else if (distance < 0) {
1161
1161
  return exports.ContainmentType.Disjoint;
1162
1162
  }
1163
1163
  distance = CollisionUtil.distancePlaneAndPoint(frustum.top, point);
1164
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1164
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1165
1165
  return exports.ContainmentType.Intersects;
1166
1166
  } else if (distance < 0) {
1167
1167
  return exports.ContainmentType.Disjoint;
1168
1168
  }
1169
1169
  distance = CollisionUtil.distancePlaneAndPoint(frustum.bottom, point);
1170
- if (Math.abs(distance) < MathUtil$1.zeroTolerance) {
1170
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1171
1171
  return exports.ContainmentType.Intersects;
1172
1172
  } else if (distance < 0) {
1173
1173
  return exports.ContainmentType.Disjoint;
@@ -1745,7 +1745,7 @@
1745
1745
  */ Matrix3x3.equals = function equals(left, right) {
1746
1746
  var le = left.elements;
1747
1747
  var re = right.elements;
1748
- return MathUtil$1.equals(le[0], re[0]) && MathUtil$1.equals(le[1], re[1]) && MathUtil$1.equals(le[2], re[2]) && MathUtil$1.equals(le[3], re[3]) && MathUtil$1.equals(le[4], re[4]) && MathUtil$1.equals(le[5], re[5]) && MathUtil$1.equals(le[6], re[6]) && MathUtil$1.equals(le[7], re[7]) && MathUtil$1.equals(le[8], re[8]);
1748
+ return MathUtil.equals(le[0], re[0]) && MathUtil.equals(le[1], re[1]) && MathUtil.equals(le[2], re[2]) && MathUtil.equals(le[3], re[3]) && MathUtil.equals(le[4], re[4]) && MathUtil.equals(le[5], re[5]) && MathUtil.equals(le[6], re[6]) && MathUtil.equals(le[7], re[7]) && MathUtil.equals(le[8], re[8]);
1749
1749
  };
1750
1750
  /**
1751
1751
  * Performs a linear interpolation between two matrices.
@@ -2038,7 +2038,7 @@
2038
2038
  */ _proto.getAxisAngle = function getAxisAngle(out) {
2039
2039
  var _this = this, _x = _this._x, _y = _this._y, _z = _this._z;
2040
2040
  var length = _x * _x + _y * _y + _z * _z;
2041
- if (length < MathUtil$1.zeroTolerance) {
2041
+ if (length < MathUtil.zeroTolerance) {
2042
2042
  out._x = 1;
2043
2043
  out._y = 0;
2044
2044
  out._z = 0;
@@ -2241,11 +2241,11 @@
2241
2241
  var ww = w * w;
2242
2242
  var unit = xx + yy + zz + ww;
2243
2243
  var test = 2 * (x * w - y * z);
2244
- if (test > (1 - MathUtil$1.zeroTolerance) * unit) {
2244
+ if (test > (1 - MathUtil.zeroTolerance) * unit) {
2245
2245
  out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
2246
2246
  out._y = Math.PI / 2;
2247
2247
  out._z = 0;
2248
- } else if (test < -(1 - MathUtil$1.zeroTolerance) * unit) {
2248
+ } else if (test < -(1 - MathUtil.zeroTolerance) * unit) {
2249
2249
  out._x = Math.atan2(2.0 * (w * y - x * z), zz + ww - yy - zz);
2250
2250
  out._y = -Math.PI / 2;
2251
2251
  out._z = 0;
@@ -2306,7 +2306,7 @@
2306
2306
  * @param right - The second quaternion to compare
2307
2307
  * @returns True if the specified quaternions are equals, false otherwise
2308
2308
  */ Quaternion.equals = function equals(left, right) {
2309
- return MathUtil$1.equals(left._x, right._x) && MathUtil$1.equals(left._y, right._y) && MathUtil$1.equals(left._z, right._z) && MathUtil$1.equals(left._w, right._w);
2309
+ return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y) && MathUtil.equals(left._z, right._z) && MathUtil.equals(left._w, right._w);
2310
2310
  };
2311
2311
  /**
2312
2312
  * Calculate a quaternion rotates around an arbitrary axis.
@@ -2406,7 +2406,7 @@
2406
2406
  */ Quaternion.invert = function invert(a, out) {
2407
2407
  var x = a._x, y = a._y, z = a._z, w = a._w;
2408
2408
  var dot = x * x + y * y + z * z + w * w;
2409
- if (dot > MathUtil$1.zeroTolerance) {
2409
+ if (dot > MathUtil.zeroTolerance) {
2410
2410
  var invDot = 1.0 / dot;
2411
2411
  out._x = -x * invDot;
2412
2412
  out._y = -y * invDot;
@@ -2446,7 +2446,7 @@
2446
2446
  var opposite;
2447
2447
  var inverse;
2448
2448
  var dot = Quaternion.dot(start, end);
2449
- if (Math.abs(dot) > 1.0 - MathUtil$1.zeroTolerance) {
2449
+ if (Math.abs(dot) > 1.0 - MathUtil.zeroTolerance) {
2450
2450
  inverse = 1.0 - amount;
2451
2451
  opposite = amount * Math.sign(dot);
2452
2452
  } else {
@@ -2468,7 +2468,7 @@
2468
2468
  */ Quaternion.normalize = function normalize(a, out) {
2469
2469
  var _x = a._x, _y = a._y, _z = a._z, _w = a._w;
2470
2470
  var len = Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
2471
- if (len > MathUtil$1.zeroTolerance) {
2471
+ if (len > MathUtil.zeroTolerance) {
2472
2472
  len = 1 / len;
2473
2473
  out._x = _x * len;
2474
2474
  out._y = _y * len;
@@ -2579,7 +2579,7 @@
2579
2579
  out._w = a._w * s;
2580
2580
  out._onValueChanged && out._onValueChanged();
2581
2581
  };
2582
- _create_class$4(Quaternion, [
2582
+ _create_class$3(Quaternion, [
2583
2583
  {
2584
2584
  key: "x",
2585
2585
  get: /**
@@ -2621,7 +2621,7 @@
2621
2621
  get: /**
2622
2622
  * Indicting whether this instance is normalized.
2623
2623
  */ function get() {
2624
- return Math.abs(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w - 1) < MathUtil$1.zeroTolerance;
2624
+ return Math.abs(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w - 1) < MathUtil.zeroTolerance;
2625
2625
  }
2626
2626
  },
2627
2627
  {
@@ -2790,7 +2790,7 @@
2790
2790
  var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2791
2791
  if (this.determinant() < 0) sx = -sx;
2792
2792
  scale.set(sx, sy, sz);
2793
- if (Math.abs(sx) < MathUtil$1.zeroTolerance || Math.abs(sy) < MathUtil$1.zeroTolerance || Math.abs(sz) < MathUtil$1.zeroTolerance) {
2793
+ if (Math.abs(sx) < MathUtil.zeroTolerance || Math.abs(sy) < MathUtil.zeroTolerance || Math.abs(sz) < MathUtil.zeroTolerance) {
2794
2794
  rotation.identity();
2795
2795
  return false;
2796
2796
  } else {
@@ -2817,7 +2817,7 @@
2817
2817
  */ _proto.getRotation = function getRotation(out) {
2818
2818
  var e = this.elements;
2819
2819
  var trace = e[0] + e[5] + e[10];
2820
- if (trace > MathUtil$1.zeroTolerance) {
2820
+ if (trace > MathUtil.zeroTolerance) {
2821
2821
  var s = Math.sqrt(trace + 1.0) * 2;
2822
2822
  out._w = 0.25 * s;
2823
2823
  out._x = (e[6] - e[9]) / s;
@@ -3037,7 +3037,7 @@
3037
3037
  */ Matrix.equals = function equals(left, right) {
3038
3038
  var le = left.elements;
3039
3039
  var re = right.elements;
3040
- return MathUtil$1.equals(le[0], re[0]) && MathUtil$1.equals(le[1], re[1]) && MathUtil$1.equals(le[2], re[2]) && MathUtil$1.equals(le[3], re[3]) && MathUtil$1.equals(le[4], re[4]) && MathUtil$1.equals(le[5], re[5]) && MathUtil$1.equals(le[6], re[6]) && MathUtil$1.equals(le[7], re[7]) && MathUtil$1.equals(le[8], re[8]) && MathUtil$1.equals(le[9], re[9]) && MathUtil$1.equals(le[10], re[10]) && MathUtil$1.equals(le[11], re[11]) && MathUtil$1.equals(le[12], re[12]) && MathUtil$1.equals(le[13], re[13]) && MathUtil$1.equals(le[14], re[14]) && MathUtil$1.equals(le[15], re[15]);
3040
+ return MathUtil.equals(le[0], re[0]) && MathUtil.equals(le[1], re[1]) && MathUtil.equals(le[2], re[2]) && MathUtil.equals(le[3], re[3]) && MathUtil.equals(le[4], re[4]) && MathUtil.equals(le[5], re[5]) && MathUtil.equals(le[6], re[6]) && MathUtil.equals(le[7], re[7]) && MathUtil.equals(le[8], re[8]) && MathUtil.equals(le[9], re[9]) && MathUtil.equals(le[10], re[10]) && MathUtil.equals(le[11], re[11]) && MathUtil.equals(le[12], re[12]) && MathUtil.equals(le[13], re[13]) && MathUtil.equals(le[14], re[14]) && MathUtil.equals(le[15], re[15]);
3041
3041
  };
3042
3042
  /**
3043
3043
  * Performs a linear interpolation between two matrices.
@@ -3164,7 +3164,7 @@
3164
3164
  var x = axis._x, y = axis._y, z = axis._z;
3165
3165
  var len = Math.sqrt(x * x + y * y + z * z);
3166
3166
  var s, c, t;
3167
- if (Math.abs(len) < MathUtil$1.zeroTolerance) {
3167
+ if (Math.abs(len) < MathUtil.zeroTolerance) {
3168
3168
  return;
3169
3169
  }
3170
3170
  len = 1 / len;
@@ -3437,7 +3437,7 @@
3437
3437
  */ Matrix.rotateAxisAngle = function rotateAxisAngle(m, axis, r, out) {
3438
3438
  var x = axis._x, y = axis._y, z = axis._z;
3439
3439
  var len = Math.sqrt(x * x + y * y + z * z);
3440
- if (Math.abs(len) < MathUtil$1.zeroTolerance) {
3440
+ if (Math.abs(len) < MathUtil.zeroTolerance) {
3441
3441
  return;
3442
3442
  }
3443
3443
  var me = m.elements;
@@ -3865,7 +3865,7 @@
3865
3865
  * @param right - The second vector to compare
3866
3866
  * @returns True if the specified vectors are equals, false otherwise
3867
3867
  */ Vector2.equals = function equals(left, right) {
3868
- return MathUtil$1.equals(left._x, right._x) && MathUtil$1.equals(left._y, right._y);
3868
+ return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y);
3869
3869
  };
3870
3870
  /**
3871
3871
  * Performs a linear interpolation between two vectors.
@@ -3915,7 +3915,7 @@
3915
3915
  */ Vector2.normalize = function normalize(left, out) {
3916
3916
  var _x = left._x, _y = left._y;
3917
3917
  var len = Math.sqrt(_x * _x + _y * _y);
3918
- if (len > MathUtil$1.zeroTolerance) {
3918
+ if (len > MathUtil.zeroTolerance) {
3919
3919
  len = 1 / len;
3920
3920
  out._x = _x * len;
3921
3921
  out._y = _y * len;
@@ -3932,7 +3932,7 @@
3932
3932
  out._y = left._y * s;
3933
3933
  out._onValueChanged && out._onValueChanged();
3934
3934
  };
3935
- _create_class$4(Vector2, [
3935
+ _create_class$3(Vector2, [
3936
3936
  {
3937
3937
  key: "x",
3938
3938
  get: /**
@@ -4229,7 +4229,7 @@
4229
4229
  * @param right - The second vector to compare
4230
4230
  * @returns True if the specified vectors are equals, false otherwise
4231
4231
  */ Vector4.equals = function equals(left, right) {
4232
- return MathUtil$1.equals(left._x, right._x) && MathUtil$1.equals(left._y, right._y) && MathUtil$1.equals(left._z, right._z) && MathUtil$1.equals(left._w, right._w);
4232
+ return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y) && MathUtil.equals(left._z, right._z) && MathUtil.equals(left._w, right._w);
4233
4233
  };
4234
4234
  /**
4235
4235
  * Performs a linear interpolation between two vectors.
@@ -4287,7 +4287,7 @@
4287
4287
  */ Vector4.normalize = function normalize(a, out) {
4288
4288
  var _x = a._x, _y = a._y, _z = a._z, _w = a._w;
4289
4289
  var len = Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
4290
- if (len > MathUtil$1.zeroTolerance) {
4290
+ if (len > MathUtil.zeroTolerance) {
4291
4291
  len = 1 / len;
4292
4292
  out._x = _x * len;
4293
4293
  out._y = _y * len;
@@ -4345,7 +4345,7 @@
4345
4345
  out._w = w;
4346
4346
  out._onValueChanged && out._onValueChanged();
4347
4347
  };
4348
- _create_class$4(Vector4, [
4348
+ _create_class$3(Vector4, [
4349
4349
  {
4350
4350
  key: "x",
4351
4351
  get: /**
@@ -4405,7 +4405,7 @@
4405
4405
  })();
4406
4406
  /**
4407
4407
  * Describes a color in the from of RGBA (in order: R, G, B, A).
4408
- */ var Color$1 = /*#__PURE__*/ function() {
4408
+ */ var Color = /*#__PURE__*/ function() {
4409
4409
  var Color = function Color(r, g, b, a) {
4410
4410
  if (r === void 0) r = 1;
4411
4411
  if (g === void 0) g = 1;
@@ -4579,7 +4579,7 @@
4579
4579
  * @param right - The second color to compare
4580
4580
  * @returns True if the specified colors are equals, false otherwise
4581
4581
  */ Color.equals = function equals(left, right) {
4582
- return MathUtil$1.equals(left._r, right._r) && MathUtil$1.equals(left._g, right._g) && MathUtil$1.equals(left._b, right._b) && MathUtil$1.equals(left._a, right._a);
4582
+ return MathUtil.equals(left._r, right._r) && MathUtil.equals(left._g, right._g) && MathUtil.equals(left._b, right._b) && MathUtil.equals(left._a, right._a);
4583
4583
  };
4584
4584
  /**
4585
4585
  * Determines the sum of two colors.
@@ -4636,7 +4636,7 @@
4636
4636
  out._onValueChanged && out._onValueChanged();
4637
4637
  return out;
4638
4638
  };
4639
- _create_class$4(Color, [
4639
+ _create_class$3(Color, [
4640
4640
  {
4641
4641
  key: "r",
4642
4642
  get: /**
@@ -4735,7 +4735,7 @@
4735
4735
  this._onValueChanged && this._onValueChanged();
4736
4736
  return this;
4737
4737
  };
4738
- _create_class$4(Rect, [
4738
+ _create_class$3(Rect, [
4739
4739
  {
4740
4740
  key: "x",
4741
4741
  get: /**
@@ -5014,7 +5014,7 @@
5014
5014
  if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
5015
5015
  return self;
5016
5016
  }
5017
- function _defineProperties$3(target, props) {
5017
+ function _defineProperties$2(target, props) {
5018
5018
  for(var i = 0; i < props.length; i++){
5019
5019
  var descriptor = props[i];
5020
5020
  descriptor.enumerable = descriptor.enumerable || false;
@@ -5023,9 +5023,9 @@
5023
5023
  Object.defineProperty(target, descriptor.key, descriptor);
5024
5024
  }
5025
5025
  }
5026
- function _create_class$3(Constructor, protoProps, staticProps) {
5027
- if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
5028
- if (staticProps) _defineProperties$3(Constructor, staticProps);
5026
+ function _create_class$2(Constructor, protoProps, staticProps) {
5027
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
5028
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
5029
5029
  return Constructor;
5030
5030
  }
5031
5031
  function _set_prototype_of$2(o, p) {
@@ -5048,345 +5048,6 @@
5048
5048
  });
5049
5049
  if (superClass) _set_prototype_of$2(subClass, superClass);
5050
5050
  }
5051
- /**
5052
- * Common utility methods for math operations.
5053
- */ var MathUtil = /*#__PURE__*/ function() {
5054
- var MathUtil = function MathUtil() {};
5055
- /**
5056
- * Clamps the specified value.
5057
- * @param v - The specified value
5058
- * @param min - The min value
5059
- * @param max - The max value
5060
- * @returns The result of clamping a value between min and max
5061
- */ MathUtil.clamp = function clamp(v, min, max) {
5062
- return Math.max(min, Math.min(max, v));
5063
- };
5064
- /**
5065
- * Checks if a and b are almost equals.
5066
- * The absolute value of the difference between a and b is close to zero.
5067
- * @param a - The left value to compare
5068
- * @param b - The right value to compare
5069
- * @returns True if a almost equal to b, false otherwise
5070
- */ MathUtil.equals = function equals(a, b) {
5071
- return Math.abs(a - b) <= MathUtil.zeroTolerance;
5072
- };
5073
- /**
5074
- * Determines whether the specified v is pow2.
5075
- * @param v - The specified v
5076
- * @returns True if the specified v is pow2, false otherwise
5077
- */ MathUtil.isPowerOf2 = function isPowerOf2(v) {
5078
- return (v & v - 1) === 0;
5079
- };
5080
- /**
5081
- * Modify the specified r from radian to degree.
5082
- * @param r - The specified r
5083
- * @returns The degree value
5084
- */ MathUtil.radianToDegree = function radianToDegree(r) {
5085
- return r * MathUtil.radToDegreeFactor;
5086
- };
5087
- /**
5088
- * Modify the specified d from degree to radian.
5089
- * @param d - The specified d
5090
- * @returns The radian value
5091
- */ MathUtil.degreeToRadian = function degreeToRadian(d) {
5092
- return d * MathUtil.degreeToRadFactor;
5093
- };
5094
- return MathUtil;
5095
- }();
5096
- (function() {
5097
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
5098
- })();
5099
- (function() {
5100
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
5101
- })();
5102
- (function() {
5103
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
5104
- })();
5105
- /**
5106
- * Describes a color in the from of RGBA (in order: R, G, B, A).
5107
- */ var Color = /*#__PURE__*/ function() {
5108
- var Color = function Color(r, g, b, a) {
5109
- if (r === void 0) r = 1;
5110
- if (g === void 0) g = 1;
5111
- if (b === void 0) b = 1;
5112
- if (a === void 0) a = 1;
5113
- /** @internal */ this._onValueChanged = null;
5114
- this._r = r;
5115
- this._g = g;
5116
- this._b = b;
5117
- this._a = a;
5118
- };
5119
- var _proto = Color.prototype;
5120
- /**
5121
- * Set the value of this color.
5122
- * @param r - The red component of the color
5123
- * @param g - The green component of the color
5124
- * @param b - The blue component of the color
5125
- * @param a - The alpha component of the color
5126
- * @returns This color.
5127
- */ _proto.set = function set(r, g, b, a) {
5128
- this._r = r;
5129
- this._g = g;
5130
- this._b = b;
5131
- this._a = a;
5132
- this._onValueChanged && this._onValueChanged();
5133
- return this;
5134
- };
5135
- /**
5136
- * Determines the sum of this color and the specified color.
5137
- * @param color - The specified color
5138
- * @returns The added color
5139
- */ _proto.add = function add(color) {
5140
- this._r += color._r;
5141
- this._g += color._g;
5142
- this._b += color._b;
5143
- this._a += color._a;
5144
- this._onValueChanged && this._onValueChanged();
5145
- return this;
5146
- };
5147
- /**
5148
- * Scale this color by the given value.
5149
- * @param s - The amount by which to scale the color
5150
- * @returns The scaled color
5151
- */ _proto.scale = function scale(s) {
5152
- this._r *= s;
5153
- this._g *= s;
5154
- this._b *= s;
5155
- this._a *= s;
5156
- this._onValueChanged && this._onValueChanged();
5157
- return this;
5158
- };
5159
- /**
5160
- * Creates a clone of this color.
5161
- * @returns A clone of this color
5162
- */ _proto.clone = function clone() {
5163
- var ret = new Color(this._r, this._g, this._b, this._a);
5164
- return ret;
5165
- };
5166
- /**
5167
- * Copy from color like object.
5168
- * @param source - Color like object.
5169
- * @returns This vector
5170
- */ _proto.copyFrom = function copyFrom(source) {
5171
- this._r = source.r;
5172
- this._g = source.g;
5173
- this._b = source.b;
5174
- this._a = source.a;
5175
- this._onValueChanged && this._onValueChanged();
5176
- return this;
5177
- };
5178
- /**
5179
- * Copy from array like object.
5180
- * @param source - Array like object
5181
- * @param offset - The start offset
5182
- * @returns This color
5183
- */ _proto.copyFromArray = function copyFromArray(source, offset) {
5184
- if (offset === void 0) offset = 0;
5185
- this._r = source[offset];
5186
- this._g = source[offset + 1];
5187
- this._b = source[offset + 2];
5188
- this._a = source[offset + 3];
5189
- this._onValueChanged && this._onValueChanged();
5190
- return this;
5191
- };
5192
- /**
5193
- * Copy the value of this color to an array.
5194
- * @param out - The color
5195
- * @param outOffset - The start offset
5196
- */ _proto.copyToArray = function copyToArray(out, outOffset) {
5197
- if (outOffset === void 0) outOffset = 0;
5198
- out[outOffset] = this._r;
5199
- out[outOffset + 1] = this._g;
5200
- out[outOffset + 2] = this._b;
5201
- out[outOffset + 3] = this._a;
5202
- };
5203
- /**
5204
- * Modify components (r, g, b) of this color from gamma space to linear space.
5205
- * @param out - The color in linear space
5206
- * @returns The color in linear space
5207
- */ _proto.toLinear = function toLinear(out) {
5208
- out._r = Color.gammaToLinearSpace(this._r);
5209
- out._g = Color.gammaToLinearSpace(this._g);
5210
- out._b = Color.gammaToLinearSpace(this._b);
5211
- this._onValueChanged && this._onValueChanged();
5212
- return out;
5213
- };
5214
- /**
5215
- * Modify components (r, g, b) of this color from linear space to gamma space.
5216
- * @param out - The color in gamma space
5217
- * @returns The color in gamma space
5218
- */ _proto.toGamma = function toGamma(out) {
5219
- out._r = Color.linearToGammaSpace(this._r);
5220
- out._g = Color.linearToGammaSpace(this._g);
5221
- out._b = Color.linearToGammaSpace(this._b);
5222
- this._onValueChanged && this._onValueChanged();
5223
- return out;
5224
- };
5225
- /**
5226
- * Gets the brightness.
5227
- * @returns The Hue-Saturation-Brightness (HSB) saturation for this
5228
- */ _proto.getBrightness = function getBrightness() {
5229
- var r = this.r;
5230
- var g = this.g;
5231
- var b = this.b;
5232
- var max = r;
5233
- var min = r;
5234
- if (g > max) max = g;
5235
- if (b > max) max = b;
5236
- if (g < min) min = g;
5237
- if (b < min) min = b;
5238
- return (max + min) / 2;
5239
- };
5240
- /**
5241
- * Serialize this color to a JSON representation.
5242
- * @return A JSON representation of this color
5243
- */ _proto.toJSON = function toJSON() {
5244
- return {
5245
- r: this._r,
5246
- g: this._g,
5247
- b: this._b,
5248
- a: this._a
5249
- };
5250
- };
5251
- /**
5252
- * Modify a value from the gamma space to the linear space.
5253
- * @param value - The value in gamma space
5254
- * @returns The value in linear space
5255
- */ Color.gammaToLinearSpace = function gammaToLinearSpace(value) {
5256
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
5257
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
5258
- if (value <= 0.0) return 0.0;
5259
- else if (value <= 0.04045) return value / 12.92;
5260
- else if (value < 1.0) return Math.pow((value + 0.055) / 1.055, 2.4);
5261
- else return Math.pow(value, 2.4);
5262
- };
5263
- /**
5264
- * Modify a value from the linear space to the gamma space.
5265
- * @param value - The value in linear space
5266
- * @returns The value in gamma space
5267
- */ Color.linearToGammaSpace = function linearToGammaSpace(value) {
5268
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
5269
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
5270
- if (value <= 0.0) return 0.0;
5271
- else if (value < 0.0031308) return 12.92 * value;
5272
- else if (value < 1.0) return 1.055 * Math.pow(value, 0.41666) - 0.055;
5273
- else return Math.pow(value, 0.41666);
5274
- };
5275
- /**
5276
- * Determines whether the specified colors are equals.
5277
- * @param left - The first color to compare
5278
- * @param right - The second color to compare
5279
- * @returns True if the specified colors are equals, false otherwise
5280
- */ Color.equals = function equals(left, right) {
5281
- return MathUtil.equals(left._r, right._r) && MathUtil.equals(left._g, right._g) && MathUtil.equals(left._b, right._b) && MathUtil.equals(left._a, right._a);
5282
- };
5283
- /**
5284
- * Determines the sum of two colors.
5285
- * @param left - The first color to add
5286
- * @param right - The second color to add
5287
- * @param out - The sum of two colors
5288
- * @returns The added color
5289
- */ Color.add = function add(left, right, out) {
5290
- out._r = left._r + right._r;
5291
- out._g = left._g + right._g;
5292
- out._b = left._b + right._b;
5293
- out._a = left._a + right._a;
5294
- out._onValueChanged && out._onValueChanged();
5295
- return out;
5296
- };
5297
- /**
5298
- * Determines the difference between two colors.
5299
- * @param left - The first color to subtract
5300
- * @param right - The second color to subtract
5301
- * @param out - The difference between two colors
5302
- */ Color.subtract = function subtract(left, right, out) {
5303
- out._r = left._r - right._r;
5304
- out._g = left._g - right._g;
5305
- out._b = left._b - right._b;
5306
- out._a = left._a - right._a;
5307
- out._onValueChanged && out._onValueChanged();
5308
- };
5309
- /**
5310
- * Scale a color by the given value.
5311
- * @param left - The color to scale
5312
- * @param s - The amount by which to scale the color
5313
- * @param out - The scaled color
5314
- * @returns The scaled color
5315
- */ Color.scale = function scale(left, s, out) {
5316
- out._r = left._r * s;
5317
- out._g = left._g * s;
5318
- out._b = left._b * s;
5319
- out._a = left._a * s;
5320
- out._onValueChanged && out._onValueChanged();
5321
- return out;
5322
- };
5323
- /**
5324
- * Performs a linear interpolation between two color.
5325
- * @param start - The first color
5326
- * @param end - The second color
5327
- * @param t - The blend amount where 0 returns start and 1 end
5328
- * @param out - The result of linear blending between two color
5329
- */ Color.lerp = function lerp(start, end, t, out) {
5330
- var _r = start._r, _g = start._g, _b = start._b, _a = start._a;
5331
- out._r = _r + (end._r - _r) * t;
5332
- out._g = _g + (end._g - _g) * t;
5333
- out._b = _b + (end._b - _b) * t;
5334
- out._a = _a + (end._a - _a) * t;
5335
- out._onValueChanged && out._onValueChanged();
5336
- return out;
5337
- };
5338
- _create_class$3(Color, [
5339
- {
5340
- key: "r",
5341
- get: /**
5342
- * The red component of the color, 0~1.
5343
- */ function get() {
5344
- return this._r;
5345
- },
5346
- set: function set(value) {
5347
- this._r = value;
5348
- this._onValueChanged && this._onValueChanged();
5349
- }
5350
- },
5351
- {
5352
- key: "g",
5353
- get: /**
5354
- * The green component of the color, 0~1.
5355
- */ function get() {
5356
- return this._g;
5357
- },
5358
- set: function set(value) {
5359
- this._g = value;
5360
- this._onValueChanged && this._onValueChanged();
5361
- }
5362
- },
5363
- {
5364
- key: "b",
5365
- get: /**
5366
- * The blue component of the color, 0~1.
5367
- */ function get() {
5368
- return this._b;
5369
- },
5370
- set: function set(value) {
5371
- this._b = value;
5372
- this._onValueChanged && this._onValueChanged();
5373
- }
5374
- },
5375
- {
5376
- key: "a",
5377
- get: /**
5378
- * The alpha component of the color, 0~1.
5379
- */ function get() {
5380
- return this._a;
5381
- },
5382
- set: function set(value) {
5383
- this._a = value;
5384
- this._onValueChanged && this._onValueChanged();
5385
- }
5386
- }
5387
- ]);
5388
- return Color;
5389
- }();
5390
5051
  /**
5391
5052
  * Sprite mask interaction.
5392
5053
  */ exports.SpriteMaskInteraction = void 0;
@@ -5668,7 +5329,7 @@
5668
5329
  resourceManager._deleteAsset(this);
5669
5330
  resourceManager._deleteContentRestorer(this);
5670
5331
  };
5671
- _create_class$3(EngineObject, [
5332
+ _create_class$2(EngineObject, [
5672
5333
  {
5673
5334
  key: "engine",
5674
5335
  get: /**
@@ -5771,7 +5432,7 @@
5771
5432
  this._addReferCount(-refCount);
5772
5433
  }
5773
5434
  };
5774
- _create_class$3(ReferResource, [
5435
+ _create_class$2(ReferResource, [
5775
5436
  {
5776
5437
  key: "refCount",
5777
5438
  get: /**
@@ -5844,7 +5505,7 @@
5844
5505
  this._sprites = null;
5845
5506
  this._spriteNamesToIndex = null;
5846
5507
  };
5847
- _create_class$3(SpriteAtlas, [
5508
+ _create_class$2(SpriteAtlas, [
5848
5509
  {
5849
5510
  key: "sprites",
5850
5511
  get: /**
@@ -6370,9 +6031,9 @@
6370
6031
  var _this = this, region = _this._region;
6371
6032
  // @ts-ignore
6372
6033
  region._onValueChanged = null;
6373
- var x = MathUtil$1.clamp(region.x, 0, 1);
6374
- var y = MathUtil$1.clamp(region.y, 0, 1);
6375
- region.set(x, y, MathUtil$1.clamp(region.width, 0, 1 - x), MathUtil$1.clamp(region.height, 0, 1 - y));
6034
+ var x = MathUtil.clamp(region.x, 0, 1);
6035
+ var y = MathUtil.clamp(region.y, 0, 1);
6036
+ region.set(x, y, MathUtil.clamp(region.width, 0, 1 - x), MathUtil.clamp(region.height, 0, 1 - y));
6376
6037
  this._dispatchSpriteChange(SpriteModifyFlags.region);
6377
6038
  if (this._customWidth === undefined || this._customHeight === undefined) {
6378
6039
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -6387,14 +6048,14 @@
6387
6048
  var _this = this, border = _this._border;
6388
6049
  // @ts-ignore
6389
6050
  border._onValueChanged = null;
6390
- var x = MathUtil$1.clamp(border.x, 0, 1);
6391
- var y = MathUtil$1.clamp(border.y, 0, 1);
6392
- border.set(x, y, MathUtil$1.clamp(border.z, 0, 1 - x), MathUtil$1.clamp(border.w, 0, 1 - y));
6051
+ var x = MathUtil.clamp(border.x, 0, 1);
6052
+ var y = MathUtil.clamp(border.y, 0, 1);
6053
+ border.set(x, y, MathUtil.clamp(border.z, 0, 1 - x), MathUtil.clamp(border.w, 0, 1 - y));
6393
6054
  this._dispatchSpriteChange(SpriteModifyFlags.border);
6394
6055
  // @ts-ignore
6395
6056
  border._onValueChanged = this._onBorderChange;
6396
6057
  };
6397
- _create_class$3(Sprite, [
6058
+ _create_class$2(Sprite, [
6398
6059
  {
6399
6060
  key: "texture",
6400
6061
  get: /**
@@ -6479,9 +6140,9 @@
6479
6140
  return this._atlasRegion;
6480
6141
  },
6481
6142
  set: function set(value) {
6482
- var x = MathUtil$1.clamp(value.x, 0, 1);
6483
- var y = MathUtil$1.clamp(value.y, 0, 1);
6484
- this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
6143
+ var x = MathUtil.clamp(value.x, 0, 1);
6144
+ var y = MathUtil.clamp(value.y, 0, 1);
6145
+ this._atlasRegion.set(x, y, MathUtil.clamp(value.width, 0, 1 - x), MathUtil.clamp(value.height, 0, 1 - y));
6485
6146
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
6486
6147
  if (this._customWidth === undefined || this._customHeight === undefined) {
6487
6148
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -6496,9 +6157,9 @@
6496
6157
  return this._atlasRegionOffset;
6497
6158
  },
6498
6159
  set: function set(value) {
6499
- var x = MathUtil$1.clamp(value.x, 0, 1);
6500
- var y = MathUtil$1.clamp(value.y, 0, 1);
6501
- this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
6160
+ var x = MathUtil.clamp(value.x, 0, 1);
6161
+ var y = MathUtil.clamp(value.y, 0, 1);
6162
+ this._atlasRegionOffset.set(x, y, MathUtil.clamp(value.z, 0, 1 - x), MathUtil.clamp(value.w, 0, 1 - y));
6502
6163
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
6503
6164
  if (this._customWidth === undefined || this._customHeight === undefined) {
6504
6165
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -6779,7 +6440,7 @@
6779
6440
  var shaderProperty = ShaderProperty._propertyNameMap[propertyName];
6780
6441
  return (_shaderProperty = shaderProperty) == null ? void 0 : _shaderProperty._group;
6781
6442
  };
6782
- _create_class$3(ShaderProperty, [
6443
+ _create_class$2(ShaderProperty, [
6783
6444
  {
6784
6445
  key: "type",
6785
6446
  get: /**
@@ -6844,7 +6505,7 @@
6844
6505
  deltaTimeValue.set(this._deltaTime, 0, 0, 0);
6845
6506
  shaderData.setVector4(Time._deltaTimeProperty, deltaTimeValue);
6846
6507
  };
6847
- _create_class$3(Time, [
6508
+ _create_class$2(Time, [
6848
6509
  {
6849
6510
  key: "frameCount",
6850
6511
  get: /*
@@ -7065,7 +6726,7 @@
7065
6726
  entity._isActiveInHierarchy && this._onDisable();
7066
6727
  }
7067
6728
  };
7068
- _create_class$3(Component, [
6729
+ _create_class$2(Component, [
7069
6730
  {
7070
6731
  key: "enabled",
7071
6732
  get: /**
@@ -7078,20 +6739,28 @@
7078
6739
  this._enabled = value;
7079
6740
  if (this._entity._isActiveInScene) {
7080
6741
  if (value) {
7081
- this._phasedActiveInScene = true;
7082
- this._onEnableInScene();
6742
+ if (!this._phasedActiveInScene) {
6743
+ this._phasedActiveInScene = true;
6744
+ this._onEnableInScene();
6745
+ }
7083
6746
  } else {
7084
- this._phasedActiveInScene = false;
7085
- this._onDisableInScene();
6747
+ if (this._phasedActiveInScene) {
6748
+ this._phasedActiveInScene = false;
6749
+ this._onDisableInScene();
6750
+ }
7086
6751
  }
7087
6752
  }
7088
6753
  if (this._entity.isActiveInHierarchy) {
7089
6754
  if (value) {
7090
- this._phasedActive = true;
7091
- this._onEnable();
6755
+ if (!this._phasedActive) {
6756
+ this._phasedActive = true;
6757
+ this._onEnable();
6758
+ }
7092
6759
  } else {
7093
- this._phasedActive = false;
7094
- this._onDisable();
6760
+ if (this._phasedActive) {
6761
+ this._phasedActive = false;
6762
+ this._onDisable();
6763
+ }
7095
6764
  }
7096
6765
  }
7097
6766
  }
@@ -7400,7 +7069,7 @@
7400
7069
  * @param relativeToLocal = `true` - Relative to local space
7401
7070
  */ _proto.rotateByAxis = function rotateByAxis(axis, angle, relativeToLocal) {
7402
7071
  if (relativeToLocal === void 0) relativeToLocal = true;
7403
- var rad = angle * MathUtil$1.degreeToRadFactor;
7072
+ var rad = angle * MathUtil.degreeToRadFactor;
7404
7073
  Quaternion.rotationAxisAngle(axis, rad, Transform._tempQuat0);
7405
7074
  this._rotateByQuat(Transform._tempQuat0, relativeToLocal);
7406
7075
  };
@@ -7412,7 +7081,7 @@
7412
7081
  var zAxis = Transform._tempVec30;
7413
7082
  Vector3.subtract(this.worldPosition, targetPosition, zAxis);
7414
7083
  var axisLen = zAxis.length();
7415
- if (axisLen <= MathUtil$1.zeroTolerance) {
7084
+ if (axisLen <= MathUtil.zeroTolerance) {
7416
7085
  // The current position and the target position are almost the same.
7417
7086
  return;
7418
7087
  }
@@ -7424,7 +7093,7 @@
7424
7093
  xAxis.set(zAxis.z, 0, -zAxis.x);
7425
7094
  }
7426
7095
  axisLen = xAxis.length();
7427
- if (axisLen <= MathUtil$1.zeroTolerance) {
7096
+ if (axisLen <= MathUtil.zeroTolerance) {
7428
7097
  // @todo:
7429
7098
  // 1.worldUp is(0,0,0)
7430
7099
  // 2.worldUp is parallel to zAxis
@@ -7631,7 +7300,7 @@
7631
7300
  };
7632
7301
  _proto._rotateXYZ = function _rotateXYZ(x, y, z, relativeToLocal) {
7633
7302
  if (relativeToLocal === void 0) relativeToLocal = true;
7634
- var radFactor = MathUtil$1.degreeToRadFactor;
7303
+ var radFactor = MathUtil.degreeToRadFactor;
7635
7304
  var rotQuat = Transform._tempQuat0;
7636
7305
  Quaternion.rotationEuler(x * radFactor, y * radFactor, z * radFactor, rotQuat);
7637
7306
  this._rotateByQuat(rotQuat, relativeToLocal);
@@ -7658,7 +7327,7 @@
7658
7327
  };
7659
7328
  _proto._onWorldRotationChanged = function _onWorldRotationChanged() {
7660
7329
  var worldRotation = this._worldRotation;
7661
- Quaternion.rotationEuler(MathUtil$1.degreeToRadian(worldRotation.x), MathUtil$1.degreeToRadian(worldRotation.y), MathUtil$1.degreeToRadian(worldRotation.z), this._worldRotationQuaternion);
7330
+ Quaternion.rotationEuler(MathUtil.degreeToRadian(worldRotation.x), MathUtil.degreeToRadian(worldRotation.y), MathUtil.degreeToRadian(worldRotation.z), this._worldRotationQuaternion);
7662
7331
  this._setDirtyFlagFalse(0x8);
7663
7332
  };
7664
7333
  _proto._onRotationQuaternionChanged = function _onRotationQuaternionChanged() {
@@ -7682,7 +7351,7 @@
7682
7351
  this._setDirtyFlagTrue(0x40);
7683
7352
  this._updateWorldScaleFlag();
7684
7353
  };
7685
- _create_class$3(Transform, [
7354
+ _create_class$2(Transform, [
7686
7355
  {
7687
7356
  key: "position",
7688
7357
  get: /**
@@ -7733,7 +7402,7 @@
7733
7402
  //@ts-ignore
7734
7403
  rotation._onValueChanged = null;
7735
7404
  this._rotationQuaternion.toEuler(rotation);
7736
- rotation.scale(MathUtil$1.radToDegreeFactor); // radians to degrees
7405
+ rotation.scale(MathUtil.radToDegreeFactor); // radians to degrees
7737
7406
  //@ts-ignore
7738
7407
  rotation._onValueChanged = this._onRotationChanged;
7739
7408
  this._setDirtyFlagFalse(0x1);
@@ -7757,7 +7426,7 @@
7757
7426
  //@ts-ignore
7758
7427
  worldRotation._onValueChanged = null;
7759
7428
  this.worldRotationQuaternion.toEuler(worldRotation);
7760
- worldRotation.scale(MathUtil$1.radToDegreeFactor); // Radian to angle
7429
+ worldRotation.scale(MathUtil.radToDegreeFactor); // Radian to angle
7761
7430
  //@ts-ignore
7762
7431
  worldRotation._onValueChanged = this._onWorldRotationChanged;
7763
7432
  this._setDirtyFlagFalse(0x8);
@@ -7779,7 +7448,7 @@
7779
7448
  if (this._isContainDirtyFlag(0x2)) {
7780
7449
  //@ts-ignore
7781
7450
  rotationQuaternion._onValueChanged = null;
7782
- Quaternion.rotationEuler(MathUtil$1.degreeToRadian(this._rotation.x), MathUtil$1.degreeToRadian(this._rotation.y), MathUtil$1.degreeToRadian(this._rotation.z), rotationQuaternion);
7451
+ Quaternion.rotationEuler(MathUtil.degreeToRadian(this._rotation.x), MathUtil.degreeToRadian(this._rotation.y), MathUtil.degreeToRadian(this._rotation.z), rotationQuaternion);
7783
7452
  //@ts-ignore
7784
7453
  rotationQuaternion._onValueChanged = this._onRotationQuaternionChanged;
7785
7454
  this._setDirtyFlagFalse(0x2);
@@ -8703,7 +8372,7 @@
8703
8372
  _proto.getTagValue = function getTagValue(keyOrKeyName) {
8704
8373
  return this._tagsMap[typeof keyOrKeyName == "string" ? ShaderTagKey.getByName(keyOrKeyName)._uniqueId : keyOrKeyName._uniqueId];
8705
8374
  };
8706
- _create_class$3(ShaderPart, [
8375
+ _create_class$2(ShaderPart, [
8707
8376
  {
8708
8377
  key: "name",
8709
8378
  get: /**
@@ -8757,7 +8426,7 @@
8757
8426
  if (value.r !== undefined) {
8758
8427
  if (cacheValue.x !== value.r || cacheValue.y !== value.g) {
8759
8428
  if (this._colorSpace === exports.ColorSpace.Linear) {
8760
- this._gl.uniform2f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g));
8429
+ this._gl.uniform2f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g));
8761
8430
  } else {
8762
8431
  this._gl.uniform2f(shaderUniform.location, value.r, value.g);
8763
8432
  }
@@ -8780,7 +8449,7 @@
8780
8449
  if (value.r !== undefined) {
8781
8450
  if (cacheValue.x !== value.r || cacheValue.y !== value.g || cacheValue.z !== value.b) {
8782
8451
  if (this._colorSpace === exports.ColorSpace.Linear) {
8783
- this._gl.uniform3f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g), Color$1.gammaToLinearSpace(value.b));
8452
+ this._gl.uniform3f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g), Color.gammaToLinearSpace(value.b));
8784
8453
  } else {
8785
8454
  this._gl.uniform3f(shaderUniform.location, value.r, value.g, value.b);
8786
8455
  }
@@ -8805,7 +8474,7 @@
8805
8474
  if (value.r !== undefined) {
8806
8475
  if (cacheValue.x !== value.r || cacheValue.y !== value.g || cacheValue.z !== value.b || cacheValue.w !== value.a) {
8807
8476
  if (this._colorSpace === exports.ColorSpace.Linear) {
8808
- this._gl.uniform4f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g), Color$1.gammaToLinearSpace(value.b), value.a);
8477
+ this._gl.uniform4f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g), Color.gammaToLinearSpace(value.b), value.a);
8809
8478
  } else {
8810
8479
  this._gl.uniform4f(shaderUniform.location, value.r, value.g, value.b, value.a);
8811
8480
  }
@@ -9311,7 +8980,7 @@
9311
8980
  return prefix + line;
9312
8981
  }).join("\n");
9313
8982
  };
9314
- _create_class$3(ShaderProgram, [
8983
+ _create_class$2(ShaderProgram, [
9315
8984
  {
9316
8985
  key: "isValid",
9317
8986
  get: /**
@@ -9421,7 +9090,7 @@
9421
9090
  return _this;
9422
9091
  };
9423
9092
  _inherits$2(SubShader, ShaderPart1);
9424
- _create_class$3(SubShader, [
9093
+ _create_class$2(SubShader, [
9425
9094
  {
9426
9095
  key: "passes",
9427
9096
  get: /**
@@ -9450,7 +9119,7 @@
9450
9119
  */ var BlendState = /*#__PURE__*/ function() {
9451
9120
  var BlendState = function BlendState() {
9452
9121
  /** The blend state of the render target. */ this.targetBlendState = new RenderTargetBlendState();
9453
- /** Constant blend color. */ this.blendColor = new Color$1(0, 0, 0, 0);
9122
+ /** Constant blend color. */ this.blendColor = new Color(0, 0, 0, 0);
9454
9123
  /** Whether to use (Alpha-to-Coverage) technology. */ this.alphaToCoverage = false;
9455
9124
  };
9456
9125
  var _proto = BlendState.prototype;
@@ -9544,7 +9213,7 @@
9544
9213
  }
9545
9214
  // apply blend color.
9546
9215
  var blendColor = this.blendColor;
9547
- if (!Color$1.equals(lastState.blendColor, blendColor)) {
9216
+ if (!Color.equals(lastState.blendColor, blendColor)) {
9548
9217
  gl.blendColor(blendColor.r, blendColor.g, blendColor.b, blendColor.a);
9549
9218
  lastState.blendColor.copyFrom(blendColor);
9550
9219
  }
@@ -10259,7 +9928,7 @@
10259
9928
  */ Shader.getPropertyByName = function getPropertyByName(name1) {
10260
9929
  return ShaderProperty.getByName(name1);
10261
9930
  };
10262
- _create_class$3(Shader, [
9931
+ _create_class$2(Shader, [
10263
9932
  {
10264
9933
  key: "subShaders",
10265
9934
  get: /**
@@ -10301,7 +9970,7 @@
10301
9970
  ReferResource1.prototype._onDestroy.call(this);
10302
9971
  this.engine.resourceManager._deleteGraphicResource(this);
10303
9972
  };
10304
- _create_class$3(GraphicsResource, [
9973
+ _create_class$2(GraphicsResource, [
10305
9974
  {
10306
9975
  key: "isContentLost",
10307
9976
  get: /**
@@ -10369,7 +10038,7 @@
10369
10038
  _proto._getMipmapCount = function _getMipmapCount() {
10370
10039
  return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
10371
10040
  };
10372
- _create_class$3(Texture, [
10041
+ _create_class$2(Texture, [
10373
10042
  {
10374
10043
  key: "format",
10375
10044
  get: /**
@@ -10995,7 +10664,7 @@
10995
10664
  */ _proto._onTransformChanged = function _onTransformChanged(type) {
10996
10665
  this._dirtyUpdateFlag |= 0x1;
10997
10666
  };
10998
- _create_class$3(Renderer1, [
10667
+ _create_class$2(Renderer1, [
10999
10668
  {
11000
10669
  key: "shaderData",
11001
10670
  get: /**
@@ -11613,7 +11282,7 @@
11613
11282
  GraphicsResource1.prototype._onDestroy.call(this);
11614
11283
  this._platformBuffer.destroy();
11615
11284
  };
11616
- _create_class$3(Buffer, [
11285
+ _create_class$2(Buffer, [
11617
11286
  {
11618
11287
  key: "type",
11619
11288
  get: /**
@@ -11836,7 +11505,7 @@
11836
11505
  this._buffer = buffer;
11837
11506
  this._format = format;
11838
11507
  };
11839
- _create_class$3(IndexBufferBinding, [
11508
+ _create_class$2(IndexBufferBinding, [
11840
11509
  {
11841
11510
  key: "buffer",
11842
11511
  get: /**
@@ -12003,7 +11672,7 @@
12003
11672
  this._platformPrimitive.destroy();
12004
11673
  this._vertexElementMap = null;
12005
11674
  };
12006
- _create_class$3(Primitive, [
11675
+ _create_class$2(Primitive, [
12007
11676
  {
12008
11677
  key: "vertexElements",
12009
11678
  get: function get() {
@@ -12125,7 +11794,7 @@
12125
11794
  _proto._onBoundsChanged = function _onBoundsChanged() {
12126
11795
  this._updateFlagManager.dispatch(0x1);
12127
11796
  };
12128
- _create_class$3(Mesh, [
11797
+ _create_class$2(Mesh, [
12129
11798
  {
12130
11799
  key: "bounds",
12131
11800
  get: /**
@@ -12170,7 +11839,7 @@
12170
11839
  this._buffer = buffer;
12171
11840
  this._stride = stride;
12172
11841
  };
12173
- _create_class$3(VertexBufferBinding, [
11842
+ _create_class$2(VertexBufferBinding, [
12174
11843
  {
12175
11844
  key: "buffer",
12176
11845
  get: /**
@@ -12202,7 +11871,7 @@
12202
11871
  this._formatMetaInfo = BufferUtil._getElementInfo(this.format);
12203
11872
  this._instanceStepRate = Math.floor(instanceStepRate);
12204
11873
  };
12205
- _create_class$3(VertexElement, [
11874
+ _create_class$2(VertexElement, [
12206
11875
  {
12207
11876
  key: "attribute",
12208
11877
  get: /**
@@ -12287,7 +11956,7 @@
12287
11956
  this._deltaNormals = null;
12288
11957
  this._deltaTangents = null;
12289
11958
  };
12290
- _create_class$3(BlendShapeFrame, [
11959
+ _create_class$2(BlendShapeFrame, [
12291
11960
  {
12292
11961
  key: "deltaPositions",
12293
11962
  get: /**
@@ -12404,7 +12073,7 @@
12404
12073
  this._updateUseNormalAndTangent(!!frame.deltaNormals, !!frame.deltaTangents);
12405
12074
  this._dataChangeManager.dispatch();
12406
12075
  };
12407
- _create_class$3(BlendShape, [
12076
+ _create_class$2(BlendShape, [
12408
12077
  {
12409
12078
  key: "frames",
12410
12079
  get: /**
@@ -12462,7 +12131,7 @@
12462
12131
  }
12463
12132
  this._setIndexBufferBinding(binding);
12464
12133
  };
12465
- _create_class$3(BufferMesh, [
12134
+ _create_class$2(BufferMesh, [
12466
12135
  {
12467
12136
  key: "instanceCount",
12468
12137
  get: /**
@@ -12623,7 +12292,7 @@
12623
12292
  type & MeshModifyFlags.Bounds && (this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume);
12624
12293
  type & MeshModifyFlags.VertexElements && (this._dirtyUpdateFlag |= 0x2);
12625
12294
  };
12626
- _create_class$3(MeshRenderer, [
12295
+ _create_class$2(MeshRenderer, [
12627
12296
  {
12628
12297
  key: "mesh",
12629
12298
  get: /**
@@ -12873,7 +12542,7 @@
12873
12542
  */ _proto._rebuild = function _rebuild() {
12874
12543
  this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
12875
12544
  };
12876
- _create_class$3(RenderTarget, [
12545
+ _create_class$2(RenderTarget, [
12877
12546
  {
12878
12547
  key: "autoGenerateMipmaps",
12879
12548
  get: /**
@@ -13080,7 +12749,7 @@
13080
12749
  this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
13081
12750
  Texture1.prototype._rebuild.call(this);
13082
12751
  };
13083
- _create_class$3(Texture2DArray, [
12752
+ _create_class$2(Texture2DArray, [
13084
12753
  {
13085
12754
  key: "length",
13086
12755
  get: /**
@@ -14253,7 +13922,7 @@
14253
13922
  };
14254
13923
  _proto._readColorVertexData = function _readColorVertexData(attributeType) {
14255
13924
  return this._readVertexData(attributeType, function(dataReader, offset) {
14256
- return new Color$1(dataReader[offset], dataReader[offset + 1], dataReader[offset + 2], dataReader[offset + 3]);
13925
+ return new Color(dataReader[offset], dataReader[offset + 1], dataReader[offset + 2], dataReader[offset + 3]);
14257
13926
  });
14258
13927
  };
14259
13928
  _proto._readVertexData = function _readVertexData(attributeType, onVertexParse) {
@@ -14587,7 +14256,7 @@
14587
14256
  }
14588
14257
  }
14589
14258
  };
14590
- _create_class$3(ModelMesh, [
14259
+ _create_class$2(ModelMesh, [
14591
14260
  {
14592
14261
  key: "vertexCount",
14593
14262
  get: /**
@@ -14739,6 +14408,10 @@
14739
14408
  var sphereInfo = primitiveInfo;
14740
14409
  PrimitiveMesh._setSphereData(this.resource, sphereInfo.radius, sphereInfo.segments, sphereInfo.noLongerAccessible, true, sphereInfo.vertexBuffer);
14741
14410
  break;
14411
+ case 7:
14412
+ var CCSphereInfo = primitiveInfo;
14413
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(this.resource, CCSphereInfo.radius, CCSphereInfo.step, CCSphereInfo.noLongerAccessible, true, CCSphereInfo.vertexBuffer);
14414
+ break;
14742
14415
  case 1:
14743
14416
  var cuboidInfo = primitiveInfo;
14744
14417
  PrimitiveMesh._setCuboidData(this.resource, cuboidInfo.width, cuboidInfo.height, cuboidInfo.depth, cuboidInfo.noLongerAccessible, true, cuboidInfo.vertexBuffer);
@@ -14776,6 +14449,7 @@
14776
14449
  PrimitiveType[PrimitiveType["Torus"] = 4] = "Torus";
14777
14450
  PrimitiveType[PrimitiveType["Cone"] = 5] = "Cone";
14778
14451
  PrimitiveType[PrimitiveType["Capsule"] = 6] = "Capsule";
14452
+ PrimitiveType[PrimitiveType["CCSphere"] = 7] = "CCSphere";
14779
14453
  })(PrimitiveType || (PrimitiveType = {}));
14780
14454
  /**
14781
14455
  * @internal
@@ -14797,6 +14471,19 @@
14797
14471
  _inherits$2(SphereRestoreInfo, PrimitiveRestoreInfo);
14798
14472
  return SphereRestoreInfo;
14799
14473
  }(PrimitiveRestoreInfo);
14474
+ /**
14475
+ * @internal
14476
+ */ var SubdivisionSurfaceSphereRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
14477
+ var SubdivisionSurfaceSphereRestoreInfo = function SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible) {
14478
+ var _this;
14479
+ _this = PrimitiveRestoreInfo.call(this, 7, vertexBuffer, noLongerAccessible) || this;
14480
+ _this.radius = radius;
14481
+ _this.step = step;
14482
+ return _this;
14483
+ };
14484
+ _inherits$2(SubdivisionSurfaceSphereRestoreInfo, PrimitiveRestoreInfo);
14485
+ return SubdivisionSurfaceSphereRestoreInfo;
14486
+ }(PrimitiveRestoreInfo);
14800
14487
  /**
14801
14488
  * @internal
14802
14489
  */ var CuboidRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
@@ -14910,6 +14597,24 @@
14910
14597
  return sphereMesh;
14911
14598
  };
14912
14599
  /**
14600
+ * Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
14601
+ * Max step is limited to 6.
14602
+ * @param engine - Engine
14603
+ * @param radius - Sphere radius
14604
+ * @param step - Number of subdiv steps
14605
+ * @param noLongerAccessible - No longer access the vertices of the mesh after creation
14606
+ * @returns Sphere model mesh
14607
+ */ PrimitiveMesh.createSubdivisionSurfaceSphere = function createSubdivisionSurfaceSphere(engine, radius, step, noLongerAccessible) {
14608
+ if (radius === void 0) radius = 0.5;
14609
+ if (step === void 0) step = 3;
14610
+ if (noLongerAccessible === void 0) noLongerAccessible = true;
14611
+ var sphereMesh = new ModelMesh(engine);
14612
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, false);
14613
+ var vertexBuffer = sphereMesh.vertexBufferBindings[0].buffer;
14614
+ engine.resourceManager.addContentRestorer(new PrimitiveMeshRestorer(sphereMesh, new SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible)));
14615
+ return sphereMesh;
14616
+ };
14617
+ /**
14913
14618
  * Create a cuboid mesh.
14914
14619
  * @param engine - Engine
14915
14620
  * @param width - Cuboid width
@@ -15039,6 +14744,90 @@
15039
14744
  };
15040
14745
  /**
15041
14746
  * @internal
14747
+ */ PrimitiveMesh._setSubdivisionSurfaceSphereData = function _setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
14748
+ // Max step is limited to 6. Because 7 step will generate a single mesh with over 98306 vertices
14749
+ step = MathUtil.clamp(Math.floor(step), 1, 6);
14750
+ var positions = new Float32Array(3 * (6 * Math.pow(4, step) + 2));
14751
+ var cells = new Float32Array(24 * Math.pow(4, step));
14752
+ PrimitiveMesh._subdiveCatmullClark(step, positions, cells);
14753
+ var positionCount = positions.length / 3;
14754
+ var cellsCount = cells.length / 4;
14755
+ var poleOffset = positionCount + Math.pow(2, step + 1) - 1;
14756
+ // 16 extra vertices for pole uv
14757
+ // 2 vertices at each pole are idle
14758
+ var vertexCount = poleOffset + 16;
14759
+ var vertices = new Float32Array(vertexCount * 8);
14760
+ var indices = PrimitiveMesh._generateIndices(sphereMesh.engine, positionCount, cellsCount * 6);
14761
+ var seamCount = 0;
14762
+ var seamVertices = {};
14763
+ // Get normals, uvs, and scale to radius
14764
+ for(var i = 0; i < positionCount; i++){
14765
+ var offset = 3 * i;
14766
+ var x = positions[offset];
14767
+ var y = positions[offset + 1];
14768
+ var z = positions[offset + 2];
14769
+ var reciprocalLength = 1 / Math.sqrt(x * x + y * y + z * z);
14770
+ x *= reciprocalLength;
14771
+ y *= reciprocalLength;
14772
+ z *= reciprocalLength;
14773
+ offset = 8 * i;
14774
+ vertices[offset] = x * radius;
14775
+ vertices[offset + 1] = y * radius;
14776
+ vertices[offset + 2] = z * radius;
14777
+ vertices[offset + 3] = x;
14778
+ vertices[offset + 4] = y;
14779
+ vertices[offset + 5] = z;
14780
+ vertices[offset + 6] = (Math.PI - Math.atan2(z, x)) / (2 * Math.PI);
14781
+ vertices[offset + 7] = Math.acos(y) / Math.PI;
14782
+ if (vertices[offset + 6] === 0) {
14783
+ // Generate seam vertex
14784
+ var seamOffset = 8 * (positionCount + seamCount++);
14785
+ vertices.set(vertices.subarray(offset, offset + 8), seamOffset);
14786
+ vertices[seamOffset + 6] = 1.0;
14787
+ // Cache seam vertex
14788
+ seamVertices[offset / 8] = seamOffset / 8;
14789
+ }
14790
+ }
14791
+ // Get indices
14792
+ var offset1 = 0;
14793
+ this._spherePoleIdx = 0;
14794
+ for(var i1 = 0; i1 < cellsCount; i1++){
14795
+ var idx = 4 * i1;
14796
+ var indexA = cells[idx];
14797
+ var indexB = cells[idx + 1];
14798
+ var indexC = cells[idx + 2];
14799
+ var indexD = cells[idx + 3];
14800
+ // Handle seam by replacing vertex index to seam vertex index if necessary
14801
+ var floatIndexA = 8 * indexA;
14802
+ var floatIndexB = 8 * indexB;
14803
+ var floatIndexC = 8 * indexC;
14804
+ var floatIndexD = 8 * indexD;
14805
+ // If center Z is negative
14806
+ if (vertices[floatIndexA + 2] + vertices[floatIndexB + 2] + vertices[floatIndexC + 2] < 0) {
14807
+ vertices[floatIndexA + 6] === 0 && (indexA = seamVertices[indexA]);
14808
+ vertices[floatIndexB + 6] === 0 && (indexB = seamVertices[indexB]);
14809
+ vertices[floatIndexC + 6] === 0 && (indexC = seamVertices[indexC]);
14810
+ vertices[floatIndexD + 6] === 0 && (indexD = seamVertices[indexD]);
14811
+ }
14812
+ indices[offset1] = indexA;
14813
+ indices[offset1 + 1] = indexB;
14814
+ indices[offset1 + 2] = indexC;
14815
+ this._generateAndReplacePoleUV(indices, vertices, offset1, poleOffset);
14816
+ indices[offset1 + 3] = indexA;
14817
+ indices[offset1 + 4] = indexC;
14818
+ indices[offset1 + 5] = indexD;
14819
+ this._generateAndReplacePoleUV(indices, vertices, offset1 + 3, poleOffset);
14820
+ offset1 += 6;
14821
+ }
14822
+ if (!isRestoreMode) {
14823
+ var bounds = sphereMesh.bounds;
14824
+ bounds.min.set(-radius, -radius, -radius);
14825
+ bounds.max.set(radius, radius, radius);
14826
+ }
14827
+ PrimitiveMesh._initialize(sphereMesh, vertices, indices, noLongerAccessible, isRestoreMode, restoreVertexBuffer);
14828
+ };
14829
+ /**
14830
+ * @internal
15042
14831
  */ PrimitiveMesh._setSphereData = function _setSphereData(sphereMesh, radius, segments, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
15043
14832
  segments = Math.max(2, Math.floor(segments));
15044
14833
  var count = segments + 1;
@@ -15099,6 +14888,135 @@
15099
14888
  };
15100
14889
  /**
15101
14890
  * @internal
14891
+ */ PrimitiveMesh._subdiveCatmullClark = function _subdiveCatmullClark(step, positions, cells) {
14892
+ var edges = new Map();
14893
+ var faces = new Array();
14894
+ positions.set(PrimitiveMesh._sphereSeedPositions);
14895
+ cells.set(PrimitiveMesh._sphereSeedCells);
14896
+ for(var i = 0; i < step; i++){
14897
+ var cellCount = 6 * Math.pow(4, i);
14898
+ var positionCount = 4 * cellCount + 2;
14899
+ edges.clear();
14900
+ faces.length = 0;
14901
+ // Get cell face's facePoint
14902
+ for(var j = 0; j < cellCount; j++){
14903
+ var face = faces[j] = {
14904
+ facePoint: new Vector3(),
14905
+ adjacentEdges: new Array(4)
14906
+ };
14907
+ // Get cell's edgePoint
14908
+ for(var k = 0; k < 4; k++){
14909
+ var offset = 3 * cells[4 * j + k];
14910
+ face.facePoint.x += 0.25 * positions[offset];
14911
+ face.facePoint.y += 0.25 * positions[offset + 1];
14912
+ face.facePoint.z += 0.25 * positions[offset + 2];
14913
+ }
14914
+ // Get cell edges
14915
+ for(var k1 = 0; k1 < 4; k1++){
14916
+ var vertexIdxA = cells[4 * j + k1];
14917
+ var vertexIdxB = cells[4 * j + (k1 + 1) % 4];
14918
+ var edgeIdxKey = Math.min(vertexIdxA, vertexIdxB) * positionCount + Math.max(vertexIdxA, vertexIdxB);
14919
+ if (!edges.has(edgeIdxKey)) {
14920
+ var edge = {
14921
+ edgePoint: new Vector3(),
14922
+ edgePointIndex: undefined
14923
+ };
14924
+ var offsetA = 3 * vertexIdxA;
14925
+ var offsetB = 3 * vertexIdxB;
14926
+ edge.edgePoint.set(0.25 * (positions[offsetA] + positions[offsetB]), 0.25 * (positions[offsetA + 1] + positions[offsetB + 1]), 0.25 * (positions[offsetA + 2] + positions[offsetB + 2]));
14927
+ edges.set(edgeIdxKey, edge);
14928
+ }
14929
+ var edge1 = edges.get(edgeIdxKey);
14930
+ face.adjacentEdges[k1] = edge1;
14931
+ var edgePoint = edge1.edgePoint;
14932
+ var facePoint = face.facePoint;
14933
+ edgePoint.x += 0.25 * facePoint.x;
14934
+ edgePoint.y += 0.25 * facePoint.y;
14935
+ edgePoint.z += 0.25 * facePoint.z;
14936
+ }
14937
+ }
14938
+ var prePointCount = cellCount + 2;
14939
+ var edgePointOffset = prePointCount + cellCount;
14940
+ var pointIdx = 0;
14941
+ this._sphereEdgeIdx = 0;
14942
+ var preCells = cells.slice(0, 4 * cellCount);
14943
+ // Get New positions, which consists of updated positions of existing points, face points and edge points
14944
+ for(var j1 = 0; j1 < cellCount; j1++){
14945
+ // Add face point to new positions
14946
+ var face1 = faces[j1];
14947
+ face1.facePoint.copyToArray(positions, 3 * (prePointCount + j1));
14948
+ // Get the face point index
14949
+ var ic = prePointCount + j1;
14950
+ var id = void 0, ib = void 0, temp = void 0;
14951
+ // ia -- id -- ia
14952
+ // | | |
14953
+ // ib -- ic -- ib
14954
+ // | | |
14955
+ // ia -- id -- ia
14956
+ for(var k2 = 0; k2 < 4; k2++){
14957
+ // Get the updated existing point index
14958
+ var ia = preCells[pointIdx++];
14959
+ // ib and id share four edge points in one cell
14960
+ switch(k2){
14961
+ case 0:
14962
+ {
14963
+ var edgeB = face1.adjacentEdges[k2 % 4];
14964
+ var edgeD = face1.adjacentEdges[(k2 + 3) % 4];
14965
+ ib = this._calculateEdgeIndex(positions, edgeB, edgePointOffset);
14966
+ id = this._calculateEdgeIndex(positions, edgeD, edgePointOffset);
14967
+ temp = id;
14968
+ break;
14969
+ }
14970
+ case 1:
14971
+ case 2:
14972
+ {
14973
+ var edgeB1 = face1.adjacentEdges[k2 % 4];
14974
+ id = ib;
14975
+ ib = this._calculateEdgeIndex(positions, edgeB1, edgePointOffset);
14976
+ break;
14977
+ }
14978
+ case 3:
14979
+ {
14980
+ id = ib;
14981
+ ib = temp;
14982
+ break;
14983
+ }
14984
+ }
14985
+ var idx = 4 * (4 * j1 + k2);
14986
+ cells[idx] = ia;
14987
+ cells[idx + 1] = ib;
14988
+ cells[idx + 2] = ic;
14989
+ cells[idx + 3] = id;
14990
+ }
14991
+ }
14992
+ }
14993
+ };
14994
+ /**
14995
+ * Duplicate vertices at the poles and adjust their UV coordinates.
14996
+ */ PrimitiveMesh._generateAndReplacePoleUV = function _generateAndReplacePoleUV(indices, vertices, idx, poleOffset) {
14997
+ var v = vertices[8 * indices[idx] + 7];
14998
+ if (v === 0 || v === 1) {
14999
+ var offset = 8 * indices[idx];
15000
+ var addedOffset = 8 * (poleOffset + this._spherePoleIdx);
15001
+ vertices.set(vertices.subarray(offset, offset + 8), addedOffset);
15002
+ vertices[addedOffset + 6] = 0.5 * (vertices[offset + 6] + vertices[8 * indices[idx + 1] + 6] + vertices[8 * indices[idx + 2] + 6] - 0.5);
15003
+ indices[idx] = poleOffset + this._spherePoleIdx++;
15004
+ }
15005
+ };
15006
+ /**
15007
+ * Get edge point index for subdivision surface sphere.
15008
+ */ PrimitiveMesh._calculateEdgeIndex = function _calculateEdgeIndex(positions, edge, offset) {
15009
+ if (edge.edgePointIndex !== undefined) {
15010
+ return edge.edgePointIndex;
15011
+ } else {
15012
+ edge.edgePoint.copyToArray(positions, 3 * (offset + PrimitiveMesh._sphereEdgeIdx));
15013
+ var index = offset + PrimitiveMesh._sphereEdgeIdx++;
15014
+ edge.edgePointIndex = index;
15015
+ return index;
15016
+ }
15017
+ };
15018
+ /**
15019
+ * @internal
15102
15020
  */ PrimitiveMesh._setCuboidData = function _setCuboidData(cuboidMesh, width, height, depth, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
15103
15021
  var halfWidth = width / 2;
15104
15022
  var halfHeight = height / 2;
@@ -15723,6 +15641,68 @@
15723
15641
  (function() {
15724
15642
  PrimitiveMesh._tempVec30 = new Vector3();
15725
15643
  })();
15644
+ (function() {
15645
+ PrimitiveMesh._sphereSeedPositions = new Float32Array([
15646
+ -1,
15647
+ 1,
15648
+ 1,
15649
+ -1,
15650
+ -1,
15651
+ 1,
15652
+ 1,
15653
+ -1,
15654
+ 1,
15655
+ 1,
15656
+ 1,
15657
+ 1,
15658
+ 1,
15659
+ -1,
15660
+ -1,
15661
+ 1,
15662
+ 1,
15663
+ -1,
15664
+ -1,
15665
+ -1,
15666
+ -1,
15667
+ -1,
15668
+ 1,
15669
+ -1
15670
+ ]);
15671
+ })();
15672
+ (function() {
15673
+ PrimitiveMesh._sphereSeedCells = new Float32Array([
15674
+ 0,
15675
+ 1,
15676
+ 2,
15677
+ 3,
15678
+ 3,
15679
+ 2,
15680
+ 4,
15681
+ 5,
15682
+ 5,
15683
+ 4,
15684
+ 6,
15685
+ 7,
15686
+ 7,
15687
+ 0,
15688
+ 3,
15689
+ 5,
15690
+ 7,
15691
+ 6,
15692
+ 1,
15693
+ 0,
15694
+ 6,
15695
+ 4,
15696
+ 2,
15697
+ 1
15698
+ ]);
15699
+ })();
15700
+ (function() {
15701
+ PrimitiveMesh._sphereEdgeIdx = 0;
15702
+ })();
15703
+ (function() {
15704
+ PrimitiveMesh._spherePoleIdx = 0;
15705
+ })();
15726
15706
  /**
15727
15707
  * Mesh skin data, equal glTF skins define
15728
15708
  */ var Skin = /*#__PURE__*/ function(EngineObject1) {
@@ -15940,7 +15920,7 @@
15940
15920
  }
15941
15921
  return entity;
15942
15922
  };
15943
- _create_class$3(SkinnedMeshRenderer, [
15923
+ _create_class$2(SkinnedMeshRenderer, [
15944
15924
  {
15945
15925
  key: "blendShapeWeights",
15946
15926
  get: /**
@@ -16263,8 +16243,10 @@
16263
16243
  }
16264
16244
  mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
16265
16245
  batchedQueue[curMeshIndex] = preElement;
16266
- this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
16267
- this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
16246
+ // Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
16247
+ // Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
16248
+ this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
16249
+ this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
16268
16250
  };
16269
16251
  _proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
16270
16252
  var subMesh = this._subMeshPool.getFromPool();
@@ -16410,7 +16392,7 @@
16410
16392
  rVertCount = 3;
16411
16393
  rType = 0;
16412
16394
  } else {
16413
- if (fixedCW > MathUtil$1.zeroTolerance) {
16395
+ if (fixedCW > MathUtil.zeroTolerance) {
16414
16396
  rRepeatCount = (width - fixedLR) / fixedCW;
16415
16397
  rRepeatCount = rRepeatCount % 1 >= threshold ? Math.ceil(rRepeatCount) : Math.floor(rRepeatCount);
16416
16398
  rVertCount = 4 + rRepeatCount - 1;
@@ -16424,7 +16406,7 @@
16424
16406
  cVertCount = 3;
16425
16407
  cType = 0;
16426
16408
  } else {
16427
- if (fixedCH > MathUtil$1.zeroTolerance) {
16409
+ if (fixedCH > MathUtil.zeroTolerance) {
16428
16410
  cRepeatCount = (height - fixedTB) / fixedCH;
16429
16411
  cRepeatCount = cRepeatCount % 1 >= threshold ? Math.ceil(cRepeatCount) : Math.floor(cRepeatCount);
16430
16412
  cVertCount = 4 + cRepeatCount - 1;
@@ -16515,7 +16497,7 @@
16515
16497
  rVertCount = 3;
16516
16498
  rType = 0;
16517
16499
  } else {
16518
- if (fixedCW > MathUtil$1.zeroTolerance) {
16500
+ if (fixedCW > MathUtil.zeroTolerance) {
16519
16501
  rRepeatCount = (width - fixedLR) / fixedCW;
16520
16502
  rVertCount = 4 + (rRepeatCount | 0);
16521
16503
  rType = 2;
@@ -16528,7 +16510,7 @@
16528
16510
  cVertCount = 3;
16529
16511
  cType = 0;
16530
16512
  } else {
16531
- if (fixedCH > MathUtil$1.zeroTolerance) {
16513
+ if (fixedCH > MathUtil.zeroTolerance) {
16532
16514
  cRepeatCount = (height - fixedTB) / fixedCH;
16533
16515
  cVertCount = 4 + (cRepeatCount | 0);
16534
16516
  cType = 2;
@@ -16638,7 +16620,7 @@
16638
16620
  _this = Renderer1.call(this, entity) || this;
16639
16621
  _this._tileMode = exports.SpriteTileMode.Continuous;
16640
16622
  _this._tiledAdaptiveThreshold = 0.5;
16641
- _this._color = new Color$1(1, 1, 1, 1);
16623
+ _this._color = new Color(1, 1, 1, 1);
16642
16624
  _this._sprite = null;
16643
16625
  _this._automaticWidth = 0;
16644
16626
  _this._automaticHeight = 0;
@@ -16787,7 +16769,7 @@
16787
16769
  break;
16788
16770
  }
16789
16771
  };
16790
- _create_class$3(SpriteRenderer, [
16772
+ _create_class$2(SpriteRenderer, [
16791
16773
  {
16792
16774
  key: "drawMode",
16793
16775
  get: /**
@@ -16839,7 +16821,7 @@
16839
16821
  },
16840
16822
  set: function set(value) {
16841
16823
  if (value !== this._tiledAdaptiveThreshold) {
16842
- value = MathUtil$1.clamp(value, 0, 1);
16824
+ value = MathUtil.clamp(value, 0, 1);
16843
16825
  this._tiledAdaptiveThreshold = value;
16844
16826
  if (this.drawMode === exports.SpriteDrawMode.Tiled) {
16845
16827
  this._dirtyUpdateFlag |= 0x3;
@@ -17163,7 +17145,7 @@
17163
17145
  break;
17164
17146
  }
17165
17147
  };
17166
- _create_class$3(SpriteMask, [
17148
+ _create_class$2(SpriteMask, [
17167
17149
  {
17168
17150
  key: "width",
17169
17151
  get: /**
@@ -17290,6 +17272,9 @@
17290
17272
  __decorate$1([
17291
17273
  assignmentClone
17292
17274
  ], SpriteMask.prototype, "influenceLayers", void 0);
17275
+ __decorate$1([
17276
+ ignoreClone
17277
+ ], SpriteMask.prototype, "_verticesData", void 0);
17293
17278
  __decorate$1([
17294
17279
  ignoreClone
17295
17280
  ], SpriteMask.prototype, "_sprite", void 0);
@@ -17571,8 +17556,8 @@
17571
17556
  } else {
17572
17557
  word += char;
17573
17558
  wordWidth += charInfo.xAdvance;
17574
- wordMaxAscent = lineMaxAscent = Math.max(wordMaxAscent, ascent);
17575
- wordMaxDescent = lineMaxDescent = Math.max(wordMaxDescent, descent);
17559
+ wordMaxAscent = Math.max(wordMaxAscent, ascent);
17560
+ wordMaxDescent = Math.max(wordMaxDescent, descent);
17576
17561
  }
17577
17562
  }
17578
17563
  }
@@ -17803,13 +17788,15 @@
17803
17788
  ];
17804
17789
  })();
17805
17790
  (function() {
17806
- /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
17791
+ // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
17792
+ // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
17793
+ /** @internal */ TextUtils._heightMultiplier = 2;
17807
17794
  })();
17808
17795
  (function() {
17809
- TextUtils._measureBaseline = "M";
17796
+ /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
17810
17797
  })();
17811
17798
  (function() {
17812
- TextUtils._heightMultiplier = 2;
17799
+ TextUtils._measureBaseline = "M";
17813
17800
  })();
17814
17801
  (function() {
17815
17802
  TextUtils._baselineMultiplier = 1.4;
@@ -17891,7 +17878,8 @@
17891
17878
  _proto._createFontAtlas = function _createFontAtlas() {
17892
17879
  var _this = this, engine = _this._engine;
17893
17880
  var fontAtlas = new FontAtlas(engine);
17894
- var texture = new Texture2D(engine, 256, 256);
17881
+ var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
17882
+ texture.filterMode = exports.TextureFilterMode.Bilinear;
17895
17883
  fontAtlas.texture = texture;
17896
17884
  fontAtlas.isGCIgnored = texture.isGCIgnored = true;
17897
17885
  this._fontAtlases.push(fontAtlas);
@@ -17978,7 +17966,7 @@
17978
17966
  }
17979
17967
  return null;
17980
17968
  };
17981
- _create_class$3(Font, [
17969
+ _create_class$2(Font, [
17982
17970
  {
17983
17971
  key: "name",
17984
17972
  get: /**
@@ -18044,7 +18032,7 @@
18044
18032
  /** @internal */ _this._subFont = null;
18045
18033
  /** @internal */ _this._charRenderDatas = [];
18046
18034
  _this._dirtyFlag = 15;
18047
- _this._color = new Color$1(1, 1, 1, 1);
18035
+ _this._color = new Color(1, 1, 1, 1);
18048
18036
  _this._text = "";
18049
18037
  _this._width = 0;
18050
18038
  _this._height = 0;
@@ -18125,7 +18113,7 @@
18125
18113
  /**
18126
18114
  * @internal
18127
18115
  */ _proto._render = function _render(context) {
18128
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
18116
+ if (this._isTextNoVisible()) {
18129
18117
  return;
18130
18118
  }
18131
18119
  if (this._isContainDirtyFlag(0x10)) {
@@ -18217,8 +18205,8 @@
18217
18205
  }
18218
18206
  };
18219
18207
  _proto._updateLocalData = function _updateLocalData() {
18220
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18221
18208
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
18209
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18222
18210
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
18223
18211
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
18224
18212
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -18286,7 +18274,7 @@
18286
18274
  var left = startX * pixelsPerUnitReciprocal;
18287
18275
  var right = (startX + w) * pixelsPerUnitReciprocal;
18288
18276
  var top = (startY + ascent) * pixelsPerUnitReciprocal;
18289
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
18277
+ var bottom = (startY - descent) * pixelsPerUnitReciprocal;
18290
18278
  localPositions.set(left, top, right, bottom);
18291
18279
  i === firstLine && (maxY = Math.max(maxY, top));
18292
18280
  minY = Math.min(minY, bottom);
@@ -18327,7 +18315,10 @@
18327
18315
  Renderer1.prototype._onTransformChanged.call(this, bit);
18328
18316
  this._setDirtyFlagTrue(0x4 | 0x8);
18329
18317
  };
18330
- _create_class$3(TextRenderer, [
18318
+ _proto._isTextNoVisible = function _isTextNoVisible() {
18319
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
18320
+ };
18321
+ _create_class$2(TextRenderer, [
18331
18322
  {
18332
18323
  key: "color",
18333
18324
  get: /**
@@ -18529,6 +18520,16 @@
18529
18520
  get: /**
18530
18521
  * The bounding volume of the TextRenderer.
18531
18522
  */ function get() {
18523
+ if (this._isTextNoVisible()) {
18524
+ if (this._isContainDirtyFlag(0x8)) {
18525
+ var localBounds = this._localBounds;
18526
+ localBounds.min.set(0, 0, 0);
18527
+ localBounds.max.set(0, 0, 0);
18528
+ this._updateBounds(this._bounds);
18529
+ this._setDirtyFlagFalse(0x8);
18530
+ }
18531
+ return this._bounds;
18532
+ }
18532
18533
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
18533
18534
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
18534
18535
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -19167,7 +19168,7 @@
19167
19168
  this._traverseSetOwnerScene(children[i], scene);
19168
19169
  }
19169
19170
  };
19170
- _create_class$3(Entity, [
19171
+ _create_class$2(Entity, [
19171
19172
  {
19172
19173
  key: "isActive",
19173
19174
  get: /**
@@ -19604,7 +19605,7 @@
19604
19605
  }
19605
19606
  return loopArray;
19606
19607
  };
19607
- _create_class$3(SafeLoopArray, [
19608
+ _create_class$2(SafeLoopArray, [
19608
19609
  {
19609
19610
  key: "length",
19610
19611
  get: /**
@@ -19707,7 +19708,7 @@
19707
19708
  allCreatedScenes[0].destroy();
19708
19709
  }
19709
19710
  };
19710
- _create_class$3(SceneManager, [
19711
+ _create_class$2(SceneManager, [
19711
19712
  {
19712
19713
  key: "scenes",
19713
19714
  get: /**
@@ -19894,7 +19895,7 @@
19894
19895
  }
19895
19896
  });
19896
19897
  };
19897
- _create_class$3(AssetPromise, [
19898
+ _create_class$2(AssetPromise, [
19898
19899
  {
19899
19900
  key: Symbol.toStringTag,
19900
19901
  get: /** compatible with Promise */ function get() {
@@ -20495,7 +20496,67 @@
20495
20496
  }
20496
20497
  }
20497
20498
  };
20498
- _create_class$3(SystemInfo, null, [
20499
+ /**
20500
+ * @internal
20501
+ */ SystemInfo._detectSIMDSupported = function _detectSIMDSupported() {
20502
+ if (this._simdSupported === null) {
20503
+ this._simdSupported = WebAssembly.validate(new Uint8Array([
20504
+ 0,
20505
+ 97,
20506
+ 115,
20507
+ 109,
20508
+ 1,
20509
+ 0,
20510
+ 0,
20511
+ 0,
20512
+ 1,
20513
+ 4,
20514
+ 1,
20515
+ 96,
20516
+ 0,
20517
+ 0,
20518
+ 3,
20519
+ 3,
20520
+ 2,
20521
+ 0,
20522
+ 0,
20523
+ 5,
20524
+ 3,
20525
+ 1,
20526
+ 0,
20527
+ 1,
20528
+ 12,
20529
+ 1,
20530
+ 0,
20531
+ 10,
20532
+ 22,
20533
+ 2,
20534
+ 12,
20535
+ 0,
20536
+ 65,
20537
+ 0,
20538
+ 65,
20539
+ 0,
20540
+ 65,
20541
+ 0,
20542
+ 252,
20543
+ 10,
20544
+ 0,
20545
+ 0,
20546
+ 11,
20547
+ 7,
20548
+ 0,
20549
+ 65,
20550
+ 0,
20551
+ 253,
20552
+ 15,
20553
+ 26,
20554
+ 11
20555
+ ]));
20556
+ }
20557
+ return this._simdSupported;
20558
+ };
20559
+ _create_class$2(SystemInfo, null, [
20499
20560
  {
20500
20561
  key: "devicePixelRatio",
20501
20562
  get: /**
@@ -20513,6 +20574,9 @@
20513
20574
  (function() {
20514
20575
  /** The operating system is running on. */ SystemInfo.operatingSystem = "";
20515
20576
  })();
20577
+ (function() {
20578
+ /** Whether the system support SIMD. */ SystemInfo._simdSupported = null;
20579
+ })();
20516
20580
  SystemInfo._initialize();
20517
20581
  /**
20518
20582
  * The keys of the keyboard.
@@ -20981,7 +21045,7 @@
20981
21045
  this._nativeCollider.addShape(shape._nativeShape);
20982
21046
  this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
20983
21047
  };
20984
- _create_class$3(Collider, [
21048
+ _create_class$2(Collider, [
20985
21049
  {
20986
21050
  key: "shapes",
20987
21051
  get: /**
@@ -21273,7 +21337,7 @@
21273
21337
  _proto._setGravity = function _setGravity() {
21274
21338
  this._nativePhysicsScene.setGravity(this._gravity);
21275
21339
  };
21276
- _create_class$3(PhysicsScene, [
21340
+ _create_class$2(PhysicsScene, [
21277
21341
  {
21278
21342
  key: "gravity",
21279
21343
  get: /**
@@ -21296,7 +21360,7 @@
21296
21360
  return this._fixedTimeStep;
21297
21361
  },
21298
21362
  set: function set(value) {
21299
- this._fixedTimeStep = Math.max(value, MathUtil$1.zeroTolerance);
21363
+ this._fixedTimeStep = Math.max(value, MathUtil.zeroTolerance);
21300
21364
  }
21301
21365
  }
21302
21366
  ]);
@@ -21400,7 +21464,7 @@
21400
21464
  _proto._setUpDirection = function _setUpDirection() {
21401
21465
  this._nativeCollider.setUpDirection(this._upDirection);
21402
21466
  };
21403
- _create_class$3(CharacterController, [
21467
+ _create_class$2(CharacterController, [
21404
21468
  {
21405
21469
  key: "stepOffset",
21406
21470
  get: /**
@@ -21561,7 +21625,7 @@
21561
21625
  _proto._setInertiaTensor = function _setInertiaTensor() {
21562
21626
  this._nativeCollider.setInertiaTensor(this._inertiaTensor);
21563
21627
  };
21564
- _create_class$3(DynamicCollider, [
21628
+ _create_class$2(DynamicCollider, [
21565
21629
  {
21566
21630
  key: "linearDamping",
21567
21631
  get: /**
@@ -21851,7 +21915,7 @@
21851
21915
  !this._destroyed && this._nativeMaterial.destroy();
21852
21916
  this._destroyed = true;
21853
21917
  };
21854
- _create_class$3(PhysicsMaterial, [
21918
+ _create_class$2(PhysicsMaterial, [
21855
21919
  {
21856
21920
  key: "bounciness",
21857
21921
  get: /**
@@ -21980,7 +22044,7 @@
21980
22044
  target.breakForce = this.breakForce;
21981
22045
  target.breakTorque = this.breakTorque;
21982
22046
  };
21983
- _create_class$3(Joint, [
22047
+ _create_class$2(Joint, [
21984
22048
  {
21985
22049
  key: "connectedCollider",
21986
22050
  get: /**
@@ -22182,7 +22246,7 @@
22182
22246
  target.motor = this.motor;
22183
22247
  target.limits = this.limits;
22184
22248
  };
22185
- _create_class$3(HingeJoint, [
22249
+ _create_class$2(HingeJoint, [
22186
22250
  {
22187
22251
  key: "axis",
22188
22252
  get: /**
@@ -22357,7 +22421,7 @@
22357
22421
  target.stiffness = this.stiffness;
22358
22422
  target.damping = this.damping;
22359
22423
  };
22360
- _create_class$3(SpringJoint, [
22424
+ _create_class$2(SpringJoint, [
22361
22425
  {
22362
22426
  key: "swingOffset",
22363
22427
  get: /**
@@ -22507,7 +22571,7 @@
22507
22571
  _proto._setRotation = function _setRotation() {
22508
22572
  this._nativeShape.setRotation(this._rotation);
22509
22573
  };
22510
- _create_class$3(ColliderShape, [
22574
+ _create_class$2(ColliderShape, [
22511
22575
  {
22512
22576
  key: "collider",
22513
22577
  get: /**
@@ -22646,7 +22710,7 @@
22646
22710
  _proto._setSize = function _setSize() {
22647
22711
  this._nativeShape.setSize(this._size);
22648
22712
  };
22649
- _create_class$3(BoxColliderShape, [
22713
+ _create_class$2(BoxColliderShape, [
22650
22714
  {
22651
22715
  key: "size",
22652
22716
  get: /**
@@ -22682,7 +22746,7 @@
22682
22746
  ColliderShape1.prototype._cloneTo.call(this, target);
22683
22747
  target.radius = this.radius;
22684
22748
  };
22685
- _create_class$3(SphereColliderShape, [
22749
+ _create_class$2(SphereColliderShape, [
22686
22750
  {
22687
22751
  key: "radius",
22688
22752
  get: /**
@@ -22737,7 +22801,7 @@
22737
22801
  target.height = this.height;
22738
22802
  target.upAxis = this.upAxis;
22739
22803
  };
22740
- _create_class$3(CapsuleColliderShape, [
22804
+ _create_class$2(CapsuleColliderShape, [
22741
22805
  {
22742
22806
  key: "radius",
22743
22807
  get: /**
@@ -23273,7 +23337,7 @@
23273
23337
  this._pointerManager._onFocus();
23274
23338
  this._keyboardManager._onFocus();
23275
23339
  };
23276
- _create_class$3(InputManager, [
23340
+ _create_class$2(InputManager, [
23277
23341
  {
23278
23342
  key: "pointers",
23279
23343
  get: /**
@@ -23313,6 +23377,8 @@
23313
23377
  _this = ReferResource1.call(this, engine) || this;
23314
23378
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
23315
23379
  ;
23380
+ /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
23381
+ ;
23316
23382
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
23317
23383
  _this.shader = shader;
23318
23384
  return _this;
@@ -23349,7 +23415,7 @@
23349
23415
  this._renderStates.length = 0;
23350
23416
  this._renderStates = null;
23351
23417
  };
23352
- _create_class$3(Material, [
23418
+ _create_class$2(Material, [
23353
23419
  {
23354
23420
  key: "shaderData",
23355
23421
  get: /**
@@ -24152,7 +24218,7 @@
24152
24218
  this._spriteMaskRenderDataPool.garbageCollection();
24153
24219
  this._textRenderDataPool.garbageCollection();
24154
24220
  };
24155
- _create_class$3(Engine, [
24221
+ _create_class$2(Engine, [
24156
24222
  {
24157
24223
  key: "settings",
24158
24224
  get: /**
@@ -24265,7 +24331,7 @@
24265
24331
  var Canvas = function Canvas() {
24266
24332
  /* @internal */ this._sizeUpdateFlagManager = new UpdateFlagManager();
24267
24333
  };
24268
- _create_class$3(Canvas, [
24334
+ _create_class$2(Canvas, [
24269
24335
  {
24270
24336
  key: "width",
24271
24337
  get: /**
@@ -24356,7 +24422,7 @@
24356
24422
  var e = viewProjMatrix.elements;
24357
24423
  e[12] = e[13] = e[14] = 0;
24358
24424
  // epsilon-infinity projection matrix http://terathon.com/gdc07_lengyel.pdf
24359
- var f = 1.0 / Math.tan(MathUtil$1.degreeToRadian(fieldOfView) / 2);
24425
+ var f = 1.0 / Math.tan(MathUtil.degreeToRadian(fieldOfView) / 2);
24360
24426
  projectionMatrix.elements[0] = f / aspectRatio;
24361
24427
  projectionMatrix.elements[5] = f;
24362
24428
  // view-proj matrix
@@ -24377,7 +24443,7 @@
24377
24443
  rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
24378
24444
  cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
24379
24445
  };
24380
- _create_class$3(Sky, [
24446
+ _create_class$2(Sky, [
24381
24447
  {
24382
24448
  key: "material",
24383
24449
  get: /**
@@ -24436,7 +24502,7 @@
24436
24502
  * Background solid color.
24437
24503
  * @defaultValue `new Color(0.25, 0.25, 0.25, 1.0)`
24438
24504
  * @remarks When `mode` is `BackgroundMode.SolidColor`, the property will take effects.
24439
- */ solidColor = new Color$1(0.25, 0.25, 0.25, 1.0);
24505
+ */ solidColor = new Color(0.25, 0.25, 0.25, 1.0);
24440
24506
  this.sky = new Sky();
24441
24507
  this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
24442
24508
  this._texture = null;
@@ -24522,7 +24588,7 @@
24522
24588
  mesh.addSubMesh(0, indices.length);
24523
24589
  return mesh;
24524
24590
  };
24525
- _create_class$3(Background, [
24591
+ _create_class$2(Background, [
24526
24592
  {
24527
24593
  key: "texture",
24528
24594
  get: /**
@@ -24792,7 +24858,7 @@
24792
24858
  var AmbientLight = function AmbientLight(engine) {
24793
24859
  var _this;
24794
24860
  _this = ReferResource1.call(this, engine) || this;
24795
- _this._diffuseSolidColor = new Color$1(0.212, 0.227, 0.259);
24861
+ _this._diffuseSolidColor = new Color(0.212, 0.227, 0.259);
24796
24862
  _this._diffuseIntensity = 1.0;
24797
24863
  _this._specularIntensity = 1.0;
24798
24864
  _this._diffuseMode = exports.DiffuseMode.SolidColor;
@@ -24904,7 +24970,7 @@
24904
24970
  out[25] = src[25] * 0.429042;
24905
24971
  out[26] = src[26] * 0.429042;
24906
24972
  };
24907
- _create_class$3(AmbientLight, [
24973
+ _create_class$2(AmbientLight, [
24908
24974
  {
24909
24975
  key: "specularTextureDecodeRGBM",
24910
24976
  get: /**
@@ -25085,8 +25151,8 @@
25085
25151
  /** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
25086
25152
  /** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
25087
25153
  /** @internal */ _this._lightIndex = -1;
25088
- /** @internal */ _this._lightColor = new Color$1();
25089
- _this._color = new Color$1(1, 1, 1, 1);
25154
+ /** @internal */ _this._lightColor = new Color();
25155
+ _this._color = new Color(1, 1, 1, 1);
25090
25156
  return _this;
25091
25157
  };
25092
25158
  _inherits$2(Light, Component1);
@@ -25101,7 +25167,7 @@
25101
25167
  this._lightColor.a = this.color.a * this.intensity;
25102
25168
  return this._lightColor;
25103
25169
  };
25104
- _create_class$3(Light, [
25170
+ _create_class$2(Light, [
25105
25171
  {
25106
25172
  key: "color",
25107
25173
  get: /**
@@ -25164,9 +25230,9 @@
25164
25230
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
25165
25231
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
25166
25232
  if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
25167
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
25168
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
25169
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
25233
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
25234
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
25235
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
25170
25236
  } else {
25171
25237
  data.color[colorStart] = lightColor.r;
25172
25238
  data.color[colorStart + 1] = lightColor.g;
@@ -25193,7 +25259,7 @@
25193
25259
  shaderData.setFloatArray(DirectLight._colorProperty, data.color);
25194
25260
  shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
25195
25261
  };
25196
- _create_class$3(DirectLight, [
25262
+ _create_class$2(DirectLight, [
25197
25263
  {
25198
25264
  key: "direction",
25199
25265
  get: /**
@@ -25255,9 +25321,9 @@
25255
25321
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
25256
25322
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
25257
25323
  if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
25258
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
25259
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
25260
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
25324
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
25325
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
25326
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
25261
25327
  } else {
25262
25328
  data.color[colorStart] = lightColor.r;
25263
25329
  data.color[colorStart + 1] = lightColor.g;
@@ -25286,7 +25352,7 @@
25286
25352
  shaderData.setFloatArray(PointLight._positionProperty, data.position);
25287
25353
  shaderData.setFloatArray(PointLight._distanceProperty, data.distance);
25288
25354
  };
25289
- _create_class$3(PointLight, [
25355
+ _create_class$2(PointLight, [
25290
25356
  {
25291
25357
  key: "position",
25292
25358
  get: /**
@@ -25350,9 +25416,9 @@
25350
25416
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
25351
25417
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
25352
25418
  if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
25353
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
25354
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
25355
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
25419
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
25420
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
25421
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
25356
25422
  } else {
25357
25423
  data.color[colorStart] = lightColor.r;
25358
25424
  data.color[colorStart + 1] = lightColor.g;
@@ -25389,7 +25455,7 @@
25389
25455
  shaderData.setFloatArray(SpotLight._angleCosProperty, data.angleCos);
25390
25456
  shaderData.setFloatArray(SpotLight._penumbraCosProperty, data.penumbraCos);
25391
25457
  };
25392
- _create_class$3(SpotLight, [
25458
+ _create_class$2(SpotLight, [
25393
25459
  {
25394
25460
  key: "position",
25395
25461
  get: /**
@@ -25639,7 +25705,7 @@
25639
25705
  _this._shaderData = new ShaderData(ShaderDataGroup.Scene);
25640
25706
  _this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
25641
25707
  _this._fogMode = exports.FogMode.None;
25642
- _this._fogColor = new Color$1(0.5, 0.5, 0.5, 1.0);
25708
+ _this._fogColor = new Color(0.5, 0.5, 0.5, 1.0);
25643
25709
  _this._fogStart = 0;
25644
25710
  _this._fogEnd = 300;
25645
25711
  _this._fogDensity = 0.01;
@@ -25870,7 +25936,7 @@
25870
25936
  }
25871
25937
  return sunlight;
25872
25938
  };
25873
- _create_class$3(Scene, [
25939
+ _create_class$2(Scene, [
25874
25940
  {
25875
25941
  key: "isActive",
25876
25942
  get: /**
@@ -26550,12 +26616,38 @@
26550
26616
  /**
26551
26617
  * @internal
26552
26618
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
26553
- return a.data.component.priority - b.data.component.priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
26619
+ var dataA = a.data;
26620
+ var dataB = b.data;
26621
+ var componentA = dataA.component;
26622
+ var componentB = dataB.component;
26623
+ var priorityOrder = componentA.priority - componentB.priority;
26624
+ if (priorityOrder !== 0) {
26625
+ return priorityOrder;
26626
+ }
26627
+ // make suer from the same renderer.
26628
+ if (componentA.instanceId === componentB.instanceId) {
26629
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
26630
+ } else {
26631
+ return componentA._distanceForSort - componentB._distanceForSort;
26632
+ }
26554
26633
  };
26555
26634
  /**
26556
26635
  * @internal
26557
26636
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
26558
- return a.data.component.priority - b.data.component.priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
26637
+ var dataA = a.data;
26638
+ var dataB = b.data;
26639
+ var componentA = dataA.component;
26640
+ var componentB = dataB.component;
26641
+ var priorityOrder = componentA.priority - componentB.priority;
26642
+ if (priorityOrder !== 0) {
26643
+ return priorityOrder;
26644
+ }
26645
+ // make suer from the same renderer.
26646
+ if (componentA.instanceId === componentB.instanceId) {
26647
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
26648
+ } else {
26649
+ return componentB._distanceForSort - componentA._distanceForSort;
26650
+ }
26559
26651
  };
26560
26652
  return RenderQueue;
26561
26653
  }();
@@ -26706,7 +26798,7 @@
26706
26798
  // https://lxjk.github.io/2017/04/15/Calculate-Minimal-Bounding-Sphere-of-Frustum.html
26707
26799
  var centerZ;
26708
26800
  var radius;
26709
- var k = Math.sqrt(1.0 + aspectRatio * aspectRatio) * Math.tan(MathUtil$1.degreeToRadian(fieldOfView) / 2.0);
26801
+ var k = Math.sqrt(1.0 + aspectRatio * aspectRatio) * Math.tan(MathUtil.degreeToRadian(fieldOfView) / 2.0);
26710
26802
  var k2 = k * k;
26711
26803
  var farSNear = far - near;
26712
26804
  var farANear = far + near;
@@ -27286,7 +27378,7 @@
27286
27378
  var _this__camera = this._camera, nearClipPlane = _this__camera.nearClipPlane, aspectRatio = _this__camera.aspectRatio, fieldOfView = _this__camera.fieldOfView;
27287
27379
  cascadesSplitDistance[0] = nearClipPlane;
27288
27380
  var range = shadowFar - nearClipPlane;
27289
- var tFov = Math.tan(MathUtil$1.degreeToRadian(fieldOfView) * 0.5);
27381
+ var tFov = Math.tan(MathUtil.degreeToRadian(fieldOfView) * 0.5);
27290
27382
  var denominator = 1.0 + tFov * tFov * (aspectRatio * aspectRatio + 1.0);
27291
27383
  switch(shadowCascades){
27292
27384
  case exports.ShadowCascadesMode.NoCascades:
@@ -27389,7 +27481,7 @@
27389
27481
  CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
27390
27482
  })();
27391
27483
  (function() {
27392
- CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
27484
+ CascadedShadowCasterPass._clearColor = new Color(1, 1, 1, 1);
27393
27485
  })();
27394
27486
  (function() {
27395
27487
  CascadedShadowCasterPass._tempVector = new Vector3();
@@ -27690,7 +27782,7 @@
27690
27782
  renderer._prepareRender(context);
27691
27783
  }
27692
27784
  };
27693
- _create_class$3(BasicRenderPipeline, [
27785
+ _create_class$2(BasicRenderPipeline, [
27694
27786
  {
27695
27787
  key: "defaultRenderPass",
27696
27788
  get: /**
@@ -27843,7 +27935,7 @@
27843
27935
  // Use the intersection of the near clipping plane as the origin point.
27844
27936
  var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
27845
27937
  // Use the intersection of the far clipping plane as the origin point.
27846
- var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil$1.zeroTolerance, invViewProjMat, out.direction);
27938
+ var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil.zeroTolerance, invViewProjMat, out.direction);
27847
27939
  Vector3.subtract(direction, origin, direction);
27848
27940
  direction.normalize();
27849
27941
  return out;
@@ -28055,7 +28147,7 @@
28055
28147
  var _this__customAspectRatio;
28056
28148
  (_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projMatChange();
28057
28149
  };
28058
- _create_class$3(Camera1, [
28150
+ _create_class$2(Camera1, [
28059
28151
  {
28060
28152
  key: "shaderData",
28061
28153
  get: /**
@@ -28206,7 +28298,7 @@
28206
28298
  this._isProjectionDirty = false;
28207
28299
  var aspectRatio = this.aspectRatio;
28208
28300
  if (!virtualCamera.isOrthographic) {
28209
- Matrix.perspective(MathUtil$1.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
28301
+ Matrix.perspective(MathUtil.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
28210
28302
  } else {
28211
28303
  var width = this._orthographicSize * aspectRatio;
28212
28304
  var height = this._orthographicSize;
@@ -28592,7 +28684,7 @@
28592
28684
  target._isTransparent = this._isTransparent;
28593
28685
  target._blendMode = this._blendMode;
28594
28686
  };
28595
- _create_class$3(BaseMaterial, [
28687
+ _create_class$2(BaseMaterial, [
28596
28688
  {
28597
28689
  key: "shader",
28598
28690
  get: /**
@@ -28751,9 +28843,9 @@
28751
28843
  var shaderData = _this.shaderData;
28752
28844
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
28753
28845
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
28754
- shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
28755
- shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
28756
- shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
28846
+ shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color(1, 1, 1, 1));
28847
+ shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color(1, 1, 1, 1));
28848
+ shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color(0, 0, 0, 1));
28757
28849
  shaderData.setVector4(BlinnPhongMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
28758
28850
  shaderData.setFloat(BlinnPhongMaterial._shininessProp, 16);
28759
28851
  shaderData.setFloat(BlinnPhongMaterial._normalIntensityProp, 1);
@@ -28765,7 +28857,7 @@
28765
28857
  this.cloneTo(dest);
28766
28858
  return dest;
28767
28859
  };
28768
- _create_class$3(BlinnPhongMaterial, [
28860
+ _create_class$2(BlinnPhongMaterial, [
28769
28861
  {
28770
28862
  key: "baseColor",
28771
28863
  get: /**
@@ -28943,8 +29035,8 @@
28943
29035
  var shaderData = _this.shaderData;
28944
29036
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
28945
29037
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
28946
- shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
28947
- shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
29038
+ shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color(1, 1, 1, 1));
29039
+ shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color(0, 0, 0, 1));
28948
29040
  shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
28949
29041
  shaderData.setFloat(PBRBaseMaterial._normalIntensityProp, 1);
28950
29042
  shaderData.setFloat(PBRBaseMaterial._occlusionTextureIntensityProp, 1);
@@ -28953,7 +29045,7 @@
28953
29045
  shaderData.setFloat(PBRBaseMaterial._clearCoatRoughnessProp, 0);
28954
29046
  return _this;
28955
29047
  }
28956
- _create_class$3(PBRBaseMaterial, [
29048
+ _create_class$2(PBRBaseMaterial, [
28957
29049
  {
28958
29050
  key: "baseColor",
28959
29051
  get: /**
@@ -29224,7 +29316,7 @@
29224
29316
  this.cloneTo(dest);
29225
29317
  return dest;
29226
29318
  };
29227
- _create_class$3(PBRMaterial, [
29319
+ _create_class$2(PBRMaterial, [
29228
29320
  {
29229
29321
  key: "ior",
29230
29322
  get: /**
@@ -29310,7 +29402,7 @@
29310
29402
  if (this._anisotropyRotation !== value) {
29311
29403
  this._anisotropyRotation = value;
29312
29404
  var anisotropyInfo = this.shaderData.getVector3(PBRMaterial._anisotropyInfoProp);
29313
- var rad = MathUtil$1.degreeToRadFactor * value;
29405
+ var rad = MathUtil.degreeToRadFactor * value;
29314
29406
  anisotropyInfo.x = Math.cos(rad);
29315
29407
  anisotropyInfo.y = Math.sin(rad);
29316
29408
  }
@@ -29363,7 +29455,7 @@
29363
29455
  function PBRSpecularMaterial(engine) {
29364
29456
  var _this;
29365
29457
  _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr-specular")) || this;
29366
- _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
29458
+ _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color(1, 1, 1, 1));
29367
29459
  _this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
29368
29460
  return _this;
29369
29461
  }
@@ -29375,7 +29467,7 @@
29375
29467
  this.cloneTo(dest);
29376
29468
  return dest;
29377
29469
  };
29378
- _create_class$3(PBRSpecularMaterial, [
29470
+ _create_class$2(PBRSpecularMaterial, [
29379
29471
  {
29380
29472
  key: "specularColor",
29381
29473
  get: /**
@@ -29443,7 +29535,7 @@
29443
29535
  var shaderData = _this.shaderData;
29444
29536
  shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
29445
29537
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
29446
- shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
29538
+ shaderData.setColor(UnlitMaterial._baseColorProp, new Color(1, 1, 1, 1));
29447
29539
  shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
29448
29540
  return _this;
29449
29541
  }
@@ -29455,7 +29547,7 @@
29455
29547
  this.cloneTo(dest);
29456
29548
  return dest;
29457
29549
  };
29458
- _create_class$3(UnlitMaterial, [
29550
+ _create_class$2(UnlitMaterial, [
29459
29551
  {
29460
29552
  key: "baseColor",
29461
29553
  get: /**
@@ -29891,6 +29983,7 @@
29891
29983
  _this = EngineObject1.call(this, null) || this;
29892
29984
  _this.name = name1;
29893
29985
  _this./** @internal */ _curveBindings = [];
29986
+ _this./** @internal */ _updateFlagManager = new UpdateFlagManager();
29894
29987
  _this._length = 0;
29895
29988
  _this._events = [];
29896
29989
  return _this;
@@ -29919,11 +30012,13 @@
29919
30012
  while(--index >= 0 && eventTime < events[index].time);
29920
30013
  events.splice(index + 1, 0, newEvent);
29921
30014
  }
30015
+ this._updateFlagManager.dispatch();
29922
30016
  };
29923
30017
  /**
29924
30018
  * Clears all events from the clip.
29925
30019
  */ _proto.clearEvents = function clearEvents() {
29926
30020
  this._events.length = 0;
30021
+ this._updateFlagManager.dispatch();
29927
30022
  };
29928
30023
  _proto.addCurveBinding = function addCurveBinding(entityPath, componentType, propertyOrSetPropertyPathOrComponentIndex, curveOrSetPropertyPathOrGetPropertyPath, curveOrGetPropertyPath, curve) {
29929
30024
  var curveBinding = new AnimationClipCurveBinding();
@@ -29979,7 +30074,7 @@
29979
30074
  }
29980
30075
  }
29981
30076
  };
29982
- _create_class$3(AnimationClip, [
30077
+ _create_class$2(AnimationClip, [
29983
30078
  {
29984
30079
  key: "events",
29985
30080
  get: /**
@@ -30126,7 +30221,7 @@
30126
30221
  var result = this._evaluate(time, evaluateData);
30127
30222
  return this._type._subtractValue(result, this.keys[0].value, evaluateData.value);
30128
30223
  };
30129
- _create_class$3(AnimationCurve, [
30224
+ _create_class$2(AnimationCurve, [
30130
30225
  {
30131
30226
  key: "interpolation",
30132
30227
  get: /**
@@ -30314,33 +30409,33 @@
30314
30409
  var AnimationColorCurve = function AnimationColorCurve() {
30315
30410
  var _this;
30316
30411
  _this = AnimationCurve1.call(this) || this;
30317
- _this._evaluateData.value = new Color$1();
30412
+ _this._evaluateData.value = new Color();
30318
30413
  return _this;
30319
30414
  };
30320
30415
  _inherits$2(AnimationColorCurve, AnimationCurve1);
30321
30416
  /**
30322
30417
  * @internal
30323
30418
  */ AnimationColorCurve._initializeOwner = function _initializeOwner(owner) {
30324
- owner.defaultValue = new Color$1();
30325
- owner.fixedPoseValue = new Color$1();
30326
- owner.baseEvaluateData.value = new Color$1();
30327
- owner.crossEvaluateData.value = new Color$1();
30419
+ owner.defaultValue = new Color();
30420
+ owner.fixedPoseValue = new Color();
30421
+ owner.baseEvaluateData.value = new Color();
30422
+ owner.crossEvaluateData.value = new Color();
30328
30423
  };
30329
30424
  /**
30330
30425
  * @internal
30331
30426
  */ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
30332
- owner.finalValue = new Color$1();
30427
+ owner.finalValue = new Color();
30333
30428
  };
30334
30429
  /**
30335
30430
  * @internal
30336
30431
  */ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
30337
- Color$1.lerp(srcValue, destValue, weight, out);
30432
+ Color.lerp(srcValue, destValue, weight, out);
30338
30433
  return out;
30339
30434
  };
30340
30435
  /**
30341
30436
  * @internal
30342
30437
  */ AnimationColorCurve._subtractValue = function _subtractValue(src, base, out) {
30343
- Color$1.subtract(src, base, out);
30438
+ Color.subtract(src, base, out);
30344
30439
  return out;
30345
30440
  };
30346
30441
  /**
@@ -30352,8 +30447,8 @@
30352
30447
  /**
30353
30448
  * @internal
30354
30449
  */ AnimationColorCurve._additiveValue = function _additiveValue(value, weight, out) {
30355
- Color$1.scale(value, weight, value);
30356
- Color$1.add(out, value, out);
30450
+ Color.scale(value, weight, value);
30451
+ Color.add(out, value, out);
30357
30452
  return out;
30358
30453
  };
30359
30454
  /**
@@ -31455,26 +31550,31 @@
31455
31550
  }
31456
31551
  };
31457
31552
  _proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
31553
+ var _this = this;
31458
31554
  var eventHandlerPool = this._animationEventHandlerPool;
31459
31555
  var scripts = [];
31460
- this._entity.getComponents(Script, scripts);
31461
- var scriptCount = scripts.length;
31462
31556
  var eventHandlers = animatorStateData.eventHandlers;
31463
- var events = state.clip.events;
31464
- eventHandlers.length = 0;
31465
- for(var i = 0, n = events.length; i < n; i++){
31466
- var event = events[i];
31467
- var eventHandler = eventHandlerPool.getFromPool();
31468
- var funcName = event.functionName;
31469
- var handlers = eventHandler.handlers;
31470
- eventHandler.event = event;
31471
- handlers.length = 0;
31472
- for(var j = scriptCount - 1; j >= 0; j--){
31473
- var handler = scripts[j][funcName];
31474
- handler && handlers.push(handler);
31557
+ var clipChangedListener = function clipChangedListener() {
31558
+ _this._entity.getComponents(Script, scripts);
31559
+ var scriptCount = scripts.length;
31560
+ var events = state.clip.events;
31561
+ eventHandlers.length = 0;
31562
+ for(var i = 0, n = events.length; i < n; i++){
31563
+ var event = events[i];
31564
+ var eventHandler = eventHandlerPool.getFromPool();
31565
+ var funcName = event.functionName;
31566
+ var handlers = eventHandler.handlers;
31567
+ eventHandler.event = event;
31568
+ handlers.length = 0;
31569
+ for(var j = scriptCount - 1; j >= 0; j--){
31570
+ var handler = scripts[j][funcName];
31571
+ handler && handlers.push(handler);
31572
+ }
31573
+ eventHandlers.push(eventHandler);
31475
31574
  }
31476
- eventHandlers.push(eventHandler);
31477
- }
31575
+ };
31576
+ clipChangedListener();
31577
+ state._updateFlagManager.addListener(clipChangedListener);
31478
31578
  };
31479
31579
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
31480
31580
  animatorLayerData.crossCurveMark++;
@@ -31926,7 +32026,7 @@
31926
32026
  }
31927
32027
  owner.updateMark = this._updateMark;
31928
32028
  };
31929
- _create_class$3(Animator, [
32029
+ _create_class$2(Animator, [
31930
32030
  {
31931
32031
  key: "animatorController",
31932
32032
  get: /**
@@ -32016,7 +32116,7 @@
32016
32116
  */ _proto._registerChangeFlag = function _registerChangeFlag() {
32017
32117
  return this._updateFlagManager.createFlag(BoolUpdateFlag);
32018
32118
  };
32019
- _create_class$3(AnimatorController, [
32119
+ _create_class$2(AnimatorController, [
32020
32120
  {
32021
32121
  key: "layers",
32022
32122
  get: /**
@@ -32081,9 +32181,11 @@
32081
32181
  this./** @internal */ _onStateEnterScripts = [];
32082
32182
  this./** @internal */ _onStateUpdateScripts = [];
32083
32183
  this./** @internal */ _onStateExitScripts = [];
32184
+ this./** @internal */ _updateFlagManager = new UpdateFlagManager();
32084
32185
  this._clipStartTime = 0;
32085
32186
  this._clipEndTime = 1;
32086
32187
  this._transitions = [];
32188
+ this._onClipChanged = this._onClipChanged.bind(this);
32087
32189
  };
32088
32190
  var _proto = AnimatorState.prototype;
32089
32191
  /**
@@ -32157,7 +32259,12 @@
32157
32259
  index2 !== -1 && this._onStateExitScripts.splice(index2, 1);
32158
32260
  }
32159
32261
  };
32160
- _create_class$3(AnimatorState, [
32262
+ /**
32263
+ * @internal
32264
+ */ _proto._onClipChanged = function _onClipChanged() {
32265
+ this._updateFlagManager.dispatch();
32266
+ };
32267
+ _create_class$2(AnimatorState, [
32161
32268
  {
32162
32269
  key: "transitions",
32163
32270
  get: /**
@@ -32174,8 +32281,17 @@
32174
32281
  return this._clip;
32175
32282
  },
32176
32283
  set: function set(clip) {
32284
+ var lastClip = this._clip;
32285
+ if (lastClip === clip) {
32286
+ return;
32287
+ }
32288
+ if (lastClip) {
32289
+ lastClip._updateFlagManager.removeListener(this._onClipChanged);
32290
+ }
32177
32291
  this._clip = clip;
32178
32292
  this._clipEndTime = Math.min(this._clipEndTime, 1);
32293
+ this._onClipChanged();
32294
+ clip._updateFlagManager.addListener(this._onClipChanged);
32179
32295
  }
32180
32296
  },
32181
32297
  {
@@ -32358,7 +32474,7 @@
32358
32474
  AnimatorLayerMask._addPathMaskWithChildren(mask, child, childPath);
32359
32475
  }
32360
32476
  };
32361
- _create_class$3(AnimatorLayerMask, [
32477
+ _create_class$2(AnimatorLayerMask, [
32362
32478
  {
32363
32479
  key: "pathMasks",
32364
32480
  get: /**
@@ -32378,7 +32494,7 @@
32378
32494
  var _this;
32379
32495
  _this = Material1.call(this, engine, Shader.find("skybox")) || this;
32380
32496
  _this._textureDecodeRGBM = false;
32381
- _this._tintColor = new Color$1(1, 1, 1, 1);
32497
+ _this._tintColor = new Color(1, 1, 1, 1);
32382
32498
  _this.renderState.rasterState.cullMode = exports.CullMode.Off;
32383
32499
  _this.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
32384
32500
  _this.shaderData.setFloat(SkyBoxMaterial._rotationProp, 0);
@@ -32392,7 +32508,7 @@
32392
32508
  this.cloneTo(dest);
32393
32509
  return dest;
32394
32510
  };
32395
- _create_class$3(SkyBoxMaterial, [
32511
+ _create_class$2(SkyBoxMaterial, [
32396
32512
  {
32397
32513
  key: "textureDecodeRGBM",
32398
32514
  get: /**
@@ -32489,8 +32605,8 @@
32489
32605
  _this.sunSize = 0.04;
32490
32606
  _this.sunSizeConvergence = 5;
32491
32607
  _this.atmosphereThickness = 1.0;
32492
- _this.skyTint = new Color$1(0.5, 0.5, 0.5, 1.0);
32493
- _this.groundTint = new Color$1(0.369, 0.349, 0.341, 1.0);
32608
+ _this.skyTint = new Color(0.5, 0.5, 0.5, 1.0);
32609
+ _this.groundTint = new Color(0.369, 0.349, 0.341, 1.0);
32494
32610
  _this.exposure = 1.3;
32495
32611
  _this.renderState.rasterState.cullMode = exports.CullMode.Off;
32496
32612
  _this.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
@@ -32505,7 +32621,7 @@
32505
32621
  this.cloneTo(dest);
32506
32622
  return dest;
32507
32623
  };
32508
- _create_class$3(SkyProceduralMaterial, [
32624
+ _create_class$2(SkyProceduralMaterial, [
32509
32625
  {
32510
32626
  key: "sunMode",
32511
32627
  get: /**
@@ -32725,7 +32841,7 @@
32725
32841
  }
32726
32842
  this.generator._destroy();
32727
32843
  };
32728
- _create_class$3(ParticleRenderer, [
32844
+ _create_class$2(ParticleRenderer, [
32729
32845
  {
32730
32846
  key: "renderMode",
32731
32847
  get: /**
@@ -32961,9 +33077,9 @@
32961
33077
  typeArray[offset] = key.time;
32962
33078
  var color = key.color;
32963
33079
  if (colorSpace === exports.ColorSpace.Linear) {
32964
- typeArray[offset + 1] = Color$1.gammaToLinearSpace(color.r);
32965
- typeArray[offset + 2] = Color$1.gammaToLinearSpace(color.g);
32966
- typeArray[offset + 3] = Color$1.gammaToLinearSpace(color.b);
33080
+ typeArray[offset + 1] = Color.gammaToLinearSpace(color.r);
33081
+ typeArray[offset + 2] = Color.gammaToLinearSpace(color.g);
33082
+ typeArray[offset + 3] = Color.gammaToLinearSpace(color.b);
32967
33083
  } else {
32968
33084
  typeArray[offset + 1] = color.r;
32969
33085
  typeArray[offset + 2] = color.g;
@@ -33011,7 +33127,7 @@
33011
33127
  _proto._setAlphaTypeArrayDirty = function _setAlphaTypeArrayDirty() {
33012
33128
  this._alphaTypeArrayDirty = true;
33013
33129
  };
33014
- _create_class$3(ParticleGradient, [
33130
+ _create_class$2(ParticleGradient, [
33015
33131
  {
33016
33132
  key: "colorKeys",
33017
33133
  get: /**
@@ -33048,13 +33164,13 @@
33048
33164
  */ var GradientColorKey = /*#__PURE__*/ function() {
33049
33165
  var GradientColorKey = function GradientColorKey(time, color) {
33050
33166
  /** @internal */ this._onValueChanged = null;
33051
- this._color = new Color$1();
33167
+ this._color = new Color();
33052
33168
  this._time = time;
33053
33169
  color && this._color.copyFrom(color);
33054
33170
  // @ts-ignore
33055
33171
  this._color._onValueChanged = this._onValueChanged;
33056
33172
  };
33057
- _create_class$3(GradientColorKey, [
33173
+ _create_class$2(GradientColorKey, [
33058
33174
  {
33059
33175
  key: "time",
33060
33176
  get: /**
@@ -33091,7 +33207,7 @@
33091
33207
  this._time = time;
33092
33208
  this._alpha = alpha;
33093
33209
  };
33094
- _create_class$3(GradientAlphaKey, [
33210
+ _create_class$2(GradientAlphaKey, [
33095
33211
  {
33096
33212
  key: "time",
33097
33213
  get: /**
@@ -33124,11 +33240,11 @@
33124
33240
  */ var ParticleCompositeGradient = /*#__PURE__*/ function() {
33125
33241
  var ParticleCompositeGradient = function ParticleCompositeGradient(constantOrGradient, constantMaxOrGradientMax) {
33126
33242
  /** The gradient mode. */ this.mode = exports.ParticleGradientMode.Constant;
33127
- /* The min constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMin = new Color$1();
33128
- /* The max constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMax = new Color$1();
33243
+ /* The min constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMin = new Color();
33244
+ /* The max constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMax = new Color();
33129
33245
  /** The min gradient used by the gradient if mode is set to `Gradient`. */ this.gradientMin = new ParticleGradient();
33130
33246
  /** The max gradient used by the gradient if mode is set to `Gradient`. */ this.gradientMax = new ParticleGradient();
33131
- if (constantOrGradient.constructor === Color$1) {
33247
+ if (constantOrGradient.constructor === Color) {
33132
33248
  if (constantMaxOrGradientMax) {
33133
33249
  this.constantMin.copyFrom(constantOrGradient);
33134
33250
  this.constantMax.copyFrom(constantMaxOrGradientMax);
@@ -33160,11 +33276,11 @@
33160
33276
  out.copyFrom(this.constant);
33161
33277
  break;
33162
33278
  case exports.ParticleGradientMode.TwoConstants:
33163
- Color$1.lerp(this.constantMin, this.constantMax, lerpFactor, out);
33279
+ Color.lerp(this.constantMin, this.constantMax, lerpFactor, out);
33164
33280
  break;
33165
33281
  }
33166
33282
  };
33167
- _create_class$3(ParticleCompositeGradient, [
33283
+ _create_class$2(ParticleCompositeGradient, [
33168
33284
  {
33169
33285
  key: "constant",
33170
33286
  get: /**
@@ -33229,8 +33345,8 @@
33229
33345
  var _this;
33230
33346
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
33231
33347
  /** Color gradient over lifetime. */ _this.color = new ParticleCompositeGradient(new ParticleGradient([
33232
- new GradientColorKey(0.0, new Color$1(1, 1, 1)),
33233
- new GradientColorKey(1.0, new Color$1(1, 1, 1))
33348
+ new GradientColorKey(0.0, new Color(1, 1, 1)),
33349
+ new GradientColorKey(1.0, new Color(1, 1, 1))
33234
33350
  ], [
33235
33351
  new GradientAlphaKey(0, 1),
33236
33352
  new GradientAlphaKey(1, 1)
@@ -33352,7 +33468,7 @@
33352
33468
  return this.constantMin + (this.constantMax - this.constantMin) * lerpFactor;
33353
33469
  }
33354
33470
  };
33355
- _create_class$3(ParticleCompositeCurve, [
33471
+ _create_class$2(ParticleCompositeCurve, [
33356
33472
  {
33357
33473
  key: "constant",
33358
33474
  get: /**
@@ -33503,7 +33619,7 @@
33503
33619
  }
33504
33620
  this._currentBurstIndex = index;
33505
33621
  };
33506
- _create_class$3(EmissionModule, [
33622
+ _create_class$2(EmissionModule, [
33507
33623
  {
33508
33624
  key: "bursts",
33509
33625
  get: /**
@@ -33557,7 +33673,7 @@
33557
33673
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
33558
33674
  /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
33559
33675
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
33560
- /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
33676
+ /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color(1, 1, 1, 1));
33561
33677
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
33562
33678
  /** This selects the space in which to simulate particles. It can be either world or local space. */ this.simulationSpace = exports.ParticleSimulationSpace.Local;
33563
33679
  /** Override the default playback speed of the Particle Generator. */ this.simulationSpeed = 1.0;
@@ -33641,7 +33757,7 @@
33641
33757
  */ _proto._cloneTo = function _cloneTo(target) {
33642
33758
  target.maxParticles = this.maxParticles;
33643
33759
  };
33644
- _create_class$3(MainModule, [
33760
+ _create_class$2(MainModule, [
33645
33761
  {
33646
33762
  key: "maxParticles",
33647
33763
  get: /**
@@ -33801,11 +33917,11 @@
33801
33917
  isCurveMacro = RotationOverLifetimeModule._curveModeMacro;
33802
33918
  } else {
33803
33919
  var constantMax = this._rotationMaxConstant;
33804
- constantMax.set(MathUtil$1.degreeToRadian(rotationX.constantMax), MathUtil$1.degreeToRadian(rotationY.constantMax), MathUtil$1.degreeToRadian(rotationZ.constantMax));
33920
+ constantMax.set(MathUtil.degreeToRadian(rotationX.constantMax), MathUtil.degreeToRadian(rotationY.constantMax), MathUtil.degreeToRadian(rotationZ.constantMax));
33805
33921
  shaderData.setVector3(RotationOverLifetimeModule._maxConstantProperty, constantMax);
33806
33922
  if (separateAxes ? rotationX.mode === exports.ParticleCurveMode.TwoConstants && rotationY.mode === exports.ParticleCurveMode.TwoConstants && rotationZ.mode === exports.ParticleCurveMode.TwoConstants : rotationZ.mode === exports.ParticleCurveMode.TwoConstants) {
33807
33923
  var constantMin = this._rotationMinConstant;
33808
- constantMin.set(MathUtil$1.degreeToRadian(rotationX.constantMin), MathUtil$1.degreeToRadian(rotationY.constantMin), MathUtil$1.degreeToRadian(rotationZ.constantMin));
33924
+ constantMin.set(MathUtil.degreeToRadian(rotationX.constantMin), MathUtil.degreeToRadian(rotationY.constantMin), MathUtil.degreeToRadian(rotationZ.constantMin));
33809
33925
  shaderData.setVector3(RotationOverLifetimeModule._minConstantProperty, constantMin);
33810
33926
  isRandomTwoMacro = RotationOverLifetimeModule._isRandomTwoMacro;
33811
33927
  }
@@ -33958,7 +34074,7 @@
33958
34074
  keys.splice(index + 1, 0, key);
33959
34075
  }
33960
34076
  };
33961
- _create_class$3(ParticleCurve, [
34077
+ _create_class$2(ParticleCurve, [
33962
34078
  {
33963
34079
  key: "keys",
33964
34080
  get: /**
@@ -34033,7 +34149,7 @@
34033
34149
  this._isCurveMacro = this._enableMacro(shaderData, this._isCurveMacro, isCurveMacro);
34034
34150
  this._isRandomTwoMacro = this._enableMacro(shaderData, this._isRandomTwoMacro, isRandomTwoMacro);
34035
34151
  };
34036
- _create_class$3(SizeOverLifetimeModule, [
34152
+ _create_class$2(SizeOverLifetimeModule, [
34037
34153
  {
34038
34154
  key: "size",
34039
34155
  get: /**
@@ -34137,7 +34253,7 @@
34137
34253
  */ _proto._resetRandomSeed = function _resetRandomSeed(randomSeed) {
34138
34254
  this._frameOverTimeRand.reset(randomSeed, ParticleRandomSubSeeds.TextureSheetAnimation);
34139
34255
  };
34140
- _create_class$3(TextureSheetAnimationModule, [
34256
+ _create_class$2(TextureSheetAnimationModule, [
34141
34257
  {
34142
34258
  key: "tiling",
34143
34259
  get: /**
@@ -34684,11 +34800,11 @@
34684
34800
  // Start rotation
34685
34801
  var startRotationRand = main._startRotationRand;
34686
34802
  if (main.startRotation3D) {
34687
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
34688
- instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
34689
- instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
34803
+ instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
34804
+ instanceVertices[offset + 16] = MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
34805
+ instanceVertices[offset + 17] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
34690
34806
  } else {
34691
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
34807
+ instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
34692
34808
  }
34693
34809
  // Start speed
34694
34810
  instanceVertices[offset + 18] = startSpeed;
@@ -34813,7 +34929,7 @@
34813
34929
  out.push(vertexBufferBinding);
34814
34930
  return index;
34815
34931
  };
34816
- _create_class$3(ParticleGenerator, [
34932
+ _create_class$2(ParticleGenerator, [
34817
34933
  {
34818
34934
  key: "isAlive",
34819
34935
  get: /**
@@ -34851,7 +34967,7 @@
34851
34967
  /** @internal */ ParticleGenerator._tempVector31 = new Vector3();
34852
34968
  })();
34853
34969
  (function() {
34854
- /** @internal */ ParticleGenerator._tempColor0 = new Color$1();
34970
+ /** @internal */ ParticleGenerator._tempColor0 = new Color();
34855
34971
  })();
34856
34972
  (function() {
34857
34973
  /** @internal */ ParticleGenerator._tempParticleRenderers = new Array();
@@ -34929,7 +35045,7 @@
34929
35045
  var _this;
34930
35046
  _this = BaseMaterial1.call(this, engine, Shader.find("particle-shader")) || this;
34931
35047
  var shaderData = _this.shaderData;
34932
- shaderData.setColor(BaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
35048
+ shaderData.setColor(BaseMaterial._baseColorProp, new Color(1, 1, 1, 1));
34933
35049
  _this.isTransparent = true;
34934
35050
  return _this;
34935
35051
  };
@@ -34942,7 +35058,7 @@
34942
35058
  this.cloneTo(dest);
34943
35059
  return dest;
34944
35060
  };
34945
- _create_class$3(ParticleMaterial, [
35061
+ _create_class$2(ParticleMaterial, [
34946
35062
  {
34947
35063
  key: "baseColor",
34948
35064
  get: /**
@@ -35118,12 +35234,12 @@
35118
35234
  switch(this.arcMode){
35119
35235
  case exports.ParticleShapeArcMode.Loop:
35120
35236
  var normalizedEmitTime = emitTime * this.arcSpeed * (360 / this.arc) % 1;
35121
- var radian = MathUtil$1.degreeToRadian(this.arc * normalizedEmitTime);
35237
+ var radian = MathUtil.degreeToRadian(this.arc * normalizedEmitTime);
35122
35238
  positionPoint.set(Math.cos(radian), Math.sin(radian));
35123
35239
  positionPoint.scale(rand.random());
35124
35240
  break;
35125
35241
  case exports.ParticleShapeArcMode.Random:
35126
- ShapeUtils.randomPointInsideUnitArcCircle(MathUtil$1.degreeToRadian(this.arc), positionPoint, rand);
35242
+ ShapeUtils.randomPointInsideUnitArcCircle(MathUtil.degreeToRadian(this.arc), positionPoint, rand);
35127
35243
  break;
35128
35244
  }
35129
35245
  position.set(positionPoint.x, positionPoint.y, 0);
@@ -35155,7 +35271,7 @@
35155
35271
  * @internal
35156
35272
  */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
35157
35273
  var unitPosition = ConeShape._tempVector20;
35158
- var radian = MathUtil$1.degreeToRadian(this.angle);
35274
+ var radian = MathUtil.degreeToRadian(this.angle);
35159
35275
  var dirSinA = Math.sin(radian);
35160
35276
  var dirCosA = Math.cos(radian);
35161
35277
  switch(this.emitType){
@@ -35503,7 +35619,7 @@
35503
35619
  this._camera.renderTarget = this._oriCameraRenderTarget;
35504
35620
  this._camera.cullingMask = this._oriCameraCullingMask;
35505
35621
  };
35506
- _create_class$3(Probe, [
35622
+ _create_class$2(Probe, [
35507
35623
  {
35508
35624
  key: "_texture",
35509
35625
  get: function get() {
@@ -35900,7 +36016,7 @@
35900
36016
  GLCompressedTextureInternalFormat[GLCompressedTextureInternalFormat["RGB_BPTC_SIGNED_FLOAT_EXT"] = 0x8e8e] = "RGB_BPTC_SIGNED_FLOAT_EXT";
35901
36017
  GLCompressedTextureInternalFormat[GLCompressedTextureInternalFormat["RGB_BPTC_UNSIGNED_FLOAT_EXT"] = 0x8e8f] = "RGB_BPTC_UNSIGNED_FLOAT_EXT";
35902
36018
  })(exports.GLCompressedTextureInternalFormat || (exports.GLCompressedTextureInternalFormat = {}));
35903
- function _defineProperties$2(target, props) {
36019
+ function _defineProperties$1(target, props) {
35904
36020
  for(var i = 0; i < props.length; i++){
35905
36021
  var descriptor = props[i];
35906
36022
  descriptor.enumerable = descriptor.enumerable || false;
@@ -35909,9 +36025,9 @@
35909
36025
  Object.defineProperty(target, descriptor.key, descriptor);
35910
36026
  }
35911
36027
  }
35912
- function _create_class$2(Constructor, protoProps, staticProps) {
35913
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
35914
- if (staticProps) _defineProperties$2(Constructor, staticProps);
36028
+ function _create_class$1(Constructor, protoProps, staticProps) {
36029
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
36030
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
35915
36031
  return Constructor;
35916
36032
  }
35917
36033
  function _set_prototype_of$1(o, p) {
@@ -35978,7 +36094,7 @@
35978
36094
  this._webCanvas.width = width;
35979
36095
  this._webCanvas.height = height;
35980
36096
  };
35981
- _create_class$2(WebCanvas, [
36097
+ _create_class$1(WebCanvas, [
35982
36098
  {
35983
36099
  key: "scale",
35984
36100
  get: /**
@@ -36025,7 +36141,7 @@
36025
36141
  return engine;
36026
36142
  });
36027
36143
  };
36028
- _create_class$2(WebGLEngine, [
36144
+ _create_class$1(WebGLEngine, [
36029
36145
  {
36030
36146
  key: "canvas",
36031
36147
  get: /**
@@ -36256,7 +36372,7 @@
36256
36372
  TEXTURE_MAX_ANISOTROPY_EXT: "TEXTURE_MAX_ANISOTROPY_EXT"
36257
36373
  });
36258
36374
  };
36259
- _create_class$2(GLCapability, [
36375
+ _create_class$1(GLCapability, [
36260
36376
  {
36261
36377
  key: "maxTextureSize",
36262
36378
  get: function get() {
@@ -37005,7 +37121,7 @@
37005
37121
  }
37006
37122
  return true;
37007
37123
  };
37008
- _create_class$2(GLTexture, [
37124
+ _create_class$1(GLTexture, [
37009
37125
  {
37010
37126
  key: "wrapModeU",
37011
37127
  set: /**
@@ -37547,7 +37663,7 @@
37547
37663
  this._activeTextures = new Array(32);
37548
37664
  this._lastViewport = new Vector4(null, null, null, null);
37549
37665
  this._lastScissor = new Vector4(null, null, null, null);
37550
- this._lastClearColor = new Color$1(null, null, null, null);
37666
+ this._lastClearColor = new Color(null, null, null, null);
37551
37667
  this._scissorEnable = false;
37552
37668
  var options = _extends$1({
37553
37669
  webGLMode: 0,
@@ -37802,7 +37918,7 @@
37802
37918
  _proto._onWebGLContextRestored = function _onWebGLContextRestored(event) {
37803
37919
  this._onDeviceRestored();
37804
37920
  };
37805
- _create_class$2(WebGLGraphicDevice, [
37921
+ _create_class$1(WebGLGraphicDevice, [
37806
37922
  {
37807
37923
  key: "isWebGL2",
37808
37924
  get: function get() {
@@ -37846,230 +37962,6 @@
37846
37962
  return WebGLGraphicDevice;
37847
37963
  }();
37848
37964
 
37849
- function _defineProperties$1(target, props) {
37850
- for(var i = 0; i < props.length; i++){
37851
- var descriptor = props[i];
37852
- descriptor.enumerable = descriptor.enumerable || false;
37853
- descriptor.configurable = true;
37854
- if ("value" in descriptor) descriptor.writable = true;
37855
- Object.defineProperty(target, descriptor.key, descriptor);
37856
- }
37857
- }
37858
- function _create_class$1(Constructor, protoProps, staticProps) {
37859
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
37860
- if (staticProps) _defineProperties$1(Constructor, staticProps);
37861
- return Constructor;
37862
- }
37863
- var DRACOWorker = /*#__PURE__*/ function() {
37864
- var DRACOWorker = function DRACOWorker(workerSourceURL, decoderWASMBinary) {
37865
- var _this = this;
37866
- // Record byteLength of each task.
37867
- this._costs = {};
37868
- // The sum of bytelength that the worker is currently dealing with, in order to sort the workers.
37869
- this._currentLoad = 0;
37870
- this._callbacks = {};
37871
- this._worker = new Worker(workerSourceURL);
37872
- this._worker.onmessage = function(e) {
37873
- var message = e.data;
37874
- switch(message.type){
37875
- case "decode":
37876
- _this._callbacks[message.id].resolve(message.geometry);
37877
- break;
37878
- case "error":
37879
- _this._callbacks[message.id].reject(message);
37880
- break;
37881
- default:
37882
- Logger.error('DRACOWorker: Unexpected message, "' + message.type + '"');
37883
- }
37884
- };
37885
- if (decoderWASMBinary) {
37886
- this._worker.postMessage({
37887
- type: "init",
37888
- decoderConfig: {
37889
- wasmBinary: decoderWASMBinary
37890
- }
37891
- });
37892
- } else {
37893
- this._worker.postMessage({
37894
- type: "init",
37895
- decoderConfig: {}
37896
- });
37897
- }
37898
- };
37899
- var _proto = DRACOWorker.prototype;
37900
- _proto.setCosts = function setCosts(taskId, cost) {
37901
- this._costs[taskId] = cost;
37902
- };
37903
- _proto.addCurrentLoad = function addCurrentLoad(cost) {
37904
- this._currentLoad += cost;
37905
- };
37906
- _proto.setCallback = function setCallback(taskId, resolve, reject) {
37907
- this._callbacks[taskId] = {
37908
- resolve: resolve,
37909
- reject: reject
37910
- };
37911
- };
37912
- _proto.decode = function decode(taskId, taskConfig, buffer) {
37913
- this._worker.postMessage({
37914
- type: "decode",
37915
- id: taskId,
37916
- taskConfig: taskConfig,
37917
- buffer: buffer
37918
- }, [
37919
- buffer
37920
- ]);
37921
- };
37922
- _proto.releaseTask = function releaseTask(taskId) {
37923
- this._currentLoad -= this._costs[taskId];
37924
- delete this._callbacks[taskId];
37925
- delete this._costs[taskId];
37926
- };
37927
- _create_class$1(DRACOWorker, [
37928
- {
37929
- key: "currentLoad",
37930
- get: function get() {
37931
- return this._currentLoad;
37932
- }
37933
- }
37934
- ]);
37935
- return DRACOWorker;
37936
- }();
37937
- var workerString = 'let decoderPending;\nlet decoderConfig;\n\nonmessage = function(e) {\n const message = e.data;\n\n switch (message.type) {\n case "init":\n decoderConfig = message.decoderConfig;\n decoderPending = new Promise(function(resolve /*, reject*/) {\n decoderConfig.onModuleLoaded = function(draco) {\n // Module is Promise-like. Wrap before resolving to avoid loop.\n resolve({ draco: draco });\n };\n DracoDecoderModule(decoderConfig);\n });\n break;\n\n case "decode":\n const buffer = message.buffer;\n const taskConfig = message.taskConfig;\n decoderPending.then(module => {\n const draco = module.draco;\n const decoder = new draco.Decoder();\n const decoderBuffer = new draco.DecoderBuffer();\n decoderBuffer.Init(new Int8Array(buffer), buffer.byteLength);\n try {\n const geometry = decodeGeometry(draco, decoder, decoderBuffer, taskConfig);\n const buffers = geometry.attributes.map(attr => attr.array.buffer);\n if (geometry.index) buffers.push(geometry.index.array.buffer);\n self.postMessage({ type: "decode", id: message.id, geometry }, buffers);\n } catch (error) {\n console.error(error);\n self.postMessage({ type: "error", id: message.id, error: error.message });\n } finally {\n draco.destroy(decoderBuffer);\n draco.destroy(decoder);\n }\n });\n break;\n }\n};\n\nfunction decodeGeometry(draco, decoder, decoderBuffer, taskConfig) {\n const attributeIDs = taskConfig.attributeIDs;\n const attributeTypes = taskConfig.attributeTypes;\n\n let dracoGeometry;\n let decodingStatus;\n\n const geometryType = decoder.GetEncodedGeometryType(decoderBuffer);\n if (geometryType === draco.TRIANGULAR_MESH) {\n dracoGeometry = new draco.Mesh();\n decodingStatus = decoder.DecodeBufferToMesh(decoderBuffer, dracoGeometry);\n } else {\n throw new Error("DRACODecoder worker: Unexpected geometry type.");\n }\n\n if (!decodingStatus.ok() || dracoGeometry.ptr === 0) {\n throw new Error("DRACODecoder worker: Decoding failed: " + decodingStatus.error_msg());\n }\n\n const geometry = { index: null, attributes: [] };\n\n // Gather all vertex attributes.\n for (let attributeName in attributeIDs) {\n const attributeType = self[attributeTypes[attributeName]];\n\n let attribute;\n let attributeID;\n\n // A Draco file may be created with default vertex attributes, whose attribute IDs\n // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,\n // a Draco file may contain a custom set of attributes, identified by known unique\n // IDs. glTF files always do the latter, and .drc files typically do the former.\n if (taskConfig.useUniqueIDs) {\n attributeID = attributeIDs[attributeName];\n attribute = decoder.GetAttributeByUniqueId(dracoGeometry, attributeID);\n } else {\n attributeID = decoder.GetAttributeId(dracoGeometry, draco[attributeIDs[attributeName]]);\n if (attributeID === -1) continue;\n attribute = decoder.GetAttribute(dracoGeometry, attributeID);\n }\n geometry.attributes.push(decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute));\n }\n // Add index.\n if (geometryType === draco.TRIANGULAR_MESH) {\n // Generate mesh faces.\n const numFaces = dracoGeometry.num_faces();\n const numIndices = numFaces * 3;\n let dataSize;\n let ptr;\n let index;\n const indexType = self[taskConfig.indexType];\n\n switch (indexType) {\n case Uint16Array:\n dataSize = numIndices * 2;\n ptr = draco._malloc(dataSize);\n decoder.GetTrianglesUInt16Array(dracoGeometry, dataSize, ptr);\n index = new Uint16Array(draco.HEAPU16.buffer, ptr, numIndices).slice();\n draco._free(ptr);\n break;\n case Uint32Array:\n dataSize = numIndices * 4;\n ptr = draco._malloc(dataSize);\n decoder.GetTrianglesUInt32Array(dracoGeometry, dataSize, ptr);\n index = new Uint32Array(draco.HEAPU32.buffer, ptr, numIndices).slice();\n draco._free(ptr);\n break;\n default:\n throw new Error("DRACODecoder: Unexpected index type.");\n }\n geometry.index = { array: index, itemSize: 1 };\n }\n draco.destroy(dracoGeometry);\n return geometry;\n}\n\nfunction decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute) {\n const numComponents = attribute.num_components();\n const numPoints = dracoGeometry.num_points();\n const numValues = numPoints * numComponents;\n let ptr;\n let array;\n let dataSize;\n switch (attributeType) {\n case Float32Array:\n dataSize = numValues * 4;\n ptr = draco._malloc(dataSize);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_FLOAT32, dataSize, ptr);\n array = new Float32Array(draco.HEAPF32.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Int8Array:\n ptr = draco._malloc(numValues);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_INT8, numValues, ptr);\n array = new Int8Array(draco.HEAP8.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Int16Array:\n dataSize = numValues * 2;\n ptr = draco._malloc(dataSize);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_INT16, dataSize, ptr);\n array = new Int16Array(draco.HEAP16.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Int32Array:\n dataSize = numValues * 4;\n ptr = draco._malloc(dataSize);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_INT32, dataSize, ptr);\n array = new Int32Array(draco.HEAP32.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Uint8Array:\n ptr = draco._malloc(numValues);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_UINT8, numValues, ptr);\n array = new Uint8Array(draco.HEAPU8.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Uint16Array:\n dataSize = numValues * 2;\n ptr = draco._malloc(dataSize);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_UINT16, dataSize, ptr);\n array = new Uint16Array(draco.HEAPU16.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n case Uint32Array:\n dataSize = numValues * 4;\n ptr = draco._malloc(dataSize);\n decoder.GetAttributeDataArrayForAllPoints(dracoGeometry, attribute, draco.DT_UINT32, dataSize, ptr);\n array = new Uint32Array(draco.HEAPU32.buffer, ptr, numValues).slice();\n draco._free(ptr);\n break;\n\n default:\n throw new Error("DRACODecoder: Unexpected attribute type.");\n }\n\n return {\n name: attributeName,\n array: array,\n itemSize: numComponents\n };\n}\n';
37938
- var LIB_PATH = "https://gw.alipayobjects.com/os/lib/alipay/draco-javascript/1.3.6/lib/";
37939
- var JS_FILE = "draco_decoder_gltf.js";
37940
- var WASM_FILE = "draco_decoder_gltf.r3bin";
37941
- var WASM_WRAPPER_FILE = "draco_wasm_wrapper_gltf.js";
37942
- var DRACODecoder = /*#__PURE__*/ function() {
37943
- var DRACODecoder = function DRACODecoder(config) {
37944
- if (config === void 0) config = {
37945
- type: "wasm",
37946
- workerLimit: 4
37947
- };
37948
- this.pool = [];
37949
- this.workerLimit = Math.min(navigator.hardwareConcurrency || 4, 4);
37950
- this.currentTaskId = 1;
37951
- this.taskCache = new WeakMap();
37952
- if (config.workerLimit > this.workerLimit) {
37953
- Logger.warn("DRACOWorkerPool: Can not initialize worker pool with limit:" + config.workerLimit);
37954
- } else {
37955
- var _config_workerLimit;
37956
- this.workerLimit = (_config_workerLimit = config.workerLimit) != null ? _config_workerLimit : 4;
37957
- }
37958
- this.useJS = typeof WebAssembly !== "object" || config.type === "js";
37959
- this.loadLibPromise = this.preloadLib();
37960
- };
37961
- var _proto = DRACODecoder.prototype;
37962
- _proto.preloadLib = function preloadLib() {
37963
- var _this = this;
37964
- if (this.loadLibPromise) {
37965
- return this.loadLibPromise;
37966
- }
37967
- return new Promise(function(resolve, reject) {
37968
- if (_this.useJS) {
37969
- request("" + LIB_PATH + JS_FILE, {
37970
- type: "text"
37971
- }).then(function(jsSource) {
37972
- var body = [
37973
- jsSource,
37974
- workerString
37975
- ].join("\n");
37976
- var workerSourceURL = URL.createObjectURL(new Blob([
37977
- body
37978
- ]));
37979
- resolve({
37980
- workerSourceURL: workerSourceURL,
37981
- decoderWASMBinary: null
37982
- });
37983
- }).catch(function(reason) {
37984
- reject(reason);
37985
- });
37986
- } else {
37987
- Promise.all([
37988
- request("" + LIB_PATH + WASM_WRAPPER_FILE, {
37989
- type: "text"
37990
- }),
37991
- request("" + LIB_PATH + WASM_FILE, {
37992
- type: "arraybuffer"
37993
- })
37994
- ]).then(function(resources) {
37995
- var wrapperSource = resources[0], decoderWASMBinary = resources[1];
37996
- var body = [
37997
- wrapperSource,
37998
- workerString
37999
- ].join("\n");
38000
- var workerSourceURL = URL.createObjectURL(new Blob([
38001
- body
38002
- ]));
38003
- resolve({
38004
- workerSourceURL: workerSourceURL,
38005
- decoderWASMBinary: decoderWASMBinary
38006
- });
38007
- }).catch(function(reason) {
38008
- reject(reason);
38009
- });
38010
- }
38011
- });
38012
- };
38013
- _proto.getWorker = function getWorker() {
38014
- var _this = this;
38015
- return this.preloadLib().then(function(worderResources) {
38016
- if (_this.pool.length < _this.workerLimit) {
38017
- var dracoWorker = new DRACOWorker(worderResources.workerSourceURL, worderResources.decoderWASMBinary);
38018
- _this.pool.push(dracoWorker);
38019
- } else {
38020
- _this.pool.sort(function(a, b) {
38021
- return a.currentLoad > b.currentLoad ? -1 : 1;
38022
- });
38023
- }
38024
- return _this.pool[_this.pool.length - 1];
38025
- });
38026
- };
38027
- _proto.decode = function decode(buffer, taskConfig) {
38028
- var _this = this;
38029
- var taskKey = JSON.stringify(taskConfig);
38030
- // Check for an existing task using this buffer. A transferred buffer cannot be transferred.
38031
- // again from this thread.
38032
- if (this.taskCache.has(buffer)) {
38033
- var cachedTask = this.taskCache.get(buffer);
38034
- if (cachedTask.key === taskKey) {
38035
- return cachedTask.promise;
38036
- } else if (buffer.byteLength === 0) {
38037
- // After using transferable to transfer data, the data in the original environment will be cleared, so it is judged that byteLength is 0, which means it has been transferred.
38038
- // Technically, it would be possible to wait for the previous task to complete,
38039
- // transfer the buffer back, and decode again with the second configuration. That
38040
- // is complex, and I don't know of any reason to decode a Draco buffer twice in
38041
- // different ways, so this is left unimplemented.
38042
- throw new Error("DRACODecoder: Unable to re-decode a buffer with different " + "settings. Buffer has already been transferred.");
38043
- }
38044
- }
38045
- var taskId = this.currentTaskId++;
38046
- var cost = buffer.byteLength;
38047
- var taskWorker;
38048
- var task = new Promise(function(resolve, reject) {
38049
- _this.getWorker().then(function(worker) {
38050
- taskWorker = worker;
38051
- worker.setCosts(taskId, cost);
38052
- worker.addCurrentLoad(cost);
38053
- worker.setCallback(taskId, resolve, reject);
38054
- worker.decode(taskId, taskConfig, buffer);
38055
- }).catch(function(e) {
38056
- reject(e);
38057
- });
38058
- });
38059
- task.finally(function() {
38060
- if (taskWorker && taskId) {
38061
- taskWorker.releaseTask(taskId);
38062
- }
38063
- });
38064
- this.taskCache.set(buffer, {
38065
- key: taskKey,
38066
- promise: task
38067
- });
38068
- return task;
38069
- };
38070
- return DRACODecoder;
38071
- }();
38072
-
38073
37965
  function _extends() {
38074
37966
  _extends = Object.assign || function assign(target) {
38075
37967
  for(var i = 1; i < arguments.length; i++){
@@ -38508,7 +38400,7 @@
38508
38400
  function float32ArrayToVColor(float32Array, vertexCount) {
38509
38401
  var array = new Array(vertexCount);
38510
38402
  for(var i = 0; i < vertexCount; i++){
38511
- array[i] = new Color$1(float32Array[i * 4], float32Array[i * 4 + 1], float32Array[i * 4 + 2], float32Array[i * 4 + 3]);
38403
+ array[i] = new Color(float32Array[i * 4], float32Array[i * 4 + 1], float32Array[i * 4 + 2], float32Array[i * 4 + 3]);
38512
38404
  }
38513
38405
  return array;
38514
38406
  }
@@ -38647,6 +38539,8 @@
38647
38539
  if (position) entity.transform.position.copyFrom(position);
38648
38540
  if (rotation) entity.transform.rotation.copyFrom(rotation);
38649
38541
  if (scale) entity.transform.scale.copyFrom(scale);
38542
+ var _entityConfig_layer;
38543
+ entity.layer = (_entityConfig_layer = entityConfig.layer) != null ? _entityConfig_layer : entity.layer;
38650
38544
  return entity;
38651
38545
  });
38652
38546
  };
@@ -38940,7 +38834,7 @@
38940
38834
  for(var j5 = 0; j5 < keysLen; ++j5){
38941
38835
  var keyframe6 = new Keyframe();
38942
38836
  keyframe6.time = bufferReader.nextFloat32();
38943
- keyframe6.value = new Color$1(bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32());
38837
+ keyframe6.value = new Color(bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32());
38944
38838
  keyframe6.inTangent = new Vector4(bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32());
38945
38839
  keyframe6.outTangent = new Vector4(bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32(), bufferReader.nextFloat32());
38946
38840
  curve.addKey(keyframe6);
@@ -39615,7 +39509,7 @@
39615
39509
  * Float
39616
39510
  */ "FLOAT"] = 5126] = "FLOAT";
39617
39511
  })(AccessorComponentType || (AccessorComponentType = {}));
39618
- var AccessorType;
39512
+ exports.AccessorType = void 0;
39619
39513
  (function(AccessorType) {
39620
39514
  AccessorType[/**
39621
39515
  * Scalar
@@ -39638,7 +39532,7 @@
39638
39532
  AccessorType[/**
39639
39533
  * Matrix4x4
39640
39534
  */ "MAT4"] = "MAT4";
39641
- })(AccessorType || (AccessorType = {}));
39535
+ })(exports.AccessorType || (exports.AccessorType = {}));
39642
39536
  var AnimationChannelTargetPath;
39643
39537
  (function(AnimationChannelTargetPath) {
39644
39538
  AnimationChannelTargetPath[/**
@@ -39786,7 +39680,7 @@
39786
39680
  var glTFItems = this.glTF[glTFSchemaMap[type]];
39787
39681
  if (glTFItems && (index === undefined || glTFItems[index])) {
39788
39682
  if (index === undefined) {
39789
- resource = type === 7 ? glTFItems.map(function(_, index) {
39683
+ resource = type === 8 ? glTFItems.map(function(_, index) {
39790
39684
  return _this.get(type, index);
39791
39685
  }) : Promise.all(glTFItems.map(function(_, index) {
39792
39686
  return _this.get(type, index);
@@ -39808,11 +39702,11 @@
39808
39702
  _this.glTF = json;
39809
39703
  return Promise.all([
39810
39704
  _this.get(1),
39811
- _this.get(4),
39812
39705
  _this.get(5),
39813
39706
  _this.get(6),
39814
- _this.get(8),
39707
+ _this.get(7),
39815
39708
  _this.get(9),
39709
+ _this.get(10),
39816
39710
  _this.get(2)
39817
39711
  ]).then(function() {
39818
39712
  var glTFResource = _this.glTFResource;
@@ -39862,7 +39756,7 @@
39862
39756
  var _this = this;
39863
39757
  var glTFResourceKey = glTFResourceMap[type];
39864
39758
  if (!glTFResourceKey) return;
39865
- if (type === 7) {
39759
+ if (type === 8) {
39866
39760
  var _this_glTFResource, _glTFResourceKey;
39867
39761
  ((_this_glTFResource = this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = resource;
39868
39762
  } else {
@@ -39870,7 +39764,7 @@
39870
39764
  resource.then(function(item) {
39871
39765
  var _this_glTFResource, _glTFResourceKey;
39872
39766
  ((_this_glTFResource = _this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = item;
39873
- if (type === 6) {
39767
+ if (type === 7) {
39874
39768
  for(var i = 0, length = item.length; i < length; i++){
39875
39769
  var mesh = item[i];
39876
39770
  // @ts-ignore
@@ -39910,17 +39804,18 @@
39910
39804
  GLTFParserType[GLTFParserType["Validator"] = 1] = "Validator";
39911
39805
  GLTFParserType[GLTFParserType["Scene"] = 2] = "Scene";
39912
39806
  GLTFParserType[GLTFParserType["Buffer"] = 3] = "Buffer";
39913
- GLTFParserType[GLTFParserType["Texture"] = 4] = "Texture";
39914
- GLTFParserType[GLTFParserType["Material"] = 5] = "Material";
39915
- GLTFParserType[GLTFParserType["Mesh"] = 6] = "Mesh";
39916
- GLTFParserType[GLTFParserType["Entity"] = 7] = "Entity";
39917
- GLTFParserType[GLTFParserType["Skin"] = 8] = "Skin";
39918
- GLTFParserType[GLTFParserType["Animation"] = 9] = "Animation";
39807
+ GLTFParserType[GLTFParserType["BufferView"] = 4] = "BufferView";
39808
+ GLTFParserType[GLTFParserType["Texture"] = 5] = "Texture";
39809
+ GLTFParserType[GLTFParserType["Material"] = 6] = "Material";
39810
+ GLTFParserType[GLTFParserType["Mesh"] = 7] = "Mesh";
39811
+ GLTFParserType[GLTFParserType["Entity"] = 8] = "Entity";
39812
+ GLTFParserType[GLTFParserType["Skin"] = 9] = "Skin";
39813
+ GLTFParserType[GLTFParserType["Animation"] = 10] = "Animation";
39919
39814
  })(exports.GLTFParserType || (exports.GLTFParserType = {}));
39920
39815
  var _obj;
39921
- var glTFSchemaMap = (_obj = {}, _obj[2] = "scenes", _obj[3] = "buffers", _obj[4] = "textures", _obj[5] = "materials", _obj[6] = "meshes", _obj[7] = "nodes", _obj[8] = "skins", _obj[9] = "animations", _obj);
39816
+ var glTFSchemaMap = (_obj = {}, _obj[2] = "scenes", _obj[3] = "buffers", _obj[5] = "textures", _obj[6] = "materials", _obj[7] = "meshes", _obj[8] = "nodes", _obj[9] = "skins", _obj[10] = "animations", _obj[4] = "bufferViews", _obj);
39922
39817
  var _obj1;
39923
- var glTFResourceMap = (_obj1 = {}, _obj1[2] = "_sceneRoots", _obj1[4] = "textures", _obj1[5] = "materials", _obj1[6] = "meshes", _obj1[7] = "entities", _obj1[8] = "skins", _obj1[9] = "animations", _obj1);
39818
+ var glTFResourceMap = (_obj1 = {}, _obj1[2] = "_sceneRoots", _obj1[5] = "textures", _obj1[6] = "materials", _obj1[7] = "meshes", _obj1[8] = "entities", _obj1[9] = "skins", _obj1[10] = "animations", _obj1);
39924
39819
  function registerGLTFParser(pipeline) {
39925
39820
  return function(Parser) {
39926
39821
  var parser = new Parser();
@@ -39960,11 +39855,11 @@
39960
39855
  var colors = new Array(bufferLen / (isColor3 ? 3 : 4));
39961
39856
  if (isColor3) {
39962
39857
  for(var i = 0; i < bufferLen; i += 3){
39963
- colors[i / 3] = new Color$1(buffer[i], buffer[i + 1], buffer[i + 2], 1.0);
39858
+ colors[i / 3] = new Color(buffer[i], buffer[i + 1], buffer[i + 2], 1.0);
39964
39859
  }
39965
39860
  } else {
39966
39861
  for(var i1 = 0; i1 < bufferLen; i1 += 4){
39967
- colors[i1 / 4] = new Color$1(buffer[i1], buffer[i1 + 1], buffer[i1 + 2], buffer[i1 + 3]);
39862
+ colors[i1 / 4] = new Color(buffer[i1], buffer[i1 + 1], buffer[i1 + 2], buffer[i1 + 3]);
39968
39863
  }
39969
39864
  }
39970
39865
  return colors;
@@ -39973,19 +39868,19 @@
39973
39868
  * Get the number of bytes occupied by accessor type.
39974
39869
  */ GLTFUtils.getAccessorTypeSize = function getAccessorTypeSize(accessorType) {
39975
39870
  switch(accessorType){
39976
- case AccessorType.SCALAR:
39871
+ case exports.AccessorType.SCALAR:
39977
39872
  return 1;
39978
- case AccessorType.VEC2:
39873
+ case exports.AccessorType.VEC2:
39979
39874
  return 2;
39980
- case AccessorType.VEC3:
39875
+ case exports.AccessorType.VEC3:
39981
39876
  return 3;
39982
- case AccessorType.VEC4:
39877
+ case exports.AccessorType.VEC4:
39983
39878
  return 4;
39984
- case AccessorType.MAT2:
39879
+ case exports.AccessorType.MAT2:
39985
39880
  return 4;
39986
- case AccessorType.MAT3:
39881
+ case exports.AccessorType.MAT3:
39987
39882
  return 9;
39988
- case AccessorType.MAT4:
39883
+ case exports.AccessorType.MAT4:
39989
39884
  return 16;
39990
39885
  }
39991
39886
  };
@@ -40025,11 +39920,10 @@
40025
39920
  GLTFUtils.getAccessorBuffer = function getAccessorBuffer(context, bufferViews, accessor) {
40026
39921
  var componentType = accessor.componentType;
40027
39922
  var bufferView = bufferViews[accessor.bufferView];
40028
- return context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
39923
+ return context.get(exports.GLTFParserType.BufferView, accessor.bufferView).then(function(bufferViewData) {
40029
39924
  var bufferIndex = bufferView.buffer;
40030
- var buffer = buffers[bufferIndex];
40031
- var _bufferView_byteOffset;
40032
- var bufferByteOffset = (_bufferView_byteOffset = bufferView.byteOffset) != null ? _bufferView_byteOffset : 0;
39925
+ var _bufferViewData_byteOffset;
39926
+ var bufferByteOffset = (_bufferViewData_byteOffset = bufferViewData.byteOffset) != null ? _bufferViewData_byteOffset : 0;
40033
39927
  var _accessor_byteOffset;
40034
39928
  var byteOffset = (_accessor_byteOffset = accessor.byteOffset) != null ? _accessor_byteOffset : 0;
40035
39929
  var TypedArray = GLTFUtils.getComponentType(componentType);
@@ -40048,19 +39942,21 @@
40048
39942
  if (!bufferInfo) {
40049
39943
  var offset = bufferByteOffset + bufferSlice * bufferStride;
40050
39944
  var count = accessorCount * (bufferStride / dataElementBytes);
40051
- var data = new TypedArray(buffer, offset, count);
39945
+ var data = new TypedArray(bufferViewData.buffer, offset, count);
40052
39946
  accessorBufferCache[bufferCacheKey] = bufferInfo = new BufferInfo(data, true, bufferStride);
40053
39947
  bufferInfo.restoreInfo = new BufferDataRestoreInfo(new RestoreDataAccessor(bufferIndex, TypedArray, offset, count));
40054
39948
  }
40055
39949
  } else {
40056
39950
  var offset1 = bufferByteOffset + byteOffset;
40057
39951
  var count1 = accessorCount * dataElementSize;
40058
- var data1 = new TypedArray(buffer, offset1, count1);
39952
+ var data1 = new TypedArray(bufferViewData.buffer, offset1, count1);
40059
39953
  bufferInfo = new BufferInfo(data1, false, elementStride);
40060
39954
  bufferInfo.restoreInfo = new BufferDataRestoreInfo(new RestoreDataAccessor(bufferIndex, TypedArray, offset1, count1));
40061
39955
  }
40062
39956
  if (accessor.sparse) {
40063
- GLTFUtils.processingSparseData(bufferViews, accessor, buffers, bufferInfo);
39957
+ return GLTFUtils.processingSparseData(context, accessor, bufferInfo).then(function() {
39958
+ return bufferInfo;
39959
+ });
40064
39960
  }
40065
39961
  return bufferInfo;
40066
39962
  });
@@ -40136,40 +40032,43 @@
40136
40032
  };
40137
40033
  /**
40138
40034
  * Get accessor data.
40139
- */ GLTFUtils.processingSparseData = function processingSparseData(bufferViews, accessor, buffers, bufferInfo) {
40035
+ */ GLTFUtils.processingSparseData = function processingSparseData(context, accessor, bufferInfo) {
40140
40036
  var restoreInfo = bufferInfo.restoreInfo;
40037
+ var bufferViews = context.glTF.bufferViews;
40141
40038
  var accessorTypeSize = GLTFUtils.getAccessorTypeSize(accessor.type);
40142
40039
  var TypedArray = GLTFUtils.getComponentType(accessor.componentType);
40143
40040
  var data = bufferInfo.data.slice();
40144
40041
  var _accessor_sparse = accessor.sparse, count = _accessor_sparse.count, indices = _accessor_sparse.indices, values = _accessor_sparse.values;
40145
40042
  var indicesBufferView = bufferViews[indices.bufferView];
40146
40043
  var valuesBufferView = bufferViews[values.bufferView];
40147
- var indicesBufferIndex = indicesBufferView.buffer;
40148
- var valuesBufferIndex = valuesBufferView.buffer;
40149
- var indicesArrayBuffer = buffers[indicesBufferIndex];
40150
- var valuesArrayBuffer = buffers[valuesBufferIndex];
40151
- var _indices_byteOffset, _indicesBufferView_byteOffset;
40152
- var indicesByteOffset = ((_indices_byteOffset = indices.byteOffset) != null ? _indices_byteOffset : 0) + ((_indicesBufferView_byteOffset = indicesBufferView.byteOffset) != null ? _indicesBufferView_byteOffset : 0);
40153
- var indicesByteLength = indicesBufferView.byteLength;
40154
- var _values_byteOffset, _valuesBufferView_byteOffset;
40155
- var valuesByteOffset = ((_values_byteOffset = values.byteOffset) != null ? _values_byteOffset : 0) + ((_valuesBufferView_byteOffset = valuesBufferView.byteOffset) != null ? _valuesBufferView_byteOffset : 0);
40156
- var valuesByteLength = valuesBufferView.byteLength;
40157
- restoreInfo.typeSize = accessorTypeSize;
40158
- restoreInfo.sparseCount = count;
40159
- var IndexTypeArray = GLTFUtils.getComponentType(indices.componentType);
40160
- var indexLength = indicesByteLength / IndexTypeArray.BYTES_PER_ELEMENT;
40161
- var indicesArray = new IndexTypeArray(indicesArrayBuffer, indicesByteOffset, indexLength);
40162
- restoreInfo.sparseIndices = new RestoreDataAccessor(indicesBufferIndex, IndexTypeArray, indicesByteOffset, indexLength);
40163
- var valueLength = valuesByteLength / TypedArray.BYTES_PER_ELEMENT;
40164
- var valuesArray = new TypedArray(valuesArrayBuffer, valuesByteOffset, valueLength);
40165
- restoreInfo.sparseValues = new RestoreDataAccessor(valuesBufferIndex, TypedArray, valuesByteOffset, valueLength);
40166
- for(var i = 0; i < count; i++){
40167
- var replaceIndex = indicesArray[i];
40168
- for(var j = 0; j < accessorTypeSize; j++){
40169
- data[replaceIndex * accessorTypeSize + j] = valuesArray[i * accessorTypeSize + j];
40044
+ return Promise.all([
40045
+ context.get(exports.GLTFParserType.BufferView, indices.bufferView),
40046
+ context.get(exports.GLTFParserType.BufferView, values.bufferView)
40047
+ ]).then(function(param) {
40048
+ var indicesUint8Array = param[0], valuesUin8Array = param[1];
40049
+ var _indices_byteOffset, _indicesUint8Array_byteOffset;
40050
+ var indicesByteOffset = ((_indices_byteOffset = indices.byteOffset) != null ? _indices_byteOffset : 0) + ((_indicesUint8Array_byteOffset = indicesUint8Array.byteOffset) != null ? _indicesUint8Array_byteOffset : 0);
40051
+ var indicesByteLength = indicesUint8Array.byteLength;
40052
+ var _values_byteOffset, _valuesUin8Array_byteOffset;
40053
+ var valuesByteOffset = ((_values_byteOffset = values.byteOffset) != null ? _values_byteOffset : 0) + ((_valuesUin8Array_byteOffset = valuesUin8Array.byteOffset) != null ? _valuesUin8Array_byteOffset : 0);
40054
+ var valuesByteLength = valuesUin8Array.byteLength;
40055
+ restoreInfo.typeSize = accessorTypeSize;
40056
+ restoreInfo.sparseCount = count;
40057
+ var IndexTypeArray = GLTFUtils.getComponentType(indices.componentType);
40058
+ var indexLength = indicesByteLength / IndexTypeArray.BYTES_PER_ELEMENT;
40059
+ var indicesArray = new IndexTypeArray(indicesUint8Array.buffer, indicesByteOffset, indexLength);
40060
+ restoreInfo.sparseIndices = new RestoreDataAccessor(indicesBufferView.buffer, IndexTypeArray, indicesByteOffset, indexLength);
40061
+ var valueLength = valuesByteLength / TypedArray.BYTES_PER_ELEMENT;
40062
+ var valuesArray = new TypedArray(valuesUin8Array.buffer, valuesByteOffset, valueLength);
40063
+ restoreInfo.sparseValues = new RestoreDataAccessor(valuesBufferView.buffer, TypedArray, valuesByteOffset, valueLength);
40064
+ for(var i = 0; i < count; i++){
40065
+ var replaceIndex = indicesArray[i];
40066
+ for(var j = 0; j < accessorTypeSize; j++){
40067
+ data[replaceIndex * accessorTypeSize + j] = valuesArray[i * accessorTypeSize + j];
40068
+ }
40170
40069
  }
40171
- }
40172
- bufferInfo.data = data;
40070
+ bufferInfo.data = data;
40071
+ });
40173
40072
  };
40174
40073
  GLTFUtils.getIndexFormat = function getIndexFormat(type) {
40175
40074
  switch(type){
@@ -41181,8 +41080,9 @@
41181
41080
  });
41182
41081
  };
41183
41082
  /**
41184
- * Destroy ktx2 transcoder worker.
41185
- */ KTX2Loader1.destroy = function destroy() {
41083
+ * Release ktx2 transcoder worker.
41084
+ * @remarks If use loader after releasing, we should release again.
41085
+ */ KTX2Loader1.release = function release() {
41186
41086
  if (this._binomialLLCTranscoder) this._binomialLLCTranscoder.destroy();
41187
41087
  if (this._khronosTranscoder) this._khronosTranscoder.destroy();
41188
41088
  this._binomialLLCTranscoder = null;
@@ -41249,7 +41149,7 @@
41249
41149
  KTX2Loader1._decideTargetFormat = function _decideTargetFormat(engine, ktx2Container, priorityFormats) {
41250
41150
  var renderer = engine._hardwareRenderer;
41251
41151
  var targetFormat = this._detectSupportedFormat(renderer, priorityFormats);
41252
- if (targetFormat === exports.KTX2TargetFormat.PVRTC && (!MathUtil$1.isPowerOf2(ktx2Container.pixelWidth) || !MathUtil$1.isPowerOf2(ktx2Container.pixelHeight) || ktx2Container.pixelWidth !== ktx2Container.pixelHeight)) {
41152
+ if (targetFormat === exports.KTX2TargetFormat.PVRTC && (!MathUtil.isPowerOf2(ktx2Container.pixelWidth) || !MathUtil.isPowerOf2(ktx2Container.pixelHeight) || ktx2Container.pixelWidth !== ktx2Container.pixelHeight)) {
41253
41153
  Logger.warn("PVRTC image need power of 2 and width===height, downgrade to RGBA8");
41254
41154
  return exports.KTX2TargetFormat.R8G8B8A8;
41255
41155
  }
@@ -42031,7 +41931,7 @@
42031
41931
  if (pbrMetallicRoughness) {
42032
41932
  var baseColorFactor = pbrMetallicRoughness.baseColorFactor, baseColorTexture = pbrMetallicRoughness.baseColorTexture, metallicFactor = pbrMetallicRoughness.metallicFactor, roughnessFactor = pbrMetallicRoughness.roughnessFactor, metallicRoughnessTexture = pbrMetallicRoughness.metallicRoughnessTexture;
42033
41933
  if (baseColorFactor) {
42034
- material.baseColor = new Color$1(Color$1.linearToGammaSpace(baseColorFactor[0]), Color$1.linearToGammaSpace(baseColorFactor[1]), Color$1.linearToGammaSpace(baseColorFactor[2]), baseColorFactor[3]);
41934
+ material.baseColor = new Color(Color.linearToGammaSpace(baseColorFactor[0]), Color.linearToGammaSpace(baseColorFactor[1]), Color.linearToGammaSpace(baseColorFactor[2]), baseColorFactor[3]);
42035
41935
  }
42036
41936
  if (baseColorTexture) {
42037
41937
  context.get(exports.GLTFParserType.Texture, baseColorTexture.index).then(function(texture) {
@@ -42058,7 +41958,7 @@
42058
41958
  });
42059
41959
  }
42060
41960
  if (emissiveFactor) {
42061
- material.emissiveColor = new Color$1(Color$1.linearToGammaSpace(emissiveFactor[0]), Color$1.linearToGammaSpace(emissiveFactor[1]), Color$1.linearToGammaSpace(emissiveFactor[2]));
41961
+ material.emissiveColor = new Color(Color.linearToGammaSpace(emissiveFactor[0]), Color.linearToGammaSpace(emissiveFactor[1]), Color.linearToGammaSpace(emissiveFactor[2]));
42062
41962
  }
42063
41963
  if (normalTexture) {
42064
41964
  var index = normalTexture.index, scale = normalTexture.scale;
@@ -42697,12 +42597,254 @@
42697
42597
  exports.GLTFValidator = __decorate([
42698
42598
  registerGLTFParser(exports.GLTFParserType.Validator)
42699
42599
  ], exports.GLTFValidator);
42700
- var GLTFLoader = /*#__PURE__*/ function(Loader1) {
42600
+ exports.GLTFBufferViewParser = /*#__PURE__*/ function(GLTFParser1) {
42601
+ var GLTFBufferViewParser = function GLTFBufferViewParser() {
42602
+ return GLTFParser1.apply(this, arguments);
42603
+ };
42604
+ _inherits(GLTFBufferViewParser, GLTFParser1);
42605
+ var _proto = GLTFBufferViewParser.prototype;
42606
+ _proto.parse = function parse(context, index) {
42607
+ var bufferView = context.glTF.bufferViews[index];
42608
+ var extensions = bufferView.extensions, _bufferView_byteOffset = bufferView.byteOffset, byteOffset = _bufferView_byteOffset === void 0 ? 0 : _bufferView_byteOffset, byteLength = bufferView.byteLength, bufferIndex = bufferView.buffer;
42609
+ return extensions ? GLTFParser.executeExtensionsCreateAndParse(extensions, context, bufferView) : context.get(exports.GLTFParserType.Buffer, bufferIndex).then(function(buffer) {
42610
+ return new Uint8Array(buffer, byteOffset, byteLength);
42611
+ });
42612
+ };
42613
+ return GLTFBufferViewParser;
42614
+ }(GLTFParser);
42615
+ exports.GLTFBufferViewParser = __decorate([
42616
+ registerGLTFParser(exports.GLTFParserType.BufferView)
42617
+ ], exports.GLTFBufferViewParser);
42618
+ // Source: https://github.com/zeux/meshoptimizer/blob/master/js/meshopt_decoder.js
42619
+ var MeshoptDecoder = function() {
42620
+ var unpack = function unpack(data) {
42621
+ var result = new Uint8Array(data.length);
42622
+ for(var i = 0; i < data.length; ++i){
42623
+ var ch = data.charCodeAt(i);
42624
+ result[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4;
42625
+ }
42626
+ var write = 0;
42627
+ for(var i1 = 0; i1 < data.length; ++i1){
42628
+ result[write++] = result[i1] < 60 ? wasmpack[result[i1]] : (result[i1] - 60) * 64 + result[++i1];
42629
+ }
42630
+ return result.buffer.slice(0, write);
42631
+ };
42632
+ var decode = function decode(fun, target, count, size, source, filter) {
42633
+ var sbrk = instance.exports.sbrk;
42634
+ var count4 = count + 3 & ~3;
42635
+ var tp = sbrk(count4 * size);
42636
+ var sp = sbrk(source.length);
42637
+ var heap = new Uint8Array(instance.exports.memory.buffer);
42638
+ heap.set(source, sp);
42639
+ var res = fun(tp, count, size, sp, source.length);
42640
+ if (res == 0 && filter) {
42641
+ filter(tp, count4, size);
42642
+ }
42643
+ target.set(heap.subarray(tp, tp + count * size));
42644
+ sbrk(tp - sbrk(0));
42645
+ if (res != 0) {
42646
+ throw new Error("Malformed buffer data: " + res);
42647
+ }
42648
+ };
42649
+ var createWorker = function createWorker(url) {
42650
+ var worker = {
42651
+ object: new Worker(url),
42652
+ pending: 0,
42653
+ requests: {}
42654
+ };
42655
+ worker.object.onmessage = function(event) {
42656
+ var data = event.data;
42657
+ worker.pending -= data.count;
42658
+ worker.requests[data.id][data.action](data.value);
42659
+ delete worker.requests[data.id];
42660
+ };
42661
+ return worker;
42662
+ };
42663
+ var initWorkers = function initWorkers(count) {
42664
+ var source = "var instance; var ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(unpack(wasm)) + "]), {})" + ".then(function(result) {instance = result.instance; instance.exports.__wasm_call_ctors();});" + "self.onmessage = workerProcess;" + decode.toString() + workerProcess.toString();
42665
+ var blob = new Blob([
42666
+ source
42667
+ ], {
42668
+ type: "text/javascript"
42669
+ });
42670
+ var url = URL.createObjectURL(blob);
42671
+ for(var i = 0; i < count; ++i){
42672
+ workers[i] = createWorker(url);
42673
+ }
42674
+ URL.revokeObjectURL(url);
42675
+ };
42676
+ var decodeWorker = function decodeWorker(count, size, source, mode, filter) {
42677
+ var worker = workers[0];
42678
+ for(var i = 1; i < workers.length; ++i){
42679
+ if (workers[i].pending < worker.pending) {
42680
+ worker = workers[i];
42681
+ }
42682
+ }
42683
+ return new Promise(function(resolve, reject) {
42684
+ var data = new Uint8Array(source);
42685
+ var id = requestId++;
42686
+ worker.pending += count;
42687
+ worker.requests[id] = {
42688
+ resolve: resolve,
42689
+ reject: reject
42690
+ };
42691
+ worker.object.postMessage({
42692
+ id: id,
42693
+ count: count,
42694
+ size: size,
42695
+ source: data,
42696
+ mode: mode,
42697
+ filter: filter
42698
+ }, [
42699
+ data.buffer
42700
+ ]);
42701
+ });
42702
+ };
42703
+ var workerProcess = function workerProcess(event) {
42704
+ ready.then(function() {
42705
+ var data = event.data;
42706
+ try {
42707
+ var target = new Uint8Array(data.count * data.size);
42708
+ decode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);
42709
+ self.postMessage({
42710
+ id: data.id,
42711
+ count: data.count,
42712
+ action: "resolve",
42713
+ value: target
42714
+ }, [
42715
+ target.buffer
42716
+ ]);
42717
+ } catch (error) {
42718
+ self.postMessage({
42719
+ id: data.id,
42720
+ count: data.count,
42721
+ action: "reject",
42722
+ value: error
42723
+ });
42724
+ }
42725
+ });
42726
+ };
42727
+ var wasm_base = "b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb";
42728
+ var wasm_simd = "b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb";
42729
+ var wasmpack = new Uint8Array([
42730
+ 32,
42731
+ 0,
42732
+ 65,
42733
+ 2,
42734
+ 1,
42735
+ 106,
42736
+ 34,
42737
+ 33,
42738
+ 3,
42739
+ 128,
42740
+ 11,
42741
+ 4,
42742
+ 13,
42743
+ 64,
42744
+ 6,
42745
+ 253,
42746
+ 10,
42747
+ 7,
42748
+ 15,
42749
+ 116,
42750
+ 127,
42751
+ 5,
42752
+ 8,
42753
+ 12,
42754
+ 40,
42755
+ 16,
42756
+ 19,
42757
+ 54,
42758
+ 20,
42759
+ 9,
42760
+ 27,
42761
+ 255,
42762
+ 113,
42763
+ 17,
42764
+ 42,
42765
+ 67,
42766
+ 24,
42767
+ 23,
42768
+ 146,
42769
+ 148,
42770
+ 18,
42771
+ 14,
42772
+ 22,
42773
+ 45,
42774
+ 70,
42775
+ 69,
42776
+ 56,
42777
+ 114,
42778
+ 101,
42779
+ 21,
42780
+ 25,
42781
+ 63,
42782
+ 75,
42783
+ 136,
42784
+ 108,
42785
+ 28,
42786
+ 118,
42787
+ 29,
42788
+ 73,
42789
+ 115
42790
+ ]);
42791
+ // @ts-ignore
42792
+ var wasm = SystemInfo._detectSIMDSupported() ? wasm_simd : wasm_base;
42793
+ var instance;
42794
+ var ready = WebAssembly.instantiate(unpack(wasm), {}).then(function(result) {
42795
+ instance = result.instance;
42796
+ instance.exports.__wasm_call_ctors();
42797
+ });
42798
+ var filters = {
42799
+ NONE: "",
42800
+ OCTAHEDRAL: "meshopt_decodeFilterOct",
42801
+ QUATERNION: "meshopt_decodeFilterQuat",
42802
+ EXPONENTIAL: "meshopt_decodeFilterExp"
42803
+ };
42804
+ var decoders = {
42805
+ ATTRIBUTES: "meshopt_decodeVertexBuffer",
42806
+ TRIANGLES: "meshopt_decodeIndexBuffer",
42807
+ INDICES: "meshopt_decodeIndexSequence"
42808
+ };
42809
+ var workers = [];
42810
+ var requestId = 0;
42811
+ return {
42812
+ workerCount: 4,
42813
+ ready: ready,
42814
+ useWorkers: function useWorkers() {
42815
+ initWorkers(this.workerCount);
42816
+ },
42817
+ decodeGltfBuffer: function decodeGltfBuffer(count, stride, source, mode, filter) {
42818
+ if (this.workerCount > 0 && workers.length === 0) this.useWorkers();
42819
+ if (workers.length > 0) return decodeWorker(count, stride, source, decoders[mode], filters[filter]);
42820
+ return ready.then(function() {
42821
+ var target = new Uint8Array(count * stride);
42822
+ decode(instance.exports[decoders[mode]], target, count, stride, source, instance.exports[filters[filter]]);
42823
+ return target;
42824
+ });
42825
+ },
42826
+ release: function release() {
42827
+ for(var i = 0; i < workers.length; i++){
42828
+ workers[i].object.terminate();
42829
+ }
42830
+ }
42831
+ };
42832
+ }();
42833
+ exports.GLTFLoader = /*#__PURE__*/ function(Loader1) {
42701
42834
  var GLTFLoader = function GLTFLoader() {
42702
42835
  return Loader1.apply(this, arguments);
42703
42836
  };
42704
42837
  _inherits(GLTFLoader, Loader1);
42705
42838
  var _proto = GLTFLoader.prototype;
42839
+ _proto.initialize = function initialize(_, configuration) {
42840
+ var _configuration_glTF;
42841
+ var meshOptOptions = (_configuration_glTF = configuration.glTF) == null ? void 0 : _configuration_glTF.meshOpt;
42842
+ if (meshOptOptions) {
42843
+ MeshoptDecoder.workerCount = meshOptOptions.workerCount;
42844
+ MeshoptDecoder.useWorkers();
42845
+ }
42846
+ return Promise.resolve();
42847
+ };
42706
42848
  _proto.load = function load(item, resourceManager) {
42707
42849
  var url = item.url;
42708
42850
  var params = item.params;
@@ -42716,14 +42858,20 @@
42716
42858
  context.parse().then(resolve).catch(reject);
42717
42859
  });
42718
42860
  };
42861
+ /**
42862
+ * Release glTF loader memory(includes meshopt workers).
42863
+ * @remarks If use loader after releasing, we should release again.
42864
+ */ GLTFLoader.release = function release() {
42865
+ MeshoptDecoder.release();
42866
+ };
42719
42867
  return GLTFLoader;
42720
42868
  }(Loader);
42721
- GLTFLoader = __decorate([
42869
+ exports.GLTFLoader = __decorate([
42722
42870
  resourceLoader(exports.AssetType.GLTF, [
42723
42871
  "gltf",
42724
42872
  "glb"
42725
42873
  ])
42726
- ], GLTFLoader);
42874
+ ], exports.GLTFLoader);
42727
42875
  var _HDRLoader;
42728
42876
  var PI = Math.PI;
42729
42877
  var HDRLoader = (_HDRLoader = /*#__PURE__*/ function(Loader1) {
@@ -42834,7 +42982,7 @@
42834
42982
  var g = pixels[index + 1];
42835
42983
  var b = pixels[index + 2];
42836
42984
  var a = pixels[index + 3];
42837
- return new Color$1(r, g, b, a);
42985
+ return new Color(r, g, b, a);
42838
42986
  };
42839
42987
  HDRLoader1._readStringLine = function _readStringLine(uint8array, startIndex) {
42840
42988
  var line = "";
@@ -43343,7 +43491,7 @@
43343
43491
  materialShaderData.setVector4(key, new Vector4(value.x, value.y, value.z, value.w));
43344
43492
  break;
43345
43493
  case "Color":
43346
- materialShaderData.setColor(key, new Color$1(value.r, value.g, value.b, value.a));
43494
+ materialShaderData.setColor(key, new Color(value.r, value.g, value.b, value.a));
43347
43495
  break;
43348
43496
  case "Float":
43349
43497
  materialShaderData.setFloat(key, value);
@@ -43534,7 +43682,7 @@
43534
43682
  };
43535
43683
  _proto._makeSprite = function _makeSprite(engine, config, texture) {
43536
43684
  // Generate a SpriteAtlas object.
43537
- var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
43685
+ var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
43538
43686
  var sprite = new Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
43539
43687
  if (texture) {
43540
43688
  var invW = 1 / texture.width;
@@ -43546,6 +43694,8 @@
43546
43694
  }
43547
43695
  config.atlasRotated && (sprite.atlasRotated = true);
43548
43696
  }
43697
+ isNaN(width) || (sprite.width = width);
43698
+ isNaN(height) || (sprite.height = height);
43549
43699
  return sprite;
43550
43700
  };
43551
43701
  return SpriteAtlasLoader;
@@ -43563,26 +43713,39 @@
43563
43713
  var _proto = SpriteLoader.prototype;
43564
43714
  _proto.load = function load(item, resourceManager) {
43565
43715
  var _this = this;
43566
- return new AssetPromise(function(resolve, reject) {
43567
- _this.request(item.url, _extends({}, item, {
43568
- type: "json"
43569
- })).then(function(data) {
43570
- if (data.belongToAtlas) {
43571
- resourceManager // @ts-ignore
43572
- .getResourceByRef(data.belongToAtlas).then(function(atlas) {
43573
- resolve(atlas.getSprite(data.fullPath));
43574
- }).catch(reject);
43575
- } else if (data.texture) {
43576
- resourceManager // @ts-ignore
43577
- .getResourceByRef(data.texture).then(function(texture) {
43578
- resolve(new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border));
43579
- }).catch(reject);
43580
- } else {
43581
- resolve(new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
43582
- }
43583
- }).catch(reject);
43716
+ return this.request(item.url, _extends({}, item, {
43717
+ type: "json"
43718
+ })).then(function(data) {
43719
+ return data.belongToAtlas ? _this._loadFromAtlas(resourceManager, data) : _this._loadFromTexture(resourceManager, data);
43584
43720
  });
43585
43721
  };
43722
+ _proto._loadFromAtlas = function _loadFromAtlas(resourceManager, data) {
43723
+ var _this = this;
43724
+ return resourceManager // @ts-ignore
43725
+ .getResourceByRef(data.belongToAtlas).then(function(atlas) {
43726
+ return atlas.getSprite(data.fullPath) || _this._loadFromTexture(resourceManager, data);
43727
+ });
43728
+ };
43729
+ _proto._loadFromTexture = function _loadFromTexture(resourceManager, data) {
43730
+ if (data.texture) {
43731
+ return resourceManager // @ts-ignore
43732
+ .getResourceByRef(data.texture).then(function(texture) {
43733
+ var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
43734
+ var width = data.width, height = data.height;
43735
+ isNaN(width) || (sprite.width = width);
43736
+ isNaN(height) || (sprite.height = height);
43737
+ return sprite;
43738
+ });
43739
+ } else {
43740
+ return new AssetPromise(function(resolve) {
43741
+ var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
43742
+ var width = data.width, height = data.height;
43743
+ isNaN(width) || (sprite.width = width);
43744
+ isNaN(height) || (sprite.height = height);
43745
+ resolve(sprite);
43746
+ });
43747
+ }
43748
+ };
43586
43749
  return SpriteLoader;
43587
43750
  }(Loader);
43588
43751
  SpriteLoader = __decorate([
@@ -43876,169 +44039,6 @@
43876
44039
  ];
43877
44040
  });
43878
44041
  }));
43879
- var _KHR_draco_mesh_compression;
43880
- var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ function(GLTFExtensionParser1) {
43881
- var KHR_draco_mesh_compression1 = function KHR_draco_mesh_compression1() {
43882
- return GLTFExtensionParser1.apply(this, arguments);
43883
- };
43884
- _inherits(KHR_draco_mesh_compression1, GLTFExtensionParser1);
43885
- var _proto = KHR_draco_mesh_compression1.prototype;
43886
- _proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
43887
- var _this = this;
43888
- this._initialize();
43889
- var glTF = context.glTF, engine = context.glTFResource.engine;
43890
- var bufferViews = glTF.bufferViews, accessors = glTF.accessors;
43891
- var bufferViewIndex = schema.bufferView, gltfAttributeMap = schema.attributes;
43892
- var attributeMap = {};
43893
- var attributeTypeMap = {};
43894
- for(var attributeName in gltfAttributeMap){
43895
- attributeMap[attributeName] = gltfAttributeMap[attributeName];
43896
- }
43897
- for(var attributeName1 in glTFPrimitive.attributes){
43898
- if (gltfAttributeMap[attributeName1] !== undefined) {
43899
- var accessorDef = accessors[glTFPrimitive.attributes[attributeName1]];
43900
- attributeTypeMap[attributeName1] = GLTFUtils.getComponentType(accessorDef.componentType).name;
43901
- }
43902
- }
43903
- var indexAccessor = accessors[glTFPrimitive.indices];
43904
- var indexType = GLTFUtils.getComponentType(indexAccessor.componentType).name;
43905
- var taskConfig = {
43906
- attributeIDs: attributeMap,
43907
- attributeTypes: attributeTypeMap,
43908
- useUniqueIDs: true,
43909
- indexType: indexType
43910
- };
43911
- return context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
43912
- var buffer = GLTFUtils.getBufferViewData(bufferViews[bufferViewIndex], buffers);
43913
- return KHR_draco_mesh_compression._decoder.decode(buffer, taskConfig).then(function(decodedGeometry) {
43914
- var mesh = new ModelMesh(engine, glTFMesh.name);
43915
- return _this._parseMeshFromGLTFPrimitiveDraco(mesh, glTFMesh, glTFPrimitive, glTF, function(attributeSemantic) {
43916
- for(var j = 0; j < decodedGeometry.attributes.length; j++){
43917
- if (decodedGeometry.attributes[j].name === attributeSemantic) {
43918
- return decodedGeometry.attributes[j].array;
43919
- }
43920
- }
43921
- return null;
43922
- }, function(attributeSemantic, shapeIndex) {
43923
- throw "BlendShape animation is not supported when using draco.";
43924
- }, function() {
43925
- return decodedGeometry.index.array;
43926
- }, context.params.keepMeshData);
43927
- });
43928
- });
43929
- };
43930
- _proto._initialize = function _initialize() {
43931
- if (!KHR_draco_mesh_compression._decoder) {
43932
- KHR_draco_mesh_compression._decoder = new DRACODecoder();
43933
- }
43934
- };
43935
- _proto._parseMeshFromGLTFPrimitiveDraco = function _parseMeshFromGLTFPrimitiveDraco(mesh, gltfMesh, gltfPrimitive, gltf, getVertexBufferData, getBlendShapeData, getIndexBufferData, keepMeshData) {
43936
- var attributes = gltfPrimitive.attributes, targets = gltfPrimitive.targets, indices = gltfPrimitive.indices, mode = gltfPrimitive.mode;
43937
- var vertexCount;
43938
- var accessors = gltf.accessors;
43939
- var accessor = accessors[attributes["POSITION"]];
43940
- var positionBuffer = getVertexBufferData("POSITION");
43941
- var positions = GLTFUtils.floatBufferToVector3Array(positionBuffer);
43942
- mesh.setPositions(positions);
43943
- var bounds = mesh.bounds;
43944
- vertexCount = accessor.count;
43945
- if (accessor.min && accessor.max) {
43946
- bounds.min.copyFromArray(accessor.min);
43947
- bounds.max.copyFromArray(accessor.max);
43948
- } else {
43949
- var position = KHR_draco_mesh_compression._tempVector3;
43950
- var min = bounds.min, max = bounds.max;
43951
- min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
43952
- max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
43953
- var stride = positionBuffer.length / vertexCount;
43954
- for(var j = 0; j < vertexCount; j++){
43955
- var offset = j * stride;
43956
- position.copyFromArray(positionBuffer, offset);
43957
- Vector3.min(min, position, min);
43958
- Vector3.max(max, position, max);
43959
- }
43960
- }
43961
- for(var attributeSemantic in attributes){
43962
- if (attributeSemantic === "POSITION") {
43963
- continue;
43964
- }
43965
- var bufferData = getVertexBufferData(attributeSemantic);
43966
- switch(attributeSemantic){
43967
- case "NORMAL":
43968
- var normals = GLTFUtils.floatBufferToVector3Array(bufferData);
43969
- mesh.setNormals(normals);
43970
- break;
43971
- case "TEXCOORD_0":
43972
- var texturecoords = GLTFUtils.floatBufferToVector2Array(bufferData);
43973
- mesh.setUVs(texturecoords, 0);
43974
- break;
43975
- case "TEXCOORD_1":
43976
- var texturecoords1 = GLTFUtils.floatBufferToVector2Array(bufferData);
43977
- mesh.setUVs(texturecoords1, 1);
43978
- break;
43979
- case "TEXCOORD_2":
43980
- var texturecoords2 = GLTFUtils.floatBufferToVector2Array(bufferData);
43981
- mesh.setUVs(texturecoords2, 2);
43982
- break;
43983
- case "TEXCOORD_3":
43984
- var texturecoords3 = GLTFUtils.floatBufferToVector2Array(bufferData);
43985
- mesh.setUVs(texturecoords3, 3);
43986
- break;
43987
- case "TEXCOORD_4":
43988
- var texturecoords4 = GLTFUtils.floatBufferToVector2Array(bufferData);
43989
- mesh.setUVs(texturecoords4, 4);
43990
- break;
43991
- case "TEXCOORD_5":
43992
- var texturecoords5 = GLTFUtils.floatBufferToVector2Array(bufferData);
43993
- mesh.setUVs(texturecoords5, 5);
43994
- break;
43995
- case "TEXCOORD_6":
43996
- var texturecoords6 = GLTFUtils.floatBufferToVector2Array(bufferData);
43997
- mesh.setUVs(texturecoords6, 6);
43998
- break;
43999
- case "TEXCOORD_7":
44000
- var texturecoords7 = GLTFUtils.floatBufferToVector2Array(bufferData);
44001
- mesh.setUVs(texturecoords7, 7);
44002
- break;
44003
- case "COLOR_0":
44004
- var colors = GLTFUtils.floatBufferToColorArray(bufferData, accessors[attributes["COLOR_0"]].type === AccessorType.VEC3);
44005
- mesh.setColors(colors);
44006
- break;
44007
- case "TANGENT":
44008
- var tangents = GLTFUtils.floatBufferToVector4Array(bufferData);
44009
- mesh.setTangents(tangents);
44010
- break;
44011
- case "JOINTS_0":
44012
- var joints = GLTFUtils.floatBufferToVector4Array(bufferData);
44013
- mesh.setBoneIndices(joints);
44014
- break;
44015
- case "WEIGHTS_0":
44016
- var weights = GLTFUtils.floatBufferToVector4Array(bufferData);
44017
- mesh.setBoneWeights(weights);
44018
- break;
44019
- }
44020
- }
44021
- // Indices
44022
- if (indices !== undefined) {
44023
- var indexAccessor = gltf.accessors[indices];
44024
- var indexData = getIndexBufferData();
44025
- mesh.setIndices(indexData);
44026
- mesh.addSubMesh(0, indexAccessor.count, mode);
44027
- } else {
44028
- mesh.addSubMesh(0, vertexCount, mode);
44029
- }
44030
- // BlendShapes
44031
- targets && exports.GLTFMeshParser._createBlendShape(mesh, null, gltfMesh, accessors, targets, getBlendShapeData);
44032
- mesh.uploadData(!keepMeshData);
44033
- return Promise.resolve(mesh);
44034
- };
44035
- return KHR_draco_mesh_compression1;
44036
- }(GLTFExtensionParser), function() {
44037
- _KHR_draco_mesh_compression._tempVector3 = new Vector3();
44038
- }(), _KHR_draco_mesh_compression);
44039
- KHR_draco_mesh_compression = __decorate([
44040
- registerGLTFExtension("KHR_draco_mesh_compression", exports.GLTFExtensionMode.CreateAndParse)
44041
- ], KHR_draco_mesh_compression);
44042
44042
  var KHR_lights_punctual = /*#__PURE__*/ function(GLTFExtensionParser1) {
44043
44043
  var KHR_lights_punctual = function KHR_lights_punctual() {
44044
44044
  return GLTFExtensionParser1.apply(this, arguments);
@@ -44139,7 +44139,7 @@
44139
44139
  var material = new PBRSpecularMaterial(engine);
44140
44140
  var diffuseFactor = schema.diffuseFactor, diffuseTexture = schema.diffuseTexture, specularFactor = schema.specularFactor, glossinessFactor = schema.glossinessFactor, specularGlossinessTexture = schema.specularGlossinessTexture;
44141
44141
  if (diffuseFactor) {
44142
- material.baseColor = new Color$1(Color$1.linearToGammaSpace(diffuseFactor[0]), Color$1.linearToGammaSpace(diffuseFactor[1]), Color$1.linearToGammaSpace(diffuseFactor[2]), diffuseFactor[3]);
44142
+ material.baseColor = new Color(Color.linearToGammaSpace(diffuseFactor[0]), Color.linearToGammaSpace(diffuseFactor[1]), Color.linearToGammaSpace(diffuseFactor[2]), diffuseFactor[3]);
44143
44143
  }
44144
44144
  if (diffuseTexture) {
44145
44145
  context.get(exports.GLTFParserType.Texture, diffuseTexture.index).then(function(texture) {
@@ -44148,7 +44148,7 @@
44148
44148
  });
44149
44149
  }
44150
44150
  if (specularFactor) {
44151
- material.specularColor = new Color$1(Color$1.linearToGammaSpace(specularFactor[0]), Color$1.linearToGammaSpace(specularFactor[1]), Color$1.linearToGammaSpace(specularFactor[2]));
44151
+ material.specularColor = new Color(Color.linearToGammaSpace(specularFactor[0]), Color.linearToGammaSpace(specularFactor[1]), Color.linearToGammaSpace(specularFactor[2]));
44152
44152
  }
44153
44153
  if (glossinessFactor !== undefined) {
44154
44154
  material.glossiness = glossinessFactor;
@@ -44360,6 +44360,22 @@
44360
44360
  GALACEAN_animation_event = __decorate([
44361
44361
  registerGLTFExtension("GALACEAN_animation_event", exports.GLTFExtensionMode.AdditiveParse)
44362
44362
  ], GALACEAN_animation_event);
44363
+ var EXT_meshopt_compression = /*#__PURE__*/ function(GLTFExtensionParser1) {
44364
+ var EXT_meshopt_compression = function EXT_meshopt_compression() {
44365
+ return GLTFExtensionParser1.apply(this, arguments);
44366
+ };
44367
+ _inherits(EXT_meshopt_compression, GLTFExtensionParser1);
44368
+ var _proto = EXT_meshopt_compression.prototype;
44369
+ _proto.createAndParse = function createAndParse(context, schema) {
44370
+ return context.get(exports.GLTFParserType.Buffer, schema.buffer).then(function(arrayBuffer) {
44371
+ return MeshoptDecoder.decodeGltfBuffer(schema.count, schema.byteStride, new Uint8Array(arrayBuffer, schema.byteOffset, schema.byteLength), schema.mode, schema.filter);
44372
+ });
44373
+ };
44374
+ return EXT_meshopt_compression;
44375
+ }(GLTFExtensionParser);
44376
+ EXT_meshopt_compression = __decorate([
44377
+ registerGLTFExtension("EXT_meshopt_compression", exports.GLTFExtensionMode.CreateAndParse)
44378
+ ], EXT_meshopt_compression);
44363
44379
  var KHR_materials_anisotropy = /*#__PURE__*/ function(GLTFExtensionParser1) {
44364
44380
  var KHR_materials_anisotropy = function KHR_materials_anisotropy() {
44365
44381
  return GLTFExtensionParser1.apply(this, arguments);
@@ -44384,7 +44400,7 @@
44384
44400
  ], KHR_materials_anisotropy);
44385
44401
 
44386
44402
  //@ts-ignore
44387
- var version = "1.2.0-alpha.0";
44403
+ var version = "1.2.0-alpha.1";
44388
44404
  console.log("Galacean engine version: " + version);
44389
44405
  for(var key in CoreObjects){
44390
44406
  Loader.registerClass(key, CoreObjects[key]);
@@ -44418,6 +44434,7 @@
44418
44434
  exports.BoxColliderShape = BoxColliderShape;
44419
44435
  exports.BoxShape = BoxShape;
44420
44436
  exports.Buffer = Buffer;
44437
+ exports.BufferInfo = BufferInfo;
44421
44438
  exports.BufferMesh = BufferMesh;
44422
44439
  exports.BufferUtil = BufferUtil;
44423
44440
  exports.Burst = Burst;
@@ -44428,7 +44445,7 @@
44428
44445
  exports.CloneManager = CloneManager;
44429
44446
  exports.ColliderShape = ColliderShape;
44430
44447
  exports.CollisionUtil = CollisionUtil;
44431
- exports.Color = Color$1;
44448
+ exports.Color = Color;
44432
44449
  exports.ColorOverLifetimeModule = ColorOverLifetimeModule;
44433
44450
  exports.Component = Component;
44434
44451
  exports.ComponentMap = ComponentMap;
@@ -44466,7 +44483,7 @@
44466
44483
  exports.Logger = Logger;
44467
44484
  exports.MainModule = MainModule;
44468
44485
  exports.Material = Material;
44469
- exports.MathUtil = MathUtil$1;
44486
+ exports.MathUtil = MathUtil;
44470
44487
  exports.Matrix = Matrix;
44471
44488
  exports.Matrix3x3 = Matrix3x3;
44472
44489
  exports.Mesh = Mesh;