@galacean/engine-core 1.3.12 → 1.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -3191,8 +3191,11 @@ var ShaderFactory = /*#__PURE__*/ function() {
3191
3191
  */ _proto._destroy = function _destroy() {
3192
3192
  var shaderProgramPools = this._shaderProgramPools;
3193
3193
  for(var i = 0, n = shaderProgramPools.length; i < n; i++){
3194
- shaderProgramPools[i]._destroy();
3194
+ var shaderProgramPool = shaderProgramPools[i];
3195
+ shaderProgramPool._destroy();
3196
+ delete shaderProgramPool.engine._shaderProgramPools[this._shaderPassId];
3195
3197
  }
3198
+ // Clear array storing multiple engine shader program pools
3196
3199
  shaderProgramPools.length = 0;
3197
3200
  };
3198
3201
  /**
@@ -23176,7 +23179,8 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
23176
23179
  * Shader program pool.
23177
23180
  * @internal
23178
23181
  */ var ShaderProgramPool = /*#__PURE__*/ function() {
23179
- function ShaderProgramPool() {
23182
+ function ShaderProgramPool(engine) {
23183
+ this.engine = engine;
23180
23184
  this._cacheHierarchyDepth = 1;
23181
23185
  this._cacheMap = Object.create(null);
23182
23186
  }
@@ -23581,7 +23585,7 @@ ShaderPool.init();
23581
23585
  if (length > shaderProgramPools.length) {
23582
23586
  shaderProgramPools.length = length;
23583
23587
  }
23584
- shaderProgramPools[index] = pool = new ShaderProgramPool();
23588
+ shaderProgramPools[index] = pool = new ShaderProgramPool(this);
23585
23589
  shaderPass._shaderProgramPools.push(pool);
23586
23590
  }
23587
23591
  return pool;
@@ -28282,7 +28286,8 @@ exports.AnimatorLayerBlendingMode = void 0;
28282
28286
  var _proto = AnimatorStatePlayData.prototype;
28283
28287
  _proto.reset = function reset(state, stateData, offsetFrameTime) {
28284
28288
  this.state = state;
28285
- this.frameTime = offsetFrameTime;
28289
+ this.playedTime = 0;
28290
+ this.offsetFrameTime = offsetFrameTime;
28286
28291
  this.stateData = stateData;
28287
28292
  this.playState = AnimatorStatePlayState.UnStarted;
28288
28293
  this.clipTime = state.clipStartTime * state.clip.length;
@@ -28301,9 +28306,9 @@ exports.AnimatorLayerBlendingMode = void 0;
28301
28306
  }
28302
28307
  };
28303
28308
  _proto.update = function update(deltaTime) {
28304
- this.frameTime += deltaTime;
28309
+ this.playedTime += deltaTime;
28305
28310
  var state = this.state;
28306
- var time = this.frameTime;
28311
+ var time = this.playedTime + this.offsetFrameTime;
28307
28312
  var duration = state._getDuration();
28308
28313
  this.playState = AnimatorStatePlayState.Playing;
28309
28314
  if (state.wrapMode === exports.WrapMode.Loop) {
@@ -28638,8 +28643,9 @@ exports.AnimatorLayerBlendingMode = void 0;
28638
28643
  eventHandler.event = event;
28639
28644
  handlers.length = 0;
28640
28645
  for(var j = scriptCount - 1; j >= 0; j--){
28646
+ var _script_funcName;
28641
28647
  var script = scripts[j];
28642
- var handler = script[funcName].bind(script);
28648
+ var handler = (_script_funcName = script[funcName]) == null ? void 0 : _script_funcName.bind(script);
28643
28649
  handler && handlers.push(handler);
28644
28650
  }
28645
28651
  eventHandlers.push(eventHandler);
@@ -28749,9 +28755,8 @@ exports.AnimatorLayerBlendingMode = void 0;
28749
28755
  var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28750
28756
  var playCostTime;
28751
28757
  if (transition) {
28752
- var clipDuration = state.clip.length;
28753
- var clipEndTime = state.clipEndTime * clipDuration;
28754
- var exitTime = transition.exitTime * state._getDuration();
28758
+ var clipEndTime = state._getClipActualEndTime();
28759
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
28755
28760
  if (isForwards) {
28756
28761
  if (exitTime < lastClipTime) {
28757
28762
  playCostTime = exitTime + clipEndTime - lastClipTime;
@@ -28759,7 +28764,7 @@ exports.AnimatorLayerBlendingMode = void 0;
28759
28764
  playCostTime = exitTime - lastClipTime;
28760
28765
  }
28761
28766
  } else {
28762
- var startTime = state.clipStartTime * clipDuration;
28767
+ var startTime = state._getClipActualStartTime();
28763
28768
  if (lastClipTime < exitTime) {
28764
28769
  playCostTime = clipEndTime - exitTime + lastClipTime - startTime;
28765
28770
  } else {
@@ -28821,20 +28826,22 @@ exports.AnimatorLayerBlendingMode = void 0;
28821
28826
  var lastDestClipTime = destPlayData.clipTime, lastDstPlayState = destPlayData.playState;
28822
28827
  var dstPlayCostTime;
28823
28828
  if (destPlayData.isForwards) {
28824
- dstPlayCostTime = lastDestClipTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : dstPlayDeltaTime;
28829
+ // The time that has been played
28830
+ var playedTime = destPlayData.playedTime;
28831
+ dstPlayCostTime = playedTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - playedTime : dstPlayDeltaTime;
28825
28832
  } else {
28826
28833
  // The time that has been played
28827
- var playedTime = destStateDuration - lastDestClipTime;
28828
- dstPlayCostTime = // -actualDestDeltaTime: The time that will be played, negative are meant to make ite be a periods
28834
+ var playedTime1 = destPlayData.playedTime;
28835
+ dstPlayCostTime = // -dstPlayDeltaTime: The time that will be played, negative are meant to make it be a periods
28829
28836
  // > transition: The time that will be played is enough to finish the transition
28830
- playedTime - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28831
- playedTime - transitionDuration : dstPlayDeltaTime;
28837
+ playedTime1 - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28838
+ playedTime1 - transitionDuration : dstPlayDeltaTime;
28832
28839
  }
28833
28840
  var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
28834
28841
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
28835
28842
  srcPlayData.update(srcPlayCostTime);
28836
28843
  destPlayData.update(dstPlayCostTime);
28837
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28844
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
28838
28845
  (crossWeight >= 1.0 - engineMath.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28839
28846
  var crossFadeFinished = crossWeight === 1.0;
28840
28847
  if (crossFadeFinished) {
@@ -28884,18 +28891,20 @@ exports.AnimatorLayerBlendingMode = void 0;
28884
28891
  var lastDestClipTime = destPlayData.clipTime, lastPlayState = destPlayData.playState;
28885
28892
  var dstPlayCostTime;
28886
28893
  if (destPlayData.isForwards) {
28887
- dstPlayCostTime = lastDestClipTime + playDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : playDeltaTime;
28894
+ // The time that has been played
28895
+ var playedTime = destPlayData.playedTime;
28896
+ dstPlayCostTime = playedTime + playDeltaTime > transitionDuration ? transitionDuration - playedTime : playDeltaTime;
28888
28897
  } else {
28889
28898
  // The time that has been played
28890
- var playedTime = stateDuration - lastDestClipTime;
28899
+ var playedTime1 = destPlayData.playedTime;
28891
28900
  dstPlayCostTime = // -actualDestDeltaTime: The time that will be played, negative are meant to make ite be a periods
28892
28901
  // > transition: The time that will be played is enough to finish the transition
28893
- playedTime - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28894
- playedTime - transitionDuration : playDeltaTime;
28902
+ playedTime1 - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28903
+ playedTime1 - transitionDuration : playDeltaTime;
28895
28904
  }
28896
28905
  var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
28897
28906
  destPlayData.update(dstPlayCostTime);
28898
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28907
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
28899
28908
  (crossWeight >= 1.0 - engineMath.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28900
28909
  var crossFadeFinished = crossWeight === 1.0;
28901
28910
  if (crossFadeFinished) {
@@ -29023,10 +29032,9 @@ exports.AnimatorLayerBlendingMode = void 0;
29023
29032
  _proto._checkSubTransition = function _checkSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
29024
29033
  var state = playState.state;
29025
29034
  var transitionIndex = playState.currentTransitionIndex;
29026
- var duration = state._getDuration();
29027
29035
  for(var n = transitions.length; transitionIndex < n; transitionIndex++){
29028
29036
  var transition = transitions[transitionIndex];
29029
- var exitTime = transition.exitTime * duration;
29037
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
29030
29038
  if (exitTime > curClipTime) {
29031
29039
  break;
29032
29040
  }
@@ -29046,10 +29054,9 @@ exports.AnimatorLayerBlendingMode = void 0;
29046
29054
  _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
29047
29055
  var state = playState.state;
29048
29056
  var transitionIndex = playState.currentTransitionIndex;
29049
- var duration = playState.state._getDuration();
29050
29057
  for(; transitionIndex >= 0; transitionIndex--){
29051
29058
  var transition = transitions[transitionIndex];
29052
- var exitTime = transition.exitTime * duration;
29059
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
29053
29060
  if (exitTime < curClipTime) {
29054
29061
  break;
29055
29062
  }
@@ -29680,6 +29687,16 @@ function _possible_constructor_return(self, call) {
29680
29687
  }
29681
29688
  }
29682
29689
  };
29690
+ /**
29691
+ * @internal
29692
+ */ _proto._getClipActualStartTime = function _getClipActualStartTime() {
29693
+ return this._clipStartTime * this.clip.length;
29694
+ };
29695
+ /**
29696
+ * @internal
29697
+ */ _proto._getClipActualEndTime = function _getClipActualEndTime() {
29698
+ return this._clipEndTime * this.clip.length;
29699
+ };
29683
29700
  _create_class(AnimatorState, [
29684
29701
  {
29685
29702
  key: "transitions",