@galacean/engine 2.0.0-alpha.27 → 2.0.0-alpha.29

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.
@@ -839,20 +839,16 @@ BoundingSphere._tempVec30 = new Vector3();
839
839
  * @param matrix - The transform to apply to the bounding box
840
840
  * @param out - The transformed bounding box
841
841
  */ BoundingBox.transform = function transform(source, matrix, out) {
842
- // https://zeux.io/2010/10/17/aabb-from-obb-with-component-wise-abs/
843
- var center = BoundingBox._tempVec30;
844
- var extent = BoundingBox._tempVec31;
845
- source.getCenter(center);
846
- source.getExtent(extent);
847
- Vector3.transformCoordinate(center, matrix, center);
848
- var x = extent.x, y = extent.y, z = extent.z;
842
+ // Arvo's min/max method: for each matrix element, positive values multiply min for new min (max for new max),
843
+ // negative values multiply max for new min (min for new max), then add translation.
844
+ // Zero check avoids 0 * Infinity = NaN
845
+ var _source_min = source.min, minX = _source_min.x, minY = _source_min.y, minZ = _source_min.z;
846
+ var _source_max = source.max, maxX = _source_max.x, maxY = _source_max.y, maxZ = _source_max.z;
849
847
  var e = matrix.elements;
850
848
  // prettier-ignore
851
849
  var e0 = e[0], e1 = e[1], e2 = e[2], e4 = e[4], e5 = e[5], e6 = e[6], e8 = e[8], e9 = e[9], e10 = e[10];
852
- extent.set((e0 === 0 ? 0 : Math.abs(x * e0)) + (e4 === 0 ? 0 : Math.abs(y * e4)) + (e8 === 0 ? 0 : Math.abs(z * e8)), (e1 === 0 ? 0 : Math.abs(x * e1)) + (e5 === 0 ? 0 : Math.abs(y * e5)) + (e9 === 0 ? 0 : Math.abs(z * e9)), (e2 === 0 ? 0 : Math.abs(x * e2)) + (e6 === 0 ? 0 : Math.abs(y * e6)) + (e10 === 0 ? 0 : Math.abs(z * e10)));
853
- // set min、max
854
- Vector3.subtract(center, extent, out.min);
855
- Vector3.add(center, extent, out.max);
850
+ out.min.set((e0 > 0 ? e0 * minX : e0 < 0 ? e0 * maxX : 0) + (e4 > 0 ? e4 * minY : e4 < 0 ? e4 * maxY : 0) + (e8 > 0 ? e8 * minZ : e8 < 0 ? e8 * maxZ : 0) + e[12], (e1 > 0 ? e1 * minX : e1 < 0 ? e1 * maxX : 0) + (e5 > 0 ? e5 * minY : e5 < 0 ? e5 * maxY : 0) + (e9 > 0 ? e9 * minZ : e9 < 0 ? e9 * maxZ : 0) + e[13], (e2 > 0 ? e2 * minX : e2 < 0 ? e2 * maxX : 0) + (e6 > 0 ? e6 * minY : e6 < 0 ? e6 * maxY : 0) + (e10 > 0 ? e10 * minZ : e10 < 0 ? e10 * maxZ : 0) + e[14]);
851
+ out.max.set((e0 > 0 ? e0 * maxX : e0 < 0 ? e0 * minX : 0) + (e4 > 0 ? e4 * maxY : e4 < 0 ? e4 * minY : 0) + (e8 > 0 ? e8 * maxZ : e8 < 0 ? e8 * minZ : 0) + e[12], (e1 > 0 ? e1 * maxX : e1 < 0 ? e1 * minX : 0) + (e5 > 0 ? e5 * maxY : e5 < 0 ? e5 * minY : 0) + (e9 > 0 ? e9 * maxZ : e9 < 0 ? e9 * minZ : 0) + e[13], (e2 > 0 ? e2 * maxX : e2 < 0 ? e2 * minX : 0) + (e6 > 0 ? e6 * maxY : e6 < 0 ? e6 * minY : 0) + (e10 > 0 ? e10 * maxZ : e10 < 0 ? e10 * minZ : 0) + e[14]);
856
852
  };
