@galacean/engine 2.0.0-alpha.27 → 2.0.0-alpha.28
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 +176 -57
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/bundled.module.js +176 -57
- package/dist/bundled.module.js.map +1 -1
- package/dist/bundled.module.min.js +1 -1
- package/dist/bundled.module.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -845,20 +845,16 @@
|
|
|
845
845
|
* @param matrix - The transform to apply to the bounding box
|
|
846
846
|
* @param out - The transformed bounding box
|
|
847
847
|
*/ BoundingBox.transform = function transform(source, matrix, out) {
|
|
848
|
-
//
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
source.
|
|
852
|
-
source.
|
|
853
|
-
Vector3.transformCoordinate(center, matrix, center);
|
|
854
|
-
var x = extent.x, y = extent.y, z = extent.z;
|
|
848
|
+
// Arvo's min/max method: for each matrix element, positive values multiply min for new min (max for new max),
|
|
849
|
+
// negative values multiply max for new min (min for new max), then add translation.
|
|
850
|
+
// Zero check avoids 0 * Infinity = NaN
|
|
851
|
+
var _source_min = source.min, minX = _source_min.x, minY = _source_min.y, minZ = _source_min.z;
|
|
852
|
+
var _source_max = source.max, maxX = _source_max.x, maxY = _source_max.y, maxZ = _source_max.z;
|
|
855
853
|
var e = matrix.elements;
|
|
856
854
|
// prettier-ignore
|
|
857
855
|
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];
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
Vector3.subtract(center, extent, out.min);
|
|
861
|
-
Vector3.add(center, extent, out.max);
|
|
856
|
+
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]);
|
|
857
|
+
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]);
|
|
862
858
|
};
|
|
863
859
|
/**
|
|
864
860
|
* Calculate a bounding box that is as large as the total combined area of the two specified boxes.
|
|
@@ -873,8 +869,6 @@
|
|
|
873
869
|
};
|
|
874
870
|
return BoundingBox;
|
|
875
871
|
}();
|
|
876
|
-
BoundingBox._tempVec30 = new Vector3();
|
|
877
|
-
BoundingBox._tempVec31 = new Vector3();
|
|
878
872
|
/**
|
|
879
873
|
* Contains static methods to help in determining intersections, containment, etc.
|
|
880
874
|
*/ var CollisionUtil = /*#__PURE__*/ function() {
|
|
@@ -18816,7 +18810,7 @@
|
|
|
18816
18810
|
if (!shape) {
|
|
18817
18811
|
return false;
|
|
18818
18812
|
}
|
|
18819
|
-
return shape.collider.
|
|
18813
|
+
return shape.collider.collisionLayer & mask && shape.isSceneQuery;
|
|
18820
18814
|
};
|
|
18821
18815
|
};
|
|
18822
18816
|
_proto._createHitCallback = function _createHitCallback(outHitResult) {
|
|
@@ -42559,7 +42553,7 @@
|
|
|
42559
42553
|
// StartSpeed's impact
|
|
42560
42554
|
var shape = this.emission.shape;
|
|
42561
42555
|
if (shape == null ? void 0 : shape.enabled) {
|
|
42562
|
-
shape._getPositionRange(
|
|
42556
|
+
shape._getPositionRange(bounds);
|
|
42563
42557
|
shape._getDirectionRange(directionMin, directionMax);
|
|
42564
42558
|
} else {
|
|
42565
42559
|
min.set(0, 0, 0);
|
|
@@ -42939,9 +42933,28 @@
|
|
|
42939
42933
|
* Base class for all particle shapes.
|
|
42940
42934
|
*/ var BaseShape = /*#__PURE__*/ function() {
|
|
42941
42935
|
function BaseShape() {
|
|
42936
|
+
var _this = this;
|
|
42942
42937
|
this._updateManager = new UpdateFlagManager();
|
|
42943
42938
|
this._enabled = true;
|
|
42944
42939
|
this._randomDirectionAmount = 0;
|
|
42940
|
+
this._position = new Vector3(0, 0, 0);
|
|
42941
|
+
this._rotation = new Vector3(0, 0, 0);
|
|
42942
|
+
this._scale = new Vector3(1, 1, 1);
|
|
42943
|
+
this._matrix = new Matrix();
|
|
42944
|
+
this._transformDirty = false;
|
|
42945
|
+
this._hasShapeTransform = false;
|
|
42946
|
+
this._onTransformChanged = function() {
|
|
42947
|
+
_this._transformDirty = true;
|
|
42948
|
+
var p = _this._position, r = _this._rotation, s = _this._scale;
|
|
42949
|
+
_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;
|
|
42950
|
+
_this._updateManager.dispatch();
|
|
42951
|
+
};
|
|
42952
|
+
// @ts-ignore
|
|
42953
|
+
this._position._onValueChanged = this._onTransformChanged;
|
|
42954
|
+
// @ts-ignore
|
|
42955
|
+
this._rotation._onValueChanged = this._onTransformChanged;
|
|
42956
|
+
// @ts-ignore
|
|
42957
|
+
this._scale._onValueChanged = this._onTransformChanged;
|
|
42945
42958
|
}
|
|
42946
42959
|
var _proto = BaseShape.prototype;
|
|
42947
42960
|
/**
|
|
@@ -42954,6 +42967,53 @@
|
|
|
42954
42967
|
*/ _proto._unRegisterOnValueChanged = function _unRegisterOnValueChanged(listener) {
|
|
42955
42968
|
this._updateManager.removeListener(listener);
|
|
42956
42969
|
};
|
|
42970
|
+
/**
|
|
42971
|
+
* @internal
|
|
42972
|
+
*/ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
|
|
42973
|
+
this._generateLocalPositionAndDirection(rand, emitTime, position, direction);
|
|
42974
|
+
if (this._hasShapeTransform) {
|
|
42975
|
+
var matrix = this._getMatrix();
|
|
42976
|
+
Vector3.transformToVec3(position, matrix, position);
|
|
42977
|
+
Vector3.transformNormal(direction, matrix, direction);
|
|
42978
|
+
direction.normalize();
|
|
42979
|
+
}
|
|
42980
|
+
};
|
|
42981
|
+
/**
|
|
42982
|
+
* @internal
|
|
42983
|
+
*/ _proto._getPositionRange = function _getPositionRange(bounds) {
|
|
42984
|
+
this._getLocalPositionRange(bounds.min, bounds.max);
|
|
42985
|
+
if (this._hasShapeTransform) {
|
|
42986
|
+
BoundingBox.transform(bounds, this._getMatrix(), bounds);
|
|
42987
|
+
}
|
|
42988
|
+
};
|
|
42989
|
+
/**
|
|
42990
|
+
* @internal
|
|
42991
|
+
*/ _proto._getDirectionRange = function _getDirectionRange(outMin, outMax) {
|
|
42992
|
+
this._getLocalDirectionRange(outMin, outMax);
|
|
42993
|
+
if (this._hasShapeTransform) {
|
|
42994
|
+
this._transformDirectionRange(outMin, outMax);
|
|
42995
|
+
}
|
|
42996
|
+
};
|
|
42997
|
+
_proto._getMatrix = function _getMatrix() {
|
|
42998
|
+
if (this._transformDirty) {
|
|
42999
|
+
var _this = this, r = _this._rotation;
|
|
43000
|
+
var q = BaseShape._tempQuaternion;
|
|
43001
|
+
Quaternion.rotationEuler(MathUtil.degreeToRadian(r.x), MathUtil.degreeToRadian(r.y), MathUtil.degreeToRadian(r.z), q);
|
|
43002
|
+
Matrix.affineTransformation(this._scale, q, this._position, this._matrix);
|
|
43003
|
+
this._transformDirty = false;
|
|
43004
|
+
}
|
|
43005
|
+
return this._matrix;
|
|
43006
|
+
};
|
|
43007
|
+
// Arvo min/max method without translation, only apply RS part of the matrix
|
|
43008
|
+
_proto._transformDirectionRange = function _transformDirectionRange(outMin, outMax) {
|
|
43009
|
+
var e = this._getMatrix().elements;
|
|
43010
|
+
var minX = outMin.x, minY = outMin.y, minZ = outMin.z;
|
|
43011
|
+
var maxX = outMax.x, maxY = outMax.y, maxZ = outMax.z;
|
|
43012
|
+
// prettier-ignore
|
|
43013
|
+
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];
|
|
43014
|
+
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));
|
|
43015
|
+
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));
|
|
43016
|
+
};
|
|
42957
43017
|
_create_class$2(BaseShape, [
|
|
42958
43018
|
{
|
|
42959
43019
|
key: "enabled",
|
|
@@ -42982,13 +43042,78 @@
|
|
|
42982
43042
|
this._updateManager.dispatch();
|
|
42983
43043
|
}
|
|
42984
43044
|
}
|
|
43045
|
+
},
|
|
43046
|
+
{
|
|
43047
|
+
key: "position",
|
|
43048
|
+
get: /**
|
|
43049
|
+
* Apply a local position offset to the shape.
|
|
43050
|
+
*/ function get() {
|
|
43051
|
+
return this._position;
|
|
43052
|
+
},
|
|
43053
|
+
set: function set(value) {
|
|
43054
|
+
if (value !== this._position) {
|
|
43055
|
+
this._position.copyFrom(value);
|
|
43056
|
+
}
|
|
43057
|
+
}
|
|
43058
|
+
},
|
|
43059
|
+
{
|
|
43060
|
+
key: "rotation",
|
|
43061
|
+
get: /**
|
|
43062
|
+
* Apply a local rotation to the shape, specified as euler angles in degrees.
|
|
43063
|
+
*/ function get() {
|
|
43064
|
+
return this._rotation;
|
|
43065
|
+
},
|
|
43066
|
+
set: function set(value) {
|
|
43067
|
+
if (value !== this._rotation) {
|
|
43068
|
+
this._rotation.copyFrom(value);
|
|
43069
|
+
}
|
|
43070
|
+
}
|
|
43071
|
+
},
|
|
43072
|
+
{
|
|
43073
|
+
key: "scale",
|
|
43074
|
+
get: /**
|
|
43075
|
+
* Apply a local scale to the shape.
|
|
43076
|
+
*/ function get() {
|
|
43077
|
+
return this._scale;
|
|
43078
|
+
},
|
|
43079
|
+
set: function set(value) {
|
|
43080
|
+
if (value !== this._scale) {
|
|
43081
|
+
this._scale.copyFrom(value);
|
|
43082
|
+
}
|
|
43083
|
+
}
|
|
42985
43084
|
}
|
|
42986
43085
|
]);
|
|
42987
43086
|
return BaseShape;
|
|
42988
43087
|
}();
|
|
43088
|
+
/** @internal */ BaseShape._tempVector20 = new Vector2();
|
|
43089
|
+
/** @internal */ BaseShape._tempVector21 = new Vector2();
|
|
43090
|
+
/** @internal */ BaseShape._tempVector30 = new Vector3();
|
|
43091
|
+
/** @internal */ BaseShape._tempVector31 = new Vector3();
|
|
43092
|
+
BaseShape._tempQuaternion = new Quaternion();
|
|
42989
43093
|
__decorate$1([
|
|
42990
43094
|
ignoreClone
|
|
42991
43095
|
], BaseShape.prototype, "_updateManager", void 0);
|
|
43096
|
+
__decorate$1([
|
|
43097
|
+
deepClone
|
|
43098
|
+
], BaseShape.prototype, "_position", void 0);
|
|
43099
|
+
__decorate$1([
|
|
43100
|
+
deepClone
|
|
43101
|
+
], BaseShape.prototype, "_rotation", void 0);
|
|
43102
|
+
__decorate$1([
|
|
43103
|
+
deepClone
|
|
43104
|
+
], BaseShape.prototype, "_scale", void 0);
|
|
43105
|
+
__decorate$1([
|
|
43106
|
+
ignoreClone
|
|
43107
|
+
], BaseShape.prototype, "_matrix", void 0);
|
|
43108
|
+
__decorate$1([
|
|
43109
|
+
ignoreClone
|
|
43110
|
+
], BaseShape.prototype, "_transformDirty", void 0);
|
|
43111
|
+
__decorate$1([
|
|
43112
|
+
ignoreClone
|
|
43113
|
+
], BaseShape.prototype, "_hasShapeTransform", void 0);
|
|
43114
|
+
__decorate$1([
|
|
43115
|
+
ignoreClone
|
|
43116
|
+
], BaseShape.prototype, "_onTransformChanged", void 0);
|
|
42992
43117
|
/**
|
|
42993
43118
|
* @internal
|
|
42994
43119
|
*/ var ShapeUtils = /*#__PURE__*/ function() {
|
|
@@ -43051,11 +43176,11 @@
|
|
|
43051
43176
|
}({});
|
|
43052
43177
|
/**
|
|
43053
43178
|
* Particle shape that emits particles from a box.
|
|
43054
|
-
*/ var BoxShape = /*#__PURE__*/ function(
|
|
43055
|
-
_inherits$2(BoxShape,
|
|
43179
|
+
*/ var BoxShape = /*#__PURE__*/ function(BaseShape1) {
|
|
43180
|
+
_inherits$2(BoxShape, BaseShape1);
|
|
43056
43181
|
function BoxShape() {
|
|
43057
43182
|
var _this;
|
|
43058
|
-
_this =
|
|
43183
|
+
_this = BaseShape1.call(this) || this, _this.shapeType = ParticleShapeType.Box, _this._size = new Vector3(1, 1, 1);
|
|
43059
43184
|
// @ts-ignore
|
|
43060
43185
|
_this._size._onValueChanged = _this._updateManager.dispatch.bind(_this._updateManager);
|
|
43061
43186
|
return _this;
|
|
@@ -43063,17 +43188,17 @@
|
|
|
43063
43188
|
var _proto = BoxShape.prototype;
|
|
43064
43189
|
/**
|
|
43065
43190
|
* @internal
|
|
43066
|
-
*/ _proto.
|
|
43191
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43067
43192
|
ShapeUtils._randomPointInsideHalfUnitBox(position, rand);
|
|
43068
43193
|
position.multiply(this.size);
|
|
43069
|
-
var defaultDirection =
|
|
43194
|
+
var defaultDirection = BaseShape._tempVector30;
|
|
43070
43195
|
defaultDirection.set(0.0, 0.0, -1.0);
|
|
43071
43196
|
ShapeUtils._randomPointUnitSphere(direction, rand);
|
|
43072
43197
|
Vector3.lerp(defaultDirection, direction, this.randomDirectionAmount, direction);
|
|
43073
43198
|
};
|
|
43074
43199
|
/**
|
|
43075
43200
|
* @internal
|
|
43076
|
-
*/ _proto.
|
|
43201
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43077
43202
|
var radian = Math.PI * this.randomDirectionAmount;
|
|
43078
43203
|
if (this.randomDirectionAmount < 0.5) {
|
|
43079
43204
|
var dirSin = Math.sin(radian);
|
|
@@ -43087,7 +43212,7 @@
|
|
|
43087
43212
|
};
|
|
43088
43213
|
/**
|
|
43089
43214
|
* @internal
|
|
43090
|
-
*/ _proto.
|
|
43215
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43091
43216
|
var _this__size = this._size, x = _this__size.x, y = _this__size.y, z = _this__size.z;
|
|
43092
43217
|
outMin.set(-x * 0.5, -y * 0.5, -z * 0.5);
|
|
43093
43218
|
outMax.set(x * 0.5, y * 0.5, z * 0.5);
|
|
@@ -43109,7 +43234,6 @@
|
|
|
43109
43234
|
]);
|
|
43110
43235
|
return BoxShape;
|
|
43111
43236
|
}(BaseShape);
|
|
43112
|
-
BoxShape._tempVector30 = new Vector3();
|
|
43113
43237
|
__decorate$1([
|
|
43114
43238
|
deepClone
|
|
43115
43239
|
], BoxShape.prototype, "_size", void 0);
|
|
@@ -43122,18 +43246,18 @@
|
|
|
43122
43246
|
}({});
|
|
43123
43247
|
/**
|
|
43124
43248
|
* Particle shape that emits particles from a circle.
|
|
43125
|
-
*/ var CircleShape = /*#__PURE__*/ function(
|
|
43126
|
-
_inherits$2(CircleShape,
|
|
43249
|
+
*/ var CircleShape = /*#__PURE__*/ function(BaseShape1) {
|
|
43250
|
+
_inherits$2(CircleShape, BaseShape1);
|
|
43127
43251
|
function CircleShape() {
|
|
43128
43252
|
var _this;
|
|
43129
|
-
_this =
|
|
43253
|
+
_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;
|
|
43130
43254
|
return _this;
|
|
43131
43255
|
}
|
|
43132
43256
|
var _proto = CircleShape.prototype;
|
|
43133
43257
|
/**
|
|
43134
43258
|
* @internal
|
|
43135
|
-
*/ _proto.
|
|
43136
|
-
var positionPoint =
|
|
43259
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43260
|
+
var positionPoint = BaseShape._tempVector20;
|
|
43137
43261
|
switch(this.arcMode){
|
|
43138
43262
|
case ParticleShapeArcMode.Loop:
|
|
43139
43263
|
var normalizedEmitTime = emitTime * this.arcSpeed * (360 / this.arc) % 1;
|
|
@@ -43152,7 +43276,7 @@
|
|
|
43152
43276
|
};
|
|
43153
43277
|
/**
|
|
43154
43278
|
* @internal
|
|
43155
|
-
*/ _proto.
|
|
43279
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43156
43280
|
var randomDirZ = this.randomDirectionAmount > 0.5 ? 1 : Math.sin(this.randomDirectionAmount * Math.PI);
|
|
43157
43281
|
var randomDegreeOnXY = 0.5 * (360 - this._arc) * this.randomDirectionAmount;
|
|
43158
43282
|
var randomDirY = randomDegreeOnXY > 90 ? -1 : -Math.sin(randomDegreeOnXY);
|
|
@@ -43160,7 +43284,7 @@
|
|
|
43160
43284
|
};
|
|
43161
43285
|
/**
|
|
43162
43286
|
* @internal
|
|
43163
|
-
*/ _proto.
|
|
43287
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43164
43288
|
this._getUnitArcRange(this._arc, outMin, outMax, 0, 0);
|
|
43165
43289
|
outMin.scale(this._radius);
|
|
43166
43290
|
outMax.scale(this._radius);
|
|
@@ -43243,21 +43367,20 @@
|
|
|
43243
43367
|
]);
|
|
43244
43368
|
return CircleShape;
|
|
43245
43369
|
}(BaseShape);
|
|
43246
|
-
CircleShape._tempPositionPoint = new Vector2();
|
|
43247
43370
|
/**
|
|
43248
43371
|
* Cone shape.
|
|
43249
|
-
*/ var ConeShape = /*#__PURE__*/ function(
|
|
43250
|
-
_inherits$2(ConeShape,
|
|
43372
|
+
*/ var ConeShape = /*#__PURE__*/ function(BaseShape1) {
|
|
43373
|
+
_inherits$2(ConeShape, BaseShape1);
|
|
43251
43374
|
function ConeShape() {
|
|
43252
43375
|
var _this;
|
|
43253
|
-
_this =
|
|
43376
|
+
_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;
|
|
43254
43377
|
return _this;
|
|
43255
43378
|
}
|
|
43256
43379
|
var _proto = ConeShape.prototype;
|
|
43257
43380
|
/**
|
|
43258
43381
|
* @internal
|
|
43259
|
-
*/ _proto.
|
|
43260
|
-
var unitPosition =
|
|
43382
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43383
|
+
var unitPosition = BaseShape._tempVector20;
|
|
43261
43384
|
var radian = MathUtil.degreeToRadian(this.angle);
|
|
43262
43385
|
var dirSinA = Math.sin(radian);
|
|
43263
43386
|
var dirCosA = Math.cos(radian);
|
|
@@ -43265,7 +43388,7 @@
|
|
|
43265
43388
|
case 0:
|
|
43266
43389
|
ShapeUtils.randomPointInsideUnitCircle(unitPosition, rand);
|
|
43267
43390
|
position.set(unitPosition.x * this.radius, unitPosition.y * this.radius, 0);
|
|
43268
|
-
var unitDirection =
|
|
43391
|
+
var unitDirection = BaseShape._tempVector21;
|
|
43269
43392
|
ShapeUtils.randomPointInsideUnitCircle(unitDirection, rand);
|
|
43270
43393
|
Vector2.lerp(unitPosition, unitDirection, this.randomDirectionAmount, unitDirection);
|
|
43271
43394
|
direction.set(unitDirection.x * dirSinA, unitDirection.y * dirSinA, -dirCosA);
|
|
@@ -43275,10 +43398,10 @@
|
|
|
43275
43398
|
position.set(unitPosition.x * this.radius, unitPosition.y * this.radius, 0);
|
|
43276
43399
|
direction.set(unitPosition.x * dirSinA, unitPosition.y * dirSinA, -dirCosA);
|
|
43277
43400
|
direction.normalize();
|
|
43278
|
-
var distance =
|
|
43401
|
+
var distance = BaseShape._tempVector30;
|
|
43279
43402
|
Vector3.scale(direction, this.length * rand.random(), distance);
|
|
43280
43403
|
position.add(distance);
|
|
43281
|
-
var randomDirection =
|
|
43404
|
+
var randomDirection = BaseShape._tempVector31;
|
|
43282
43405
|
ShapeUtils._randomPointUnitSphere(randomDirection, rand);
|
|
43283
43406
|
Vector3.lerp(direction, randomDirection, this.randomDirectionAmount, direction);
|
|
43284
43407
|
break;
|
|
@@ -43286,7 +43409,7 @@
|
|
|
43286
43409
|
};
|
|
43287
43410
|
/**
|
|
43288
43411
|
* @internal
|
|
43289
|
-
*/ _proto.
|
|
43412
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43290
43413
|
var radian = 0;
|
|
43291
43414
|
switch(this.emitType){
|
|
43292
43415
|
case 0:
|
|
@@ -43303,7 +43426,7 @@
|
|
|
43303
43426
|
};
|
|
43304
43427
|
/**
|
|
43305
43428
|
* @internal
|
|
43306
|
-
*/ _proto.
|
|
43429
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43307
43430
|
var radius = this.radius;
|
|
43308
43431
|
switch(this.emitType){
|
|
43309
43432
|
case 0:
|
|
@@ -43378,10 +43501,6 @@
|
|
|
43378
43501
|
]);
|
|
43379
43502
|
return ConeShape;
|
|
43380
43503
|
}(BaseShape);
|
|
43381
|
-
ConeShape._tempVector20 = new Vector2();
|
|
43382
|
-
ConeShape._tempVector21 = new Vector2();
|
|
43383
|
-
ConeShape._tempVector30 = new Vector3();
|
|
43384
|
-
ConeShape._tempVector31 = new Vector3();
|
|
43385
43504
|
/**
|
|
43386
43505
|
* Cone emitter type.
|
|
43387
43506
|
*/ var ConeEmitType = /*#__PURE__*/ function(ConeEmitType) {
|
|
@@ -43401,7 +43520,7 @@
|
|
|
43401
43520
|
var _proto = HemisphereShape.prototype;
|
|
43402
43521
|
/**
|
|
43403
43522
|
* @internal
|
|
43404
|
-
*/ _proto.
|
|
43523
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43405
43524
|
ShapeUtils._randomPointInsideUnitSphere(position, rand);
|
|
43406
43525
|
position.scale(this.radius);
|
|
43407
43526
|
var z = position.z;
|
|
@@ -43411,14 +43530,14 @@
|
|
|
43411
43530
|
};
|
|
43412
43531
|
/**
|
|
43413
43532
|
* @internal
|
|
43414
|
-
*/ _proto.
|
|
43533
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43415
43534
|
var randomDir = Math.sin(0.5 * this.randomDirectionAmount * Math.PI);
|
|
43416
43535
|
outMin.set(-1, -1, -1);
|
|
43417
43536
|
outMax.set(1, 1, randomDir);
|
|
43418
43537
|
};
|
|
43419
43538
|
/**
|
|
43420
43539
|
* @internal
|
|
43421
|
-
*/ _proto.
|
|
43540
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43422
43541
|
var radius = this._radius;
|
|
43423
43542
|
outMin.set(-radius, -radius, -radius);
|
|
43424
43543
|
outMax.set(radius, radius, 0);
|
|
@@ -43455,7 +43574,7 @@
|
|
|
43455
43574
|
var _proto = MeshShape.prototype;
|
|
43456
43575
|
/**
|
|
43457
43576
|
* @internal
|
|
43458
|
-
*/ _proto.
|
|
43577
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43459
43578
|
var _this = this, positions = _this._positionBuffer, positionInfo = _this._positionElementInfo, normals = _this._normalBuffer, normalInfo = _this._normalElementInfo;
|
|
43460
43579
|
var randomIndex = Math.floor(rand.random() * this._mesh.vertexCount);
|
|
43461
43580
|
// index = randomIndex * stride + offset
|
|
@@ -43468,14 +43587,14 @@
|
|
|
43468
43587
|
};
|
|
43469
43588
|
/**
|
|
43470
43589
|
* @internal
|
|
43471
|
-
*/ _proto.
|
|
43590
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43472
43591
|
var bounds = this._mesh.bounds;
|
|
43473
43592
|
bounds.min.copyTo(outMin);
|
|
43474
43593
|
bounds.max.copyTo(outMax);
|
|
43475
43594
|
};
|
|
43476
43595
|
/**
|
|
43477
43596
|
* @internal
|
|
43478
|
-
*/ _proto.
|
|
43597
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43479
43598
|
// @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.
|
|
43480
43599
|
var bounds = this._mesh.bounds;
|
|
43481
43600
|
bounds.min.copyTo(outMin);
|
|
@@ -43589,7 +43708,7 @@
|
|
|
43589
43708
|
var _proto = SphereShape.prototype;
|
|
43590
43709
|
/**
|
|
43591
43710
|
* @internal
|
|
43592
|
-
*/ _proto.
|
|
43711
|
+
*/ _proto._generateLocalPositionAndDirection = function _generateLocalPositionAndDirection(rand, emitTime, position, direction) {
|
|
43593
43712
|
ShapeUtils._randomPointInsideUnitSphere(position, rand);
|
|
43594
43713
|
position.scale(this.radius);
|
|
43595
43714
|
ShapeUtils._randomPointUnitSphere(direction, rand);
|
|
@@ -43597,13 +43716,13 @@
|
|
|
43597
43716
|
};
|
|
43598
43717
|
/**
|
|
43599
43718
|
* @internal
|
|
43600
|
-
*/ _proto.
|
|
43719
|
+
*/ _proto._getLocalDirectionRange = function _getLocalDirectionRange(outMin, outMax) {
|
|
43601
43720
|
outMin.set(-1, -1, -1);
|
|
43602
43721
|
outMax.set(1, 1, 1);
|
|
43603
43722
|
};
|
|
43604
43723
|
/**
|
|
43605
43724
|
* @internal
|
|
43606
|
-
*/ _proto.
|
|
43725
|
+
*/ _proto._getLocalPositionRange = function _getLocalPositionRange(outMin, outMax) {
|
|
43607
43726
|
var radius = this._radius;
|
|
43608
43727
|
outMin.set(-radius, -radius, -radius);
|
|
43609
43728
|
outMax.set(radius, radius, radius);
|
|
@@ -44355,7 +44474,7 @@
|
|
|
44355
44474
|
* Suspend the audio context.
|
|
44356
44475
|
* @returns A promise that resolves when the audio context is suspended
|
|
44357
44476
|
*/ AudioManager.suspend = function suspend() {
|
|
44358
|
-
return AudioManager.
|
|
44477
|
+
return AudioManager.getContext().suspend();
|
|
44359
44478
|
};
|
|
44360
44479
|
/**
|
|
44361
44480
|
* Resume the audio context.
|
|
@@ -44364,7 +44483,7 @@
|
|
|
44364
44483
|
*/ AudioManager.resume = function resume() {
|
|
44365
44484
|
var _AudioManager;
|
|
44366
44485
|
var __resumePromise;
|
|
44367
|
-
return (__resumePromise = (_AudioManager = AudioManager)._resumePromise) != null ? __resumePromise : _AudioManager._resumePromise = AudioManager.
|
|
44486
|
+
return (__resumePromise = (_AudioManager = AudioManager)._resumePromise) != null ? __resumePromise : _AudioManager._resumePromise = AudioManager.getContext().resume().then(function() {
|
|
44368
44487
|
AudioManager._needsUserGestureResume = false;
|
|
44369
44488
|
}).finally(function() {
|
|
44370
44489
|
AudioManager._resumePromise = null;
|
|
@@ -54738,7 +54857,7 @@
|
|
|
54738
54857
|
], EXT_texture_webp);
|
|
54739
54858
|
|
|
54740
54859
|
//@ts-ignore
|
|
54741
|
-
var version = "2.0.0-alpha.
|
|
54860
|
+
var version = "2.0.0-alpha.28";
|
|
54742
54861
|
console.log("Galacean Engine Version: " + version);
|
|
54743
54862
|
for(var key in CoreObjects){
|
|
54744
54863
|
Loader.registerClass(key, CoreObjects[key]);
|