@galacean/engine-core 0.0.0-experimental-2.0-game.13 → 0.0.0-experimental-2.0-game.15
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/main.js +230 -80
- package/dist/main.js.map +1 -1
- package/dist/module.js +230 -81
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/animation/AnimationClip.d.ts +7 -1
- package/types/animation/Animator.d.ts +3 -1
- package/types/animation/internal/AnimatorStatePlayData.d.ts +3 -3
- package/types/particle/modules/EmissionModule.d.ts +5 -0
- package/types/physics/Collider.d.ts +8 -0
- package/types/physics/DynamicCollider.d.ts +20 -0
- package/types/physics/index.d.ts +1 -1
package/dist/main.js
CHANGED
|
@@ -353,10 +353,14 @@ function _instanceof(left, right) {
|
|
|
353
353
|
if (_instanceof(sourceProperty, Map) || _instanceof(sourceProperty, Set)) return CloneMode.Deep;
|
|
354
354
|
// Value types with copyFrom (math types like Vector3, Color, etc.)
|
|
355
355
|
if (sourceProperty.copyFrom) return CloneMode.Deep;
|
|
356
|
-
//
|
|
357
|
-
|
|
358
|
-
//
|
|
359
|
-
return CloneMode.Assignment;
|
|
356
|
+
// Engine resources (Material, Texture, Mesh, Shader, ...) — refCount-managed,
|
|
357
|
+
// shared by reference. Anything outside this contract is treated as a value-like
|
|
358
|
+
// user class and gets a deep clone (so nested Entity/Component refs are remapped).
|
|
359
|
+
if (_instanceof(sourceProperty, ReferResource)) return CloneMode.Assignment;
|
|
360
|
+
// Default: deep clone. Covers plain objects {...} and user-defined value classes
|
|
361
|
+
// (EventHandler, business data containers). Internal Entity/Component refs reach
|
|
362
|
+
// line 109's _remap branch and are correctly rebound to the target tree.
|
|
363
|
+
return CloneMode.Deep;
|
|
360
364
|
};
|
|
361
365
|
CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
|
|
362
366
|
for(var k in source){
|
|
@@ -7360,7 +7364,7 @@ var particle_common = "vec3 rotationByQuaternions(in vec3 v, in vec4 q) {\n r
|
|
|
7360
7364
|
|
|
7361
7365
|
var velocity_over_lifetime_module = "#if defined(RENDERER_VOL_CONSTANT_MODE) || defined(RENDERER_VOL_CURVE_MODE)\n #define _VOL_MODULE_ENABLED\n#endif\n\n#ifdef _VOL_MODULE_ENABLED\n uniform int renderer_VOLSpace;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n uniform vec3 renderer_VOLMaxConst;\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec3 renderer_VOLMinConst;\n #endif\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n uniform vec2 renderer_VOLMaxGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMaxGradientZ[4]; // x:time y:value\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n uniform vec2 renderer_VOLMinGradientX[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientY[4]; // x:time y:value\n uniform vec2 renderer_VOLMinGradientZ[4]; // x:time y:value\n #endif\n #endif\n\n\n vec3 computeVelocityPositionOffset(in float normalizedAge, in float age, out vec3 currentVelocity) {\n vec3 velocityPosition;\n\n #ifdef RENDERER_VOL_CONSTANT_MODE\n currentVelocity = renderer_VOLMaxConst;\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n currentVelocity = mix(renderer_VOLMinConst, currentVelocity, a_Random1.yzw);\n #endif\n\n velocityPosition = currentVelocity * age;\n #endif\n\n #ifdef RENDERER_VOL_CURVE_MODE\n velocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientX, normalizedAge, currentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientY, normalizedAge, currentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMaxGradientZ, normalizedAge, currentVelocity.z));\n\n #ifdef RENDERER_VOL_IS_RANDOM_TWO\n vec3 minCurrentVelocity;\n vec3 minVelocityPosition = vec3(\n evaluateParticleCurveCumulative(renderer_VOLMinGradientX, normalizedAge, minCurrentVelocity.x),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientY, normalizedAge, minCurrentVelocity.y),\n evaluateParticleCurveCumulative(renderer_VOLMinGradientZ, normalizedAge, minCurrentVelocity.z));\n\n currentVelocity = mix(minCurrentVelocity, currentVelocity, a_Random1.yzw);\n velocityPosition = mix(minVelocityPosition, velocityPosition, a_Random1.yzw);\n #endif\n\n velocityPosition *= vec3(a_ShapePositionStartLifeTime.w);\n #endif\n return velocityPosition;\n }\n#endif\n"; // eslint-disable-line
|
|
7362
7366
|
|
|
7363
|
-
var rotation_over_lifetime_module = "#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n uniform vec2 renderer_ROLMaxCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMaxCurveX[4];\n uniform vec2 renderer_ROLMaxCurveY[4];\n #endif\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec2 renderer_ROLMinCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMinCurveX[4];\n uniform vec2 renderer_ROLMinCurveY[4];\n #endif\n #endif\n #else\n uniform vec3 renderer_ROLMaxConst;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec3 renderer_ROLMinConst;\n #endif\n #endif\n#endif\n\nfloat computeParticleRotationFloat(in float rotation, in float age, in float normalizedAge) {\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #else\n float lifeRotation = renderer_ROLMaxConst.z;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(renderer_ROLMinConst.z, lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * age;\n #endif\n #endif\n return rotation;\n}\n\n\n#if defined(RENDERER_MODE_MESH) && (defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE))\nvec3 computeParticleRotationVec3(in vec3 rotation, in float age, in float normalizedAge) {\n #ifdef RENDERER_ROL_IS_SEPARATE\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n vec3 ageRot = mix(renderer_ROLMinConst, renderer_ROLMaxConst, a_Random0.w) * age;\n #else\n vec3 ageRot = renderer_ROLMaxConst * age;\n #endif\n rotation += ageRot;\n #endif\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifetime = a_ShapePositionStartLifeTime.w;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n rotation += vec3(\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue), a_Random0.w)) * lifetime;\n #else\n rotation += vec3(\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue)) * lifetime;\n #endif\n #endif\n #else\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n float ageRot = mix(renderer_ROLMinConst.z, renderer_ROLMaxConst.z, a_Random0.w) * age;\n #else\n float ageRot = renderer_ROLMaxConst.z * age;\n #endif\n rotation += ageRot;\n #endif\n\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #endif\n #endif\n return rotation;\n}\n#endif\n"; // eslint-disable-line
|
|
7367
|
+
var rotation_over_lifetime_module = "#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n uniform vec2 renderer_ROLMaxCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMaxCurveX[4];\n uniform vec2 renderer_ROLMaxCurveY[4];\n #endif\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec2 renderer_ROLMinCurveZ[4];\n #ifdef RENDERER_ROL_IS_SEPARATE\n uniform vec2 renderer_ROLMinCurveX[4];\n uniform vec2 renderer_ROLMinCurveY[4];\n #endif\n #endif\n #else\n uniform vec3 renderer_ROLMaxConst;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n uniform vec3 renderer_ROLMinConst;\n #endif\n #endif\n#endif\n\nfloat computeParticleRotationFloat(in float rotation, in float age, in float normalizedAge) {\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * a_ShapePositionStartLifeTime.w;\n #else\n float lifeRotation = renderer_ROLMaxConst.z;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(renderer_ROLMinConst.z, lifeRotation, a_Random0.w);\n #endif\n rotation += lifeRotation * age;\n #endif\n #endif\n return rotation;\n}\n\n\n#if defined(RENDERER_MODE_MESH) && (defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE))\nvec3 computeParticleRotationVec3(in vec3 rotation, in float age, in float normalizedAge) {\n #ifdef RENDERER_ROL_IS_SEPARATE\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n vec3 ageRot = mix(renderer_ROLMinConst, renderer_ROLMaxConst, a_Random0.w) * age;\n #else\n vec3 ageRot = renderer_ROLMaxConst * age;\n #endif\n rotation += ageRot;\n #endif\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifetime = a_ShapePositionStartLifeTime.w;\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n rotation += vec3(\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue), a_Random0.w),\n mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue), a_Random0.w)) * lifetime;\n #else\n rotation += vec3(\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveX, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveY, normalizedAge, currentValue),\n evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue)) * lifetime;\n #endif\n #endif\n #else\n #ifdef RENDERER_ROL_CONSTANT_MODE\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n float ageRot = mix(renderer_ROLMinConst.z, renderer_ROLMaxConst.z, a_Random0.w) * age;\n #else\n float ageRot = renderer_ROLMaxConst.z * age;\n #endif\n rotation.z += ageRot;\n #endif\n\n #ifdef RENDERER_ROL_CURVE_MODE\n float currentValue;\n float lifeRotation = evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ, normalizedAge, currentValue);\n #ifdef RENDERER_ROL_IS_RANDOM_TWO\n lifeRotation = mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ, normalizedAge, currentValue), lifeRotation, a_Random0.w);\n #endif\n rotation.z += lifeRotation * a_ShapePositionStartLifeTime.w;\n #endif\n #endif\n return rotation;\n}\n#endif\n"; // eslint-disable-line
|
|
7364
7368
|
|
|
7365
7369
|
var size_over_lifetime_module = "#ifdef RENDERER_SOL_CURVE_MODE\n uniform vec2 renderer_SOLMaxCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMaxCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMaxCurveZ[4]; // x:time y:value\n #endif\n\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n uniform vec2 renderer_SOLMinCurveX[4]; // x:time y:value\n #ifdef RENDERER_SOL_IS_SEPARATE\n uniform vec2 renderer_SOLMinCurveY[4]; // x:time y:value\n uniform vec2 renderer_SOLMinCurveZ[4]; // x:time y:value\n #endif\n #endif\n#endif\n\nvec2 computeParticleSizeBillboard(in vec2 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE_MODE\n float lifeSizeX = evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeX = mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge), lifeSizeX, a_Random0.z);\n #endif\n\n #ifdef RENDERER_SOL_IS_SEPARATE\n float lifeSizeY = evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge);\n #ifdef RENDERER_SOL_IS_RANDOM_TWO\n lifeSizeY = mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge), lifeSizeY, a_Random0.z);\n #endif\n size *= vec2(lifeSizeX, lifeSizeY);\n #else\n size *= lifeSizeX;\n #endif\n #endif\n return size;\n}\n\n#ifdef RENDERER_MODE_MESH\n vec3 computeParticleSizeMesh(in vec3 size, in float normalizedAge) {\n #ifdef RENDERER_SOL_CURVE\n size *= evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge);\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES\n size *= mix(evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n evaluateParticleCurve(u_SOLSizeGradientMax, normalizedAge),\n a_Random0.z);\n #endif\n #ifdef RENDERER_SOL_CURVE_SEPARATE\n size *= vec3(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge));\n #endif\n #ifdef RENDERER_SOL_RANDOM_CURVES_SEPARATE\n size *= vec3(mix(evaluateParticleCurve(renderer_SOLMinCurveX, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveX, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveY, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveY, normalizedAge),\n a_Random0.z),\n mix(evaluateParticleCurve(renderer_SOLMinCurveZ, normalizedAge),\n evaluateParticleCurve(renderer_SOLMaxCurveZ, normalizedAge),\n a_Random0.z));\n #endif\n return size;\n }\n#endif"; // eslint-disable-line
|
|
7366
7370
|
|
|
@@ -20559,7 +20563,13 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20559
20563
|
_inherits(Collider, Component);
|
|
20560
20564
|
function Collider(entity) {
|
|
20561
20565
|
var _this;
|
|
20562
|
-
_this = Component.call(this, entity) || this, /** @internal */ _this._index = -1, _this._shapes = [], _this._collisionLayerIndex = 0
|
|
20566
|
+
_this = Component.call(this, entity) || this, /** @internal */ _this._index = -1, _this._shapes = [], _this._collisionLayerIndex = 0, /**
|
|
20567
|
+
* Disabling a collider only detaches its native actor from the simulation
|
|
20568
|
+
* scene; the actor is not destroyed, so on re-enable it still holds its
|
|
20569
|
+
* pre-disable pose. The first transform sync after (re-)enable must teleport,
|
|
20570
|
+
* never sweep — otherwise a kinematic actor drags across the scene from that
|
|
20571
|
+
* stale pose and fires spurious contacts along the path.
|
|
20572
|
+
*/ _this._pendingReenterTeleport = false;
|
|
20563
20573
|
_this._updateFlag = entity.registerWorldChangeFlag();
|
|
20564
20574
|
return _this;
|
|
20565
20575
|
}
|
|
@@ -20603,9 +20613,14 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20603
20613
|
* @internal
|
|
20604
20614
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
20605
20615
|
var shapes = this._shapes;
|
|
20606
|
-
if (this._updateFlag.flag) {
|
|
20616
|
+
if (this._pendingReenterTeleport || this._updateFlag.flag) {
|
|
20607
20617
|
var transform = this.entity.transform;
|
|
20608
|
-
this.
|
|
20618
|
+
if (this._pendingReenterTeleport) {
|
|
20619
|
+
this._teleportToEntityTransform(transform.worldPosition, transform.worldRotationQuaternion);
|
|
20620
|
+
this._pendingReenterTeleport = false;
|
|
20621
|
+
} else {
|
|
20622
|
+
this._syncEntityTransformToNative(transform.worldPosition, transform.worldRotationQuaternion);
|
|
20623
|
+
}
|
|
20609
20624
|
var worldScale = transform.lossyWorldScale;
|
|
20610
20625
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
20611
20626
|
var _shapes_i__nativeShape;
|
|
@@ -20627,6 +20642,7 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20627
20642
|
* @internal
|
|
20628
20643
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
20629
20644
|
this.scene.physics._addCollider(this);
|
|
20645
|
+
this._pendingReenterTeleport = true;
|
|
20630
20646
|
};
|
|
20631
20647
|
/**
|
|
20632
20648
|
* @internal
|
|
@@ -20745,6 +20761,9 @@ __decorate([
|
|
|
20745
20761
|
__decorate([
|
|
20746
20762
|
deepClone
|
|
20747
20763
|
], exports.Collider.prototype, "_shapes", void 0);
|
|
20764
|
+
__decorate([
|
|
20765
|
+
ignoreClone
|
|
20766
|
+
], exports.Collider.prototype, "_pendingReenterTeleport", void 0);
|
|
20748
20767
|
exports.Collider = __decorate([
|
|
20749
20768
|
dependentComponents(Transform, DependentMode.CheckOnly)
|
|
20750
20769
|
], exports.Collider);
|
|
@@ -21045,7 +21064,6 @@ __decorate([
|
|
|
21045
21064
|
this._isTrigger = false;
|
|
21046
21065
|
this._rotation = new engineMath.Vector3();
|
|
21047
21066
|
this._position = new engineMath.Vector3();
|
|
21048
|
-
this._contactOffset = 0.02;
|
|
21049
21067
|
/**
|
|
21050
21068
|
* @internal
|
|
21051
21069
|
* @beta
|
|
@@ -21111,7 +21129,9 @@ __decorate([
|
|
|
21111
21129
|
if (!this._nativeShape) return;
|
|
21112
21130
|
this._nativeShape.setPosition(this._position);
|
|
21113
21131
|
this._nativeShape.setRotation(this._rotation);
|
|
21114
|
-
|
|
21132
|
+
if (this._contactOffset !== undefined) {
|
|
21133
|
+
this._nativeShape.setContactOffset(this._contactOffset);
|
|
21134
|
+
}
|
|
21115
21135
|
this._nativeShape.setIsTrigger(this._isTrigger);
|
|
21116
21136
|
this._nativeShape.setMaterial(this._material._nativeMaterial);
|
|
21117
21137
|
(_this__collider = this._collider) == null ? void 0 : _this__collider._handleShapesChanged(ColliderShapeChangeFlag.Property);
|
|
@@ -21149,7 +21169,9 @@ __decorate([
|
|
|
21149
21169
|
* Contact offset for this shape, the value must be greater than or equal to 0.
|
|
21150
21170
|
* @defaultValue 0.02
|
|
21151
21171
|
*/ function get() {
|
|
21152
|
-
|
|
21172
|
+
var _Engine__nativePhysics_getDefaultContactOffset, _Engine__nativePhysics;
|
|
21173
|
+
var _this__contactOffset, _ref;
|
|
21174
|
+
return (_ref = (_this__contactOffset = this._contactOffset) != null ? _this__contactOffset : (_Engine__nativePhysics = Engine._nativePhysics) == null ? void 0 : (_Engine__nativePhysics_getDefaultContactOffset = _Engine__nativePhysics.getDefaultContactOffset) == null ? void 0 : _Engine__nativePhysics_getDefaultContactOffset.call(_Engine__nativePhysics)) != null ? _ref : 0.02;
|
|
21153
21175
|
},
|
|
21154
21176
|
set: function set(value) {
|
|
21155
21177
|
value = Math.max(0, value);
|
|
@@ -21472,7 +21494,7 @@ __decorate([
|
|
|
21472
21494
|
_inherits(DynamicCollider, Collider);
|
|
21473
21495
|
function DynamicCollider(entity) {
|
|
21474
21496
|
var _this;
|
|
21475
|
-
_this = Collider.call(this, entity) || this, _this._linearDamping = 0, _this._angularDamping = 0.05, _this._linearVelocity = new engineMath.Vector3(), _this._angularVelocity = new engineMath.Vector3(), _this._mass = 1.0, _this._centerOfMass = new engineMath.Vector3(), _this._inertiaTensor = new engineMath.Vector3(1, 1, 1), _this._maxAngularVelocity = 18000 / Math.PI, _this._maxDepenetrationVelocity = 1.0000000331813535e32, _this._solverIterations = 4, _this._useGravity = true, _this._isKinematic = false, _this._constraints = 0, _this._collisionDetectionMode = 0, _this.
|
|
21497
|
+
_this = Collider.call(this, entity) || this, _this._linearDamping = 0, _this._angularDamping = 0.05, _this._linearVelocity = new engineMath.Vector3(), _this._angularVelocity = new engineMath.Vector3(), _this._mass = 1.0, _this._centerOfMass = new engineMath.Vector3(), _this._inertiaTensor = new engineMath.Vector3(1, 1, 1), _this._maxAngularVelocity = 18000 / Math.PI, _this._maxDepenetrationVelocity = 1.0000000331813535e32, _this._solverIterations = 4, _this._useGravity = true, _this._isKinematic = false, _this._constraints = 0, _this._collisionDetectionMode = 0, _this._kinematicTransformSyncMode = 0, _this._automaticCenterOfMass = true, _this._automaticInertiaTensor = true;
|
|
21476
21498
|
var transform = _this.entity.transform;
|
|
21477
21499
|
_this._nativeCollider = Engine._nativePhysics.createDynamicCollider(transform.worldPosition, transform.worldRotationQuaternion);
|
|
21478
21500
|
_this._setLinearVelocity = _this._setLinearVelocity.bind(_this);
|
|
@@ -21564,17 +21586,14 @@ __decorate([
|
|
|
21564
21586
|
* collision detection, use setKinematicTarget() instead."
|
|
21565
21587
|
*
|
|
21566
21588
|
* setGlobalPose is a teleport: PhysX skips contact detection between the old
|
|
21567
|
-
* and new pose
|
|
21568
|
-
*
|
|
21569
|
-
*
|
|
21570
|
-
*
|
|
21571
|
-
* setKinematicTarget) tells PhysX the actor is animating to the target during the
|
|
21572
|
-
* next simulate(), enabling sweep contact detection for kine-kine and kine-dynamic
|
|
21573
|
-
* pairs alike.
|
|
21589
|
+
* and new pose. setKinematicTarget tells PhysX the actor is animating to the
|
|
21590
|
+
* target during the next simulate(), enabling swept contacts. Some compatibility
|
|
21591
|
+
* layers need transform writes to stay teleport-like, so the sync mode is
|
|
21592
|
+
* explicit while {@link move} always keeps target semantics.
|
|
21574
21593
|
*
|
|
21575
21594
|
* @internal
|
|
21576
21595
|
*/ _proto._syncEntityTransformToNative = function _syncEntityTransformToNative(worldPosition, worldRotation) {
|
|
21577
|
-
if (this._isKinematic) {
|
|
21596
|
+
if (this._isKinematic && this._kinematicTransformSyncMode === 0) {
|
|
21578
21597
|
this._nativeCollider.move(worldPosition, worldRotation);
|
|
21579
21598
|
} else {
|
|
21580
21599
|
Collider.prototype._syncEntityTransformToNative.call(this, worldPosition, worldRotation);
|
|
@@ -21604,6 +21623,7 @@ __decorate([
|
|
|
21604
21623
|
target._angularVelocity.copyFrom(this.angularVelocity);
|
|
21605
21624
|
target._centerOfMass.copyFrom(this.centerOfMass);
|
|
21606
21625
|
target._inertiaTensor.copyFrom(this.inertiaTensor);
|
|
21626
|
+
target._kinematicTransformSyncMode = this._kinematicTransformSyncMode;
|
|
21607
21627
|
Collider.prototype._cloneTo.call(this, target);
|
|
21608
21628
|
};
|
|
21609
21629
|
/**
|
|
@@ -21629,7 +21649,9 @@ __decorate([
|
|
|
21629
21649
|
}
|
|
21630
21650
|
this._nativeCollider.setMaxAngularVelocity(this._maxAngularVelocity);
|
|
21631
21651
|
this._nativeCollider.setMaxDepenetrationVelocity(this._maxDepenetrationVelocity);
|
|
21632
|
-
|
|
21652
|
+
if (this._sleepThreshold !== undefined) {
|
|
21653
|
+
this._nativeCollider.setSleepThreshold(this._sleepThreshold);
|
|
21654
|
+
}
|
|
21633
21655
|
this._nativeCollider.setSolverIterations(this._solverIterations);
|
|
21634
21656
|
this._nativeCollider.setUseGravity(this._useGravity);
|
|
21635
21657
|
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
@@ -21853,7 +21875,9 @@ __decorate([
|
|
|
21853
21875
|
get: /**
|
|
21854
21876
|
* The mass-normalized energy threshold, below which objects start going to sleep.
|
|
21855
21877
|
*/ function get() {
|
|
21856
|
-
|
|
21878
|
+
var _Engine__nativePhysics_getDefaultSleepThreshold, _Engine__nativePhysics;
|
|
21879
|
+
var _this__sleepThreshold, _ref;
|
|
21880
|
+
return (_ref = (_this__sleepThreshold = this._sleepThreshold) != null ? _this__sleepThreshold : (_Engine__nativePhysics = Engine._nativePhysics) == null ? void 0 : (_Engine__nativePhysics_getDefaultSleepThreshold = _Engine__nativePhysics.getDefaultSleepThreshold) == null ? void 0 : _Engine__nativePhysics_getDefaultSleepThreshold.call(_Engine__nativePhysics)) != null ? _ref : 5e-3;
|
|
21857
21881
|
},
|
|
21858
21882
|
set: function set(value) {
|
|
21859
21883
|
if (value !== this._sleepThreshold) {
|
|
@@ -21949,6 +21973,22 @@ __decorate([
|
|
|
21949
21973
|
this._nativeCollider.setCollisionDetectionMode(value);
|
|
21950
21974
|
}
|
|
21951
21975
|
}
|
|
21976
|
+
},
|
|
21977
|
+
{
|
|
21978
|
+
key: "kinematicTransformSyncMode",
|
|
21979
|
+
get: /**
|
|
21980
|
+
* Controls how entity transform changes are synchronized to a kinematic native actor.
|
|
21981
|
+
*
|
|
21982
|
+
* @remarks
|
|
21983
|
+
* `Target` routes transform changes through {@link move}, so PhysX treats the
|
|
21984
|
+
* actor as moving between frames and can generate swept contacts. `Teleport`
|
|
21985
|
+
* writes the native pose directly and does not imply velocity.
|
|
21986
|
+
*/ function get() {
|
|
21987
|
+
return this._kinematicTransformSyncMode;
|
|
21988
|
+
},
|
|
21989
|
+
set: function set(value) {
|
|
21990
|
+
this._kinematicTransformSyncMode = value;
|
|
21991
|
+
}
|
|
21952
21992
|
}
|
|
21953
21993
|
]);
|
|
21954
21994
|
return DynamicCollider;
|
|
@@ -21990,6 +22030,13 @@ __decorate([
|
|
|
21990
22030
|
/** Speculative continuous collision detection is on for static and dynamic geometries */ CollisionDetectionMode[CollisionDetectionMode["ContinuousSpeculative"] = 3] = "ContinuousSpeculative";
|
|
21991
22031
|
return CollisionDetectionMode;
|
|
21992
22032
|
}({});
|
|
22033
|
+
/**
|
|
22034
|
+
* Kinematic transform synchronization mode.
|
|
22035
|
+
*/ var DynamicColliderKinematicTransformSyncMode = /*#__PURE__*/ function(DynamicColliderKinematicTransformSyncMode) {
|
|
22036
|
+
/** Synchronize transform changes through PhysX setKinematicTarget. */ DynamicColliderKinematicTransformSyncMode[DynamicColliderKinematicTransformSyncMode["Target"] = 0] = "Target";
|
|
22037
|
+
/** Synchronize transform changes by directly teleporting the native actor. */ DynamicColliderKinematicTransformSyncMode[DynamicColliderKinematicTransformSyncMode["Teleport"] = 1] = "Teleport";
|
|
22038
|
+
return DynamicColliderKinematicTransformSyncMode;
|
|
22039
|
+
}({});
|
|
21993
22040
|
/**
|
|
21994
22041
|
* Use these flags to constrain motion of dynamic collider.
|
|
21995
22042
|
*/ var DynamicColliderConstraints = /*#__PURE__*/ function(DynamicColliderConstraints) {
|
|
@@ -31750,6 +31797,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
31750
31797
|
this._length = 0;
|
|
31751
31798
|
};
|
|
31752
31799
|
/**
|
|
31800
|
+
* Samples an animation at a given time.
|
|
31801
|
+
* @param entity - The animated entity
|
|
31802
|
+
* @param time - The time to sample an animation
|
|
31803
|
+
*/ _proto.sampleAnimation = function sampleAnimation(entity, time) {
|
|
31804
|
+
this._sampleAnimation(entity, time);
|
|
31805
|
+
};
|
|
31806
|
+
/**
|
|
31753
31807
|
* @internal
|
|
31754
31808
|
* Samples an animation at a given time.
|
|
31755
31809
|
* @param entity - The animated entity
|
|
@@ -32929,6 +32983,14 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
32929
32983
|
return LayerState;
|
|
32930
32984
|
}({});
|
|
32931
32985
|
|
|
32986
|
+
/**
|
|
32987
|
+
* Animation wrap mode.
|
|
32988
|
+
*/ var WrapMode = /*#__PURE__*/ function(WrapMode) {
|
|
32989
|
+
/** Play once */ WrapMode[WrapMode["Once"] = 0] = "Once";
|
|
32990
|
+
/** Loop play */ WrapMode[WrapMode["Loop"] = 1] = "Loop";
|
|
32991
|
+
return WrapMode;
|
|
32992
|
+
}({});
|
|
32993
|
+
|
|
32932
32994
|
/**
|
|
32933
32995
|
* @internal
|
|
32934
32996
|
*/ var AnimationEventHandler = /*#__PURE__*/ function() {
|
|
@@ -33040,22 +33102,15 @@ function _type_of(obj) {
|
|
|
33040
33102
|
return AnimatorStateTransition;
|
|
33041
33103
|
}();
|
|
33042
33104
|
|
|
33043
|
-
/**
|
|
33044
|
-
* Animation wrap mode.
|
|
33045
|
-
*/ var WrapMode = /*#__PURE__*/ function(WrapMode) {
|
|
33046
|
-
/** Play once */ WrapMode[WrapMode["Once"] = 0] = "Once";
|
|
33047
|
-
/** Loop play */ WrapMode[WrapMode["Loop"] = 1] = "Loop";
|
|
33048
|
-
return WrapMode;
|
|
33049
|
-
}({});
|
|
33050
|
-
|
|
33051
33105
|
/**
|
|
33052
33106
|
* Per-instance runtime data for an AnimatorState.
|
|
33053
33107
|
* Proxies read-only properties from the shared AnimatorState asset,
|
|
33054
|
-
* while providing per-instance mutable properties (e.g. speed).
|
|
33108
|
+
* while providing per-instance mutable properties (e.g. speed, wrapMode).
|
|
33055
33109
|
*/ var AnimatorStatePlayData = /*#__PURE__*/ function() {
|
|
33056
33110
|
function AnimatorStatePlayData() {
|
|
33057
33111
|
/** @internal */ this.isForward = true;
|
|
33058
33112
|
/** Per-instance speed. Initialized from AnimatorState.speed, safe to modify without affecting other instances. */ this.speed = 1.0;
|
|
33113
|
+
/** Per-instance wrap mode. Initialized from AnimatorState.wrapMode, safe to modify without affecting other instances. */ this.wrapMode = WrapMode.Loop;
|
|
33059
33114
|
this._changedOrientation = false;
|
|
33060
33115
|
}
|
|
33061
33116
|
var _proto = AnimatorStatePlayData.prototype;
|
|
@@ -33074,6 +33129,7 @@ function _type_of(obj) {
|
|
|
33074
33129
|
this.currentEventIndex = 0;
|
|
33075
33130
|
this.isForward = true;
|
|
33076
33131
|
this.speed = state.speed;
|
|
33132
|
+
this.wrapMode = state.wrapMode;
|
|
33077
33133
|
this.state._transitionCollection.needResetCurrentCheckIndex = true;
|
|
33078
33134
|
};
|
|
33079
33135
|
_proto.updateOrientation = function updateOrientation(deltaTime) {
|
|
@@ -33092,7 +33148,7 @@ function _type_of(obj) {
|
|
|
33092
33148
|
var time = this.playedTime + this.offsetFrameTime;
|
|
33093
33149
|
var duration = state._getDuration();
|
|
33094
33150
|
this.playState = AnimatorStatePlayState.Playing;
|
|
33095
|
-
if (
|
|
33151
|
+
if (this.wrapMode === WrapMode.Loop) {
|
|
33096
33152
|
time = duration ? time % duration : 0;
|
|
33097
33153
|
} else {
|
|
33098
33154
|
if (Math.abs(time) >= duration) {
|
|
@@ -33127,12 +33183,6 @@ function _type_of(obj) {
|
|
|
33127
33183
|
return this.state.clip;
|
|
33128
33184
|
}
|
|
33129
33185
|
},
|
|
33130
|
-
{
|
|
33131
|
-
key: "wrapMode",
|
|
33132
|
-
get: /** The wrap mode. */ function get() {
|
|
33133
|
-
return this.state.wrapMode;
|
|
33134
|
-
}
|
|
33135
|
-
},
|
|
33136
33186
|
{
|
|
33137
33187
|
key: "transitions",
|
|
33138
33188
|
get: /** The transitions going out of this state. */ function get() {
|
|
@@ -33175,6 +33225,8 @@ function _type_of(obj) {
|
|
|
33175
33225
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
33176
33226
|
this.curveLayerOwner = [];
|
|
33177
33227
|
this.eventHandlers = [];
|
|
33228
|
+
this.state = null;
|
|
33229
|
+
this.clipChangedListener = null;
|
|
33178
33230
|
};
|
|
33179
33231
|
|
|
33180
33232
|
/**
|
|
@@ -33183,7 +33235,7 @@ function _type_of(obj) {
|
|
|
33183
33235
|
_inherits(Animator, Component);
|
|
33184
33236
|
function Animator(entity) {
|
|
33185
33237
|
var _this;
|
|
33186
|
-
_this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = Object.create(null), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
|
|
33238
|
+
_this = Component.call(this, entity) || this, /** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None, /** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0, /** Whether the Animator sends AnimationEvent callbacks. */ _this.fireEvents = true, /** @internal */ _this._playFrameCount = -1, /** @internal */ _this._onUpdateIndex = -1, _this._updateMark = 0, _this._animatorLayersData = new Array(), _this._curveOwnerPool = Object.create(null), _this._animationEventHandlerPool = new ClearableObjectPool(AnimationEventHandler), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
|
|
33187
33239
|
layerIndex: -1,
|
|
33188
33240
|
state: null
|
|
33189
33241
|
}, _this._controlledRenderers = new Array();
|
|
@@ -33282,7 +33334,7 @@ function _type_of(obj) {
|
|
|
33282
33334
|
* @param layerIndex - The layer index(default -1). If layer is -1, find the first state with the given state name
|
|
33283
33335
|
*/ /**
|
|
33284
33336
|
* Find the per-instance play data for a state by name.
|
|
33285
|
-
* The returned object's `speed`
|
|
33337
|
+
* The returned object's `speed` and `wrapMode` are per-instance and safe to modify without affecting other Animator instances.
|
|
33286
33338
|
* @param stateName - The state name
|
|
33287
33339
|
* @param layerIndex - The layer index (default -1, searches all layers)
|
|
33288
33340
|
* @returns Per-instance AnimatorStatePlayData, or null if not found
|
|
@@ -33387,6 +33439,18 @@ function _type_of(obj) {
|
|
|
33387
33439
|
owner.revertDefaultValue();
|
|
33388
33440
|
}
|
|
33389
33441
|
}
|
|
33442
|
+
var layersData = this._animatorLayersData;
|
|
33443
|
+
for(var i = 0, n = layersData.length; i < n; i++){
|
|
33444
|
+
var stateDataMap = layersData[i].animatorStateDataMap;
|
|
33445
|
+
for(var stateName in stateDataMap){
|
|
33446
|
+
var stateData = stateDataMap[stateName];
|
|
33447
|
+
if (stateData.clipChangedListener && stateData.state) {
|
|
33448
|
+
stateData.state._updateFlagManager.removeListener(stateData.clipChangedListener);
|
|
33449
|
+
stateData.clipChangedListener = null;
|
|
33450
|
+
stateData.state = null;
|
|
33451
|
+
}
|
|
33452
|
+
}
|
|
33453
|
+
}
|
|
33390
33454
|
this._animatorLayersData.length = 0;
|
|
33391
33455
|
this._curveOwnerPool = Object.create(null);
|
|
33392
33456
|
this._parametersValueMap = Object.create(null);
|
|
@@ -33406,6 +33470,7 @@ function _type_of(obj) {
|
|
|
33406
33470
|
};
|
|
33407
33471
|
_proto._onDestroy = function _onDestroy() {
|
|
33408
33472
|
Component.prototype._onDestroy.call(this);
|
|
33473
|
+
this._reset();
|
|
33409
33474
|
var controller = this._animatorController;
|
|
33410
33475
|
if (controller) {
|
|
33411
33476
|
var _this__controllerUpdateFlag;
|
|
@@ -33526,6 +33591,8 @@ function _type_of(obj) {
|
|
|
33526
33591
|
};
|
|
33527
33592
|
clipChangedListener();
|
|
33528
33593
|
state._updateFlagManager.addListener(clipChangedListener);
|
|
33594
|
+
animatorStateData.state = state;
|
|
33595
|
+
animatorStateData.clipChangedListener = clipChangedListener;
|
|
33529
33596
|
};
|
|
33530
33597
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
33531
33598
|
animatorLayerData.crossCurveMark++;
|
|
@@ -34108,22 +34175,27 @@ function _type_of(obj) {
|
|
|
34108
34175
|
return true;
|
|
34109
34176
|
};
|
|
34110
34177
|
_proto._fireAnimationEvents = function _fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime) {
|
|
34111
|
-
var state = playData.state, isForward = playData.isForward, clipTime = playData.clipTime;
|
|
34178
|
+
var state = playData.state, isForward = playData.isForward, clipTime = playData.clipTime, wrapMode = playData.wrapMode;
|
|
34112
34179
|
var startTime = state._getClipActualStartTime();
|
|
34113
34180
|
var endTime = state._getClipActualEndTime();
|
|
34181
|
+
var canWrap = wrapMode === WrapMode.Loop;
|
|
34114
34182
|
if (isForward) {
|
|
34115
34183
|
if (lastClipTime + deltaTime >= endTime) {
|
|
34116
34184
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, endTime);
|
|
34117
|
-
|
|
34118
|
-
|
|
34185
|
+
if (canWrap) {
|
|
34186
|
+
playData.currentEventIndex = 0;
|
|
34187
|
+
this._fireSubAnimationEvents(playData, eventHandlers, startTime, clipTime);
|
|
34188
|
+
}
|
|
34119
34189
|
} else {
|
|
34120
34190
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
34121
34191
|
}
|
|
34122
34192
|
} else {
|
|
34123
34193
|
if (lastClipTime + deltaTime <= startTime) {
|
|
34124
34194
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, startTime);
|
|
34125
|
-
|
|
34126
|
-
|
|
34195
|
+
if (canWrap) {
|
|
34196
|
+
playData.currentEventIndex = eventHandlers.length - 1;
|
|
34197
|
+
this._fireBackwardSubAnimationEvents(playData, eventHandlers, endTime, clipTime);
|
|
34198
|
+
}
|
|
34127
34199
|
} else {
|
|
34128
34200
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
34129
34201
|
}
|
|
@@ -34189,7 +34261,7 @@ function _type_of(obj) {
|
|
|
34189
34261
|
};
|
|
34190
34262
|
_proto._fireAnimationEventsAndCallScripts = function _fireAnimationEventsAndCallScripts(layerIndex, playData, state, lastClipTime, lastPlayState, deltaTime) {
|
|
34191
34263
|
var eventHandlers = playData.stateData.eventHandlers;
|
|
34192
|
-
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
|
|
34264
|
+
this.fireEvents && eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
|
|
34193
34265
|
if (lastPlayState === AnimatorStatePlayState.UnStarted) {
|
|
34194
34266
|
state._callOnEnter(this, layerIndex);
|
|
34195
34267
|
}
|
|
@@ -34253,6 +34325,9 @@ Animator._passedTriggerParameterNames = new Array();
|
|
|
34253
34325
|
__decorate([
|
|
34254
34326
|
assignmentClone
|
|
34255
34327
|
], Animator.prototype, "speed", void 0);
|
|
34328
|
+
__decorate([
|
|
34329
|
+
assignmentClone
|
|
34330
|
+
], Animator.prototype, "fireEvents", void 0);
|
|
34256
34331
|
__decorate([
|
|
34257
34332
|
assignmentClone
|
|
34258
34333
|
], Animator.prototype, "_animatorController", void 0);
|
|
@@ -36615,7 +36690,7 @@ __decorate([
|
|
|
36615
36690
|
_inherits(EmissionModule, ParticleGeneratorModule);
|
|
36616
36691
|
function EmissionModule() {
|
|
36617
36692
|
var _this;
|
|
36618
|
-
_this = ParticleGeneratorModule.apply(this, arguments) || this, /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10), /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0), /** @internal */ _this._shapeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Shape), /** @internal */ _this._frameRateTime = 0, _this._bursts = [], _this._currentBurstIndex = 0, _this._burstRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Burst);
|
|
36693
|
+
_this = ParticleGeneratorModule.apply(this, arguments) || this, /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10), /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0), /** @internal */ _this._shapeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Shape), /** @internal */ _this._frameRateTime = 0, _this._distanceAccumulator = 0, _this._lastEmitPosition = new engineMath.Vector3(), _this._hasLastEmitPosition = false, _this._bursts = [], _this._currentBurstIndex = 0, _this._burstRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Burst);
|
|
36619
36694
|
return _this;
|
|
36620
36695
|
}
|
|
36621
36696
|
var _proto = EmissionModule.prototype;
|
|
@@ -36652,6 +36727,7 @@ __decorate([
|
|
|
36652
36727
|
* @internal
|
|
36653
36728
|
*/ _proto._emit = function _emit(lastPlayTime, playTime) {
|
|
36654
36729
|
this._emitByRateOverTime(playTime);
|
|
36730
|
+
this._emitByRateOverDistance(lastPlayTime, playTime);
|
|
36655
36731
|
this._emitByBurst(lastPlayTime, playTime);
|
|
36656
36732
|
};
|
|
36657
36733
|
/**
|
|
@@ -36665,6 +36741,13 @@ __decorate([
|
|
|
36665
36741
|
*/ _proto._reset = function _reset() {
|
|
36666
36742
|
this._frameRateTime = 0;
|
|
36667
36743
|
this._currentBurstIndex = 0;
|
|
36744
|
+
this._invalidateDistanceBaseline();
|
|
36745
|
+
};
|
|
36746
|
+
/**
|
|
36747
|
+
* @internal
|
|
36748
|
+
*/ _proto._invalidateDistanceBaseline = function _invalidateDistanceBaseline() {
|
|
36749
|
+
this._hasLastEmitPosition = false;
|
|
36750
|
+
this._distanceAccumulator = 0;
|
|
36668
36751
|
};
|
|
36669
36752
|
/**
|
|
36670
36753
|
* @internal
|
|
@@ -36685,6 +36768,55 @@ __decorate([
|
|
|
36685
36768
|
}
|
|
36686
36769
|
}
|
|
36687
36770
|
};
|
|
36771
|
+
_proto._emitByRateOverDistance = function _emitByRateOverDistance(lastPlayTime, playTime) {
|
|
36772
|
+
var ratePerUnit = this.rateOverDistance.evaluate(undefined, undefined);
|
|
36773
|
+
var generator = this._generator;
|
|
36774
|
+
if (ratePerUnit <= 0) {
|
|
36775
|
+
this._invalidateDistanceBaseline();
|
|
36776
|
+
return;
|
|
36777
|
+
}
|
|
36778
|
+
if (!this._hasLastEmitPosition) {
|
|
36779
|
+
this._lastEmitPosition.copyFrom(generator._renderer.entity.transform.worldPosition);
|
|
36780
|
+
this._hasLastEmitPosition = true;
|
|
36781
|
+
return;
|
|
36782
|
+
}
|
|
36783
|
+
var lastPos = this._lastEmitPosition;
|
|
36784
|
+
var currentPos = generator._renderer.entity.transform.worldPosition;
|
|
36785
|
+
var dx = currentPos.x - lastPos.x;
|
|
36786
|
+
var dy = currentPos.y - lastPos.y;
|
|
36787
|
+
var dz = currentPos.z - lastPos.z;
|
|
36788
|
+
var moveLength = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
36789
|
+
this._distanceAccumulator += moveLength;
|
|
36790
|
+
var emitInterval = 1.0 / ratePerUnit;
|
|
36791
|
+
// `+ zeroTolerance` absorbs float divide error so an exact `N*interval` accumulator doesn't drop 1
|
|
36792
|
+
var count = Math.floor(this._distanceAccumulator / emitInterval + engineMath.MathUtil.zeroTolerance);
|
|
36793
|
+
if (count > 0) {
|
|
36794
|
+
this._distanceAccumulator -= count * emitInterval;
|
|
36795
|
+
// `subFrameAge ∈ [0, 1]`: how far back into the frame a particle was born
|
|
36796
|
+
// (0 = newest at currentPos/playTime, 1 = oldest at lastPos/lastPlayTime).
|
|
36797
|
+
// The initial clamp protects two edges — moveLength ≈ 0 (collapse to frame-end
|
|
36798
|
+
// emit) and a tiny moveLength near the emitInterval edge (would put age > 1).
|
|
36799
|
+
// Local simulation space ignores the position override but still uses emitTime.
|
|
36800
|
+
var isWorld = generator.main.simulationSpace === ParticleSimulationSpace.World;
|
|
36801
|
+
var invMoveLength = moveLength > engineMath.MathUtil.zeroTolerance ? 1.0 / moveLength : 0;
|
|
36802
|
+
var ageStep = emitInterval * invMoveLength;
|
|
36803
|
+
var dt = playTime - lastPlayTime;
|
|
36804
|
+
var subFrameAge = Math.min(this._distanceAccumulator * invMoveLength, 1.0);
|
|
36805
|
+
var emitPos = EmissionModule._tempEmitPosition;
|
|
36806
|
+
for(var i = 0; i < count; i++){
|
|
36807
|
+
if (isWorld) {
|
|
36808
|
+
emitPos.set(currentPos.x - dx * subFrameAge, currentPos.y - dy * subFrameAge, currentPos.z - dz * subFrameAge);
|
|
36809
|
+
}
|
|
36810
|
+
if (generator._emit(playTime - dt * subFrameAge, 1, isWorld ? emitPos : undefined) === 0) {
|
|
36811
|
+
// Buffer full: settle the frame's distance budget instead of carrying it over
|
|
36812
|
+
this._distanceAccumulator = 0;
|
|
36813
|
+
break;
|
|
36814
|
+
}
|
|
36815
|
+
subFrameAge += ageStep;
|
|
36816
|
+
}
|
|
36817
|
+
}
|
|
36818
|
+
lastPos.copyFrom(currentPos);
|
|
36819
|
+
};
|
|
36688
36820
|
_proto._emitByBurst = function _emitByBurst(lastPlayTime, playTime) {
|
|
36689
36821
|
var main = this._generator.main;
|
|
36690
36822
|
var duration = main.duration;
|
|
@@ -36781,6 +36913,7 @@ __decorate([
|
|
|
36781
36913
|
return EmissionModule;
|
|
36782
36914
|
}(ParticleGeneratorModule);
|
|
36783
36915
|
/** @internal */ EmissionModule._emissionShapeMacro = ShaderMacro.getByName("RENDERER_EMISSION_SHAPE");
|
|
36916
|
+
EmissionModule._tempEmitPosition = new engineMath.Vector3();
|
|
36784
36917
|
__decorate([
|
|
36785
36918
|
deepClone
|
|
36786
36919
|
], EmissionModule.prototype, "rateOverTime", void 0);
|
|
@@ -36793,6 +36926,15 @@ __decorate([
|
|
|
36793
36926
|
__decorate([
|
|
36794
36927
|
ignoreClone
|
|
36795
36928
|
], EmissionModule.prototype, "_shapeRand", void 0);
|
|
36929
|
+
__decorate([
|
|
36930
|
+
ignoreClone
|
|
36931
|
+
], EmissionModule.prototype, "_distanceAccumulator", void 0);
|
|
36932
|
+
__decorate([
|
|
36933
|
+
ignoreClone
|
|
36934
|
+
], EmissionModule.prototype, "_lastEmitPosition", void 0);
|
|
36935
|
+
__decorate([
|
|
36936
|
+
ignoreClone
|
|
36937
|
+
], EmissionModule.prototype, "_hasLastEmitPosition", void 0);
|
|
36796
36938
|
__decorate([
|
|
36797
36939
|
deepClone
|
|
36798
36940
|
], EmissionModule.prototype, "_bursts", void 0);
|
|
@@ -38479,11 +38621,15 @@ __decorate([
|
|
|
38479
38621
|
}
|
|
38480
38622
|
} else {
|
|
38481
38623
|
this._isPlaying = false;
|
|
38624
|
+
// Invalidate the rateOverDistance baseline so emitter movement during the stop
|
|
38625
|
+
// interval doesn't burst on resume.
|
|
38482
38626
|
if (stopMode === ParticleStopMode.StopEmittingAndClear) {
|
|
38483
38627
|
this._clearActiveParticles();
|
|
38484
38628
|
this._playTime = 0;
|
|
38485
38629
|
this._firstActiveTransformedBoundingBox = this._firstFreeTransformedBoundingBox;
|
|
38486
38630
|
this.emission._reset();
|
|
38631
|
+
} else {
|
|
38632
|
+
this.emission._invalidateDistanceBaseline();
|
|
38487
38633
|
}
|
|
38488
38634
|
}
|
|
38489
38635
|
};
|
|
@@ -38495,37 +38641,40 @@ __decorate([
|
|
|
38495
38641
|
};
|
|
38496
38642
|
/**
|
|
38497
38643
|
* @internal
|
|
38498
|
-
*/ _proto._emit = function _emit(playTime, count) {
|
|
38499
|
-
var emission =
|
|
38500
|
-
if (emission.enabled) {
|
|
38501
|
-
|
|
38502
|
-
|
|
38503
|
-
|
|
38504
|
-
|
|
38505
|
-
|
|
38506
|
-
|
|
38507
|
-
|
|
38508
|
-
|
|
38509
|
-
|
|
38510
|
-
|
|
38511
|
-
|
|
38512
|
-
|
|
38513
|
-
|
|
38514
|
-
|
|
38515
|
-
|
|
38516
|
-
|
|
38517
|
-
|
|
38518
|
-
|
|
38519
|
-
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
38524
|
-
|
|
38644
|
+
*/ _proto._emit = function _emit(playTime, count, emitWorldPositionOverride) {
|
|
38645
|
+
var _this = this, emission = _this.emission, main = _this.main;
|
|
38646
|
+
if (!emission.enabled) {
|
|
38647
|
+
return 0;
|
|
38648
|
+
}
|
|
38649
|
+
var budget = main.maxParticles - this._getNotRetiredParticleCount();
|
|
38650
|
+
if (count > budget) {
|
|
38651
|
+
count = budget;
|
|
38652
|
+
}
|
|
38653
|
+
if (count <= 0) {
|
|
38654
|
+
return 0;
|
|
38655
|
+
}
|
|
38656
|
+
var position = ParticleGenerator._tempVector30;
|
|
38657
|
+
var direction = ParticleGenerator._tempVector31;
|
|
38658
|
+
var transform = this._renderer.entity.transform;
|
|
38659
|
+
var shape = emission.shape;
|
|
38660
|
+
var positionScale = main._getPositionScale();
|
|
38661
|
+
for(var i = 0; i < count; i++){
|
|
38662
|
+
if (shape == null ? void 0 : shape.enabled) {
|
|
38663
|
+
shape._generatePositionAndDirection(emission._shapeRand, playTime, position, direction);
|
|
38664
|
+
position.multiply(positionScale);
|
|
38665
|
+
direction.normalize().multiply(positionScale);
|
|
38666
|
+
} else {
|
|
38667
|
+
position.set(0, 0, 0);
|
|
38668
|
+
direction.set(0, 0, -1);
|
|
38669
|
+
// Speed is scaled by shape scale in world simulation space
|
|
38670
|
+
// So if no shape and in world simulation space, we shouldn't scale the speed
|
|
38671
|
+
if (main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
38672
|
+
direction.multiply(positionScale);
|
|
38525
38673
|
}
|
|
38526
|
-
this._addNewParticle(position, direction, transform, playTime);
|
|
38527
38674
|
}
|
|
38675
|
+
this._addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride);
|
|
38528
38676
|
}
|
|
38677
|
+
return count;
|
|
38529
38678
|
};
|
|
38530
38679
|
/**
|
|
38531
38680
|
* @internal
|
|
@@ -38927,7 +39076,7 @@ __decorate([
|
|
|
38927
39076
|
this._transformedBoundsArray[previousFreeElement * ParticleBufferUtils.boundsFloatStride + boundsTimeOffset] = this._playTime;
|
|
38928
39077
|
}
|
|
38929
39078
|
};
|
|
38930
|
-
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime) {
|
|
39079
|
+
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride) {
|
|
38931
39080
|
var firstFreeElement = this._firstFreeElement;
|
|
38932
39081
|
var nextFreeElement = firstFreeElement + 1;
|
|
38933
39082
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
@@ -38950,7 +39099,7 @@ __decorate([
|
|
|
38950
39099
|
}
|
|
38951
39100
|
var pos, rot;
|
|
38952
39101
|
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
38953
|
-
pos = transform.worldPosition;
|
|
39102
|
+
pos = emitWorldPositionOverride != null ? emitWorldPositionOverride : transform.worldPosition;
|
|
38954
39103
|
rot = transform.worldRotationQuaternion;
|
|
38955
39104
|
}
|
|
38956
39105
|
var startSpeed = main.startSpeed.evaluate(undefined, main._startSpeedRand.random());
|
|
@@ -39070,18 +39219,18 @@ __decorate([
|
|
|
39070
39219
|
}
|
|
39071
39220
|
// Initialize feedback buffer for this particle
|
|
39072
39221
|
if (this._useTransformFeedback) {
|
|
39073
|
-
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform);
|
|
39222
|
+
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform, pos);
|
|
39074
39223
|
}
|
|
39075
39224
|
this._firstFreeElement = nextFreeElement;
|
|
39076
39225
|
};
|
|
39077
|
-
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform) {
|
|
39226
|
+
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform, emitWorldPosition) {
|
|
39078
39227
|
var position;
|
|
39079
39228
|
if (this.main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
39080
39229
|
position = shapePosition;
|
|
39081
39230
|
} else {
|
|
39082
39231
|
position = ParticleGenerator._tempVector32;
|
|
39083
39232
|
engineMath.Vector3.transformByQuat(shapePosition, transform.worldRotationQuaternion, position);
|
|
39084
|
-
position.add(transform.worldPosition);
|
|
39233
|
+
position.add(emitWorldPosition != null ? emitWorldPosition : transform.worldPosition);
|
|
39085
39234
|
}
|
|
39086
39235
|
this._feedbackSimulator.writeParticleData(index, position, direction.x * startSpeed, direction.y * startSpeed, direction.z * startSpeed);
|
|
39087
39236
|
};
|
|
@@ -41768,6 +41917,7 @@ exports.DisorderedArray = DisorderedArray;
|
|
|
41768
41917
|
exports.Downsampling = Downsampling;
|
|
41769
41918
|
exports.DynamicCollider = DynamicCollider;
|
|
41770
41919
|
exports.DynamicColliderConstraints = DynamicColliderConstraints;
|
|
41920
|
+
exports.DynamicColliderKinematicTransformSyncMode = DynamicColliderKinematicTransformSyncMode;
|
|
41771
41921
|
exports.EmissionModule = EmissionModule;
|
|
41772
41922
|
exports.Engine = Engine;
|
|
41773
41923
|
exports.EngineObject = EngineObject;
|