@galacean/engine-core 2.0.0-alpha.37 → 2.0.0-alpha.38
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 +731 -240
- package/dist/main.js.map +1 -1
- package/dist/module.js +731 -240
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Engine.d.ts +1 -0
- package/types/Entity.d.ts +2 -1
- package/types/Signal.d.ts +6 -2
- package/types/animation/AnimationClip.d.ts +7 -1
- package/types/animation/Animator.d.ts +2 -0
- package/types/animation/AnimatorController.d.ts +1 -0
- package/types/animation/AnimatorControllerLayer.d.ts +8 -2
- package/types/animation/AnimatorStateMachine.d.ts +1 -0
- package/types/asset/ResourceManager.d.ts +1 -1
- package/types/audio/AudioManager.d.ts +4 -0
- package/types/audio/AudioSource.d.ts +1 -0
- package/types/particle/ParticleGenerator.d.ts +7 -0
- package/types/particle/modules/ParticleCompositeCurve.d.ts +2 -2
- package/types/particle/modules/VelocityOverLifetimeModule.d.ts +62 -0
- package/types/physics/DynamicCollider.d.ts +6 -0
package/dist/main.js
CHANGED
|
@@ -3852,7 +3852,7 @@ exports.TiledSpriteAssembler = __decorate([
|
|
|
3852
3852
|
sprite.name === name && outSprites.push(sprite);
|
|
3853
3853
|
}
|
|
3854
3854
|
} else {
|
|
3855
|
-
console.warn("
|
|
3855
|
+
console.warn("There is no sprite named " + name + " in the atlas.");
|
|
3856
3856
|
}
|
|
3857
3857
|
return outSprites;
|
|
3858
3858
|
};
|
|
@@ -6063,6 +6063,9 @@ __decorate([
|
|
|
6063
6063
|
__decorate([
|
|
6064
6064
|
ignoreClone
|
|
6065
6065
|
], Transform.prototype, "_isParentDirty", void 0);
|
|
6066
|
+
__decorate([
|
|
6067
|
+
ignoreClone
|
|
6068
|
+
], Transform.prototype, "_parentTransformCache", void 0);
|
|
6066
6069
|
__decorate([
|
|
6067
6070
|
ignoreClone
|
|
6068
6071
|
], Transform.prototype, "_dirtyFlag", void 0);
|
|
@@ -17075,9 +17078,10 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17075
17078
|
};
|
|
17076
17079
|
/**
|
|
17077
17080
|
* Get the components which match the type of the entity and it's children.
|
|
17081
|
+
* @remarks The components are returned in depth-first pre-order: the entity itself first, then each child's subtree in sibling order.
|
|
17078
17082
|
* @param type - The component type
|
|
17079
17083
|
* @param results - The components collection
|
|
17080
|
-
* @returns
|
|
17084
|
+
* @returns The components collection which match the type
|
|
17081
17085
|
*/ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
|
|
17082
17086
|
results.length = 0;
|
|
17083
17087
|
this._getComponentsInChildren(type, results);
|
|
@@ -17382,14 +17386,16 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17382
17386
|
}
|
|
17383
17387
|
};
|
|
17384
17388
|
_proto._getComponentsInChildren = function _getComponentsInChildren(type, results) {
|
|
17385
|
-
|
|
17386
|
-
|
|
17389
|
+
var components = this._components;
|
|
17390
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
17391
|
+
var component = components[i];
|
|
17387
17392
|
if (_instanceof(component, type)) {
|
|
17388
17393
|
results.push(component);
|
|
17389
17394
|
}
|
|
17390
17395
|
}
|
|
17391
|
-
|
|
17392
|
-
|
|
17396
|
+
var children = this._children;
|
|
17397
|
+
for(var i1 = 0, n1 = children.length; i1 < n1; i1++){
|
|
17398
|
+
children[i1]._getComponentsInChildren(type, results);
|
|
17393
17399
|
}
|
|
17394
17400
|
};
|
|
17395
17401
|
_proto._setActiveComponents = function _setActiveComponents(isActive, activeChangeFlag) {
|
|
@@ -18821,37 +18827,39 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
18821
18827
|
this._contentRestorerPool = null;
|
|
18822
18828
|
this._loadingPromises = null;
|
|
18823
18829
|
};
|
|
18824
|
-
_proto.
|
|
18825
|
-
var
|
|
18826
|
-
|
|
18830
|
+
_proto._resolveLoadItemOptions = function _resolveLoadItemOptions(assetInfo, virtualResourceEntry) {
|
|
18831
|
+
var _assetInfo;
|
|
18832
|
+
var _virtualResourceEntry_type, _ref;
|
|
18833
|
+
assetInfo.type = (_ref = (_virtualResourceEntry_type = virtualResourceEntry == null ? void 0 : virtualResourceEntry.type) != null ? _virtualResourceEntry_type : assetInfo.type) != null ? _ref : ResourceManager._getTypeByUrl(assetInfo.url);
|
|
18827
18834
|
if (assetInfo.type === undefined) {
|
|
18828
18835
|
throw "asset type should be specified: " + assetInfo.url;
|
|
18829
18836
|
}
|
|
18837
|
+
var _params;
|
|
18838
|
+
(_params = (_assetInfo = assetInfo).params) != null ? _params : _assetInfo.params = virtualResourceEntry == null ? void 0 : virtualResourceEntry.params;
|
|
18830
18839
|
var _assetInfo_retryCount;
|
|
18831
18840
|
assetInfo.retryCount = (_assetInfo_retryCount = assetInfo.retryCount) != null ? _assetInfo_retryCount : this.retryCount;
|
|
18832
18841
|
var _assetInfo_timeout;
|
|
18833
18842
|
assetInfo.timeout = (_assetInfo_timeout = assetInfo.timeout) != null ? _assetInfo_timeout : this.timeout;
|
|
18834
18843
|
var _assetInfo_retryInterval;
|
|
18835
18844
|
assetInfo.retryInterval = (_assetInfo_retryInterval = assetInfo.retryInterval) != null ? _assetInfo_retryInterval : this.retryInterval;
|
|
18836
|
-
var _assetInfo_url;
|
|
18837
|
-
assetInfo.url = (_assetInfo_url = assetInfo.url) != null ? _assetInfo_url : assetInfo.urls.join(",");
|
|
18838
|
-
return assetInfo;
|
|
18839
18845
|
};
|
|
18840
18846
|
_proto._loadSingleItem = function _loadSingleItem(itemOrURL) {
|
|
18841
18847
|
var _this = this;
|
|
18842
|
-
var item =
|
|
18848
|
+
var item = typeof itemOrURL === "string" ? {
|
|
18843
18849
|
url: itemOrURL
|
|
18844
|
-
} : itemOrURL
|
|
18845
|
-
var
|
|
18846
|
-
|
|
18847
|
-
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
18850
|
+
} : itemOrURL;
|
|
18851
|
+
var _item_url;
|
|
18852
|
+
item.url = (_item_url = item.url) != null ? _item_url : item.urls.join(",");
|
|
18848
18853
|
// Parse url
|
|
18849
|
-
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
18854
|
+
var _this__parseURL = this._parseURL(item.url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
18850
18855
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
18851
18856
|
// Get remote asset base url
|
|
18852
|
-
var
|
|
18853
|
-
|
|
18854
|
-
|
|
18857
|
+
var virtualResourceEntry = this._virtualPathResourceMap[assetBaseURL];
|
|
18858
|
+
this._resolveLoadItemOptions(item, virtualResourceEntry);
|
|
18859
|
+
// Not absolute and base url is set
|
|
18860
|
+
item.url = !Utils.isAbsoluteUrl(assetBaseURL) && this.baseUrl ? Utils.resolveAbsoluteUrl(this.baseUrl, assetBaseURL) : assetBaseURL;
|
|
18861
|
+
var _virtualResourceEntry_path;
|
|
18862
|
+
var remoteAssetBaseURL = (_virtualResourceEntry_path = virtualResourceEntry == null ? void 0 : virtualResourceEntry.path) != null ? _virtualResourceEntry_path : item.url;
|
|
18855
18863
|
// Check cache
|
|
18856
18864
|
var cacheObject = this._assetUrlPool[remoteAssetBaseURL];
|
|
18857
18865
|
if (cacheObject) {
|
|
@@ -18885,25 +18893,24 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
18885
18893
|
if (!loader) {
|
|
18886
18894
|
throw "loader not found: " + item.type;
|
|
18887
18895
|
}
|
|
18888
|
-
var subpackageName =
|
|
18896
|
+
var subpackageName = virtualResourceEntry == null ? void 0 : virtualResourceEntry.subpackageName;
|
|
18889
18897
|
// Check sub asset
|
|
18890
18898
|
if (queryPath) {
|
|
18891
18899
|
// Check whether load main asset
|
|
18892
|
-
var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL,
|
|
18900
|
+
var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
18893
18901
|
mainPromise.catch(function(e) {
|
|
18894
18902
|
_this._onSubAssetFail(remoteAssetBaseURL, queryPath, e);
|
|
18895
18903
|
});
|
|
18896
18904
|
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath);
|
|
18897
18905
|
}
|
|
18898
|
-
return this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL,
|
|
18906
|
+
return this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
18899
18907
|
};
|
|
18900
18908
|
// For adapter mini-game platform
|
|
18901
|
-
_proto._loadSubpackageAndMainAsset = function _loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL,
|
|
18902
|
-
return this._loadMainAsset(loader, item, remoteAssetBaseURL
|
|
18909
|
+
_proto._loadSubpackageAndMainAsset = function _loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName) {
|
|
18910
|
+
return this._loadMainAsset(loader, item, remoteAssetBaseURL);
|
|
18903
18911
|
};
|
|
18904
|
-
_proto._loadMainAsset = function _loadMainAsset(loader, item, remoteAssetBaseURL
|
|
18912
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, remoteAssetBaseURL) {
|
|
18905
18913
|
var _this = this;
|
|
18906
|
-
item.url = assetBaseURL;
|
|
18907
18914
|
var loadingPromises = this._loadingPromises;
|
|
18908
18915
|
var promise = loader.load(item, this);
|
|
18909
18916
|
loadingPromises[remoteAssetBaseURL] = promise;
|
|
@@ -19030,10 +19037,9 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19030
19037
|
return AssetPromise.resolve(null);
|
|
19031
19038
|
}
|
|
19032
19039
|
var loadUrl = key ? url + "?q=" + key : url;
|
|
19040
|
+
// type and params omitted: resolved from the virtualPath map, the single source of truth
|
|
19033
19041
|
var promise = this.load({
|
|
19034
|
-
url: loadUrl
|
|
19035
|
-
type: mapped.type,
|
|
19036
|
-
params: mapped.params
|
|
19042
|
+
url: loadUrl
|
|
19037
19043
|
});
|
|
19038
19044
|
return isClone ? promise.then(function(item) {
|
|
19039
19045
|
return item.clone();
|
|
@@ -20440,6 +20446,13 @@ __decorate([
|
|
|
20440
20446
|
this._phasedActiveInScene && this._nativeCollider.addForce(force);
|
|
20441
20447
|
};
|
|
20442
20448
|
/**
|
|
20449
|
+
* Apply a force to the DynamicCollider at a given position in world space.
|
|
20450
|
+
* @param force - The force to apply, in world space
|
|
20451
|
+
* @param position - The position where the force is applied, in world space
|
|
20452
|
+
*/ _proto.applyForceAtPosition = function applyForceAtPosition(force, position) {
|
|
20453
|
+
this._phasedActiveInScene && this._nativeCollider.addForceAtPosition(force, position);
|
|
20454
|
+
};
|
|
20455
|
+
/**
|
|
20443
20456
|
* Apply a torque to the DynamicCollider.
|
|
20444
20457
|
* @param torque - The force make the collider rotate
|
|
20445
20458
|
*/ _proto.applyTorque = function applyTorque(torque) {
|
|
@@ -26792,6 +26805,7 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
26792
26805
|
depthOnlyPass.release();
|
|
26793
26806
|
camera.shaderData.setTexture(exports.Camera._cameraDepthTextureProperty, engine._basicResources.whiteTexture2D);
|
|
26794
26807
|
}
|
|
26808
|
+
var pool = engine._renderTargetPool;
|
|
26795
26809
|
// Check if need to create internal color texture or grab texture
|
|
26796
26810
|
if (independentCanvasEnabled) {
|
|
26797
26811
|
var depthFormat;
|
|
@@ -26807,26 +26821,12 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
26807
26821
|
depthFormat = null;
|
|
26808
26822
|
}
|
|
26809
26823
|
var viewport = camera.pixelViewport;
|
|
26810
|
-
|
|
26824
|
+
this._internalColorTarget = pool.allocateRenderTarget(viewport.width, viewport.height, camera._getInternalColorTextureFormat(), depthFormat, false, false, !camera.enableHDR, msaaSamples, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
|
|
26811
26825
|
if (this._shouldCopyBackgroundColor) {
|
|
26812
26826
|
var _camera_renderTarget;
|
|
26813
26827
|
var colorTexture = (_camera_renderTarget = camera.renderTarget) == null ? void 0 : _camera_renderTarget.getColorTexture(0);
|
|
26814
26828
|
var _colorTexture_format, _colorTexture_isSRGBColorSpace;
|
|
26815
|
-
|
|
26816
|
-
this._copyBackgroundTexture = copyBackgroundTexture;
|
|
26817
|
-
}
|
|
26818
|
-
this._internalColorTarget = internalColorTarget;
|
|
26819
|
-
} else {
|
|
26820
|
-
var internalColorTarget1 = this._internalColorTarget;
|
|
26821
|
-
var copyBackgroundTexture1 = this._copyBackgroundTexture;
|
|
26822
|
-
var pool = engine._renderTargetPool;
|
|
26823
|
-
if (internalColorTarget1) {
|
|
26824
|
-
pool.freeRenderTarget(internalColorTarget1);
|
|
26825
|
-
this._internalColorTarget = null;
|
|
26826
|
-
}
|
|
26827
|
-
if (copyBackgroundTexture1) {
|
|
26828
|
-
pool.freeTexture(copyBackgroundTexture1);
|
|
26829
|
-
this._copyBackgroundTexture = null;
|
|
26829
|
+
this._copyBackgroundTexture = pool.allocateTexture(viewport.width, viewport.height, (_colorTexture_format = colorTexture == null ? void 0 : colorTexture.format) != null ? _colorTexture_format : TextureFormat.R8G8B8A8, false, (_colorTexture_isSRGBColorSpace = colorTexture == null ? void 0 : colorTexture.isSRGBColorSpace) != null ? _colorTexture_isSRGBColorSpace : false, TextureWrapMode.Clamp, TextureFilterMode.Bilinear);
|
|
26830
26830
|
}
|
|
26831
26831
|
}
|
|
26832
26832
|
// Scalable ambient obscurance pass
|
|
@@ -26839,6 +26839,15 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
26839
26839
|
this._saoPass.release();
|
|
26840
26840
|
}
|
|
26841
26841
|
this._drawRenderPass(context, camera, finalClearFlags, cubeFace, mipLevel);
|
|
26842
|
+
// Return the per-frame leases so the next camera with matching shape can reuse them
|
|
26843
|
+
if (this._internalColorTarget) {
|
|
26844
|
+
pool.freeRenderTarget(this._internalColorTarget);
|
|
26845
|
+
this._internalColorTarget = null;
|
|
26846
|
+
}
|
|
26847
|
+
if (this._copyBackgroundTexture) {
|
|
26848
|
+
pool.freeTexture(this._copyBackgroundTexture);
|
|
26849
|
+
this._copyBackgroundTexture = null;
|
|
26850
|
+
}
|
|
26842
26851
|
};
|
|
26843
26852
|
_proto._drawRenderPass = function _drawRenderPass(context, camera, finalClearFlags, cubeFace, mipLevel) {
|
|
26844
26853
|
var cullingResults = this._cullingResults;
|
|
@@ -27172,7 +27181,9 @@ var OverlayCamera = function OverlayCamera() {
|
|
|
27172
27181
|
_inherits(Engine, EventDispatcher);
|
|
27173
27182
|
function Engine(canvas, hardwareRenderer, configuration) {
|
|
27174
27183
|
var _this;
|
|
27175
|
-
_this = EventDispatcher.call(this) || this, /** @internal */ _this._renderingStatistics = new RenderingStatistics(), /** @internal */ _this._isDeviceLost = false, /** @internal */ _this._frameInProcess = false, /** @internal */ _this._pendingDestroyObjects = [], /** @internal */ _this._processingPendingDestroys = false, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._textRenderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramMaps = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._waitingDestroy = false, _this._waitingGC = false, _this._postProcessPasses = new Array(), _this._activePostProcessPasses = new Array(), _this.
|
|
27184
|
+
_this = EventDispatcher.call(this) || this, /** @internal */ _this._renderingStatistics = new RenderingStatistics(), /** @internal */ _this._isDeviceLost = false, /** @internal */ _this._frameInProcess = false, /** @internal */ _this._pendingDestroyObjects = [], /** @internal */ _this._processingPendingDestroys = false, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._textRenderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramMaps = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._waitingDestroy = false, _this._waitingGC = false, _this._postProcessPasses = new Array(), _this._activePostProcessPasses = new Array(), _this._onCanvasResize = function() {
|
|
27185
|
+
return _this._renderTargetPool.gc();
|
|
27186
|
+
}, _this._animate = function() {
|
|
27176
27187
|
if (_this._vSyncCount) {
|
|
27177
27188
|
var _this_xrManager;
|
|
27178
27189
|
var raf = ((_this_xrManager = _this.xrManager) == null ? void 0 : _this_xrManager._getRequestAnimationFrame()) || requestAnimationFrame;
|
|
@@ -27193,6 +27204,7 @@ var OverlayCamera = function OverlayCamera() {
|
|
|
27193
27204
|
_this._textDefaultFont.isGCIgnored = true;
|
|
27194
27205
|
_this._batcherManager = new BatcherManager(_this);
|
|
27195
27206
|
_this._renderTargetPool = new RenderTargetPool(_this);
|
|
27207
|
+
canvas._sizeUpdateFlagManager.addListener(_this._onCanvasResize);
|
|
27196
27208
|
_this.inputManager = new InputManager(_this, configuration.input);
|
|
27197
27209
|
var xrDevice = configuration.xrDevice;
|
|
27198
27210
|
if (xrDevice) {
|
|
@@ -27396,6 +27408,7 @@ var OverlayCamera = function OverlayCamera() {
|
|
|
27396
27408
|
var _this_xrManager;
|
|
27397
27409
|
this._destroyed = true;
|
|
27398
27410
|
this._waitingDestroy = false;
|
|
27411
|
+
this._canvas._sizeUpdateFlagManager.removeListener(this._onCanvasResize);
|
|
27399
27412
|
this._sceneManager._destroyAllScene();
|
|
27400
27413
|
this._resourceManager._destroy();
|
|
27401
27414
|
this.inputManager._destroy();
|
|
@@ -29730,7 +29743,7 @@ var PointerMethods = /*#__PURE__*/ function(PointerMethods) {
|
|
|
29730
29743
|
for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
29731
29744
|
signalArgs[_key] = arguments[_key];
|
|
29732
29745
|
}
|
|
29733
|
-
return (_target = target)[methodName].apply(_target, [].concat(
|
|
29746
|
+
return (_target = target)[methodName].apply(_target, [].concat(signalArgs, args));
|
|
29734
29747
|
} : function() {
|
|
29735
29748
|
for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
29736
29749
|
signalArgs[_key] = arguments[_key];
|
|
@@ -30164,7 +30177,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
30164
30177
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
30165
30178
|
function AnimationClipCurveBinding() {
|
|
30166
30179
|
/** The index of the component that is animated. */ this.typeIndex = 0;
|
|
30167
|
-
this._tempCurveOwner =
|
|
30180
|
+
this._tempCurveOwner = new WeakMap();
|
|
30168
30181
|
}
|
|
30169
30182
|
var _proto = AnimationClipCurveBinding.prototype;
|
|
30170
30183
|
/**
|
|
@@ -30190,11 +30203,12 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
30190
30203
|
/**
|
|
30191
30204
|
* @internal
|
|
30192
30205
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity, component) {
|
|
30193
|
-
var
|
|
30194
|
-
if (!
|
|
30195
|
-
|
|
30206
|
+
var owner = this._tempCurveOwner.get(entity);
|
|
30207
|
+
if (!owner) {
|
|
30208
|
+
owner = this._createCurveOwner(entity, component);
|
|
30209
|
+
this._tempCurveOwner.set(entity, owner);
|
|
30196
30210
|
}
|
|
30197
|
-
return
|
|
30211
|
+
return owner;
|
|
30198
30212
|
};
|
|
30199
30213
|
return AnimationClipCurveBinding;
|
|
30200
30214
|
}();
|
|
@@ -30276,11 +30290,10 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
30276
30290
|
this._length = 0;
|
|
30277
30291
|
};
|
|
30278
30292
|
/**
|
|
30279
|
-
* @internal
|
|
30280
30293
|
* Samples an animation at a given time.
|
|
30281
30294
|
* @param entity - The animated entity
|
|
30282
30295
|
* @param time - The time to sample an animation
|
|
30283
|
-
*/ _proto.
|
|
30296
|
+
*/ _proto.sampleAnimation = function sampleAnimation(entity, time) {
|
|
30284
30297
|
var _this = this, curveBindings = _this._curveBindings;
|
|
30285
30298
|
var components = AnimationCurveOwner._components;
|
|
30286
30299
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
@@ -31455,12 +31468,6 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
31455
31468
|
return LayerState;
|
|
31456
31469
|
}({});
|
|
31457
31470
|
|
|
31458
|
-
/**
|
|
31459
|
-
* @internal
|
|
31460
|
-
*/ var AnimationEventHandler = function AnimationEventHandler() {
|
|
31461
|
-
this.handlers = [];
|
|
31462
|
-
};
|
|
31463
|
-
|
|
31464
31471
|
/**
|
|
31465
31472
|
* Animation wrap mode.
|
|
31466
31473
|
*/ var WrapMode = /*#__PURE__*/ function(WrapMode) {
|
|
@@ -31469,6 +31476,12 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
31469
31476
|
return WrapMode;
|
|
31470
31477
|
}({});
|
|
31471
31478
|
|
|
31479
|
+
/**
|
|
31480
|
+
* @internal
|
|
31481
|
+
*/ var AnimationEventHandler = function AnimationEventHandler() {
|
|
31482
|
+
this.handlers = [];
|
|
31483
|
+
};
|
|
31484
|
+
|
|
31472
31485
|
/**
|
|
31473
31486
|
* @internal
|
|
31474
31487
|
*/ var AnimatorStatePlayData = /*#__PURE__*/ function() {
|
|
@@ -31509,19 +31522,21 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
31509
31522
|
this.playedTime += deltaTime;
|
|
31510
31523
|
var instance = this.instance;
|
|
31511
31524
|
var state = instance._state;
|
|
31525
|
+
var clipLength = state.clip.length;
|
|
31526
|
+
var clipStartTime = state.clipStartTime;
|
|
31512
31527
|
var time = this.playedTime + this.offsetFrameTime;
|
|
31513
|
-
var duration = state.
|
|
31528
|
+
var duration = (state.clipEndTime - clipStartTime) * clipLength;
|
|
31514
31529
|
this.playState = AnimatorStatePlayState.Playing;
|
|
31515
31530
|
if (instance.wrapMode === WrapMode.Loop) {
|
|
31516
31531
|
time = duration ? time % duration : 0;
|
|
31517
|
-
} else {
|
|
31518
|
-
|
|
31519
|
-
|
|
31520
|
-
this.playState = AnimatorStatePlayState.Finished;
|
|
31521
|
-
}
|
|
31532
|
+
} else if (time >= duration || time <= -duration) {
|
|
31533
|
+
time = time < 0 ? -duration : duration;
|
|
31534
|
+
this.playState = AnimatorStatePlayState.Finished;
|
|
31522
31535
|
}
|
|
31523
|
-
time < 0
|
|
31524
|
-
|
|
31536
|
+
if (time < 0) {
|
|
31537
|
+
time += duration;
|
|
31538
|
+
}
|
|
31539
|
+
this.clipTime = time + clipStartTime * clipLength;
|
|
31525
31540
|
if (this._changedOrientation) {
|
|
31526
31541
|
!this.isForward && this._correctTime();
|
|
31527
31542
|
this._changedOrientation = false;
|
|
@@ -31534,6 +31549,26 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
31534
31549
|
this.clipTime = state.clipEndTime * state.clip.length;
|
|
31535
31550
|
}
|
|
31536
31551
|
};
|
|
31552
|
+
_create_class(AnimatorStatePlayData, [
|
|
31553
|
+
{
|
|
31554
|
+
key: "state",
|
|
31555
|
+
get: function get() {
|
|
31556
|
+
return this.instance._state;
|
|
31557
|
+
}
|
|
31558
|
+
},
|
|
31559
|
+
{
|
|
31560
|
+
key: "speed",
|
|
31561
|
+
get: function get() {
|
|
31562
|
+
return this.instance.speed;
|
|
31563
|
+
}
|
|
31564
|
+
},
|
|
31565
|
+
{
|
|
31566
|
+
key: "wrapMode",
|
|
31567
|
+
get: function get() {
|
|
31568
|
+
return this.instance.wrapMode;
|
|
31569
|
+
}
|
|
31570
|
+
}
|
|
31571
|
+
]);
|
|
31537
31572
|
return AnimatorStatePlayData;
|
|
31538
31573
|
}();
|
|
31539
31574
|
|
|
@@ -31712,8 +31747,8 @@ function _type_of(obj) {
|
|
|
31712
31747
|
* @internal
|
|
31713
31748
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
31714
31749
|
function AnimatorLayerData() {
|
|
31715
|
-
this.curveOwnerPool =
|
|
31716
|
-
this.animatorStateDataMap = new
|
|
31750
|
+
this.curveOwnerPool = new WeakMap();
|
|
31751
|
+
this.animatorStateDataMap = new Map();
|
|
31717
31752
|
this.instanceMap = new WeakMap();
|
|
31718
31753
|
this.srcPlayData = null;
|
|
31719
31754
|
this.destPlayData = null;
|
|
@@ -31732,15 +31767,6 @@ function _type_of(obj) {
|
|
|
31732
31767
|
}
|
|
31733
31768
|
return instance;
|
|
31734
31769
|
};
|
|
31735
|
-
_proto.completeCrossFade = function completeCrossFade() {
|
|
31736
|
-
this.srcPlayData = this.destPlayData;
|
|
31737
|
-
this.destPlayData = null;
|
|
31738
|
-
this.crossFadeTransition = null;
|
|
31739
|
-
};
|
|
31740
|
-
_proto.clearCrossFadeSlot = function clearCrossFadeSlot() {
|
|
31741
|
-
this.destPlayData = null;
|
|
31742
|
-
this.crossFadeTransition = null;
|
|
31743
|
-
};
|
|
31744
31770
|
_proto.resetCurrentCheckIndex = function resetCurrentCheckIndex() {
|
|
31745
31771
|
this.layer.stateMachine._entryTransitionCollection.needResetCurrentCheckIndex = true;
|
|
31746
31772
|
this.layer.stateMachine._anyStateTransitionCollection.needResetCurrentCheckIndex = true;
|
|
@@ -31764,7 +31790,7 @@ function _type_of(obj) {
|
|
|
31764
31790
|
_inherits(Animator, Component);
|
|
31765
31791
|
function Animator(entity) {
|
|
31766
31792
|
var _this;
|
|
31767
|
-
_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 =
|
|
31793
|
+
_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 = new WeakMap(), _this._parametersValueMap = Object.create(null), _this._tempAnimatorStateInfo = {
|
|
31768
31794
|
layerIndex: -1,
|
|
31769
31795
|
state: null
|
|
31770
31796
|
}, _this._controlledRenderers = new Array();
|
|
@@ -31947,16 +31973,21 @@ function _type_of(obj) {
|
|
|
31947
31973
|
/**
|
|
31948
31974
|
* @internal
|
|
31949
31975
|
*/ _proto._reset = function _reset() {
|
|
31950
|
-
var
|
|
31951
|
-
for(var
|
|
31952
|
-
var
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31976
|
+
var layersData = this._animatorLayersData;
|
|
31977
|
+
for(var i = 0, n = layersData.length; i < n; i++){
|
|
31978
|
+
var layerData = layersData[i];
|
|
31979
|
+
if (!layerData) continue;
|
|
31980
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(layerData.animatorStateDataMap.values()), _step; !(_step = _iterator()).done;){
|
|
31981
|
+
var stateData = _step.value;
|
|
31982
|
+
var layerOwners = stateData.curveLayerOwner;
|
|
31983
|
+
for(var k = 0, l = layerOwners.length; k < l; k++){
|
|
31984
|
+
var _layerOwners_k_curveOwner, _layerOwners_k;
|
|
31985
|
+
(_layerOwners_k = layerOwners[k]) == null ? void 0 : (_layerOwners_k_curveOwner = _layerOwners_k.curveOwner) == null ? void 0 : _layerOwners_k_curveOwner.revertDefaultValue();
|
|
31986
|
+
}
|
|
31956
31987
|
}
|
|
31957
31988
|
}
|
|
31958
31989
|
this._animatorLayersData.length = 0;
|
|
31959
|
-
this._curveOwnerPool =
|
|
31990
|
+
this._curveOwnerPool = new WeakMap();
|
|
31960
31991
|
this._parametersValueMap = Object.create(null);
|
|
31961
31992
|
if (this._controllerUpdateFlag) {
|
|
31962
31993
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -31979,6 +32010,7 @@ function _type_of(obj) {
|
|
|
31979
32010
|
};
|
|
31980
32011
|
_proto._onDestroy = function _onDestroy() {
|
|
31981
32012
|
Component.prototype._onDestroy.call(this);
|
|
32013
|
+
this._reset();
|
|
31982
32014
|
var controller = this._animatorController;
|
|
31983
32015
|
if (controller) {
|
|
31984
32016
|
var _this__controllerUpdateFlag;
|
|
@@ -31992,7 +32024,8 @@ function _type_of(obj) {
|
|
|
31992
32024
|
if (!state) {
|
|
31993
32025
|
return;
|
|
31994
32026
|
}
|
|
31995
|
-
var
|
|
32027
|
+
var animatorLayerData = this._getAnimatorLayerData(playLayerIndex);
|
|
32028
|
+
var manuallyTransition = animatorLayerData.manuallyTransition;
|
|
31996
32029
|
manuallyTransition.duration = duration;
|
|
31997
32030
|
manuallyTransition.offset = normalizedTimeOffset;
|
|
31998
32031
|
manuallyTransition.isFixedDuration = isFixedDuration;
|
|
@@ -32047,20 +32080,30 @@ function _type_of(obj) {
|
|
|
32047
32080
|
var relativePath = curve.relativePath;
|
|
32048
32081
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
32049
32082
|
if (targetEntity) {
|
|
32050
|
-
var
|
|
32083
|
+
var _layerPropertyOwners, _property;
|
|
32051
32084
|
var component = curve.typeIndex > 0 ? targetEntity.getComponents(curve.type, components)[curve.typeIndex] : targetEntity.getComponent(curve.type);
|
|
32052
32085
|
components.length = 0;
|
|
32053
32086
|
if (!component) {
|
|
32054
32087
|
continue;
|
|
32055
32088
|
}
|
|
32056
32089
|
var property = curve.property;
|
|
32057
|
-
|
|
32058
|
-
|
|
32059
|
-
|
|
32060
|
-
|
|
32061
|
-
|
|
32062
|
-
|
|
32063
|
-
var
|
|
32090
|
+
// Key owner lookup by Component identity instead of instanceId.
|
|
32091
|
+
var propertyOwners = curveOwnerPool.get(component);
|
|
32092
|
+
if (!propertyOwners) {
|
|
32093
|
+
propertyOwners = Object.create(null);
|
|
32094
|
+
curveOwnerPool.set(component, propertyOwners);
|
|
32095
|
+
}
|
|
32096
|
+
var owner = propertyOwners[property];
|
|
32097
|
+
if (!owner) {
|
|
32098
|
+
owner = curve._createCurveOwner(targetEntity, component);
|
|
32099
|
+
propertyOwners[property] = owner;
|
|
32100
|
+
}
|
|
32101
|
+
var layerPropertyOwners = layerCurveOwnerPool.get(component);
|
|
32102
|
+
if (!layerPropertyOwners) {
|
|
32103
|
+
layerPropertyOwners = Object.create(null);
|
|
32104
|
+
layerCurveOwnerPool.set(component, layerPropertyOwners);
|
|
32105
|
+
}
|
|
32106
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property = property] || (_layerPropertyOwners[_property] = curve._createCurveLayerOwner(owner));
|
|
32064
32107
|
if (mask && mask.pathMasks.length) {
|
|
32065
32108
|
var _mask_getPathMask;
|
|
32066
32109
|
var _mask_getPathMask_active;
|
|
@@ -32074,8 +32117,6 @@ function _type_of(obj) {
|
|
|
32074
32117
|
}
|
|
32075
32118
|
};
|
|
32076
32119
|
_proto._ensureEventHandlers = function _ensureEventHandlers(state, animatorStateData) {
|
|
32077
|
-
// state._updateFlagManager dispatches on both clip-swap and clip-events-mutation,
|
|
32078
|
-
// so its version covers every input that affects eventHandlers binding
|
|
32079
32120
|
var stateVersion = state._updateFlagManager.version;
|
|
32080
32121
|
var scriptsVersion = this._entity._scriptsVersion;
|
|
32081
32122
|
if (animatorStateData.eventsBuiltVersion === stateVersion && animatorStateData.eventsBuiltScriptsVersion === scriptsVersion) {
|
|
@@ -32199,8 +32240,8 @@ function _type_of(obj) {
|
|
|
32199
32240
|
};
|
|
32200
32241
|
_proto._updatePlayingState = function _updatePlayingState(layerData, weight, additive, deltaTime, aniUpdate) {
|
|
32201
32242
|
var srcPlayData = layerData.srcPlayData;
|
|
32202
|
-
var state = srcPlayData.
|
|
32203
|
-
var playSpeed = srcPlayData.
|
|
32243
|
+
var state = srcPlayData.state;
|
|
32244
|
+
var playSpeed = srcPlayData.speed * this.speed;
|
|
32204
32245
|
var playDeltaTime = playSpeed * deltaTime;
|
|
32205
32246
|
srcPlayData.updateOrientation(playDeltaTime);
|
|
32206
32247
|
var lastClipTime = srcPlayData.clipTime, lastPlayState = srcPlayData.playState;
|
|
@@ -32244,14 +32285,13 @@ function _type_of(obj) {
|
|
|
32244
32285
|
this._evaluatePlayingState(srcPlayData, weight, additive, aniUpdate);
|
|
32245
32286
|
this._fireAnimationEventsAndCallScripts(layerData.layerIndex, srcPlayData, state, lastClipTime, lastPlayState, playCostTime);
|
|
32246
32287
|
if (transition) {
|
|
32247
|
-
// Remove speed factor, use actual cost time
|
|
32248
|
-
// state is paused, so it consumes no time — pass deltaTime through to the destination.
|
|
32288
|
+
// Remove speed factor, use actual cost time
|
|
32249
32289
|
var remainDeltaTime = playSpeed === 0 ? deltaTime : deltaTime - playCostTime / playSpeed;
|
|
32250
32290
|
remainDeltaTime > 0 && this._updateState(layerData, remainDeltaTime, aniUpdate);
|
|
32251
32291
|
}
|
|
32252
32292
|
};
|
|
32253
32293
|
_proto._evaluatePlayingState = function _evaluatePlayingState(playData, weight, additive, aniUpdate) {
|
|
32254
|
-
var curveBindings = playData.
|
|
32294
|
+
var curveBindings = playData.state.clip._curveBindings;
|
|
32255
32295
|
var finished = playData.playState === AnimatorStatePlayState.Finished;
|
|
32256
32296
|
if (aniUpdate || finished) {
|
|
32257
32297
|
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
@@ -32274,14 +32314,14 @@ function _type_of(obj) {
|
|
|
32274
32314
|
_proto._updateCrossFadeState = function _updateCrossFadeState(layerData, weight, additive, deltaTime, aniUpdate) {
|
|
32275
32315
|
var srcPlayData = layerData.srcPlayData, destPlayData = layerData.destPlayData, layerIndex = layerData.layerIndex;
|
|
32276
32316
|
var speed = this.speed;
|
|
32277
|
-
var srcState = srcPlayData.
|
|
32278
|
-
var destState = destPlayData.
|
|
32317
|
+
var srcState = srcPlayData.state;
|
|
32318
|
+
var destState = destPlayData.state;
|
|
32279
32319
|
var transitionDuration = layerData.crossFadeTransition._getFixedDuration();
|
|
32280
32320
|
if (this._tryCrossFadeInterrupt(layerData, transitionDuration, destState, deltaTime, aniUpdate)) {
|
|
32281
32321
|
return;
|
|
32282
32322
|
}
|
|
32283
|
-
var srcPlaySpeed = srcPlayData.
|
|
32284
|
-
var dstPlaySpeed = destPlayData.
|
|
32323
|
+
var srcPlaySpeed = srcPlayData.speed * speed;
|
|
32324
|
+
var dstPlaySpeed = destPlayData.speed * speed;
|
|
32285
32325
|
var dstPlayDeltaTime = dstPlaySpeed * deltaTime;
|
|
32286
32326
|
srcPlayData.updateOrientation(srcPlaySpeed * deltaTime);
|
|
32287
32327
|
destPlayData.updateOrientation(dstPlayDeltaTime);
|
|
@@ -32324,8 +32364,8 @@ function _type_of(obj) {
|
|
|
32324
32364
|
};
|
|
32325
32365
|
_proto._evaluateCrossFadeState = function _evaluateCrossFadeState(layerData, srcPlayData, destPlayData, weight, crossWeight, additive, aniUpdate) {
|
|
32326
32366
|
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
32327
|
-
var
|
|
32328
|
-
var destState = destPlayData.
|
|
32367
|
+
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
32368
|
+
var destState = destPlayData.state;
|
|
32329
32369
|
var _destState_clip = destState.clip, destCurves = _destState_clip._curveBindings;
|
|
32330
32370
|
var finished = destPlayData.playState === AnimatorStatePlayState.Finished;
|
|
32331
32371
|
if (aniUpdate || finished) {
|
|
@@ -32344,12 +32384,12 @@ function _type_of(obj) {
|
|
|
32344
32384
|
};
|
|
32345
32385
|
_proto._updateCrossFadeFromPoseState = function _updateCrossFadeFromPoseState(layerData, weight, additive, deltaTime, aniUpdate) {
|
|
32346
32386
|
var destPlayData = layerData.destPlayData;
|
|
32347
|
-
var state = destPlayData.
|
|
32387
|
+
var state = destPlayData.state;
|
|
32348
32388
|
var transitionDuration = layerData.crossFadeTransition._getFixedDuration();
|
|
32349
32389
|
if (this._tryCrossFadeInterrupt(layerData, transitionDuration, state, deltaTime, aniUpdate)) {
|
|
32350
32390
|
return;
|
|
32351
32391
|
}
|
|
32352
|
-
var playSpeed = destPlayData.
|
|
32392
|
+
var playSpeed = destPlayData.speed * this.speed;
|
|
32353
32393
|
var playDeltaTime = playSpeed * deltaTime;
|
|
32354
32394
|
destPlayData.updateOrientation(playDeltaTime);
|
|
32355
32395
|
var lastDestClipTime = destPlayData.clipTime, lastPlayState = destPlayData.playState;
|
|
@@ -32386,7 +32426,7 @@ function _type_of(obj) {
|
|
|
32386
32426
|
};
|
|
32387
32427
|
_proto._evaluateCrossFadeFromPoseState = function _evaluateCrossFadeFromPoseState(layerData, destPlayData, weight, crossWeight, additive, aniUpdate) {
|
|
32388
32428
|
var crossLayerOwnerCollection = layerData.crossLayerOwnerCollection;
|
|
32389
|
-
var state = destPlayData.
|
|
32429
|
+
var state = destPlayData.state;
|
|
32390
32430
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
32391
32431
|
var destClipTime = destPlayData.clipTime, playState = destPlayData.playState;
|
|
32392
32432
|
var finished = playState === AnimatorStatePlayState.Finished;
|
|
@@ -32398,7 +32438,7 @@ function _type_of(obj) {
|
|
|
32398
32438
|
if (!owner) continue;
|
|
32399
32439
|
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
32400
32440
|
this._checkRevertOwner(owner, additive);
|
|
32401
|
-
var value =
|
|
32441
|
+
var value = owner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, additive);
|
|
32402
32442
|
aniUpdate && owner.applyValue(value, weight, additive);
|
|
32403
32443
|
finished && layerOwner.saveFinalValue();
|
|
32404
32444
|
}
|
|
@@ -32406,8 +32446,8 @@ function _type_of(obj) {
|
|
|
32406
32446
|
};
|
|
32407
32447
|
_proto._updateFinishedState = function _updateFinishedState(layerData, weight, additive, deltaTime, aniUpdate) {
|
|
32408
32448
|
var playData = layerData.srcPlayData;
|
|
32409
|
-
var state = playData.
|
|
32410
|
-
var actualSpeed = playData.
|
|
32449
|
+
var state = playData.state;
|
|
32450
|
+
var actualSpeed = playData.speed * this.speed;
|
|
32411
32451
|
var actualDeltaTime = actualSpeed * deltaTime;
|
|
32412
32452
|
playData.updateOrientation(actualDeltaTime);
|
|
32413
32453
|
var clipTime = playData.clipTime, isForward = playData.isForward;
|
|
@@ -32425,7 +32465,7 @@ function _type_of(obj) {
|
|
|
32425
32465
|
return;
|
|
32426
32466
|
}
|
|
32427
32467
|
var curveLayerOwner = playData.stateData.curveLayerOwner;
|
|
32428
|
-
var
|
|
32468
|
+
var _playData_state_clip = playData.state.clip, curveBindings = _playData_state_clip._curveBindings;
|
|
32429
32469
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
32430
32470
|
var layerOwner = curveLayerOwner[i];
|
|
32431
32471
|
var owner = layerOwner == null ? void 0 : layerOwner.curveOwner;
|
|
@@ -32441,12 +32481,14 @@ function _type_of(obj) {
|
|
|
32441
32481
|
} else {
|
|
32442
32482
|
layerData.layerState = LayerState.Playing;
|
|
32443
32483
|
}
|
|
32444
|
-
layerData.
|
|
32484
|
+
layerData.srcPlayData = destPlayData;
|
|
32485
|
+
layerData.destPlayData = null;
|
|
32486
|
+
layerData.crossFadeTransition = null;
|
|
32445
32487
|
};
|
|
32446
32488
|
_proto._preparePlayOwner = function _preparePlayOwner(layerData, playState) {
|
|
32447
32489
|
if (layerData.layerState === LayerState.Playing) {
|
|
32448
32490
|
var srcPlayData = layerData.srcPlayData;
|
|
32449
|
-
if (srcPlayData.
|
|
32491
|
+
if (srcPlayData.state !== playState) {
|
|
32450
32492
|
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
32451
32493
|
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
32452
32494
|
var _curveLayerOwner_i;
|
|
@@ -32461,17 +32503,17 @@ function _type_of(obj) {
|
|
|
32461
32503
|
}
|
|
32462
32504
|
};
|
|
32463
32505
|
_proto._applyStateTransitions = function _applyStateTransitions(layerData, isForward, playData, transitionCollection, lastClipTime, clipTime, deltaTime, aniUpdate) {
|
|
32464
|
-
var state = playData.
|
|
32465
|
-
var clipDuration = state.clip.length;
|
|
32506
|
+
var state = playData.state;
|
|
32466
32507
|
var targetTransition = null;
|
|
32467
|
-
var startTime = state.clipStartTime * clipDuration;
|
|
32468
|
-
var endTime = state.clipEndTime * clipDuration;
|
|
32469
32508
|
if (transitionCollection.noExitTimeCount) {
|
|
32470
32509
|
targetTransition = this._checkNoExitTimeTransitions(layerData, transitionCollection, aniUpdate);
|
|
32471
32510
|
if (targetTransition) {
|
|
32472
32511
|
return targetTransition;
|
|
32473
32512
|
}
|
|
32474
32513
|
}
|
|
32514
|
+
var clipDuration = state.clip.length;
|
|
32515
|
+
var startTime = state.clipStartTime * clipDuration;
|
|
32516
|
+
var endTime = state.clipEndTime * clipDuration;
|
|
32475
32517
|
if (isForward) {
|
|
32476
32518
|
if (lastClipTime + deltaTime >= endTime) {
|
|
32477
32519
|
targetTransition = this._checkSubTransition(layerData, state, transitionCollection, lastClipTime, endTime, aniUpdate);
|
|
@@ -32578,9 +32620,8 @@ function _type_of(obj) {
|
|
|
32578
32620
|
var playData = animatorLayerData.getOrCreateInstance(state)._playData;
|
|
32579
32621
|
playData.reset(animatorStateData, state._getClipActualEndTime() * normalizedTimeOffset);
|
|
32580
32622
|
animatorLayerData.srcPlayData = playData;
|
|
32581
|
-
|
|
32582
|
-
|
|
32583
|
-
animatorLayerData.clearCrossFadeSlot();
|
|
32623
|
+
animatorLayerData.destPlayData = null;
|
|
32624
|
+
animatorLayerData.crossFadeTransition = null;
|
|
32584
32625
|
animatorLayerData.resetCurrentCheckIndex();
|
|
32585
32626
|
return true;
|
|
32586
32627
|
};
|
|
@@ -32664,9 +32705,7 @@ function _type_of(obj) {
|
|
|
32664
32705
|
return false;
|
|
32665
32706
|
}
|
|
32666
32707
|
var animatorLayerData = this._getAnimatorLayerData(layerIndex);
|
|
32667
|
-
|
|
32668
|
-
// instance per layer, so a second concurrent fade has nowhere to live.
|
|
32669
|
-
if (((_animatorLayerData_srcPlayData = animatorLayerData.srcPlayData) == null ? void 0 : _animatorLayerData_srcPlayData.instance._state) === crossState || ((_animatorLayerData_destPlayData = animatorLayerData.destPlayData) == null ? void 0 : _animatorLayerData_destPlayData.instance._state) === crossState) {
|
|
32708
|
+
if (((_animatorLayerData_srcPlayData = animatorLayerData.srcPlayData) == null ? void 0 : _animatorLayerData_srcPlayData.state) === crossState || ((_animatorLayerData_destPlayData = animatorLayerData.destPlayData) == null ? void 0 : _animatorLayerData_destPlayData.state) === crossState) {
|
|
32670
32709
|
return false;
|
|
32671
32710
|
}
|
|
32672
32711
|
var animatorStateData = this._getAnimatorStateData(crossState, animatorLayerData, layerIndex);
|
|
@@ -32698,23 +32737,27 @@ function _type_of(obj) {
|
|
|
32698
32737
|
return true;
|
|
32699
32738
|
};
|
|
32700
32739
|
_proto._fireAnimationEvents = function _fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime) {
|
|
32701
|
-
var isForward = playData.isForward, clipTime = playData.clipTime;
|
|
32702
|
-
var state = playData.instance._state;
|
|
32740
|
+
var state = playData.state, isForward = playData.isForward, clipTime = playData.clipTime, wrapMode = playData.wrapMode;
|
|
32703
32741
|
var startTime = state._getClipActualStartTime();
|
|
32704
32742
|
var endTime = state._getClipActualEndTime();
|
|
32743
|
+
var canWrap = wrapMode === WrapMode.Loop;
|
|
32705
32744
|
if (isForward) {
|
|
32706
32745
|
if (lastClipTime + deltaTime >= endTime) {
|
|
32707
32746
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, endTime);
|
|
32708
|
-
|
|
32709
|
-
|
|
32747
|
+
if (canWrap) {
|
|
32748
|
+
playData.currentEventIndex = 0;
|
|
32749
|
+
this._fireSubAnimationEvents(playData, eventHandlers, startTime, clipTime);
|
|
32750
|
+
}
|
|
32710
32751
|
} else {
|
|
32711
32752
|
this._fireSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
32712
32753
|
}
|
|
32713
32754
|
} else {
|
|
32714
32755
|
if (lastClipTime + deltaTime <= startTime) {
|
|
32715
32756
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, startTime);
|
|
32716
|
-
|
|
32717
|
-
|
|
32757
|
+
if (canWrap) {
|
|
32758
|
+
playData.currentEventIndex = eventHandlers.length - 1;
|
|
32759
|
+
this._fireBackwardSubAnimationEvents(playData, eventHandlers, endTime, clipTime);
|
|
32760
|
+
}
|
|
32718
32761
|
} else {
|
|
32719
32762
|
this._fireBackwardSubAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
32720
32763
|
}
|
|
@@ -32730,8 +32773,10 @@ function _type_of(obj) {
|
|
|
32730
32773
|
}
|
|
32731
32774
|
var handlers = eventHandler.handlers;
|
|
32732
32775
|
if (time >= lastClipTime) {
|
|
32733
|
-
|
|
32734
|
-
handlers
|
|
32776
|
+
if (this.fireEvents) {
|
|
32777
|
+
for(var j = handlers.length - 1; j >= 0; j--){
|
|
32778
|
+
handlers[j](parameter);
|
|
32779
|
+
}
|
|
32735
32780
|
}
|
|
32736
32781
|
playState.currentEventIndex = Math.min(eventIndex + 1, n - 1);
|
|
32737
32782
|
}
|
|
@@ -32747,8 +32792,10 @@ function _type_of(obj) {
|
|
|
32747
32792
|
}
|
|
32748
32793
|
if (time <= lastClipTime) {
|
|
32749
32794
|
var handlers = eventHandler.handlers;
|
|
32750
|
-
|
|
32751
|
-
handlers
|
|
32795
|
+
if (this.fireEvents) {
|
|
32796
|
+
for(var j = handlers.length - 1; j >= 0; j--){
|
|
32797
|
+
handlers[j](parameter);
|
|
32798
|
+
}
|
|
32752
32799
|
}
|
|
32753
32800
|
playState.currentEventIndex = Math.max(eventIndex - 1, 0);
|
|
32754
32801
|
}
|
|
@@ -32779,9 +32826,6 @@ function _type_of(obj) {
|
|
|
32779
32826
|
owner.updateMark = this._updateMark;
|
|
32780
32827
|
};
|
|
32781
32828
|
_proto._fireAnimationEventsAndCallScripts = function _fireAnimationEventsAndCallScripts(layerIndex, playData, state, lastClipTime, lastPlayState, deltaTime) {
|
|
32782
|
-
// Re-check whether the clip events/scripts changed since the last build —
|
|
32783
|
-
// play()/crossFade() entry points already ensure on enter, but addEvent()
|
|
32784
|
-
// or addComponent(Script) after play() must also flow through.
|
|
32785
32829
|
this._ensureEventHandlers(state, playData.stateData);
|
|
32786
32830
|
var eventHandlers = playData.stateData.eventHandlers;
|
|
32787
32831
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, deltaTime);
|
|
@@ -32849,6 +32893,9 @@ Animator._tempScripts = [];
|
|
|
32849
32893
|
__decorate([
|
|
32850
32894
|
assignmentClone
|
|
32851
32895
|
], Animator.prototype, "speed", void 0);
|
|
32896
|
+
__decorate([
|
|
32897
|
+
assignmentClone
|
|
32898
|
+
], Animator.prototype, "fireEvents", void 0);
|
|
32852
32899
|
__decorate([
|
|
32853
32900
|
assignmentClone
|
|
32854
32901
|
], Animator.prototype, "_animatorController", void 0);
|
|
@@ -32920,7 +32967,10 @@ function _assert_this_initialized(self) {
|
|
|
32920
32967
|
/** @internal */ _this._parametersMap = {},
|
|
32921
32968
|
/** @internal */ _this._layers = [],
|
|
32922
32969
|
/** @internal */ _this._layersMap = {},
|
|
32923
|
-
_this._updateFlagManager = new UpdateFlagManager()
|
|
32970
|
+
_this._updateFlagManager = new UpdateFlagManager(),
|
|
32971
|
+
_this._onStatesInvalidate = function() {
|
|
32972
|
+
return _this._updateFlagManager.dispatch();
|
|
32973
|
+
}
|
|
32924
32974
|
][0];
|
|
32925
32975
|
return _assert_this_initialized(_this);
|
|
32926
32976
|
}
|
|
@@ -32975,6 +33025,7 @@ function _assert_this_initialized(self) {
|
|
|
32975
33025
|
*/ _proto.addLayer = function addLayer(layer) {
|
|
32976
33026
|
this._layers.push(layer);
|
|
32977
33027
|
this._layersMap[layer.name] = layer;
|
|
33028
|
+
layer._setStatesInvalidateCallback(this._onStatesInvalidate);
|
|
32978
33029
|
layer._setEngine(this._engine);
|
|
32979
33030
|
this._updateFlagManager.dispatch();
|
|
32980
33031
|
};
|
|
@@ -32984,13 +33035,18 @@ function _assert_this_initialized(self) {
|
|
|
32984
33035
|
*/ _proto.removeLayer = function removeLayer(layerIndex) {
|
|
32985
33036
|
var theLayer = this.layers[layerIndex];
|
|
32986
33037
|
this._layers.splice(layerIndex, 1);
|
|
33038
|
+
theLayer._setStatesInvalidateCallback(null);
|
|
32987
33039
|
delete this._layersMap[theLayer.name];
|
|
32988
33040
|
this._updateFlagManager.dispatch();
|
|
32989
33041
|
};
|
|
32990
33042
|
/**
|
|
32991
33043
|
* Clear layers.
|
|
32992
33044
|
*/ _proto.clearLayers = function clearLayers() {
|
|
32993
|
-
this
|
|
33045
|
+
var _this = this, layers = _this._layers;
|
|
33046
|
+
for(var i = 0, n = layers.length; i < n; i++){
|
|
33047
|
+
layers[i]._setStatesInvalidateCallback(null);
|
|
33048
|
+
}
|
|
33049
|
+
layers.length = 0;
|
|
32994
33050
|
for(var name in this._layersMap){
|
|
32995
33051
|
delete this._layersMap[name];
|
|
32996
33052
|
}
|
|
@@ -33006,7 +33062,9 @@ function _assert_this_initialized(self) {
|
|
|
33006
33062
|
*/ _proto._setEngine = function _setEngine(engine) {
|
|
33007
33063
|
var _this = this, layers = _this._layers;
|
|
33008
33064
|
for(var i = 0, n = layers.length; i < n; i++){
|
|
33009
|
-
layers[i]
|
|
33065
|
+
var layer = layers[i];
|
|
33066
|
+
layer._setStatesInvalidateCallback(this._onStatesInvalidate);
|
|
33067
|
+
layer._setEngine(engine);
|
|
33010
33068
|
}
|
|
33011
33069
|
};
|
|
33012
33070
|
_proto._addParameter = function _addParameter(name, defaultValue, isTrigger) {
|
|
@@ -33393,6 +33451,7 @@ function _assert_this_initialized(self) {
|
|
|
33393
33451
|
*/ var AnimatorStateMachine = /*#__PURE__*/ function() {
|
|
33394
33452
|
function AnimatorStateMachine() {
|
|
33395
33453
|
/** The list of states. */ this.states = [];
|
|
33454
|
+
this._onStatesInvalidate = null;
|
|
33396
33455
|
/**
|
|
33397
33456
|
* The state will be played automatically.
|
|
33398
33457
|
* @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered. Cleared to `null` if the state is removed via `removeState`.
|
|
@@ -33429,6 +33488,7 @@ function _assert_this_initialized(self) {
|
|
|
33429
33488
|
if (this.defaultState === state) {
|
|
33430
33489
|
this.defaultState = null;
|
|
33431
33490
|
}
|
|
33491
|
+
this._onStatesInvalidate == null ? void 0 : this._onStatesInvalidate.call(this);
|
|
33432
33492
|
}
|
|
33433
33493
|
};
|
|
33434
33494
|
/**
|
|
@@ -33488,6 +33548,11 @@ function _assert_this_initialized(self) {
|
|
|
33488
33548
|
states[i]._setEngine(engine);
|
|
33489
33549
|
}
|
|
33490
33550
|
};
|
|
33551
|
+
/**
|
|
33552
|
+
* @internal
|
|
33553
|
+
*/ _proto._setStatesInvalidateCallback = function _setStatesInvalidateCallback(onStatesInvalidate) {
|
|
33554
|
+
this._onStatesInvalidate = onStatesInvalidate;
|
|
33555
|
+
};
|
|
33491
33556
|
_create_class(AnimatorStateMachine, [
|
|
33492
33557
|
{
|
|
33493
33558
|
key: "entryTransitions",
|
|
@@ -33516,14 +33581,43 @@ function _assert_this_initialized(self) {
|
|
|
33516
33581
|
this.name = name;
|
|
33517
33582
|
this./** The blending weight that the layers has. It is not taken into account for the first layer. */ weight = 1.0;
|
|
33518
33583
|
this./** The blending mode used by the layer. It is not taken into account for the first layer. */ blendingMode = AnimatorLayerBlendingMode.Override;
|
|
33519
|
-
this.
|
|
33584
|
+
this._onStatesInvalidate = null;
|
|
33585
|
+
this._stateMachine = new AnimatorStateMachine();
|
|
33520
33586
|
}
|
|
33521
33587
|
var _proto = AnimatorControllerLayer.prototype;
|
|
33522
33588
|
/**
|
|
33523
33589
|
* @internal
|
|
33524
33590
|
*/ _proto._setEngine = function _setEngine(engine) {
|
|
33525
|
-
this.
|
|
33591
|
+
this._engine = engine;
|
|
33592
|
+
this._stateMachine._setEngine(engine);
|
|
33526
33593
|
};
|
|
33594
|
+
/**
|
|
33595
|
+
* @internal
|
|
33596
|
+
*/ _proto._setStatesInvalidateCallback = function _setStatesInvalidateCallback(onStatesInvalidate) {
|
|
33597
|
+
this._onStatesInvalidate = onStatesInvalidate;
|
|
33598
|
+
this._stateMachine._setStatesInvalidateCallback(onStatesInvalidate);
|
|
33599
|
+
};
|
|
33600
|
+
_create_class(AnimatorControllerLayer, [
|
|
33601
|
+
{
|
|
33602
|
+
key: "stateMachine",
|
|
33603
|
+
get: /**
|
|
33604
|
+
* The state machine for the layer.
|
|
33605
|
+
*/ function get() {
|
|
33606
|
+
return this._stateMachine;
|
|
33607
|
+
},
|
|
33608
|
+
set: function set(value) {
|
|
33609
|
+
var lastStateMachine = this._stateMachine;
|
|
33610
|
+
if (lastStateMachine === value) {
|
|
33611
|
+
return;
|
|
33612
|
+
}
|
|
33613
|
+
lastStateMachine._setStatesInvalidateCallback(null);
|
|
33614
|
+
this._stateMachine = value;
|
|
33615
|
+
value._setStatesInvalidateCallback(this._onStatesInvalidate);
|
|
33616
|
+
this._engine && value._setEngine(this._engine);
|
|
33617
|
+
this._onStatesInvalidate == null ? void 0 : this._onStatesInvalidate.call(this);
|
|
33618
|
+
}
|
|
33619
|
+
}
|
|
33620
|
+
]);
|
|
33527
33621
|
return AnimatorControllerLayer;
|
|
33528
33622
|
}();
|
|
33529
33623
|
|
|
@@ -35125,6 +35219,7 @@ __decorate([
|
|
|
35125
35219
|
/**
|
|
35126
35220
|
* @internal
|
|
35127
35221
|
*/ _proto._getMax = function _getMax() {
|
|
35222
|
+
var minMaxRange = ParticleCompositeCurve._minMaxRange;
|
|
35128
35223
|
switch(this.mode){
|
|
35129
35224
|
case ParticleCurveMode.Constant:
|
|
35130
35225
|
return this.constantMax;
|
|
@@ -35132,17 +35227,18 @@ __decorate([
|
|
|
35132
35227
|
return Math.max(this.constantMin, this.constantMax);
|
|
35133
35228
|
case ParticleCurveMode.Curve:
|
|
35134
35229
|
var _this_curveMax;
|
|
35135
|
-
|
|
35230
|
+
this._getKeyMinMax((_this_curveMax = this.curveMax) == null ? void 0 : _this_curveMax.keys, minMaxRange);
|
|
35231
|
+
return minMaxRange.y;
|
|
35136
35232
|
case ParticleCurveMode.TwoCurves:
|
|
35137
35233
|
var _this_curveMin, _this_curveMax1;
|
|
35138
|
-
|
|
35139
|
-
var
|
|
35140
|
-
|
|
35234
|
+
this._getKeyMinMax((_this_curveMin = this.curveMin) == null ? void 0 : _this_curveMin.keys, minMaxRange);
|
|
35235
|
+
var maxCurveMin = minMaxRange.y;
|
|
35236
|
+
this._getKeyMinMax((_this_curveMax1 = this.curveMax) == null ? void 0 : _this_curveMax1.keys, minMaxRange);
|
|
35237
|
+
return maxCurveMin > minMaxRange.y ? maxCurveMin : minMaxRange.y;
|
|
35141
35238
|
}
|
|
35142
35239
|
};
|
|
35143
35240
|
/**
|
|
35144
35241
|
* @internal
|
|
35145
|
-
|
|
35146
35242
|
*/ _proto._getMinMax = function _getMinMax(out) {
|
|
35147
35243
|
switch(this.mode){
|
|
35148
35244
|
case ParticleCurveMode.Constant:
|
|
@@ -35152,23 +35248,40 @@ __decorate([
|
|
|
35152
35248
|
out.set(Math.min(this.constantMin, this.constantMax), Math.max(this.constantMin, this.constantMax));
|
|
35153
35249
|
break;
|
|
35154
35250
|
case ParticleCurveMode.Curve:
|
|
35155
|
-
var _this_curveMax
|
|
35156
|
-
|
|
35251
|
+
var _this_curveMax;
|
|
35252
|
+
this._getKeyMinMax((_this_curveMax = this.curveMax) == null ? void 0 : _this_curveMax.keys, out);
|
|
35157
35253
|
break;
|
|
35158
35254
|
case ParticleCurveMode.TwoCurves:
|
|
35159
|
-
var
|
|
35160
|
-
|
|
35161
|
-
var minCurveMin =
|
|
35162
|
-
var
|
|
35163
|
-
|
|
35164
|
-
var
|
|
35165
|
-
var
|
|
35166
|
-
out.set(
|
|
35255
|
+
var _this_curveMin, _this_curveMax1;
|
|
35256
|
+
this._getKeyMinMax((_this_curveMin = this.curveMin) == null ? void 0 : _this_curveMin.keys, out);
|
|
35257
|
+
var minCurveMin = out.x;
|
|
35258
|
+
var maxCurveMin = out.y;
|
|
35259
|
+
this._getKeyMinMax((_this_curveMax1 = this.curveMax) == null ? void 0 : _this_curveMax1.keys, out);
|
|
35260
|
+
var minCurveMax = out.x;
|
|
35261
|
+
var maxCurveMax = out.y;
|
|
35262
|
+
out.set(minCurveMax < minCurveMin ? minCurveMax : minCurveMin, maxCurveMax > maxCurveMin ? maxCurveMax : maxCurveMin);
|
|
35167
35263
|
break;
|
|
35168
35264
|
}
|
|
35169
35265
|
};
|
|
35170
35266
|
/**
|
|
35171
35267
|
* @internal
|
|
35268
|
+
*/ _proto._isZero = function _isZero() {
|
|
35269
|
+
var minMax = ParticleCompositeCurve._minMaxRange;
|
|
35270
|
+
this._getMinMax(minMax);
|
|
35271
|
+
return minMax.x === 0 && minMax.y === 0;
|
|
35272
|
+
};
|
|
35273
|
+
/**
|
|
35274
|
+
* @internal
|
|
35275
|
+
*/ _proto._isCurveMode = function _isCurveMode() {
|
|
35276
|
+
return this._mode === ParticleCurveMode.Curve || this._mode === ParticleCurveMode.TwoCurves;
|
|
35277
|
+
};
|
|
35278
|
+
/**
|
|
35279
|
+
* @internal
|
|
35280
|
+
*/ _proto._isRandomMode = function _isRandomMode() {
|
|
35281
|
+
return this._mode === ParticleCurveMode.TwoConstants || this._mode === ParticleCurveMode.TwoCurves;
|
|
35282
|
+
};
|
|
35283
|
+
/**
|
|
35284
|
+
* @internal
|
|
35172
35285
|
*/ _proto._registerOnValueChanged = function _registerOnValueChanged(listener) {
|
|
35173
35286
|
this._updateManager.addListener(listener);
|
|
35174
35287
|
};
|
|
@@ -35177,31 +35290,20 @@ __decorate([
|
|
|
35177
35290
|
*/ _proto._unRegisterOnValueChanged = function _unRegisterOnValueChanged(listener) {
|
|
35178
35291
|
this._updateManager.removeListener(listener);
|
|
35179
35292
|
};
|
|
35180
|
-
_proto.
|
|
35181
|
-
var max = undefined;
|
|
35182
|
-
var _keys_length;
|
|
35183
|
-
var count = (_keys_length = keys == null ? void 0 : keys.length) != null ? _keys_length : 0;
|
|
35184
|
-
if (count > 0) {
|
|
35185
|
-
max = keys[0].value;
|
|
35186
|
-
for(var i = 1; i < count; i++){
|
|
35187
|
-
var value = keys[i].value;
|
|
35188
|
-
max = Math.max(max, value);
|
|
35189
|
-
}
|
|
35190
|
-
}
|
|
35191
|
-
return max;
|
|
35192
|
-
};
|
|
35193
|
-
_proto._getMinKeyValue = function _getMinKeyValue(keys) {
|
|
35293
|
+
_proto._getKeyMinMax = function _getKeyMinMax(keys, out) {
|
|
35194
35294
|
var min = undefined;
|
|
35295
|
+
var max = undefined;
|
|
35195
35296
|
var _keys_length;
|
|
35196
35297
|
var count = (_keys_length = keys == null ? void 0 : keys.length) != null ? _keys_length : 0;
|
|
35197
35298
|
if (count > 0) {
|
|
35198
|
-
min = keys[0].value;
|
|
35299
|
+
min = max = keys[0].value;
|
|
35199
35300
|
for(var i = 1; i < count; i++){
|
|
35200
35301
|
var value = keys[i].value;
|
|
35201
35302
|
min = Math.min(min, value);
|
|
35303
|
+
max = Math.max(max, value);
|
|
35202
35304
|
}
|
|
35203
35305
|
}
|
|
35204
|
-
|
|
35306
|
+
out.set(min != null ? min : 0, max != null ? max : 0);
|
|
35205
35307
|
};
|
|
35206
35308
|
_proto._onCurveChange = function _onCurveChange(lastValue, value) {
|
|
35207
35309
|
var dispatch = this._updateDispatch;
|
|
@@ -35307,6 +35409,7 @@ __decorate([
|
|
|
35307
35409
|
]);
|
|
35308
35410
|
return ParticleCompositeCurve;
|
|
35309
35411
|
}();
|
|
35412
|
+
ParticleCompositeCurve._minMaxRange = new engineMath.Vector2();
|
|
35310
35413
|
__decorate([
|
|
35311
35414
|
ignoreClone
|
|
35312
35415
|
], ParticleCompositeCurve.prototype, "_updateManager", void 0);
|
|
@@ -37644,10 +37747,20 @@ __decorate([
|
|
|
37644
37747
|
_inherits(VelocityOverLifetimeModule, ParticleGeneratorModule);
|
|
37645
37748
|
function VelocityOverLifetimeModule(generator) {
|
|
37646
37749
|
var _this;
|
|
37647
|
-
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._velocityRand = new engineMath.Rand(0, ParticleRandomSubSeeds.VelocityOverLifetime), _this._velocityMinConstant = new engineMath.Vector3(), _this._velocityMaxConstant = new engineMath.Vector3(), _this._space = ParticleSimulationSpace.Local
|
|
37750
|
+
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._velocityRand = new engineMath.Rand(0, ParticleRandomSubSeeds.VelocityOverLifetime), _this._velocityMinConstant = new engineMath.Vector3(), _this._velocityMaxConstant = new engineMath.Vector3(), _this._orbitalMinConstant = new engineMath.Vector3(), _this._orbitalConstant = new engineMath.Vector3(), _this._offset = new engineMath.Vector3(), _this._space = ParticleSimulationSpace.Local, _this._onTransformFeedbackDirty = function() {
|
|
37751
|
+
return _this._generator._setTransformFeedback();
|
|
37752
|
+
};
|
|
37648
37753
|
_this.velocityX = new ParticleCompositeCurve(0);
|
|
37649
37754
|
_this.velocityY = new ParticleCompositeCurve(0);
|
|
37650
37755
|
_this.velocityZ = new ParticleCompositeCurve(0);
|
|
37756
|
+
_this.orbitalX = new ParticleCompositeCurve(0);
|
|
37757
|
+
_this.orbitalY = new ParticleCompositeCurve(0);
|
|
37758
|
+
_this.orbitalZ = new ParticleCompositeCurve(0);
|
|
37759
|
+
_this.radial = new ParticleCompositeCurve(0);
|
|
37760
|
+
// @ts-ignore
|
|
37761
|
+
_this._offset._onValueChanged = function() {
|
|
37762
|
+
return _this._generator._renderer._onGeneratorParamsChanged();
|
|
37763
|
+
};
|
|
37651
37764
|
return _this;
|
|
37652
37765
|
}
|
|
37653
37766
|
var _proto = VelocityOverLifetimeModule.prototype;
|
|
@@ -37656,6 +37769,10 @@ __decorate([
|
|
|
37656
37769
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
37657
37770
|
var velocityMacro = null;
|
|
37658
37771
|
var isRandomModeMacro = null;
|
|
37772
|
+
var orbitalMacro = null;
|
|
37773
|
+
var orbitalRandomModeMacro = null;
|
|
37774
|
+
var radialMacro = null;
|
|
37775
|
+
var radialRandomModeMacro = null;
|
|
37659
37776
|
if (this.enabled) {
|
|
37660
37777
|
var velocityX = this.velocityX;
|
|
37661
37778
|
var velocityY = this.velocityY;
|
|
@@ -37685,15 +37802,111 @@ __decorate([
|
|
|
37685
37802
|
}
|
|
37686
37803
|
}
|
|
37687
37804
|
shaderData.setInt(VelocityOverLifetimeModule._spaceProperty, this.space);
|
|
37805
|
+
var needTransformFeedback = this._needTransformFeedback();
|
|
37806
|
+
var orbitalActive = needTransformFeedback && this._isOrbitalActive();
|
|
37807
|
+
var radialActive = needTransformFeedback && this._isRadialActive();
|
|
37808
|
+
if (orbitalActive) {
|
|
37809
|
+
var orbitalX = this._orbitalX;
|
|
37810
|
+
var orbitalY = this._orbitalY;
|
|
37811
|
+
var orbitalZ = this._orbitalZ;
|
|
37812
|
+
var isOrbitalRandomCurveMode = orbitalX.mode === ParticleCurveMode.TwoCurves && orbitalY.mode === ParticleCurveMode.TwoCurves && orbitalZ.mode === ParticleCurveMode.TwoCurves;
|
|
37813
|
+
if (isOrbitalRandomCurveMode || orbitalX.mode === ParticleCurveMode.Curve && orbitalY.mode === ParticleCurveMode.Curve && orbitalZ.mode === ParticleCurveMode.Curve) {
|
|
37814
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMaxCurveXProperty, orbitalX.curveMax._getTypeArray());
|
|
37815
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMaxCurveYProperty, orbitalY.curveMax._getTypeArray());
|
|
37816
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMaxCurveZProperty, orbitalZ.curveMax._getTypeArray());
|
|
37817
|
+
orbitalMacro = VelocityOverLifetimeModule._orbitalCurveModeMacro;
|
|
37818
|
+
if (isOrbitalRandomCurveMode) {
|
|
37819
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMinCurveXProperty, orbitalX.curveMin._getTypeArray());
|
|
37820
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMinCurveYProperty, orbitalY.curveMin._getTypeArray());
|
|
37821
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._orbitalMinCurveZProperty, orbitalZ.curveMin._getTypeArray());
|
|
37822
|
+
orbitalRandomModeMacro = VelocityOverLifetimeModule._orbitalRandomModeMacro;
|
|
37823
|
+
}
|
|
37824
|
+
} else {
|
|
37825
|
+
this._orbitalConstant.set(orbitalX.constantMax, orbitalY.constantMax, orbitalZ.constantMax);
|
|
37826
|
+
shaderData.setVector3(VelocityOverLifetimeModule._orbitalMaxConstantProperty, this._orbitalConstant);
|
|
37827
|
+
orbitalMacro = VelocityOverLifetimeModule._orbitalConstantModeMacro;
|
|
37828
|
+
if (orbitalX.mode === ParticleCurveMode.TwoConstants && orbitalY.mode === ParticleCurveMode.TwoConstants && orbitalZ.mode === ParticleCurveMode.TwoConstants) {
|
|
37829
|
+
this._orbitalMinConstant.set(orbitalX.constantMin, orbitalY.constantMin, orbitalZ.constantMin);
|
|
37830
|
+
shaderData.setVector3(VelocityOverLifetimeModule._orbitalMinConstantProperty, this._orbitalMinConstant);
|
|
37831
|
+
orbitalRandomModeMacro = VelocityOverLifetimeModule._orbitalRandomModeMacro;
|
|
37832
|
+
}
|
|
37833
|
+
}
|
|
37834
|
+
}
|
|
37835
|
+
if (radialActive) {
|
|
37836
|
+
var radial = this._radial;
|
|
37837
|
+
var isRadialRandomMode = radial._isRandomMode();
|
|
37838
|
+
if (radial._isCurveMode()) {
|
|
37839
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._radialMaxCurveProperty, radial.curveMax._getTypeArray());
|
|
37840
|
+
radialMacro = VelocityOverLifetimeModule._radialCurveModeMacro;
|
|
37841
|
+
if (isRadialRandomMode) {
|
|
37842
|
+
shaderData.setFloatArray(VelocityOverLifetimeModule._radialMinCurveProperty, radial.curveMin._getTypeArray());
|
|
37843
|
+
radialRandomModeMacro = VelocityOverLifetimeModule._radialRandomModeMacro;
|
|
37844
|
+
}
|
|
37845
|
+
} else {
|
|
37846
|
+
shaderData.setFloat(VelocityOverLifetimeModule._radialMaxConstantProperty, radial.constantMax);
|
|
37847
|
+
radialMacro = VelocityOverLifetimeModule._radialConstantModeMacro;
|
|
37848
|
+
if (isRadialRandomMode) {
|
|
37849
|
+
shaderData.setFloat(VelocityOverLifetimeModule._radialMinConstantProperty, radial.constantMin);
|
|
37850
|
+
radialRandomModeMacro = VelocityOverLifetimeModule._radialRandomModeMacro;
|
|
37851
|
+
}
|
|
37852
|
+
}
|
|
37853
|
+
}
|
|
37854
|
+
if (orbitalActive || radialActive) {
|
|
37855
|
+
shaderData.setVector3(VelocityOverLifetimeModule._offsetProperty, this._offset);
|
|
37856
|
+
}
|
|
37688
37857
|
}
|
|
37689
37858
|
this._velocityMacro = this._enableMacro(shaderData, this._velocityMacro, velocityMacro);
|
|
37690
37859
|
this._randomModeMacro = this._enableMacro(shaderData, this._randomModeMacro, isRandomModeMacro);
|
|
37860
|
+
this._orbitalMacro = this._enableMacro(shaderData, this._orbitalMacro, orbitalMacro);
|
|
37861
|
+
this._orbitalRandomModeMacro = this._enableMacro(shaderData, this._orbitalRandomModeMacro, orbitalRandomModeMacro);
|
|
37862
|
+
this._radialMacro = this._enableMacro(shaderData, this._radialMacro, radialMacro);
|
|
37863
|
+
this._radialRandomModeMacro = this._enableMacro(shaderData, this._radialRandomModeMacro, radialRandomModeMacro);
|
|
37691
37864
|
};
|
|
37692
37865
|
/**
|
|
37693
37866
|
* @internal
|
|
37694
37867
|
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
37695
37868
|
this._velocityRand.reset(seed, ParticleRandomSubSeeds.VelocityOverLifetime);
|
|
37696
37869
|
};
|
|
37870
|
+
/**
|
|
37871
|
+
* @internal
|
|
37872
|
+
*/ _proto._needTransformFeedback = function _needTransformFeedback() {
|
|
37873
|
+
if (!this._enabled || !this._generator._renderer.engine._hardwareRenderer.isWebGL2) {
|
|
37874
|
+
return false;
|
|
37875
|
+
}
|
|
37876
|
+
return this._isOrbitalActive() || this._isRadialActive();
|
|
37877
|
+
};
|
|
37878
|
+
/**
|
|
37879
|
+
* @internal
|
|
37880
|
+
*/ _proto._isOrbitalActive = function _isOrbitalActive() {
|
|
37881
|
+
return !(this._orbitalX._isZero() && this._orbitalY._isZero() && this._orbitalZ._isZero());
|
|
37882
|
+
};
|
|
37883
|
+
/**
|
|
37884
|
+
* @internal
|
|
37885
|
+
*/ _proto._isRadialActive = function _isRadialActive() {
|
|
37886
|
+
return !this._radial._isZero();
|
|
37887
|
+
};
|
|
37888
|
+
/**
|
|
37889
|
+
* @internal
|
|
37890
|
+
*/ _proto._isRandomMode = function _isRandomMode() {
|
|
37891
|
+
var velocityX = this.velocityX;
|
|
37892
|
+
var velocityY = this.velocityY;
|
|
37893
|
+
var velocityZ = this.velocityZ;
|
|
37894
|
+
var isLinearRandomMode = velocityX.mode === ParticleCurveMode.TwoConstants && velocityY.mode === ParticleCurveMode.TwoConstants && velocityZ.mode === ParticleCurveMode.TwoConstants || velocityX.mode === ParticleCurveMode.TwoCurves && velocityY.mode === ParticleCurveMode.TwoCurves && velocityZ.mode === ParticleCurveMode.TwoCurves;
|
|
37895
|
+
if (!this._needTransformFeedback()) {
|
|
37896
|
+
return isLinearRandomMode;
|
|
37897
|
+
}
|
|
37898
|
+
var orbitalX = this._orbitalX;
|
|
37899
|
+
var orbitalY = this._orbitalY;
|
|
37900
|
+
var orbitalZ = this._orbitalZ;
|
|
37901
|
+
var isOrbitalRandomMode = orbitalX.mode === ParticleCurveMode.TwoConstants && orbitalY.mode === ParticleCurveMode.TwoConstants && orbitalZ.mode === ParticleCurveMode.TwoConstants || orbitalX.mode === ParticleCurveMode.TwoCurves && orbitalY.mode === ParticleCurveMode.TwoCurves && orbitalZ.mode === ParticleCurveMode.TwoCurves;
|
|
37902
|
+
return isLinearRandomMode || isOrbitalRandomMode || this._radial._isRandomMode();
|
|
37903
|
+
};
|
|
37904
|
+
_proto._onOrbitalRadialChange = function _onOrbitalRadialChange(lastValue, value) {
|
|
37905
|
+
this._onCompositeCurveChange(lastValue, value);
|
|
37906
|
+
lastValue == null ? void 0 : lastValue._unRegisterOnValueChanged(this._onTransformFeedbackDirty);
|
|
37907
|
+
value == null ? void 0 : value._registerOnValueChanged(this._onTransformFeedbackDirty);
|
|
37908
|
+
this._generator._setTransformFeedback();
|
|
37909
|
+
};
|
|
37697
37910
|
_create_class(VelocityOverLifetimeModule, [
|
|
37698
37911
|
{
|
|
37699
37912
|
key: "velocityX",
|
|
@@ -37740,6 +37953,84 @@ __decorate([
|
|
|
37740
37953
|
}
|
|
37741
37954
|
}
|
|
37742
37955
|
},
|
|
37956
|
+
{
|
|
37957
|
+
key: "orbitalX",
|
|
37958
|
+
get: /**
|
|
37959
|
+
* Orbital velocity (radians/second) around the x axis of the system.
|
|
37960
|
+
* @remarks Requires WebGL2.
|
|
37961
|
+
*/ function get() {
|
|
37962
|
+
return this._orbitalX;
|
|
37963
|
+
},
|
|
37964
|
+
set: function set(value) {
|
|
37965
|
+
var lastValue = this._orbitalX;
|
|
37966
|
+
if (value !== lastValue) {
|
|
37967
|
+
this._orbitalX = value;
|
|
37968
|
+
this._onOrbitalRadialChange(lastValue, value);
|
|
37969
|
+
}
|
|
37970
|
+
}
|
|
37971
|
+
},
|
|
37972
|
+
{
|
|
37973
|
+
key: "orbitalY",
|
|
37974
|
+
get: /**
|
|
37975
|
+
* Orbital velocity (radians/second) around the y axis of the system.
|
|
37976
|
+
* @remarks Requires WebGL2.
|
|
37977
|
+
*/ function get() {
|
|
37978
|
+
return this._orbitalY;
|
|
37979
|
+
},
|
|
37980
|
+
set: function set(value) {
|
|
37981
|
+
var lastValue = this._orbitalY;
|
|
37982
|
+
if (value !== lastValue) {
|
|
37983
|
+
this._orbitalY = value;
|
|
37984
|
+
this._onOrbitalRadialChange(lastValue, value);
|
|
37985
|
+
}
|
|
37986
|
+
}
|
|
37987
|
+
},
|
|
37988
|
+
{
|
|
37989
|
+
key: "orbitalZ",
|
|
37990
|
+
get: /**
|
|
37991
|
+
* Orbital velocity (radians/second) around the z axis of the system.
|
|
37992
|
+
* @remarks Requires WebGL2.
|
|
37993
|
+
*/ function get() {
|
|
37994
|
+
return this._orbitalZ;
|
|
37995
|
+
},
|
|
37996
|
+
set: function set(value) {
|
|
37997
|
+
var lastValue = this._orbitalZ;
|
|
37998
|
+
if (value !== lastValue) {
|
|
37999
|
+
this._orbitalZ = value;
|
|
38000
|
+
this._onOrbitalRadialChange(lastValue, value);
|
|
38001
|
+
}
|
|
38002
|
+
}
|
|
38003
|
+
},
|
|
38004
|
+
{
|
|
38005
|
+
key: "radial",
|
|
38006
|
+
get: /**
|
|
38007
|
+
* Radial velocity moving particles away from (or towards) the center.
|
|
38008
|
+
* @remarks Requires WebGL2.
|
|
38009
|
+
*/ function get() {
|
|
38010
|
+
return this._radial;
|
|
38011
|
+
},
|
|
38012
|
+
set: function set(value) {
|
|
38013
|
+
var lastValue = this._radial;
|
|
38014
|
+
if (value !== lastValue) {
|
|
38015
|
+
this._radial = value;
|
|
38016
|
+
this._onOrbitalRadialChange(lastValue, value);
|
|
38017
|
+
}
|
|
38018
|
+
}
|
|
38019
|
+
},
|
|
38020
|
+
{
|
|
38021
|
+
key: "centerOffset",
|
|
38022
|
+
get: /**
|
|
38023
|
+
* The center offset of orbital/radial motion from the particle system origin.
|
|
38024
|
+
*/ function get() {
|
|
38025
|
+
return this._offset;
|
|
38026
|
+
},
|
|
38027
|
+
set: function set(value) {
|
|
38028
|
+
var offset = this._offset;
|
|
38029
|
+
if (value !== offset) {
|
|
38030
|
+
offset.copyFrom(value);
|
|
38031
|
+
}
|
|
38032
|
+
}
|
|
38033
|
+
},
|
|
37743
38034
|
{
|
|
37744
38035
|
key: "space",
|
|
37745
38036
|
get: /**
|
|
@@ -37762,6 +38053,7 @@ __decorate([
|
|
|
37762
38053
|
set: function set(value) {
|
|
37763
38054
|
if (value !== this._enabled) {
|
|
37764
38055
|
this._enabled = value;
|
|
38056
|
+
this._generator._setTransformFeedback();
|
|
37765
38057
|
this._generator._renderer._onGeneratorParamsChanged();
|
|
37766
38058
|
}
|
|
37767
38059
|
}
|
|
@@ -37781,6 +38073,25 @@ VelocityOverLifetimeModule._maxGradientXProperty = ShaderProperty.getByName("ren
|
|
|
37781
38073
|
VelocityOverLifetimeModule._maxGradientYProperty = ShaderProperty.getByName("renderer_VOLMaxGradientY");
|
|
37782
38074
|
VelocityOverLifetimeModule._maxGradientZProperty = ShaderProperty.getByName("renderer_VOLMaxGradientZ");
|
|
37783
38075
|
VelocityOverLifetimeModule._spaceProperty = ShaderProperty.getByName("renderer_VOLSpace");
|
|
38076
|
+
VelocityOverLifetimeModule._orbitalConstantModeMacro = ShaderMacro.getByName("RENDERER_VOL_ORBITAL_CONSTANT_MODE");
|
|
38077
|
+
VelocityOverLifetimeModule._orbitalCurveModeMacro = ShaderMacro.getByName("RENDERER_VOL_ORBITAL_CURVE_MODE");
|
|
38078
|
+
VelocityOverLifetimeModule._orbitalRandomModeMacro = ShaderMacro.getByName("RENDERER_VOL_ORBITAL_IS_RANDOM_TWO");
|
|
38079
|
+
VelocityOverLifetimeModule._radialConstantModeMacro = ShaderMacro.getByName("RENDERER_VOL_RADIAL_CONSTANT_MODE");
|
|
38080
|
+
VelocityOverLifetimeModule._radialCurveModeMacro = ShaderMacro.getByName("RENDERER_VOL_RADIAL_CURVE_MODE");
|
|
38081
|
+
VelocityOverLifetimeModule._radialRandomModeMacro = ShaderMacro.getByName("RENDERER_VOL_RADIAL_IS_RANDOM_TWO");
|
|
38082
|
+
VelocityOverLifetimeModule._orbitalMinConstantProperty = ShaderProperty.getByName("renderer_VOLOrbitalMinConst");
|
|
38083
|
+
VelocityOverLifetimeModule._orbitalMaxConstantProperty = ShaderProperty.getByName("renderer_VOLOrbitalMaxConst");
|
|
38084
|
+
VelocityOverLifetimeModule._orbitalMinCurveXProperty = ShaderProperty.getByName("renderer_VOLOrbitalMinCurveX");
|
|
38085
|
+
VelocityOverLifetimeModule._orbitalMinCurveYProperty = ShaderProperty.getByName("renderer_VOLOrbitalMinCurveY");
|
|
38086
|
+
VelocityOverLifetimeModule._orbitalMinCurveZProperty = ShaderProperty.getByName("renderer_VOLOrbitalMinCurveZ");
|
|
38087
|
+
VelocityOverLifetimeModule._orbitalMaxCurveXProperty = ShaderProperty.getByName("renderer_VOLOrbitalMaxCurveX");
|
|
38088
|
+
VelocityOverLifetimeModule._orbitalMaxCurveYProperty = ShaderProperty.getByName("renderer_VOLOrbitalMaxCurveY");
|
|
38089
|
+
VelocityOverLifetimeModule._orbitalMaxCurveZProperty = ShaderProperty.getByName("renderer_VOLOrbitalMaxCurveZ");
|
|
38090
|
+
VelocityOverLifetimeModule._radialMinConstantProperty = ShaderProperty.getByName("renderer_VOLRadialMinConst");
|
|
38091
|
+
VelocityOverLifetimeModule._radialMaxConstantProperty = ShaderProperty.getByName("renderer_VOLRadialMaxConst");
|
|
38092
|
+
VelocityOverLifetimeModule._radialMinCurveProperty = ShaderProperty.getByName("renderer_VOLRadialMinCurve");
|
|
38093
|
+
VelocityOverLifetimeModule._radialMaxCurveProperty = ShaderProperty.getByName("renderer_VOLRadialMaxCurve");
|
|
38094
|
+
VelocityOverLifetimeModule._offsetProperty = ShaderProperty.getByName("renderer_VOLOffset");
|
|
37784
38095
|
__decorate([
|
|
37785
38096
|
ignoreClone
|
|
37786
38097
|
], VelocityOverLifetimeModule.prototype, "_velocityRand", void 0);
|
|
@@ -37796,6 +38107,24 @@ __decorate([
|
|
|
37796
38107
|
__decorate([
|
|
37797
38108
|
ignoreClone
|
|
37798
38109
|
], VelocityOverLifetimeModule.prototype, "_randomModeMacro", void 0);
|
|
38110
|
+
__decorate([
|
|
38111
|
+
ignoreClone
|
|
38112
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalMinConstant", void 0);
|
|
38113
|
+
__decorate([
|
|
38114
|
+
ignoreClone
|
|
38115
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalConstant", void 0);
|
|
38116
|
+
__decorate([
|
|
38117
|
+
ignoreClone
|
|
38118
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalMacro", void 0);
|
|
38119
|
+
__decorate([
|
|
38120
|
+
ignoreClone
|
|
38121
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalRandomModeMacro", void 0);
|
|
38122
|
+
__decorate([
|
|
38123
|
+
ignoreClone
|
|
38124
|
+
], VelocityOverLifetimeModule.prototype, "_radialMacro", void 0);
|
|
38125
|
+
__decorate([
|
|
38126
|
+
ignoreClone
|
|
38127
|
+
], VelocityOverLifetimeModule.prototype, "_radialRandomModeMacro", void 0);
|
|
37799
38128
|
__decorate([
|
|
37800
38129
|
deepClone
|
|
37801
38130
|
], VelocityOverLifetimeModule.prototype, "_velocityX", void 0);
|
|
@@ -37805,6 +38134,24 @@ __decorate([
|
|
|
37805
38134
|
__decorate([
|
|
37806
38135
|
deepClone
|
|
37807
38136
|
], VelocityOverLifetimeModule.prototype, "_velocityZ", void 0);
|
|
38137
|
+
__decorate([
|
|
38138
|
+
deepClone
|
|
38139
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalX", void 0);
|
|
38140
|
+
__decorate([
|
|
38141
|
+
deepClone
|
|
38142
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalY", void 0);
|
|
38143
|
+
__decorate([
|
|
38144
|
+
deepClone
|
|
38145
|
+
], VelocityOverLifetimeModule.prototype, "_orbitalZ", void 0);
|
|
38146
|
+
__decorate([
|
|
38147
|
+
deepClone
|
|
38148
|
+
], VelocityOverLifetimeModule.prototype, "_radial", void 0);
|
|
38149
|
+
__decorate([
|
|
38150
|
+
deepClone
|
|
38151
|
+
], VelocityOverLifetimeModule.prototype, "_offset", void 0);
|
|
38152
|
+
__decorate([
|
|
38153
|
+
ignoreClone
|
|
38154
|
+
], VelocityOverLifetimeModule.prototype, "_onTransformFeedbackDirty", void 0);
|
|
37808
38155
|
|
|
37809
38156
|
/**
|
|
37810
38157
|
* Optional parent properties a sub-emitter inherits
|
|
@@ -38405,12 +38752,10 @@ __decorate([
|
|
|
38405
38752
|
/**
|
|
38406
38753
|
* @internal
|
|
38407
38754
|
*/ _proto._setTransformFeedback = function _setTransformFeedback() {
|
|
38408
|
-
var
|
|
38755
|
+
var _this_limitVelocityOverLifetime, _this_noise, _this_velocityOverLifetime, _this_subEmitters;
|
|
38756
|
+
var needed = !!(this._renderer.engine._hardwareRenderer.isWebGL2 && (((_this_limitVelocityOverLifetime = this.limitVelocityOverLifetime) == null ? void 0 : _this_limitVelocityOverLifetime.enabled) || ((_this_noise = this.noise) == null ? void 0 : _this_noise.enabled) || ((_this_velocityOverLifetime = this.velocityOverLifetime) == null ? void 0 : _this_velocityOverLifetime._needTransformFeedback()) || ((_this_subEmitters = this.subEmitters) == null ? void 0 : _this_subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death))));
|
|
38409
38757
|
if (needed === this._useTransformFeedback) return;
|
|
38410
38758
|
this._useTransformFeedback = needed;
|
|
38411
|
-
// Switching TF mode invalidates all active particle state: feedback buffers and instance
|
|
38412
|
-
// buffer layout are incompatible between the two paths. Clear rather than show a one-frame
|
|
38413
|
-
// jump; new particles will fill in naturally from the next emit cycle.
|
|
38414
38759
|
this._clearActiveParticles();
|
|
38415
38760
|
if (needed) {
|
|
38416
38761
|
if (!this._feedbackSimulator) {
|
|
@@ -38488,7 +38833,12 @@ __decorate([
|
|
|
38488
38833
|
this._calculateTransformedBounds(maxLifetime, generatorBounds, transformedBounds);
|
|
38489
38834
|
renderer._setDirtyFlagFalse(ParticleUpdateFlags.TransformVolume);
|
|
38490
38835
|
}
|
|
38491
|
-
this.
|
|
38836
|
+
if (this._useOrbitalBounds()) {
|
|
38837
|
+
bounds.min.copyFrom(transformedBounds.min);
|
|
38838
|
+
bounds.max.copyFrom(transformedBounds.max);
|
|
38839
|
+
} else {
|
|
38840
|
+
this._addGravityToBounds(maxLifetime, transformedBounds, bounds);
|
|
38841
|
+
}
|
|
38492
38842
|
};
|
|
38493
38843
|
/**
|
|
38494
38844
|
* @internal
|
|
@@ -38514,7 +38864,9 @@ __decorate([
|
|
|
38514
38864
|
}
|
|
38515
38865
|
}
|
|
38516
38866
|
var maxLifetime = this.main.startLifetime._getMax();
|
|
38517
|
-
this.
|
|
38867
|
+
if (!this._useOrbitalBounds()) {
|
|
38868
|
+
this._addGravityToBounds(maxLifetime, bounds, bounds);
|
|
38869
|
+
}
|
|
38518
38870
|
};
|
|
38519
38871
|
/**
|
|
38520
38872
|
* @internal
|
|
@@ -38663,7 +39015,7 @@ __decorate([
|
|
|
38663
39015
|
}
|
|
38664
39016
|
// Velocity random
|
|
38665
39017
|
var velocityOverLifetime = this.velocityOverLifetime;
|
|
38666
|
-
if (velocityOverLifetime.enabled && velocityOverLifetime.
|
|
39018
|
+
if (velocityOverLifetime.enabled && velocityOverLifetime._isRandomMode()) {
|
|
38667
39019
|
var rand = velocityOverLifetime._velocityRand;
|
|
38668
39020
|
instanceVertices[offset + 24] = rand.random();
|
|
38669
39021
|
instanceVertices[offset + 25] = rand.random();
|
|
@@ -39075,7 +39427,7 @@ __decorate([
|
|
|
39075
39427
|
max.set(Math.max(max.x, boundsArray[offset + 3]), Math.max(max.y, boundsArray[offset + 4]), Math.max(max.z, boundsArray[offset + 5]));
|
|
39076
39428
|
};
|
|
39077
39429
|
_proto._calculateTransformedBounds = function _calculateTransformedBounds(maxLifetime, origin, out) {
|
|
39078
|
-
var velMinMaxX = ParticleGenerator._tempVector20, velMinMaxY = ParticleGenerator._tempVector21, velMinMaxZ = ParticleGenerator._tempVector22, worldOffsetMin = ParticleGenerator._tempVector30, worldOffsetMax = ParticleGenerator._tempVector31, rotateMat = ParticleGenerator._tempMat;
|
|
39430
|
+
var velMinMaxX = ParticleGenerator._tempVector20, velMinMaxY = ParticleGenerator._tempVector21, velMinMaxZ = ParticleGenerator._tempVector22, worldOffsetMin = ParticleGenerator._tempVector30, worldOffsetMax = ParticleGenerator._tempVector31, noiseBoundsExtents = ParticleGenerator._tempVector32, rotateMat = ParticleGenerator._tempMat;
|
|
39079
39431
|
worldOffsetMin.set(0, 0, 0);
|
|
39080
39432
|
worldOffsetMax.set(0, 0, 0);
|
|
39081
39433
|
var transform = this._renderer.entity.transform;
|
|
@@ -39118,27 +39470,89 @@ __decorate([
|
|
|
39118
39470
|
worldOffsetMax.set(worldOffsetMax.x + forceMinMaxX.y, worldOffsetMax.y + forceMinMaxY.y, worldOffsetMax.z + forceMinMaxZ.y);
|
|
39119
39471
|
}
|
|
39120
39472
|
}
|
|
39121
|
-
out.transform(rotateMat);
|
|
39122
|
-
min.add(worldOffsetMin);
|
|
39123
|
-
max.add(worldOffsetMax);
|
|
39124
|
-
// Noise module impact: noise output is normalized to [-1, 1],
|
|
39125
|
-
// max displacement = |strength_max|
|
|
39126
39473
|
var noise = this.noise;
|
|
39127
|
-
|
|
39128
|
-
|
|
39129
|
-
|
|
39130
|
-
|
|
39131
|
-
|
|
39132
|
-
|
|
39133
|
-
|
|
39134
|
-
|
|
39474
|
+
this._getNoiseBoundsExtents(maxLifetime, noiseBoundsExtents);
|
|
39475
|
+
var needTransformFeedback = velocityOverLifetime._needTransformFeedback();
|
|
39476
|
+
var orbitalActive = needTransformFeedback && velocityOverLifetime._isOrbitalActive();
|
|
39477
|
+
if (needTransformFeedback) {
|
|
39478
|
+
var centerOffset = velocityOverLifetime.centerOffset;
|
|
39479
|
+
var radialReach = 0;
|
|
39480
|
+
if (velocityOverLifetime._isRadialActive()) {
|
|
39481
|
+
this._getExtremeValueFromZero(velocityOverLifetime.radial, velMinMaxX);
|
|
39482
|
+
radialReach = Math.max(Math.abs(velMinMaxX.x), Math.abs(velMinMaxX.y)) * maxLifetime;
|
|
39483
|
+
}
|
|
39484
|
+
if (orbitalActive) {
|
|
39485
|
+
var dx = Math.max(Math.abs(min.x - centerOffset.x), Math.abs(max.x - centerOffset.x));
|
|
39486
|
+
var dy = Math.max(Math.abs(min.y - centerOffset.y), Math.abs(max.y - centerOffset.y));
|
|
39487
|
+
var dz = Math.max(Math.abs(min.z - centerOffset.z), Math.abs(max.z - centerOffset.z));
|
|
39488
|
+
var worldReach = this._getRangeReach(worldOffsetMin, worldOffsetMax);
|
|
39489
|
+
var noiseReach = this._getVectorReach(noiseBoundsExtents);
|
|
39490
|
+
var gravityReach = this._getGravityBoundsReach(maxLifetime);
|
|
39491
|
+
var reach = Math.sqrt(dx * dx + dy * dy + dz * dz) + worldReach + noiseReach + gravityReach + radialReach;
|
|
39492
|
+
min.set(Math.min(min.x, centerOffset.x - reach), Math.min(min.y, centerOffset.y - reach), Math.min(min.z, centerOffset.z - reach));
|
|
39493
|
+
max.set(Math.max(max.x, centerOffset.x + reach), Math.max(max.y, centerOffset.y + reach), Math.max(max.z, centerOffset.z + reach));
|
|
39494
|
+
} else if (radialReach > 0) {
|
|
39495
|
+
min.set(min.x - radialReach, min.y - radialReach, min.z - radialReach);
|
|
39496
|
+
max.set(max.x + radialReach, max.y + radialReach, max.z + radialReach);
|
|
39497
|
+
}
|
|
39498
|
+
}
|
|
39499
|
+
out.transform(rotateMat);
|
|
39500
|
+
if (!orbitalActive) {
|
|
39501
|
+
min.add(worldOffsetMin);
|
|
39502
|
+
max.add(worldOffsetMax);
|
|
39503
|
+
if (noise.enabled) {
|
|
39504
|
+
min.set(min.x - noiseBoundsExtents.x, min.y - noiseBoundsExtents.y, min.z - noiseBoundsExtents.z);
|
|
39505
|
+
max.set(max.x + noiseBoundsExtents.x, max.y + noiseBoundsExtents.y, max.z + noiseBoundsExtents.z);
|
|
39135
39506
|
}
|
|
39136
|
-
min.set(min.x - noiseMaxX, min.y - noiseMaxY, min.z - noiseMaxZ);
|
|
39137
|
-
max.set(max.x + noiseMaxX, max.y + noiseMaxY, max.z + noiseMaxZ);
|
|
39138
39507
|
}
|
|
39139
39508
|
min.add(worldPosition);
|
|
39140
39509
|
max.add(worldPosition);
|
|
39141
39510
|
};
|
|
39511
|
+
_proto._useOrbitalBounds = function _useOrbitalBounds() {
|
|
39512
|
+
var velocityOverLifetime = this.velocityOverLifetime;
|
|
39513
|
+
return velocityOverLifetime._needTransformFeedback() && velocityOverLifetime._isOrbitalActive();
|
|
39514
|
+
};
|
|
39515
|
+
_proto._getNoiseBoundsExtents = function _getNoiseBoundsExtents(maxLifetime, out) {
|
|
39516
|
+
var noise = this.noise;
|
|
39517
|
+
if (!noise.enabled) {
|
|
39518
|
+
out.set(0, 0, 0);
|
|
39519
|
+
return;
|
|
39520
|
+
}
|
|
39521
|
+
var noiseMaxX, noiseMaxY, noiseMaxZ;
|
|
39522
|
+
if (noise.separateAxes) {
|
|
39523
|
+
noiseMaxX = this._getCurveMagnitudeFromZero(noise.strengthX);
|
|
39524
|
+
noiseMaxY = this._getCurveMagnitudeFromZero(noise.strengthY);
|
|
39525
|
+
noiseMaxZ = this._getCurveMagnitudeFromZero(noise.strengthZ);
|
|
39526
|
+
} else {
|
|
39527
|
+
noiseMaxX = noiseMaxY = noiseMaxZ = this._getCurveMagnitudeFromZero(noise.strengthX);
|
|
39528
|
+
}
|
|
39529
|
+
out.set(noiseMaxX * maxLifetime, noiseMaxY * maxLifetime, noiseMaxZ * maxLifetime);
|
|
39530
|
+
};
|
|
39531
|
+
_proto._getGravityBoundsReach = function _getGravityBoundsReach(maxLifetime) {
|
|
39532
|
+
var modifierMinMax = ParticleGenerator._tempVector20;
|
|
39533
|
+
this._getExtremeValueFromZero(this.main.gravityModifier, modifierMinMax);
|
|
39534
|
+
var coefficient = 0.5 * maxLifetime * maxLifetime;
|
|
39535
|
+
var minGravityEffect = modifierMinMax.x * coefficient;
|
|
39536
|
+
var maxGravityEffect = modifierMinMax.y * coefficient;
|
|
39537
|
+
var _this__renderer_scene_physics_gravity = this._renderer.scene.physics.gravity, x = _this__renderer_scene_physics_gravity.x, y = _this__renderer_scene_physics_gravity.y, z = _this__renderer_scene_physics_gravity.z;
|
|
39538
|
+
var gravityBoundsExtents = ParticleGenerator._tempVector33;
|
|
39539
|
+
gravityBoundsExtents.set(Math.max(Math.abs(x * minGravityEffect), Math.abs(x * maxGravityEffect)), Math.max(Math.abs(y * minGravityEffect), Math.abs(y * maxGravityEffect)), Math.max(Math.abs(z * minGravityEffect), Math.abs(z * maxGravityEffect)));
|
|
39540
|
+
return this._getVectorReach(gravityBoundsExtents);
|
|
39541
|
+
};
|
|
39542
|
+
_proto._getRangeReach = function _getRangeReach(min, max) {
|
|
39543
|
+
var x = Math.max(Math.abs(min.x), Math.abs(max.x));
|
|
39544
|
+
var y = Math.max(Math.abs(min.y), Math.abs(max.y));
|
|
39545
|
+
var z = Math.max(Math.abs(min.z), Math.abs(max.z));
|
|
39546
|
+
return Math.sqrt(x * x + y * y + z * z);
|
|
39547
|
+
};
|
|
39548
|
+
_proto._getVectorReach = function _getVectorReach(value) {
|
|
39549
|
+
return Math.sqrt(value.x * value.x + value.y * value.y + value.z * value.z);
|
|
39550
|
+
};
|
|
39551
|
+
_proto._getCurveMagnitudeFromZero = function _getCurveMagnitudeFromZero(curve) {
|
|
39552
|
+
var minMax = ParticleGenerator._tempVector20;
|
|
39553
|
+
this._getExtremeValueFromZero(curve, minMax);
|
|
39554
|
+
return Math.max(Math.abs(minMax.x), Math.abs(minMax.y));
|
|
39555
|
+
};
|
|
39142
39556
|
_proto._addGravityToBounds = function _addGravityToBounds(maxLifetime, origin, out) {
|
|
39143
39557
|
var originMin = origin.min, originMax = origin.max;
|
|
39144
39558
|
var modifierMinMax = ParticleGenerator._tempVector20;
|
|
@@ -39200,6 +39614,7 @@ ParticleGenerator._tempVector22 = new engineMath.Vector2();
|
|
|
39200
39614
|
ParticleGenerator._tempVector30 = new engineMath.Vector3();
|
|
39201
39615
|
ParticleGenerator._tempVector31 = new engineMath.Vector3();
|
|
39202
39616
|
ParticleGenerator._tempVector32 = new engineMath.Vector3();
|
|
39617
|
+
ParticleGenerator._tempVector33 = new engineMath.Vector3();
|
|
39203
39618
|
ParticleGenerator._tempMat = new engineMath.Matrix();
|
|
39204
39619
|
ParticleGenerator._tempColor = new engineMath.Color();
|
|
39205
39620
|
ParticleGenerator._tempQuat0 = new engineMath.Quaternion();
|
|
@@ -41037,7 +41452,14 @@ var cacheDir = new engineMath.Vector3();
|
|
|
41037
41452
|
* Suspend the audio context.
|
|
41038
41453
|
* @returns A promise that resolves when the audio context is suspended
|
|
41039
41454
|
*/ AudioManager.suspend = function suspend() {
|
|
41040
|
-
|
|
41455
|
+
// No context means nothing is playing: suspending is a no-op and must NOT flag a caller-suspend
|
|
41456
|
+
// (a ghost flag would later block foreground recovery), and don't create a cold context just to suspend
|
|
41457
|
+
var context = AudioManager._context;
|
|
41458
|
+
if (!context) {
|
|
41459
|
+
return Promise.resolve();
|
|
41460
|
+
}
|
|
41461
|
+
AudioManager._suspendedByCaller = true;
|
|
41462
|
+
return context.suspend();
|
|
41041
41463
|
};
|
|
41042
41464
|
/**
|
|
41043
41465
|
* Resume the audio context.
|
|
@@ -41045,6 +41467,7 @@ var cacheDir = new engineMath.Vector3();
|
|
|
41045
41467
|
* @returns A promise that resolves when the audio context is resumed
|
|
41046
41468
|
*/ AudioManager.resume = function resume() {
|
|
41047
41469
|
var _AudioManager;
|
|
41470
|
+
AudioManager._suspendedByCaller = false;
|
|
41048
41471
|
var __resumePromise;
|
|
41049
41472
|
return (__resumePromise = (_AudioManager = AudioManager)._resumePromise) != null ? __resumePromise : _AudioManager._resumePromise = AudioManager.getContext().resume().then(function() {
|
|
41050
41473
|
AudioManager._needsUserGestureResume = false;
|
|
@@ -41059,7 +41482,9 @@ var cacheDir = new engineMath.Vector3();
|
|
|
41059
41482
|
if (!context) {
|
|
41060
41483
|
AudioManager._context = context = new window.AudioContext();
|
|
41061
41484
|
document.addEventListener("visibilitychange", AudioManager._onVisibilityChange);
|
|
41062
|
-
// iOS Safari
|
|
41485
|
+
// iOS Safari bfcache restore fires pageshow (persisted) but NOT visibilitychange, so recover here too
|
|
41486
|
+
window.addEventListener("pageshow", AudioManager._onPageShow);
|
|
41487
|
+
// iOS Safari requires a user gesture to resume the AudioContext
|
|
41063
41488
|
document.addEventListener("touchstart", AudioManager._resumeAfterInterruption, {
|
|
41064
41489
|
passive: true
|
|
41065
41490
|
});
|
|
@@ -41087,27 +41512,62 @@ var cacheDir = new engineMath.Vector3();
|
|
|
41087
41512
|
return AudioManager.getContext().state === "running";
|
|
41088
41513
|
};
|
|
41089
41514
|
AudioManager._onVisibilityChange = function _onVisibilityChange() {
|
|
41090
|
-
if (
|
|
41091
|
-
//
|
|
41092
|
-
//
|
|
41093
|
-
|
|
41094
|
-
|
|
41095
|
-
|
|
41096
|
-
AudioManager.
|
|
41515
|
+
if (document.hidden) {
|
|
41516
|
+
var // Desktop/Android don't auto-suspend a running WebAudio context when backgrounded (only iOS does),
|
|
41517
|
+
// so suspend here to stop audio in the background; only if a context already exists (don't create one)
|
|
41518
|
+
_AudioManager__context;
|
|
41519
|
+
(_AudioManager__context = AudioManager._context) == null ? void 0 : _AudioManager__context.suspend().catch(function() {});
|
|
41520
|
+
} else {
|
|
41521
|
+
AudioManager._recoverPlaybackContext();
|
|
41522
|
+
}
|
|
41523
|
+
};
|
|
41524
|
+
AudioManager._recoverPlaybackContext = function _recoverPlaybackContext() {
|
|
41525
|
+
// Returning to foreground with a non-running context (and not a deliberate pause): iOS leaves it
|
|
41526
|
+
// "interrupted", which cannot be resumed directly; suspend() first transitions it to "suspended",
|
|
41527
|
+
// then resume() restarts the pipeline https://bugs.webkit.org/show_bug.cgi?id=263627
|
|
41528
|
+
// _recovering guards re-entry: a bfcache restore fires both visibilitychange and pageshow
|
|
41529
|
+
if (AudioManager._recovering || document.hidden || AudioManager._suspendedByCaller || AudioManager._playingCount <= 0 || AudioManager.isAudioContextRunning()) {
|
|
41530
|
+
return;
|
|
41531
|
+
}
|
|
41532
|
+
AudioManager._recovering = true;
|
|
41533
|
+
AudioManager._needsUserGestureResume = true; // fallback if the auto-resume below is rejected
|
|
41534
|
+
var context = AudioManager.getContext();
|
|
41535
|
+
context.suspend().catch(function() {});
|
|
41536
|
+
// 100ms empirical delay (resume too soon after suspend is unreliable on iOS); _recovering is cleared
|
|
41537
|
+
// on the timer rather than off a promise because iOS may never settle suspend/resume in interrupted
|
|
41538
|
+
setTimeout(function() {
|
|
41539
|
+
AudioManager._recovering = false;
|
|
41540
|
+
if (document.hidden || AudioManager._suspendedByCaller) {
|
|
41541
|
+
return;
|
|
41542
|
+
}
|
|
41543
|
+
// Go through AudioManager.resume() so _resumePromise coalesces any gesture-resume racing us during
|
|
41544
|
+
// the slow iOS interrupted->running transition; a bare context.resume() here wouldn't dedupe
|
|
41545
|
+
AudioManager.resume().catch(function() {});
|
|
41546
|
+
}, 100);
|
|
41547
|
+
};
|
|
41548
|
+
AudioManager._onPageShow = function _onPageShow(event) {
|
|
41549
|
+
// iOS Safari bfcache restore (persisted) needs recovery; a normal load has no suspended context
|
|
41550
|
+
if (event.persisted) {
|
|
41551
|
+
AudioManager._recoverPlaybackContext();
|
|
41097
41552
|
}
|
|
41098
41553
|
};
|
|
41099
41554
|
AudioManager._resumeAfterInterruption = function _resumeAfterInterruption() {
|
|
41100
|
-
|
|
41101
|
-
|
|
41102
|
-
|
|
41103
|
-
|
|
41555
|
+
// iOS Safari gesture fallback for when auto-resume is blocked.
|
|
41556
|
+
// _recovering: don't bypass the 100ms delay (would resume on a still-interrupted context)
|
|
41557
|
+
if (AudioManager._recovering || AudioManager._suspendedByCaller || !AudioManager._needsUserGestureResume) {
|
|
41558
|
+
return;
|
|
41104
41559
|
}
|
|
41560
|
+
AudioManager.resume().catch(function(e) {
|
|
41561
|
+
console.warn("Failed to resume AudioContext:", e);
|
|
41562
|
+
});
|
|
41105
41563
|
};
|
|
41106
41564
|
return AudioManager;
|
|
41107
41565
|
}();
|
|
41108
41566
|
/** @internal */ AudioManager._playingCount = 0;
|
|
41109
41567
|
AudioManager._resumePromise = null;
|
|
41110
41568
|
AudioManager._needsUserGestureResume = false;
|
|
41569
|
+
AudioManager._suspendedByCaller = false;
|
|
41570
|
+
AudioManager._recovering = false;
|
|
41111
41571
|
|
|
41112
41572
|
/**
|
|
41113
41573
|
* Audio Source Component.
|
|
@@ -41117,8 +41577,6 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41117
41577
|
var _this;
|
|
41118
41578
|
_this = Component.call(this, entity) || this, /** If set to true, the audio component automatically begins to play on startup. */ _this.playOnEnabled = true, _this._isPlaying = false, _this._pendingPlay = false, _this._sourceNode = null, _this._pausedTime = -1, _this._playTime = -1, _this._volume = 1, _this._lastVolume = 1, _this._playbackRate = 1, _this._loop = false;
|
|
41119
41579
|
_this._onPlayEnd = _this._onPlayEnd.bind(_this);
|
|
41120
|
-
_this._gainNode = AudioManager.getContext().createGain();
|
|
41121
|
-
_this._gainNode.connect(AudioManager.getGainNode());
|
|
41122
41580
|
return _this;
|
|
41123
41581
|
}
|
|
41124
41582
|
var _proto = AudioSource.prototype;
|
|
@@ -41130,6 +41588,10 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41130
41588
|
if (!((_this__clip = this._clip) == null ? void 0 : _this__clip._getAudioSource()) || this._isPlaying || this._pendingPlay) {
|
|
41131
41589
|
return;
|
|
41132
41590
|
}
|
|
41591
|
+
// Hidden page: don't start (would leak a sound) and don't pend (would replay out of sync) -> drop
|
|
41592
|
+
if (document.hidden) {
|
|
41593
|
+
return;
|
|
41594
|
+
}
|
|
41133
41595
|
if (AudioManager.isAudioContextRunning()) {
|
|
41134
41596
|
this._startPlayback();
|
|
41135
41597
|
} else {
|
|
@@ -41142,8 +41604,8 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41142
41604
|
return;
|
|
41143
41605
|
}
|
|
41144
41606
|
_this._pendingPlay = false;
|
|
41145
|
-
// Check if still valid to play after async resume
|
|
41146
|
-
if (_this._destroyed || !_this.enabled || !_this._clip) {
|
|
41607
|
+
// Check if still valid to play after async resume (page may have been hidden meanwhile)
|
|
41608
|
+
if (_this._destroyed || !_this.enabled || !_this._clip || document.hidden) {
|
|
41147
41609
|
return;
|
|
41148
41610
|
}
|
|
41149
41611
|
_this._startPlayback();
|
|
@@ -41160,10 +41622,11 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41160
41622
|
if (this._isPlaying) {
|
|
41161
41623
|
this._clearSourceNode();
|
|
41162
41624
|
this._isPlaying = false;
|
|
41163
|
-
this._pausedTime = -1;
|
|
41164
|
-
this._playTime = -1;
|
|
41165
41625
|
AudioManager._playingCount--;
|
|
41166
41626
|
}
|
|
41627
|
+
// stop() always resets to the start, including from a paused state (where _isPlaying is already false)
|
|
41628
|
+
this._pausedTime = -1;
|
|
41629
|
+
this._playTime = -1;
|
|
41167
41630
|
};
|
|
41168
41631
|
/**
|
|
41169
41632
|
* Pauses playing the clip.
|
|
@@ -41181,7 +41644,7 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41181
41644
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
41182
41645
|
var _target__clip;
|
|
41183
41646
|
(_target__clip = target._clip) == null ? void 0 : _target__clip._addReferCount(1);
|
|
41184
|
-
|
|
41647
|
+
// _volume is field-cloned; its gain node is applied lazily on first play
|
|
41185
41648
|
};
|
|
41186
41649
|
/**
|
|
41187
41650
|
* @internal
|
|
@@ -41203,6 +41666,15 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41203
41666
|
_proto._onPlayEnd = function _onPlayEnd() {
|
|
41204
41667
|
this.stop();
|
|
41205
41668
|
};
|
|
41669
|
+
_proto._ensureGainNode = function _ensureGainNode() {
|
|
41670
|
+
var gainNode = this._gainNode;
|
|
41671
|
+
if (!gainNode) {
|
|
41672
|
+
this._gainNode = gainNode = AudioManager.getContext().createGain();
|
|
41673
|
+
gainNode.connect(AudioManager.getGainNode());
|
|
41674
|
+
gainNode.gain.setValueAtTime(this._volume, AudioManager.getContext().currentTime);
|
|
41675
|
+
}
|
|
41676
|
+
return gainNode;
|
|
41677
|
+
};
|
|
41206
41678
|
_proto._startPlayback = function _startPlayback() {
|
|
41207
41679
|
var startTime = this._pausedTime > 0 ? this._pausedTime - this._playTime : 0;
|
|
41208
41680
|
this._initSourceNode(startTime);
|
|
@@ -41214,13 +41686,17 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41214
41686
|
_proto._initSourceNode = function _initSourceNode(startTime) {
|
|
41215
41687
|
var context = AudioManager.getContext();
|
|
41216
41688
|
var sourceNode = context.createBufferSource();
|
|
41217
|
-
|
|
41689
|
+
var buffer = this._clip._getAudioSource();
|
|
41690
|
+
sourceNode.buffer = buffer;
|
|
41218
41691
|
sourceNode.playbackRate.value = this._playbackRate;
|
|
41219
41692
|
sourceNode.loop = this._loop;
|
|
41220
41693
|
sourceNode.onended = this._onPlayEnd;
|
|
41221
41694
|
this._sourceNode = sourceNode;
|
|
41222
|
-
sourceNode.connect(this.
|
|
41223
|
-
|
|
41695
|
+
sourceNode.connect(this._ensureGainNode());
|
|
41696
|
+
// startTime is total elapsed time; for a looping clip wrap it into the buffer to keep the loop phase
|
|
41697
|
+
// (start()'s offset clamps past the end, it does not wrap)
|
|
41698
|
+
var offset = this._loop && buffer.duration > 0 ? startTime % buffer.duration : startTime;
|
|
41699
|
+
sourceNode.start(0, offset);
|
|
41224
41700
|
};
|
|
41225
41701
|
_proto._clearSourceNode = function _clearSourceNode() {
|
|
41226
41702
|
this._sourceNode.stop();
|
|
@@ -41263,9 +41739,11 @@ AudioManager._needsUserGestureResume = false;
|
|
|
41263
41739
|
return this._volume;
|
|
41264
41740
|
},
|
|
41265
41741
|
set: function set(value) {
|
|
41742
|
+
var // No node yet -> _ensureGainNode() applies _volume on first play
|
|
41743
|
+
_this__gainNode;
|
|
41266
41744
|
value = Math.min(Math.max(0, value), 1.0);
|
|
41267
41745
|
this._volume = value;
|
|
41268
|
-
this._gainNode.gain.setValueAtTime(value, AudioManager.getContext().currentTime);
|
|
41746
|
+
(_this__gainNode = this._gainNode) == null ? void 0 : _this__gainNode.gain.setValueAtTime(value, AudioManager.getContext().currentTime);
|
|
41269
41747
|
}
|
|
41270
41748
|
},
|
|
41271
41749
|
{
|
|
@@ -41377,6 +41855,7 @@ __decorate([
|
|
|
41377
41855
|
Polyfill.registerPolyfill = function registerPolyfill() {
|
|
41378
41856
|
Polyfill._registerMatchAll();
|
|
41379
41857
|
Polyfill._registerAudioContext();
|
|
41858
|
+
Polyfill._registerOfflineAudioContext();
|
|
41380
41859
|
Polyfill._registerTextMetrics();
|
|
41381
41860
|
Polyfill._registerPromiseFinally();
|
|
41382
41861
|
};
|
|
@@ -41441,20 +41920,32 @@ __decorate([
|
|
|
41441
41920
|
if (!window.AudioContext && window.webkitAudioContext) {
|
|
41442
41921
|
Logger.info("Polyfill window.AudioContext");
|
|
41443
41922
|
window.AudioContext = window.webkitAudioContext;
|
|
41444
|
-
|
|
41445
|
-
|
|
41446
|
-
|
|
41447
|
-
|
|
41448
|
-
|
|
41449
|
-
|
|
41450
|
-
|
|
41451
|
-
|
|
41452
|
-
|
|
41453
|
-
|
|
41454
|
-
|
|
41923
|
+
Polyfill._promisifyDecodeAudioData(AudioContext.prototype);
|
|
41924
|
+
}
|
|
41925
|
+
};
|
|
41926
|
+
Polyfill._registerOfflineAudioContext = function _registerOfflineAudioContext() {
|
|
41927
|
+
// iOS 14.0 and earlier expose only webkitOfflineAudioContext, with callback-form decodeAudioData
|
|
41928
|
+
if (!window.OfflineAudioContext && window.webkitOfflineAudioContext) {
|
|
41929
|
+
Logger.info("Polyfill window.OfflineAudioContext");
|
|
41930
|
+
window.OfflineAudioContext = window.webkitOfflineAudioContext;
|
|
41931
|
+
Polyfill._promisifyDecodeAudioData(OfflineAudioContext.prototype);
|
|
41932
|
+
}
|
|
41933
|
+
};
|
|
41934
|
+
// Wrap the old callback-form decodeAudioData (on prefixed iOS contexts) into the modern Promise form
|
|
41935
|
+
Polyfill._promisifyDecodeAudioData = function _promisifyDecodeAudioData(proto) {
|
|
41936
|
+
var originalDecodeAudioData = proto.decodeAudioData;
|
|
41937
|
+
proto.decodeAudioData = function(arrayBuffer, successCallback, errorCallback) {
|
|
41938
|
+
var _this = this;
|
|
41939
|
+
return new Promise(function(resolve, reject) {
|
|
41940
|
+
originalDecodeAudioData.call(_this, arrayBuffer, function(buffer) {
|
|
41941
|
+
successCallback == null ? void 0 : successCallback(buffer);
|
|
41942
|
+
resolve(buffer);
|
|
41943
|
+
}, function(error) {
|
|
41944
|
+
errorCallback == null ? void 0 : errorCallback(error);
|
|
41945
|
+
reject(error);
|
|
41455
41946
|
});
|
|
41456
|
-
};
|
|
41457
|
-
}
|
|
41947
|
+
});
|
|
41948
|
+
};
|
|
41458
41949
|
};
|
|
41459
41950
|
Polyfill._registerTextMetrics = function _registerTextMetrics() {
|
|
41460
41951
|
// Based on the specific version of the engine implementation, when actualBoundingBoxLeft is not supported, width is used to represent the rendering width, and `textAlign` uses the default value `start` and direction is left to right.
|