857
853
  /**
858
854
  * Calculate a bounding box that is as large as the total combined area of the two specified boxes.
@@ -867,8 +863,6 @@ BoundingSphere._tempVec30 = new Vector3();
867
863
  };
868
864
  return BoundingBox;
869
865
  }();
870
- BoundingBox._tempVec30 = new Vector3();
871
- BoundingBox._tempVec31 = new Vector3();
872
866
  /**
873
867
  * Contains static methods to help in determining intersections, containment, etc.
874
868
  */ var CollisionUtil = /*#__PURE__*/ function() {
@@ -18810,7 +18804,7 @@ __decorate$1([
18810
18804
  if (!shape) {
18811
18805
  return false;
18812
18806
  }
18813
- return shape.collider.entity.layer & mask && shape.isSceneQuery;
18807
+ return shape.collider.collisionLayer & mask && shape.isSceneQuery;
18814
18808
  };
18815
18809
  };
18816
18810
  _proto._createHitCallback = function _createHitCallback(outHitResult) {
@@ -40437,9 +40431,9 @@ __decorate$1([
40437
40431
  /**
40438
40432
  * Control how Particle Generator apply transform scale.
40439
40433
  */ var ParticleScaleMode = /*#__PURE__*/ function(ParticleScaleMode) {
40440
- /** Scale the Particle Generator using the entire transform hierarchy. */ ParticleScaleMode[ParticleScaleMode["Hierarchy"] = 0] = "Hierarchy";
40441
- /** Scale the Particle Generator using only its own transform scale. (Ignores parent scale). */ ParticleScaleMode[ParticleScaleMode["Local"] = 1] = "Local";
40442
- /** Only apply transform scale to the shape component, which controls where particles are spawned, but does not affect their size or movement. */ ParticleScaleMode[ParticleScaleMode["World"] = 2] = "World";
40434
+ /** Scale the Particle Generator using the world scale, including all parent transforms. */ ParticleScaleMode[ParticleScaleMode["World"] = 0] = "World";
40435
+ /** Scale the Particle Generator using only its own transform scale, ignoring parent scale. */ ParticleScaleMode[ParticleScaleMode["Local"] = 1] = "Local";
40436
+ /** Scale only the emitter shape positions; particle size and movement are unaffected. */ ParticleScaleMode[ParticleScaleMode["Shape"] = 2] = "Shape";
40443
40437
  return ParticleScaleMode;
40444
40438
  }({});
40445
40439
  var MainModule = /*#__PURE__*/ function() {
@@ -40490,8 +40484,8 @@ var MainModule = /*#__PURE__*/ function() {
40490
40484
  */ _proto._getPositionScale = function _getPositionScale() {
40491
40485
  var transform = this._generator._renderer.entity.transform;
40492
40486
  switch(this.scalingMode){
40493
- case ParticleScaleMode.Hierarchy:
40494
40487
  case ParticleScaleMode.World:
40488
+ case ParticleScaleMode.Shape:
40495
40489
  return transform.lossyWorldScale;
40496
40490
  case ParticleScaleMode.Local:
40497
40491
  return transform.scale;
@@ -40515,7 +40509,7 @@ var MainModule = /*#__PURE__*/ function() {
40515
40509
  throw new Error("ParticleRenderer: SimulationSpace value is invalid.");
40516
40510
  }
40517
40511
  switch(this.scalingMode){
40518
- case ParticleScaleMode.Hierarchy:
40512
+ case ParticleScaleMode.World:
40519
40513
  var scale = transform.lossyWorldScale;
40520
40514
  shaderData.setVector3(MainModule._positionScale, scale);
40521
40515
  shaderData.setVector3(MainModule._sizeScale, scale);
@@ -40525,7 +40519,7 @@ var MainModule = /*#__PURE__*/ function() {
40525
40519
  shaderData.setVector3(MainModule._positionScale, scale);
40526
40520
  shaderData.setVector3(MainModule._sizeScale, scale);
40527
40521
  break;
40528
- case ParticleScaleMode.World:
40522
+ case ParticleScaleMode.Shape:
40529
40523
  shaderData.setVector3(MainModule._positionScale, transform.lossyWorldScale);
40530
40524
  shaderData.setVector3(MainModule._sizeScale, MainModule._vector3One);
40531
40525
  break;
@@ -42553,7 +42547,7 @@ __decorate$1([
42553
42547
  // StartSpeed's impact
42554
42548
  var shape = this.emission.shape;
42555
42549
  if (shape == null ? void 0 : shape.enabled) {
42556
- shape._getPositionRange(min, max);
42550
+ shape._getPositionRange(bounds);
42557
42551
  shape._getDirectionRange(directionMin, directionMax);
42558
42552
  } else {
42559
42553
  min.set(0, 0, 0);
@@ -42933,9 +42927,28 @@ __decorate$1([
42933
42927
  * Base class for all particle shapes.
42934
42928
  */ var BaseShape = /*#__PURE__*/ function() {
42935
42929
  function BaseShape() {
42930
+ var _this = this;
42936
42931
  this._updateManager = new UpdateFlagManager();
42937
42932
  this._enabled = true;
42938
42933
  this._randomDirectionAmount = 0;
42934
+ this._position = new Vector3(0, 0, 0);
42935
+ this._rotation = new Vector3(0, 0, 0);
42936
+ this._scale = new Vector3(1, 1, 1);
42937
+ this._matrix = new Matrix();
42938
+ this._transformDirty = false;
42939
+ this._hasShapeTransform = false;
42940
+ this._onTransformChanged = function() {
42941
+ _this._transformDirty = true;
42942
+ var p = _this._position, r = _this._rotation, s = _this._scale;
42943
+ _this._hasShapeTransform = p.x !== 0 || p.y !== 0 || p.z !== 0 || r.x !== 0 || r.y !== 0 || r.z !== 0 || s.x !== 1 || s.y !== 1 || s.z !== 1;
42944
+ _this._updateManager.dispatch();
42945
+ };
42946
+ // @ts-ignore
42947
+ this._position._onValueChanged = this._onTransformChanged;
42948
+ // @ts-ignore
42949
+ this._rotation._onValueChanged = this._onTransformChanged;
42950
+ // @ts-ignore
42951
+ this._scale._onValueChanged = this._onTransformChanged;
42939
42952
  }
42940
42953
  var _proto = BaseShape.prototype;
42941
42954
  /**
@@ -42948,6 +42961,53 @@ __decorate$1([
42948
42961
  */ _proto._unRegisterOnValueChanged = function _unRegisterOnValueChanged(listener) {
42949
42962
  this._updateManager.removeListener(listener);
42950
42963
  };
42964
+ /**
42965
+ * @internal
42966
+ */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
42967
+ this._generateLocalPositionAndDirection(rand, emitTime, position, direction);
42968
+ if (this._hasShapeTransform) {
42969
+ var matrix = this._getMatrix();
42970
+ Vector3.transformToVec3(position, matrix, position);
42971
+ Vector3.transformNormal(direction, matrix, direction);
42972
+ direction.normalize();
42973
+ }
42974
+ };
42975
+ /**
42976
+ * @internal
42977
+ */ _proto._getPositionRange = function _getPositionRange(bounds) {
42978
+ this._getLocalPositionRange(bounds.min, bounds.max);
42979
+ if (this._hasShapeTransform) {
42980
+ BoundingBox.transform(bounds, this._getMatrix(), bounds);
42981
+ }
42982
+ };
42983
+ /**
42984
+ * @internal
42985
+ */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
42986
+ this._getLocalDirectionRange(outMin, outMax);
42987
+ if (this._hasShapeTransform) {
42988
+ this._transformDirectionRange(outMin, outMax);
42989
+ }
42990
+ };
42991
+ _proto._getMatrix = function _getMatrix() {
42992
+ if (this._transformDirty) {
42993
+ var _this = this, r = _this._rotation;
42994
+ var q = BaseShape._tempQuaternion;
42995
+ Quaternion.rotationEuler(MathUtil.degreeToRadian(r.x), MathUtil.degreeToRadian(r.y), MathUtil.degreeToRadian(r.z), q);
42996
+ Matrix.affineTransformation(this._scale, q, this._position, this._matrix);
42997
+ this._transformDirty = false;
42998
+ }
42999
+ return this._matrix;
43000
+ };
43001
+ // Arvo min/max method without translation, only apply RS part of the matrix
43002
+ _proto._transformDirectionRange = function _transformDirectionRange(outMin, outMax) {
43003
+ var e = this._getMatrix().elements;
43004
+ var minX = outMin.x, minY = outMin.y, minZ = outMin.z;
43005
+ var maxX = outMax.x, maxY = outMax.y, maxZ = outMax.z;
43006
+ // prettier-ignore
43007
+ var e0 = e[0], e1 = e[1], e2 = e[2], e4 = e[4], e5 = e[5], e6 = e[6], e8 = e[8], e9 = e[9], e10 = e[10];
43008
+ outMin.set((e0 > 0 ? e0 * minX : e0 * maxX) + (e4 > 0 ? e4 * minY : e4 * maxY) + (e8 > 0 ? e8 * minZ : e8 * maxZ), (e1 > 0 ? e1 * minX : e1 * maxX) + (e5 > 0 ? e5 * minY : e5 * maxY) + (e9 > 0 ? e9 * minZ : e9 * maxZ), (e2 > 0 ? e2 * minX : e2 * maxX) + (e6 > 0 ? e6 * minY : e6 * maxY) + (e10 > 0 ? e10 * minZ : e10 * maxZ));
43009
+ outMax.set((e0 > 0 ? e0 * maxX : e0 * minX) + (e4 > 0 ? e4 * maxY : e4 * minY) + (e8 > 0 ? e8 * maxZ : e8 * minZ), (e1 > 0 ? e1 * maxX : e1 * minX) + (e5 > 0 ? e5 * maxY : e5 * minY) + (e9 > 0 ? e9 * maxZ : e9 * minZ), (e2 > 0 ? e2 * maxX : e2 * minX) + (e6 > 0 ? e6 * maxY : e6 * minY) + (e10 > 0 ? e10 * maxZ : e10 * minZ));
43010
+ };
42951
43011
  _create_class$2(BaseShape, [
42952
43012
  {
42953
43013
  key: "enabled",
@@ -42976,13 +43036,78 @@ __decorate$1([
42976
43036
  this._updateManager.dispatch();
42977
43037
  }
42978
43038
  }
43039
+ },
43040
+ {
43041
+ key: "position",
43042
+ get: /**
43043
+ * Apply a local position offset to the shape.
43044
+ */ function get() {
43045
+ return this._position;
43046
+ },
43047
+ set: function set(value) {
43048
+ if (value !== this._position) {
43049
+ this._position.copyFrom(value);
43050
+ }
43051
+ }
43052
+ },
43053
+ {
43054
+ key: "rotation",
43055
+ get: /**
43056
+ * Apply a local rotation to the shape, specified as euler angles in degrees.
43057
+ */ function get() {
43058
+ return this._rotation;
43059
+ },
43060
+ set: function set(value) {
43061
+ if (value !== this._rotation) {
43062
+ this._rotation.copyFrom(value);
43063
+ }
43064
+ }
43065
+ },
43066
+ {
43067
+ key: "scale",
43068
+ get: /**
43069
+ * Apply a local scale to the shape.
43070
+ */ function get() {
43071
+ return this._scale;
43072
+ },
43073
+ set: function set(value) {
43074
+ if (value !== this._scale) {
43075
+ this._scale.copyFrom(value);
43076
+ }
43077
+ }
42979
43078
  }
42980
43079
  ]);
42981
43080
  return BaseShape;
42982
43081
  }();
43082
+ /** @internal */ BaseShape._tempVector20 = new Vector2();
43083
+ /** @internal */ BaseShape._tempVector21 = new Vector2();
43084
+ /** @internal */ BaseShape._tempVector30 = new Vector3();
43085
+ /** @internal */ BaseShape._tempVector31 = new Vector3();
43086
+ BaseShape._tempQuaternion = new Quaternion();
42983
43087
  __decorate$1([
42984
43088
  ignoreClone
42985
43089
  ], BaseShape.prototype, "_updateManager", void 0);
43090
+ __decorate$1([
43091
+ deepClone
43092
+ ], BaseShape.prototype, "_position", void 0);
43093
+ __decorate$1([
43094
+ deepClone
43095
+ ], BaseShape.prototype, "_rotation", void 0);
43096
+ __decorate$1([
43097
+ deepClone
43098
+ ], BaseShape.prototype, "_scale", void 0);
43099
+ __decorate$1([
43100
+ ignoreClone
43101
+ ], BaseShape.prototype, "_matrix", void 0);
43102
+ __decorate$1([
43103
+ ignoreClone
43104
+ ], BaseShape.prototype, "_transformDirty", void 0);
43105
+ __decorate$1([
43106
+ ignoreClone
43107
+ ], BaseShape.prototype, "_hasShapeTransform", void 0);
43108
+ __decorate$1([
43109
+ ignoreClone
43110
+ ], BaseShape.prototype, "_onTransformChanged", void 0);
42986
43111
  /**
42987
43112
  * @internal
42988
43113
  */ var ShapeUtils = /*#__PURE__*/ function() {
@@ -43045,11 +43170,11 @@ __decorate$1([
43045
43170
  }({});
43046
43171
  /**
43047
43172
  * Particle shape that emits particles from a box.
43048
- */ var BoxShape = /*#__PURE__*/ function(BaseShape) {
43049
- _inherits$2(BoxShape, BaseShape);
43173
+ */ var BoxShape = /*#__PURE__*/ function(BaseShape1) {
43174
+ _inherits$2(BoxShape, BaseShape1);
43050
43175
  function BoxShape() {
43051
43176
  var _this;
43052
- _this = BaseShape.call(this) || this, _this.shapeType = ParticleShapeType.Box, _this._size = new Vector3(1, 1, 1);
43177
+ _this = BaseShape1.call(this) || this, _this.shapeType = ParticleShapeType.Box, _this._size = new Vector3(1, 1, 1);
43053
43178
  // @ts-ignore
43054
43179
  _this._size._onValueChanged = _this._updateManager.dispatch.bind(_this._updateManager);
43055
43180
  return _this;
@@ -43057,17 +43182,17 @@ __decorate$1([
43057
43182
  var _proto = BoxShape.prototype;
43058
43183
  /**
43059
43184
  * @internal
43060
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43185
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43061
43186
  ShapeUtils._randomPointInsideHalfUnitBox(position, rand);
43062
43187
  position.multiply(this.size);
43063
- var defaultDirection = BoxShape._tempVector30;
43188
+ var defaultDirection = BaseShape._tempVector30;
43064
43189
  defaultDirection.set(0.0, 0.0, -1.0);
43065
43190
  ShapeUtils._randomPointUnitSphere(direction, rand);
43066
43191
  Vector3.lerp(defaultDirection, direction, this.randomDirectionAmount, direction);
43067
43192
  };
43068
43193
  /**
43069
43194
  * @internal
43070
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43195
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43071
43196
  var radian = Math.PI * this.randomDirectionAmount;
43072
43197
  if (this.randomDirectionAmount < 0.5) {
43073
43198
  var dirSin = Math.sin(radian);
@@ -43081,7 +43206,7 @@ __decorate$1([
43081
43206
  };
43082
43207
  /**
43083
43208
  * @internal
43084
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43209
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43085
43210
  var _this__size = this._size, x = _this__size.x, y = _this__size.y, z = _this__size.z;
43086
43211
  outMin.set(-x * 0.5, -y * 0.5, -z * 0.5);
43087
43212
  outMax.set(x * 0.5, y * 0.5, z * 0.5);
@@ -43103,7 +43228,6 @@ __decorate$1([
43103
43228
  ]);
43104
43229
  return BoxShape;
43105
43230
  }(BaseShape);
43106
- BoxShape._tempVector30 = new Vector3();
43107
43231
  __decorate$1([
43108
43232
  deepClone
43109
43233
  ], BoxShape.prototype, "_size", void 0);
@@ -43116,18 +43240,18 @@ __decorate$1([
43116
43240
  }({});
43117
43241
  /**
43118
43242
  * Particle shape that emits particles from a circle.
43119
- */ var CircleShape = /*#__PURE__*/ function(BaseShape) {
43120
- _inherits$2(CircleShape, BaseShape);
43243
+ */ var CircleShape = /*#__PURE__*/ function(BaseShape1) {
43244
+ _inherits$2(CircleShape, BaseShape1);
43121
43245
  function CircleShape() {
43122
43246
  var _this;
43123
- _this = BaseShape.apply(this, arguments) || this, _this.shapeType = ParticleShapeType.Circle, _this._radius = 1.0, _this._arc = 360.0, _this._arcMode = ParticleShapeArcMode.Random, _this._arcSpeed = 1.0;
43247
+ _this = BaseShape1.apply(this, arguments) || this, _this.shapeType = ParticleShapeType.Circle, _this._radius = 1.0, _this._arc = 360.0, _this._arcMode = ParticleShapeArcMode.Random, _this._arcSpeed = 1.0;
43124
43248
  return _this;
43125
43249
  }
43126
43250
  var _proto = CircleShape.prototype;
43127
43251
  /**
43128
43252
  * @internal
43129
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43130
- var positionPoint = CircleShape._tempPositionPoint;
43253
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43254
+ var positionPoint = BaseShape._tempVector20;
43131
43255
  switch(this.arcMode){
43132
43256
  case ParticleShapeArcMode.Loop:
43133
43257
  var normalizedEmitTime = emitTime * this.arcSpeed * (360 / this.arc) % 1;
@@ -43146,7 +43270,7 @@ __decorate$1([
43146
43270
  };
43147
43271
  /**
43148
43272
  * @internal
43149
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43273
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43150
43274
  var randomDirZ = this.randomDirectionAmount > 0.5 ? 1 : Math.sin(this.randomDirectionAmount * Math.PI);
43151
43275
  var randomDegreeOnXY = 0.5 * (360 - this._arc) * this.randomDirectionAmount;
43152
43276
  var randomDirY = randomDegreeOnXY > 90 ? -1 : -Math.sin(randomDegreeOnXY);
@@ -43154,7 +43278,7 @@ __decorate$1([
43154
43278
  };
43155
43279
  /**
43156
43280
  * @internal
43157
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43281
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43158
43282
  this._getUnitArcRange(this._arc, outMin, outMax, 0, 0);
43159
43283
  outMin.scale(this._radius);
43160
43284
  outMax.scale(this._radius);
@@ -43237,21 +43361,20 @@ __decorate$1([
43237
43361
  ]);
43238
43362
  return CircleShape;
43239
43363
  }(BaseShape);
43240
- CircleShape._tempPositionPoint = new Vector2();
43241
43364
  /**
43242
43365
  * Cone shape.
43243
- */ var ConeShape = /*#__PURE__*/ function(BaseShape) {
43244
- _inherits$2(ConeShape, BaseShape);
43366
+ */ var ConeShape = /*#__PURE__*/ function(BaseShape1) {
43367
+ _inherits$2(ConeShape, BaseShape1);
43245
43368
  function ConeShape() {
43246
43369
  var _this;
43247
- _this = BaseShape.apply(this, arguments) || this, _this.shapeType = ParticleShapeType.Cone, _this._angle = 25.0, _this._radius = 1.0, _this._length = 5.0, _this._emitType = 0;
43370
+ _this = BaseShape1.apply(this, arguments) || this, _this.shapeType = ParticleShapeType.Cone, _this._angle = 25.0, _this._radius = 1.0, _this._length = 5.0, _this._emitType = 0;
43248
43371
  return _this;
43249
43372
  }
43250
43373
  var _proto = ConeShape.prototype;
43251
43374
  /**
43252
43375
  * @internal
43253
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43254
- var unitPosition = ConeShape._tempVector20;
43376
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43377
+ var unitPosition = BaseShape._tempVector20;
43255
43378
  var radian = MathUtil.degreeToRadian(this.angle);
43256
43379
  var dirSinA = Math.sin(radian);
43257
43380
  var dirCosA = Math.cos(radian);
@@ -43259,7 +43382,7 @@ CircleShape._tempPositionPoint = new Vector2();
43259
43382
  case 0:
43260
43383
  ShapeUtils.randomPointInsideUnitCircle(unitPosition, rand);
43261
43384
  position.set(unitPosition.x * this.radius, unitPosition.y * this.radius, 0);
43262
- var unitDirection = ConeShape._tempVector21;
43385
+ var unitDirection = BaseShape._tempVector21;
43263
43386
  ShapeUtils.randomPointInsideUnitCircle(unitDirection, rand);
43264
43387
  Vector2.lerp(unitPosition, unitDirection, this.randomDirectionAmount, unitDirection);
43265
43388
  direction.set(unitDirection.x * dirSinA, unitDirection.y * dirSinA, -dirCosA);
@@ -43269,10 +43392,10 @@ CircleShape._tempPositionPoint = new Vector2();
43269
43392
  position.set(unitPosition.x * this.radius, unitPosition.y * this.radius, 0);
43270
43393
  direction.set(unitPosition.x * dirSinA, unitPosition.y * dirSinA, -dirCosA);
43271
43394
  direction.normalize();
43272
- var distance = ConeShape._tempVector30;
43395
+ var distance = BaseShape._tempVector30;
43273
43396
  Vector3.scale(direction, this.length * rand.random(), distance);
43274
43397
  position.add(distance);
43275
- var randomDirection = ConeShape._tempVector31;
43398
+ var randomDirection = BaseShape._tempVector31;
43276
43399
  ShapeUtils._randomPointUnitSphere(randomDirection, rand);
43277
43400
  Vector3.lerp(direction, randomDirection, this.randomDirectionAmount, direction);
43278
43401
  break;
@@ -43280,7 +43403,7 @@ CircleShape._tempPositionPoint = new Vector2();
43280
43403
  };
43281
43404
  /**
43282
43405
  * @internal
43283
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43406
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43284
43407
  var radian = 0;
43285
43408
  switch(this.emitType){
43286
43409
  case 0:
@@ -43297,7 +43420,7 @@ CircleShape._tempPositionPoint = new Vector2();
43297
43420
  };
43298
43421
  /**
43299
43422
  * @internal
43300
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43423
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43301
43424
  var radius = this.radius;
43302
43425
  switch(this.emitType){
43303
43426
  case 0:
@@ -43372,10 +43495,6 @@ CircleShape._tempPositionPoint = new Vector2();
43372
43495
  ]);
43373
43496
  return ConeShape;
43374
43497
  }(BaseShape);
43375
- ConeShape._tempVector20 = new Vector2();
43376
- ConeShape._tempVector21 = new Vector2();
43377
- ConeShape._tempVector30 = new Vector3();
43378
- ConeShape._tempVector31 = new Vector3();
43379
43498
  /**
43380
43499
  * Cone emitter type.
43381
43500
  */ var ConeEmitType = /*#__PURE__*/ function(ConeEmitType) {
@@ -43395,7 +43514,7 @@ ConeShape._tempVector31 = new Vector3();
43395
43514
  var _proto = HemisphereShape.prototype;
43396
43515
  /**
43397
43516
  * @internal
43398
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43517
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43399
43518
  ShapeUtils._randomPointInsideUnitSphere(position, rand);
43400
43519
  position.scale(this.radius);
43401
43520
  var z = position.z;
@@ -43405,14 +43524,14 @@ ConeShape._tempVector31 = new Vector3();
43405
43524
  };
43406
43525
  /**
43407
43526
  * @internal
43408
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43527
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43409
43528
  var randomDir = Math.sin(0.5 * this.randomDirectionAmount * Math.PI);
43410
43529
  outMin.set(-1, -1, -1);
43411
43530
  outMax.set(1, 1, randomDir);
43412
43531
  };
43413
43532
  /**
43414
43533
  * @internal
43415
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43534
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43416
43535
  var radius = this._radius;
43417
43536
  outMin.set(-radius, -radius, -radius);
43418
43537
  outMax.set(radius, radius, 0);
@@ -43449,7 +43568,7 @@ ConeShape._tempVector31 = new Vector3();
43449
43568
  var _proto = MeshShape.prototype;
43450
43569
  /**
43451
43570
  * @internal
43452
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43571
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43453
43572
  var _this = this, positions = _this._positionBuffer, positionInfo = _this._positionElementInfo, normals = _this._normalBuffer, normalInfo = _this._normalElementInfo;
43454
43573
  var randomIndex = Math.floor(rand.random() * this._mesh.vertexCount);
43455
43574
  // index = randomIndex * stride + offset
@@ -43462,14 +43581,14 @@ ConeShape._tempVector31 = new Vector3();
43462
43581
  };
43463
43582
  /**
43464
43583
  * @internal
43465
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43584
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43466
43585
  var bounds = this._mesh.bounds;
43467
43586
  bounds.min.copyTo(outMin);
43468
43587
  bounds.max.copyTo(outMax);
43469
43588
  };
43470
43589
  /**
43471
43590
  * @internal
43472
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43591
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43473
43592
  // @todo: Should use min and max of normal, use bounds is worst, but we can't get the min and max of normal by fast way.
43474
43593
  var bounds = this._mesh.bounds;
43475
43594
  bounds.min.copyTo(outMin);
@@ -43583,7 +43702,7 @@ __decorate$1([
43583
43702
  var _proto = SphereShape.prototype;
43584
43703
  /**
43585
43704
  * @internal
43586
- */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
43705
+ */ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
43587
43706
  ShapeUtils._randomPointInsideUnitSphere(position, rand);
43588
43707
  position.scale(this.radius);
43589
43708
  ShapeUtils._randomPointUnitSphere(direction, rand);
@@ -43591,13 +43710,13 @@ __decorate$1([
43591
43710
  };
43592
43711
  /**
43593
43712
  * @internal
43594
- */ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
43713
+ */ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
43595
43714
  outMin.set(-1, -1, -1);
43596
43715
  outMax.set(1, 1, 1);
43597
43716
  };
43598
43717
  /**
43599
43718
  * @internal
43600
- */ _proto._getPositionRange = function _getPositionRange(outMin, outMax) {
43719
+ */ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
43601
43720
  var radius = this._radius;
43602
43721
  outMin.set(-radius, -radius, -radius);
43603
43722
  outMax.set(radius, radius, radius);
@@ -44349,7 +44468,7 @@ var cacheDir = new Vector3();
44349
44468
  * Suspend the audio context.
44350
44469
  * @returns A promise that resolves when the audio context is suspended
44351
44470
  */ AudioManager.suspend = function suspend() {
44352
- return AudioManager._context.suspend();
44471
+ return AudioManager.getContext().suspend();
44353
44472
  };
44354
44473
  /**
44355
44474
  * Resume the audio context.
@@ -44358,7 +44477,7 @@ var cacheDir = new Vector3();
44358
44477
  */ AudioManager.resume = function resume() {
44359
44478
  var _AudioManager;
44360
44479
  var __resumePromise;
44361
- return (__resumePromise = (_AudioManager = AudioManager)._resumePromise) != null ? __resumePromise : _AudioManager._resumePromise = AudioManager._context.resume().then(function() {
44480
+ return (__resumePromise = (_AudioManager = AudioManager)._resumePromise) != null ? __resumePromise : _AudioManager._resumePromise = AudioManager.getContext().resume().then(function() {
44362
44481
  AudioManager._needsUserGestureResume = false;
44363
44482
  }).finally(function() {
44364
44483
  AudioManager._resumePromise = null;
@@ -54732,7 +54851,7 @@ EXT_texture_webp = __decorate([
54732
54851
  ], EXT_texture_webp);
54733
54852
 
54734
54853
  //@ts-ignore
54735
- var version = "2.0.0-alpha.27";
54854
+ var version = "2.0.0-alpha.29";
54736
54855
  console.log("Galacean Engine Version: " + version);
54737
54856
  for(var key in CoreObjects){
54738
54857
  Loader.registerClass(key, CoreObjects[key]);