@galacean/engine-core 0.0.0-experimental-2.0-game.12 → 0.0.0-experimental-2.0-game.14
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 +204 -80
- package/dist/main.js.map +1 -1
- package/dist/module.js +204 -81
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/animation/Animator.d.ts +1 -1
- package/types/animation/internal/AnimatorStatePlayData.d.ts +3 -3
- package/types/asset/AssetType.d.ts +1 -1
- 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
|
@@ -7360,7 +7360,7 @@ var particle_common = "vec3 rotationByQuaternions(in vec3 v, in vec4 q) {\n r
|
|
|
7360
7360
|
|
|
7361
7361
|
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
7362
|
|
|
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
|
|
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.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
7364
|
|
|
7365
7365
|
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
7366
|
|
|
@@ -7801,7 +7801,13 @@ ShaderFactory._std140TypeInfoMap = {
|
|
|
7801
7801
|
};
|
|
7802
7802
|
ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?vec4\s+\w+\s*;/;
|
|
7803
7803
|
ShaderFactory._precisionStr = "\n#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n#endif\n";
|
|
7804
|
-
|
|
7804
|
+
// Derived built-ins re-exposed on top of `renderer_ModelMat`.
|
|
7805
|
+
// `renderer_NormalMat` uses the cofactor (cross-product) form, which algebraically equals
|
|
7806
|
+
// `det(M) · transpose(inverse(M))`. After `normalize()` it's directionally identical to the
|
|
7807
|
+
// classic `transpose(inverse(M))`, but stays NaN-free when `M` is singular (e.g. any scale
|
|
7808
|
+
// axis is 0 — common in animations that pop / hide via scale). `sign(det)` (`s` below)
|
|
7809
|
+
// keeps mirrored matrices facing the right way
|
|
7810
|
+
ShaderFactory._derivedDefines = "mat3 _normalMatFromModel(mat3 m) {\n vec3 c0 = cross(m[1], m[2]);\n vec3 c1 = cross(m[2], m[0]);\n vec3 c2 = cross(m[0], m[1]);\n float s = (dot(m[0], c0) < 0.0) ? -1.0 : 1.0;\n return mat3(c0 * s, c1 * s, c2 * s);\n}\n#define renderer_MVMat (camera_ViewMat * renderer_ModelMat)\n#define renderer_MVPMat (camera_VPMat * renderer_ModelMat)\n#define renderer_NormalMat mat4(_normalMatFromModel(mat3(renderer_ModelMat)))";
|
|
7805
7811
|
// Built-in renderer uniforms. value=true means derived (remove but not added to UBO)
|
|
7806
7812
|
ShaderFactory._builtinRendererUniforms = {
|
|
7807
7813
|
renderer_ModelMat: false,
|
|
@@ -19119,7 +19125,7 @@ RenderContext._flipYViewProjectionMatrix = new engineMath.Matrix();
|
|
|
19119
19125
|
/** Scene. */ AssetType["Scene"] = "Scene";
|
|
19120
19126
|
/** Font. */ AssetType["Font"] = "Font";
|
|
19121
19127
|
/** Source Font, include ttf, otf and woff. */ AssetType["SourceFont"] = "SourceFont";
|
|
19122
|
-
/** AudioClip, include ogg, wav and
|
|
19128
|
+
/** AudioClip, include ogg, wav, mp3, m4a, aac and flac. */ AssetType["Audio"] = "Audio";
|
|
19123
19129
|
/** Project asset. */ AssetType["Project"] = "project";
|
|
19124
19130
|
/** PhysicsMaterial. */ AssetType["PhysicsMaterial"] = "PhysicsMaterial";
|
|
19125
19131
|
/** RenderTarget. */ AssetType["RenderTarget"] = "RenderTarget";
|
|
@@ -20553,7 +20559,13 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20553
20559
|
_inherits(Collider, Component);
|
|
20554
20560
|
function Collider(entity) {
|
|
20555
20561
|
var _this;
|
|
20556
|
-
_this = Component.call(this, entity) || this, /** @internal */ _this._index = -1, _this._shapes = [], _this._collisionLayerIndex = 0
|
|
20562
|
+
_this = Component.call(this, entity) || this, /** @internal */ _this._index = -1, _this._shapes = [], _this._collisionLayerIndex = 0, /**
|
|
20563
|
+
* Disabling a collider only detaches its native actor from the simulation
|
|
20564
|
+
* scene; the actor is not destroyed, so on re-enable it still holds its
|
|
20565
|
+
* pre-disable pose. The first transform sync after (re-)enable must teleport,
|
|
20566
|
+
* never sweep — otherwise a kinematic actor drags across the scene from that
|
|
20567
|
+
* stale pose and fires spurious contacts along the path.
|
|
20568
|
+
*/ _this._pendingReenterTeleport = false;
|
|
20557
20569
|
_this._updateFlag = entity.registerWorldChangeFlag();
|
|
20558
20570
|
return _this;
|
|
20559
20571
|
}
|
|
@@ -20597,9 +20609,14 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20597
20609
|
* @internal
|
|
20598
20610
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
20599
20611
|
var shapes = this._shapes;
|
|
20600
|
-
if (this._updateFlag.flag) {
|
|
20612
|
+
if (this._pendingReenterTeleport || this._updateFlag.flag) {
|
|
20601
20613
|
var transform = this.entity.transform;
|
|
20602
|
-
this.
|
|
20614
|
+
if (this._pendingReenterTeleport) {
|
|
20615
|
+
this._teleportToEntityTransform(transform.worldPosition, transform.worldRotationQuaternion);
|
|
20616
|
+
this._pendingReenterTeleport = false;
|
|
20617
|
+
} else {
|
|
20618
|
+
this._syncEntityTransformToNative(transform.worldPosition, transform.worldRotationQuaternion);
|
|
20619
|
+
}
|
|
20603
20620
|
var worldScale = transform.lossyWorldScale;
|
|
20604
20621
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
20605
20622
|
var _shapes_i__nativeShape;
|
|
@@ -20621,6 +20638,7 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20621
20638
|
* @internal
|
|
20622
20639
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
20623
20640
|
this.scene.physics._addCollider(this);
|
|
20641
|
+
this._pendingReenterTeleport = true;
|
|
20624
20642
|
};
|
|
20625
20643
|
/**
|
|
20626
20644
|
* @internal
|
|
@@ -20739,6 +20757,9 @@ __decorate([
|
|
|
20739
20757
|
__decorate([
|
|
20740
20758
|
deepClone
|
|
20741
20759
|
], exports.Collider.prototype, "_shapes", void 0);
|
|
20760
|
+
__decorate([
|
|
20761
|
+
ignoreClone
|
|
20762
|
+
], exports.Collider.prototype, "_pendingReenterTeleport", void 0);
|
|
20742
20763
|
exports.Collider = __decorate([
|
|
20743
20764
|
dependentComponents(Transform, DependentMode.CheckOnly)
|
|
20744
20765
|
], exports.Collider);
|
|
@@ -21039,7 +21060,6 @@ __decorate([
|
|
|
21039
21060
|
this._isTrigger = false;
|
|
21040
21061
|
this._rotation = new engineMath.Vector3();
|
|
21041
21062
|
this._position = new engineMath.Vector3();
|
|
21042
|
-
this._contactOffset = 0.02;
|
|
21043
21063
|
/**
|
|
21044
21064
|
* @internal
|
|
21045
21065
|
* @beta
|
|
@@ -21105,7 +21125,9 @@ __decorate([
|
|
|
21105
21125
|
if (!this._nativeShape) return;
|
|
21106
21126
|
this._nativeShape.setPosition(this._position);
|
|
21107
21127
|
this._nativeShape.setRotation(this._rotation);
|
|
21108
|
-
|
|
21128
|
+
if (this._contactOffset !== undefined) {
|
|
21129
|
+
this._nativeShape.setContactOffset(this._contactOffset);
|
|
21130
|
+
}
|
|
21109
21131
|
this._nativeShape.setIsTrigger(this._isTrigger);
|
|
21110
21132
|
this._nativeShape.setMaterial(this._material._nativeMaterial);
|
|
21111
21133
|
(_this__collider = this._collider) == null ? void 0 : _this__collider._handleShapesChanged(ColliderShapeChangeFlag.Property);
|
|
@@ -21143,7 +21165,9 @@ __decorate([
|
|
|
21143
21165
|
* Contact offset for this shape, the value must be greater than or equal to 0.
|
|
21144
21166
|
* @defaultValue 0.02
|
|
21145
21167
|
*/ function get() {
|
|
21146
|
-
|
|
21168
|
+
var _Engine__nativePhysics_getDefaultContactOffset, _Engine__nativePhysics;
|
|
21169
|
+
var _this__contactOffset, _ref;
|
|
21170
|
+
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;
|
|
21147
21171
|
},
|
|
21148
21172
|
set: function set(value) {
|
|
21149
21173
|
value = Math.max(0, value);
|
|
@@ -21466,7 +21490,7 @@ __decorate([
|
|
|
21466
21490
|
_inherits(DynamicCollider, Collider);
|
|
21467
21491
|
function DynamicCollider(entity) {
|
|
21468
21492
|
var _this;
|
|
21469
|
-
_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.
|
|
21493
|
+
_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;
|
|
21470
21494
|
var transform = _this.entity.transform;
|
|
21471
21495
|
_this._nativeCollider = Engine._nativePhysics.createDynamicCollider(transform.worldPosition, transform.worldRotationQuaternion);
|
|
21472
21496
|
_this._setLinearVelocity = _this._setLinearVelocity.bind(_this);
|
|
@@ -21558,17 +21582,14 @@ __decorate([
|
|
|
21558
21582
|
* collision detection, use setKinematicTarget() instead."
|
|
21559
21583
|
*
|
|
21560
21584
|
* setGlobalPose is a teleport: PhysX skips contact detection between the old
|
|
21561
|
-
* and new pose
|
|
21562
|
-
*
|
|
21563
|
-
*
|
|
21564
|
-
*
|
|
21565
|
-
* setKinematicTarget) tells PhysX the actor is animating to the target during the
|
|
21566
|
-
* next simulate(), enabling sweep contact detection for kine-kine and kine-dynamic
|
|
21567
|
-
* pairs alike.
|
|
21585
|
+
* and new pose. setKinematicTarget tells PhysX the actor is animating to the
|
|
21586
|
+
* target during the next simulate(), enabling swept contacts. Some compatibility
|
|
21587
|
+
* layers need transform writes to stay teleport-like, so the sync mode is
|
|
21588
|
+
* explicit while {@link move} always keeps target semantics.
|
|
21568
21589
|
*
|
|
21569
21590
|
* @internal
|
|
21570
21591
|
*/ _proto._syncEntityTransformToNative = function _syncEntityTransformToNative(worldPosition, worldRotation) {
|
|
21571
|
-
if (this._isKinematic) {
|
|
21592
|
+
if (this._isKinematic && this._kinematicTransformSyncMode === 0) {
|
|
21572
21593
|
this._nativeCollider.move(worldPosition, worldRotation);
|
|
21573
21594
|
} else {
|
|
21574
21595
|
Collider.prototype._syncEntityTransformToNative.call(this, worldPosition, worldRotation);
|
|
@@ -21598,6 +21619,7 @@ __decorate([
|
|
|
21598
21619
|
target._angularVelocity.copyFrom(this.angularVelocity);
|
|
21599
21620
|
target._centerOfMass.copyFrom(this.centerOfMass);
|
|
21600
21621
|
target._inertiaTensor.copyFrom(this.inertiaTensor);
|
|
21622
|
+
target._kinematicTransformSyncMode = this._kinematicTransformSyncMode;
|
|
21601
21623
|
Collider.prototype._cloneTo.call(this, target);
|
|
21602
21624
|
};
|
|
21603
21625
|
/**
|
|
@@ -21623,7 +21645,9 @@ __decorate([
|
|
|
21623
21645
|
}
|
|
21624
21646
|
this._nativeCollider.setMaxAngularVelocity(this._maxAngularVelocity);
|
|
21625
21647
|
this._nativeCollider.setMaxDepenetrationVelocity(this._maxDepenetrationVelocity);
|
|
21626
|
-
|
|
21648
|
+
if (this._sleepThreshold !== undefined) {
|
|
21649
|
+
this._nativeCollider.setSleepThreshold(this._sleepThreshold);
|
|
21650
|
+
}
|
|
21627
21651
|
this._nativeCollider.setSolverIterations(this._solverIterations);
|
|
21628
21652
|
this._nativeCollider.setUseGravity(this._useGravity);
|
|
21629
21653
|
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
@@ -21847,7 +21871,9 @@ __decorate([
|
|
|
21847
21871
|
get: /**
|
|
21848
21872
|
* The mass-normalized energy threshold, below which objects start going to sleep.
|
|
21849
21873
|
*/ function get() {
|
|
21850
|
-
|
|
21874
|
+
var _Engine__nativePhysics_getDefaultSleepThreshold, _Engine__nativePhysics;
|
|
21875
|
+
var _this__sleepThreshold, _ref;
|
|
21876
|
+
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;
|
|
21851
21877
|
},
|
|
21852
21878
|
set: function set(value) {
|
|
21853
21879
|
if (value !== this._sleepThreshold) {
|
|
@@ -21943,6 +21969,22 @@ __decorate([
|
|
|
21943
21969
|
this._nativeCollider.setCollisionDetectionMode(value);
|
|
21944
21970
|
}
|
|
21945
21971
|
}
|
|
21972
|
+
},
|
|
21973
|
+
{
|
|
21974
|
+
key: "kinematicTransformSyncMode",
|
|
21975
|
+
get: /**
|
|
21976
|
+
* Controls how entity transform changes are synchronized to a kinematic native actor.
|
|
21977
|
+
*
|
|
21978
|
+
* @remarks
|
|
21979
|
+
* `Target` routes transform changes through {@link move}, so PhysX treats the
|
|
21980
|
+
* actor as moving between frames and can generate swept contacts. `Teleport`
|
|
21981
|
+
* writes the native pose directly and does not imply velocity.
|
|
21982
|
+
*/ function get() {
|
|
21983
|
+
return this._kinematicTransformSyncMode;
|
|
21984
|
+
},
|
|
21985
|
+
set: function set(value) {
|
|
21986
|
+
this._kinematicTransformSyncMode = value;
|
|
21987
|
+
}
|
|
21946
21988
|
}
|
|
21947
21989
|
]);
|
|
21948
21990
|
return DynamicCollider;
|
|
@@ -21984,6 +22026,13 @@ __decorate([
|
|
|
21984
22026
|
/** Speculative continuous collision detection is on for static and dynamic geometries */ CollisionDetectionMode[CollisionDetectionMode["ContinuousSpeculative"] = 3] = "ContinuousSpeculative";
|
|
21985
22027
|
return CollisionDetectionMode;
|
|
21986
22028
|
}({});
|
|
22029
|
+
/**
|
|
22030
|
+
* Kinematic transform synchronization mode.
|
|
22031
|
+
*/ var DynamicColliderKinematicTransformSyncMode = /*#__PURE__*/ function(DynamicColliderKinematicTransformSyncMode) {
|
|
22032
|
+
/** Synchronize transform changes through PhysX setKinematicTarget. */ DynamicColliderKinematicTransformSyncMode[DynamicColliderKinematicTransformSyncMode["Target"] = 0] = "Target";
|
|
22033
|
+
/** Synchronize transform changes by directly teleporting the native actor. */ DynamicColliderKinematicTransformSyncMode[DynamicColliderKinematicTransformSyncMode["Teleport"] = 1] = "Teleport";
|
|
22034
|
+
return DynamicColliderKinematicTransformSyncMode;
|
|
22035
|
+
}({});
|
|
21987
22036
|
/**
|
|
21988
22037
|
* Use these flags to constrain motion of dynamic collider.
|
|
21989
22038
|
*/ var DynamicColliderConstraints = /*#__PURE__*/ function(DynamicColliderConstraints) {
|
|
@@ -22029,8 +22078,7 @@ __decorate([
|
|
|
22029
22078
|
* You need to obtain the actual number of contact points from the function's return value.
|
|
22030
22079
|
*/ _proto.getContacts = function getContacts(outContacts) {
|
|
22031
22080
|
var nativeCollision = this._nativeCollision;
|
|
22032
|
-
var
|
|
22033
|
-
var factor = this.shape.id === smallerShapeId ? 1 : -1;
|
|
22081
|
+
var factor = this.shape.id === nativeCollision.shape1Id ? 1 : -1;
|
|
22034
22082
|
var nativeContactPoints = nativeCollision.getContacts();
|
|
22035
22083
|
var length = nativeContactPoints.size();
|
|
22036
22084
|
for(var i = 0; i < length; i++){
|
|
@@ -32924,6 +32972,14 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
32924
32972
|
return LayerState;
|
|
32925
32973
|
}({});
|
|
32926
32974
|
|
|
32975
|
+
/**
|
|
32976
|
+
* Animation wrap mode.
|
|
32977
|
+
*/ var WrapMode = /*#__PURE__*/ function(WrapMode) {
|
|
32978
|
+
/** Play once */ WrapMode[WrapMode["Once"] = 0] = "Once";
|
|
32979
|
+
/** Loop play */ WrapMode[WrapMode["Loop"] = 1] = "Loop";
|
|
32980
|
+
return WrapMode;
|
|
32981
|
+
}({});
|
|
32982
|
+
|
|
32927
32983
|
/**
|
|
32928
32984
|
* @internal
|
|
32929
32985
|
*/ var AnimationEventHandler = /*#__PURE__*/ function() {
|
|
@@ -33035,22 +33091,15 @@ function _type_of(obj) {
|
|
|
33035
33091
|
return AnimatorStateTransition;
|
|
33036
33092
|
}();
|
|
33037
33093
|
|
|
33038
|
-
/**
|
|
33039
|
-
* Animation wrap mode.
|
|
33040
|
-
*/ var WrapMode = /*#__PURE__*/ function(WrapMode) {
|
|
33041
|
-
/** Play once */ WrapMode[WrapMode["Once"] = 0] = "Once";
|
|
33042
|
-
/** Loop play */ WrapMode[WrapMode["Loop"] = 1] = "Loop";
|
|
33043
|
-
return WrapMode;
|
|
33044
|
-
}({});
|
|
33045
|
-
|
|
33046
33094
|
/**
|
|
33047
33095
|
* Per-instance runtime data for an AnimatorState.
|
|
33048
33096
|
* Proxies read-only properties from the shared AnimatorState asset,
|
|
33049
|
-
* while providing per-instance mutable properties (e.g. speed).
|
|
33097
|
+
* while providing per-instance mutable properties (e.g. speed, wrapMode).
|
|
33050
33098
|
*/ var AnimatorStatePlayData = /*#__PURE__*/ function() {
|
|
33051
33099
|
function AnimatorStatePlayData() {
|
|
33052
33100
|
/** @internal */ this.isForward = true;
|
|
33053
33101
|
/** Per-instance speed. Initialized from AnimatorState.speed, safe to modify without affecting other instances. */ this.speed = 1.0;
|
|
33102
|
+
/** Per-instance wrap mode. Initialized from AnimatorState.wrapMode, safe to modify without affecting other instances. */ this.wrapMode = WrapMode.Loop;
|
|
33054
33103
|
this._changedOrientation = false;
|
|
33055
33104
|
}
|
|
33056
33105
|
var _proto = AnimatorStatePlayData.prototype;
|
|
@@ -33069,6 +33118,7 @@ function _type_of(obj) {
|
|
|
33069
33118
|
this.currentEventIndex = 0;
|
|
33070
33119
|
this.isForward = true;
|
|
33071
33120
|
this.speed = state.speed;
|
|
33121
|
+
this.wrapMode = state.wrapMode;
|
|
33072
33122
|
this.state._transitionCollection.needResetCurrentCheckIndex = true;
|
|
33073
33123
|
};
|
|
33074
33124
|
_proto.updateOrientation = function updateOrientation(deltaTime) {
|
|
@@ -33087,7 +33137,7 @@ function _type_of(obj) {
|
|
|
33087
33137
|
var time = this.playedTime + this.offsetFrameTime;
|
|
33088
33138
|
var duration = state._getDuration();
|
|
33089
33139
|
this.playState = AnimatorStatePlayState.Playing;
|
|
33090
|
-
if (
|
|
33140
|
+
if (this.wrapMode === WrapMode.Loop) {
|
|
33091
33141
|
time = duration ? time % duration : 0;
|
|
33092
33142
|
} else {
|
|
33093
33143
|
if (Math.abs(time) >= duration) {
|
|
@@ -33122,12 +33172,6 @@ function _type_of(obj) {
|
|
|
33122
33172
|
return this.state.clip;
|
|
33123
33173
|
}
|
|
33124
33174
|
},
|
|
33125
|
-
{
|
|
33126
|
-
key: "wrapMode",
|
|
33127
|
-
get: /** The wrap mode. */ function get() {
|
|
33128
|
-
return this.state.wrapMode;
|
|
33129
|
-
}
|
|
33130
|
-
},
|
|
33131
33175
|
{
|
|
33132
33176
|
key: "transitions",
|
|
33133
33177
|
get: /** The transitions going out of this state. */ function get() {
|
|
@@ -33277,7 +33321,7 @@ function _type_of(obj) {
|
|
|
33277
33321
|
* @param layerIndex - The layer index(default -1). If layer is -1, find the first state with the given state name
|
|
33278
33322
|
*/ /**
|
|
33279
33323
|
* Find the per-instance play data for a state by name.
|
|
33280
|
-
* The returned object's `speed`
|
|
33324
|
+
* The returned object's `speed` and `wrapMode` are per-instance and safe to modify without affecting other Animator instances.
|
|
33281
33325
|
* @param stateName - The state name
|
|
33282
33326
|
* @param layerIndex - The layer index (default -1, searches all layers)
|
|
33283
33327
|
* @returns Per-instance AnimatorStatePlayData, or null if not found
|
|
@@ -33696,8 +33740,8 @@ function _type_of(obj) {
|
|
|
33696
33740
|
if (this._tryCrossFadeInterrupt(layerData, transitionDuration, destState, deltaTime, aniUpdate)) {
|
|
33697
33741
|
return;
|
|
33698
33742
|
}
|
|
33699
|
-
var srcPlaySpeed =
|
|
33700
|
-
var dstPlaySpeed =
|
|
33743
|
+
var srcPlaySpeed = srcPlayData.speed * speed;
|
|
33744
|
+
var dstPlaySpeed = destPlayData.speed * speed;
|
|
33701
33745
|
var dstPlayDeltaTime = dstPlaySpeed * deltaTime;
|
|
33702
33746
|
srcPlayData && srcPlayData.updateOrientation(srcPlaySpeed * deltaTime);
|
|
33703
33747
|
destPlayData && destPlayData.updateOrientation(dstPlayDeltaTime);
|
|
@@ -34103,22 +34147,27 @@ function _type_of(obj) {
|
|
|
34103
34147
|
return true;
|
|
34104
34148
|
};
|
|
34105
34149
|
_proto._fireAnimationEvents = function _fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime) {
|
|
34106
|
-
var state = playData.state, isForward = playData.isForward, clipTime = playData.clipTime;
|
|
34150
|
+
var state = playData.state, isForward = playData.isForward, clipTime = playData.clipTime, wrapMode = playData.wrapMode;
|
|
34107
34151
|
var startTime = state._getClipActualStartTime();
|
|
34108
34152
|
var endTime = state._getClipActualEndTime();
|
|
34153
|
+
var canWrap = wrapMode === WrapMode.Loop;
|
|
34109
34154
|
if (isForward) {
|
|
34110
34155
|
if (lastClipTime + deltaTime >= endTime) {
|
|
34111
34156
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, endTime);
|
|
34112
|
-
|
|
34113
|
-
|
|
34157
|
+
if (canWrap) {
|
|
34158
|
+
playData.currentEventIndex = 0;
|
|
34159
|
+
this._fireSubAnimationEvents(playData, eventHandlers, startTime, clipTime);
|
|
34160
|
+
}
|
|
34114
34161
|
} else {
|
|
34115
34162
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
34116
34163
|
}
|
|
34117
34164
|
} else {
|
|
34118
34165
|
if (lastClipTime + deltaTime <= startTime) {
|
|
34119
34166
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, startTime);
|
|
34120
|
-
|
|
34121
|
-
|
|
34167
|
+
if (canWrap) {
|
|
34168
|
+
playData.currentEventIndex = eventHandlers.length - 1;
|
|
34169
|
+
this._fireBackwardSubAnimationEvents(playData, eventHandlers, endTime, clipTime);
|
|
34170
|
+
}
|
|
34122
34171
|
} else {
|
|
34123
34172
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
34124
34173
|
}
|
|
@@ -36610,7 +36659,7 @@ __decorate([
|
|
|
36610
36659
|
_inherits(EmissionModule, ParticleGeneratorModule);
|
|
36611
36660
|
function EmissionModule() {
|
|
36612
36661
|
var _this;
|
|
36613
|
-
_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);
|
|
36662
|
+
_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);
|
|
36614
36663
|
return _this;
|
|
36615
36664
|
}
|
|
36616
36665
|
var _proto = EmissionModule.prototype;
|
|
@@ -36647,6 +36696,7 @@ __decorate([
|
|
|
36647
36696
|
* @internal
|
|
36648
36697
|
*/ _proto._emit = function _emit(lastPlayTime, playTime) {
|
|
36649
36698
|
this._emitByRateOverTime(playTime);
|
|
36699
|
+
this._emitByRateOverDistance(lastPlayTime, playTime);
|
|
36650
36700
|
this._emitByBurst(lastPlayTime, playTime);
|
|
36651
36701
|
};
|
|
36652
36702
|
/**
|
|
@@ -36660,6 +36710,13 @@ __decorate([
|
|
|
36660
36710
|
*/ _proto._reset = function _reset() {
|
|
36661
36711
|
this._frameRateTime = 0;
|
|
36662
36712
|
this._currentBurstIndex = 0;
|
|
36713
|
+
this._invalidateDistanceBaseline();
|
|
36714
|
+
};
|
|
36715
|
+
/**
|
|
36716
|
+
* @internal
|
|
36717
|
+
*/ _proto._invalidateDistanceBaseline = function _invalidateDistanceBaseline() {
|
|
36718
|
+
this._hasLastEmitPosition = false;
|
|
36719
|
+
this._distanceAccumulator = 0;
|
|
36663
36720
|
};
|
|
36664
36721
|
/**
|
|
36665
36722
|
* @internal
|
|
@@ -36680,6 +36737,55 @@ __decorate([
|
|
|
36680
36737
|
}
|
|
36681
36738
|
}
|
|
36682
36739
|
};
|
|
36740
|
+
_proto._emitByRateOverDistance = function _emitByRateOverDistance(lastPlayTime, playTime) {
|
|
36741
|
+
var ratePerUnit = this.rateOverDistance.evaluate(undefined, undefined);
|
|
36742
|
+
var generator = this._generator;
|
|
36743
|
+
if (ratePerUnit <= 0) {
|
|
36744
|
+
this._invalidateDistanceBaseline();
|
|
36745
|
+
return;
|
|
36746
|
+
}
|
|
36747
|
+
if (!this._hasLastEmitPosition) {
|
|
36748
|
+
this._lastEmitPosition.copyFrom(generator._renderer.entity.transform.worldPosition);
|
|
36749
|
+
this._hasLastEmitPosition = true;
|
|
36750
|
+
return;
|
|
36751
|
+
}
|
|
36752
|
+
var lastPos = this._lastEmitPosition;
|
|
36753
|
+
var currentPos = generator._renderer.entity.transform.worldPosition;
|
|
36754
|
+
var dx = currentPos.x - lastPos.x;
|
|
36755
|
+
var dy = currentPos.y - lastPos.y;
|
|
36756
|
+
var dz = currentPos.z - lastPos.z;
|
|
36757
|
+
var moveLength = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
36758
|
+
this._distanceAccumulator += moveLength;
|
|
36759
|
+
var emitInterval = 1.0 / ratePerUnit;
|
|
36760
|
+
// `+ zeroTolerance` absorbs float divide error so an exact `N*interval` accumulator doesn't drop 1
|
|
36761
|
+
var count = Math.floor(this._distanceAccumulator / emitInterval + engineMath.MathUtil.zeroTolerance);
|
|
36762
|
+
if (count > 0) {
|
|
36763
|
+
this._distanceAccumulator -= count * emitInterval;
|
|
36764
|
+
// `subFrameAge ∈ [0, 1]`: how far back into the frame a particle was born
|
|
36765
|
+
// (0 = newest at currentPos/playTime, 1 = oldest at lastPos/lastPlayTime).
|
|
36766
|
+
// The initial clamp protects two edges — moveLength ≈ 0 (collapse to frame-end
|
|
36767
|
+
// emit) and a tiny moveLength near the emitInterval edge (would put age > 1).
|
|
36768
|
+
// Local simulation space ignores the position override but still uses emitTime.
|
|
36769
|
+
var isWorld = generator.main.simulationSpace === ParticleSimulationSpace.World;
|
|
36770
|
+
var invMoveLength = moveLength > engineMath.MathUtil.zeroTolerance ? 1.0 / moveLength : 0;
|
|
36771
|
+
var ageStep = emitInterval * invMoveLength;
|
|
36772
|
+
var dt = playTime - lastPlayTime;
|
|
36773
|
+
var subFrameAge = Math.min(this._distanceAccumulator * invMoveLength, 1.0);
|
|
36774
|
+
var emitPos = EmissionModule._tempEmitPosition;
|
|
36775
|
+
for(var i = 0; i < count; i++){
|
|
36776
|
+
if (isWorld) {
|
|
36777
|
+
emitPos.set(currentPos.x - dx * subFrameAge, currentPos.y - dy * subFrameAge, currentPos.z - dz * subFrameAge);
|
|
36778
|
+
}
|
|
36779
|
+
if (generator._emit(playTime - dt * subFrameAge, 1, isWorld ? emitPos : undefined) === 0) {
|
|
36780
|
+
// Buffer full: settle the frame's distance budget instead of carrying it over
|
|
36781
|
+
this._distanceAccumulator = 0;
|
|
36782
|
+
break;
|
|
36783
|
+
}
|
|
36784
|
+
subFrameAge += ageStep;
|
|
36785
|
+
}
|
|
36786
|
+
}
|
|
36787
|
+
lastPos.copyFrom(currentPos);
|
|
36788
|
+
};
|
|
36683
36789
|
_proto._emitByBurst = function _emitByBurst(lastPlayTime, playTime) {
|
|
36684
36790
|
var main = this._generator.main;
|
|
36685
36791
|
var duration = main.duration;
|
|
@@ -36776,6 +36882,7 @@ __decorate([
|
|
|
36776
36882
|
return EmissionModule;
|
|
36777
36883
|
}(ParticleGeneratorModule);
|
|
36778
36884
|
/** @internal */ EmissionModule._emissionShapeMacro = ShaderMacro.getByName("RENDERER_EMISSION_SHAPE");
|
|
36885
|
+
EmissionModule._tempEmitPosition = new engineMath.Vector3();
|
|
36779
36886
|
__decorate([
|
|
36780
36887
|
deepClone
|
|
36781
36888
|
], EmissionModule.prototype, "rateOverTime", void 0);
|
|
@@ -36788,6 +36895,15 @@ __decorate([
|
|
|
36788
36895
|
__decorate([
|
|
36789
36896
|
ignoreClone
|
|
36790
36897
|
], EmissionModule.prototype, "_shapeRand", void 0);
|
|
36898
|
+
__decorate([
|
|
36899
|
+
ignoreClone
|
|
36900
|
+
], EmissionModule.prototype, "_distanceAccumulator", void 0);
|
|
36901
|
+
__decorate([
|
|
36902
|
+
ignoreClone
|
|
36903
|
+
], EmissionModule.prototype, "_lastEmitPosition", void 0);
|
|
36904
|
+
__decorate([
|
|
36905
|
+
ignoreClone
|
|
36906
|
+
], EmissionModule.prototype, "_hasLastEmitPosition", void 0);
|
|
36791
36907
|
__decorate([
|
|
36792
36908
|
deepClone
|
|
36793
36909
|
], EmissionModule.prototype, "_bursts", void 0);
|
|
@@ -38474,11 +38590,15 @@ __decorate([
|
|
|
38474
38590
|
}
|
|
38475
38591
|
} else {
|
|
38476
38592
|
this._isPlaying = false;
|
|
38593
|
+
// Invalidate the rateOverDistance baseline so emitter movement during the stop
|
|
38594
|
+
// interval doesn't burst on resume.
|
|
38477
38595
|
if (stopMode === ParticleStopMode.StopEmittingAndClear) {
|
|
38478
38596
|
this._clearActiveParticles();
|
|
38479
38597
|
this._playTime = 0;
|
|
38480
38598
|
this._firstActiveTransformedBoundingBox = this._firstFreeTransformedBoundingBox;
|
|
38481
38599
|
this.emission._reset();
|
|
38600
|
+
} else {
|
|
38601
|
+
this.emission._invalidateDistanceBaseline();
|
|
38482
38602
|
}
|
|
38483
38603
|
}
|
|
38484
38604
|
};
|
|
@@ -38490,37 +38610,40 @@ __decorate([
|
|
|
38490
38610
|
};
|
|
38491
38611
|
/**
|
|
38492
38612
|
* @internal
|
|
38493
|
-
*/ _proto._emit = function _emit(playTime, count) {
|
|
38494
|
-
var emission =
|
|
38495
|
-
if (emission.enabled) {
|
|
38496
|
-
|
|
38497
|
-
|
|
38498
|
-
|
|
38499
|
-
|
|
38500
|
-
|
|
38501
|
-
|
|
38502
|
-
|
|
38503
|
-
|
|
38504
|
-
|
|
38505
|
-
|
|
38506
|
-
|
|
38507
|
-
|
|
38508
|
-
|
|
38509
|
-
|
|
38510
|
-
|
|
38511
|
-
|
|
38512
|
-
|
|
38513
|
-
|
|
38514
|
-
|
|
38515
|
-
|
|
38516
|
-
|
|
38517
|
-
|
|
38518
|
-
|
|
38519
|
-
|
|
38613
|
+
*/ _proto._emit = function _emit(playTime, count, emitWorldPositionOverride) {
|
|
38614
|
+
var _this = this, emission = _this.emission, main = _this.main;
|
|
38615
|
+
if (!emission.enabled) {
|
|
38616
|
+
return 0;
|
|
38617
|
+
}
|
|
38618
|
+
var budget = main.maxParticles - this._getNotRetiredParticleCount();
|
|
38619
|
+
if (count > budget) {
|
|
38620
|
+
count = budget;
|
|
38621
|
+
}
|
|
38622
|
+
if (count <= 0) {
|
|
38623
|
+
return 0;
|
|
38624
|
+
}
|
|
38625
|
+
var position = ParticleGenerator._tempVector30;
|
|
38626
|
+
var direction = ParticleGenerator._tempVector31;
|
|
38627
|
+
var transform = this._renderer.entity.transform;
|
|
38628
|
+
var shape = emission.shape;
|
|
38629
|
+
var positionScale = main._getPositionScale();
|
|
38630
|
+
for(var i = 0; i < count; i++){
|
|
38631
|
+
if (shape == null ? void 0 : shape.enabled) {
|
|
38632
|
+
shape._generatePositionAndDirection(emission._shapeRand, playTime, position, direction);
|
|
38633
|
+
position.multiply(positionScale);
|
|
38634
|
+
direction.normalize().multiply(positionScale);
|
|
38635
|
+
} else {
|
|
38636
|
+
position.set(0, 0, 0);
|
|
38637
|
+
direction.set(0, 0, -1);
|
|
38638
|
+
// Speed is scaled by shape scale in world simulation space
|
|
38639
|
+
// So if no shape and in world simulation space, we shouldn't scale the speed
|
|
38640
|
+
if (main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
38641
|
+
direction.multiply(positionScale);
|
|
38520
38642
|
}
|
|
38521
|
-
this._addNewParticle(position, direction, transform, playTime);
|
|
38522
38643
|
}
|
|
38644
|
+
this._addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride);
|
|
38523
38645
|
}
|
|
38646
|
+
return count;
|
|
38524
38647
|
};
|
|
38525
38648
|
/**
|
|
38526
38649
|
* @internal
|
|
@@ -38922,7 +39045,7 @@ __decorate([
|
|
|
38922
39045
|
this._transformedBoundsArray[previousFreeElement * ParticleBufferUtils.boundsFloatStride + boundsTimeOffset] = this._playTime;
|
|
38923
39046
|
}
|
|
38924
39047
|
};
|
|
38925
|
-
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime) {
|
|
39048
|
+
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride) {
|
|
38926
39049
|
var firstFreeElement = this._firstFreeElement;
|
|
38927
39050
|
var nextFreeElement = firstFreeElement + 1;
|
|
38928
39051
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
@@ -38945,7 +39068,7 @@ __decorate([
|
|
|
38945
39068
|
}
|
|
38946
39069
|
var pos, rot;
|
|
38947
39070
|
if (main.simulationSpace === ParticleSimulationSpace.World) {
|
|
38948
|
-
pos = transform.worldPosition;
|
|
39071
|
+
pos = emitWorldPositionOverride != null ? emitWorldPositionOverride : transform.worldPosition;
|
|
38949
39072
|
rot = transform.worldRotationQuaternion;
|
|
38950
39073
|
}
|
|
38951
39074
|
var startSpeed = main.startSpeed.evaluate(undefined, main._startSpeedRand.random());
|
|
@@ -39065,18 +39188,18 @@ __decorate([
|
|
|
39065
39188
|
}
|
|
39066
39189
|
// Initialize feedback buffer for this particle
|
|
39067
39190
|
if (this._useTransformFeedback) {
|
|
39068
|
-
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform);
|
|
39191
|
+
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform, pos);
|
|
39069
39192
|
}
|
|
39070
39193
|
this._firstFreeElement = nextFreeElement;
|
|
39071
39194
|
};
|
|
39072
|
-
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform) {
|
|
39195
|
+
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform, emitWorldPosition) {
|
|
39073
39196
|
var position;
|
|
39074
39197
|
if (this.main.simulationSpace === ParticleSimulationSpace.Local) {
|
|
39075
39198
|
position = shapePosition;
|
|
39076
39199
|
} else {
|
|
39077
39200
|
position = ParticleGenerator._tempVector32;
|
|
39078
39201
|
engineMath.Vector3.transformByQuat(shapePosition, transform.worldRotationQuaternion, position);
|
|
39079
|
-
position.add(transform.worldPosition);
|
|
39202
|
+
position.add(emitWorldPosition != null ? emitWorldPosition : transform.worldPosition);
|
|
39080
39203
|
}
|
|
39081
39204
|
this._feedbackSimulator.writeParticleData(index, position, direction.x * startSpeed, direction.y * startSpeed, direction.z * startSpeed);
|
|
39082
39205
|
};
|
|
@@ -41763,6 +41886,7 @@ exports.DisorderedArray = DisorderedArray;
|
|
|
41763
41886
|
exports.Downsampling = Downsampling;
|
|
41764
41887
|
exports.DynamicCollider = DynamicCollider;
|
|
41765
41888
|
exports.DynamicColliderConstraints = DynamicColliderConstraints;
|
|
41889
|
+
exports.DynamicColliderKinematicTransformSyncMode = DynamicColliderKinematicTransformSyncMode;
|
|
41766
41890
|
exports.EmissionModule = EmissionModule;
|
|
41767
41891
|
exports.Engine = Engine;
|
|
41768
41892
|
exports.EngineObject = EngineObject;
|