@galacean/engine 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/browser.js CHANGED
@@ -4518,7 +4518,7 @@
4518
4518
  out._r = Color.gammaToLinearSpace(this._r);
4519
4519
  out._g = Color.gammaToLinearSpace(this._g);
4520
4520
  out._b = Color.gammaToLinearSpace(this._b);
4521
- this._onValueChanged && this._onValueChanged();
4521
+ out._onValueChanged && out._onValueChanged();
4522
4522
  return out;
4523
4523
  };
4524
4524
  /**
@@ -4529,7 +4529,7 @@
4529
4529
  out._r = Color.linearToGammaSpace(this._r);
4530
4530
  out._g = Color.linearToGammaSpace(this._g);
4531
4531
  out._b = Color.linearToGammaSpace(this._b);
4532
- this._onValueChanged && this._onValueChanged();
4532
+ out._onValueChanged && out._onValueChanged();
4533
4533
  return out;
4534
4534
  };
4535
4535
  /**
@@ -8059,8 +8059,11 @@
8059
8059
  */ _proto._destroy = function _destroy() {
8060
8060
  var shaderProgramPools = this._shaderProgramPools;
8061
8061
  for(var i = 0, n = shaderProgramPools.length; i < n; i++){
8062
- shaderProgramPools[i]._destroy();
8062
+ var shaderProgramPool = shaderProgramPools[i];
8063
+ shaderProgramPool._destroy();
8064
+ delete shaderProgramPool.engine._shaderProgramPools[this._shaderPassId];
8063
8065
  }
8066
+ // Clear array storing multiple engine shader program pools
8064
8067
  shaderProgramPools.length = 0;
8065
8068
  };
8066
8069
  /**
@@ -27838,7 +27841,8 @@
27838
27841
  * Shader program pool.
27839
27842
  * @internal
27840
27843
  */ var ShaderProgramPool = /*#__PURE__*/ function() {
27841
- var ShaderProgramPool = function ShaderProgramPool() {
27844
+ var ShaderProgramPool = function ShaderProgramPool(engine) {
27845
+ this.engine = engine;
27842
27846
  this._cacheHierarchyDepth = 1;
27843
27847
  this._cacheMap = Object.create(null);
27844
27848
  };
@@ -28240,7 +28244,7 @@
28240
28244
  if (length > shaderProgramPools.length) {
28241
28245
  shaderProgramPools.length = length;
28242
28246
  }
28243
- shaderProgramPools[index] = pool = new ShaderProgramPool();
28247
+ shaderProgramPools[index] = pool = new ShaderProgramPool(this);
28244
28248
  shaderPass._shaderProgramPools.push(pool);
28245
28249
  }
28246
28250
  return pool;
@@ -32872,7 +32876,8 @@
32872
32876
  var _proto = AnimatorStatePlayData.prototype;
32873
32877
  _proto.reset = function reset(state, stateData, offsetFrameTime) {
32874
32878
  this.state = state;
32875
- this.frameTime = offsetFrameTime;
32879
+ this.playedTime = 0;
32880
+ this.offsetFrameTime = offsetFrameTime;
32876
32881
  this.stateData = stateData;
32877
32882
  this.playState = AnimatorStatePlayState.UnStarted;
32878
32883
  this.clipTime = state.clipStartTime * state.clip.length;
@@ -32891,9 +32896,9 @@
32891
32896
  }
32892
32897
  };
32893
32898
  _proto.update = function update(deltaTime) {
32894
- this.frameTime += deltaTime;
32899
+ this.playedTime += deltaTime;
32895
32900
  var state = this.state;
32896
- var time = this.frameTime;
32901
+ var time = this.playedTime + this.offsetFrameTime;
32897
32902
  var duration = state._getDuration();
32898
32903
  this.playState = AnimatorStatePlayState.Playing;
32899
32904
  if (state.wrapMode === exports.WrapMode.Loop) {
@@ -33225,8 +33230,9 @@
33225
33230
  eventHandler.event = event;
33226
33231
  handlers.length = 0;
33227
33232
  for(var j = scriptCount - 1; j >= 0; j--){
33233
+ var _script_funcName;
33228
33234
  var script = scripts[j];
33229
- var handler = script[funcName].bind(script);
33235
+ var handler = (_script_funcName = script[funcName]) == null ? void 0 : _script_funcName.bind(script);
33230
33236
  handler && handlers.push(handler);
33231
33237
  }
33232
33238
  eventHandlers.push(eventHandler);
@@ -33336,9 +33342,8 @@
33336
33342
  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);
33337
33343
  var playCostTime;
33338
33344
  if (transition) {
33339
- var clipDuration = state.clip.length;
33340
- var clipEndTime = state.clipEndTime * clipDuration;
33341
- var exitTime = transition.exitTime * state._getDuration();
33345
+ var clipEndTime = state._getClipActualEndTime();
33346
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33342
33347
  if (isForwards) {
33343
33348
  if (exitTime < lastClipTime) {
33344
33349
  playCostTime = exitTime + clipEndTime - lastClipTime;
@@ -33346,7 +33351,7 @@
33346
33351
  playCostTime = exitTime - lastClipTime;
33347
33352
  }
33348
33353
  } else {
33349
- var startTime = state.clipStartTime * clipDuration;
33354
+ var startTime = state._getClipActualStartTime();
33350
33355
  if (lastClipTime < exitTime) {
33351
33356
  playCostTime = clipEndTime - exitTime + lastClipTime - startTime;
33352
33357
  } else {
@@ -33408,18 +33413,20 @@
33408
33413
  var lastDestClipTime = destPlayData.clipTime, lastDstPlayState = destPlayData.playState;
33409
33414
  var dstPlayCostTime;
33410
33415
  if (destPlayData.isForwards) {
33411
- dstPlayCostTime = lastDestClipTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : dstPlayDeltaTime;
33416
+ // The time that has been played
33417
+ var playedTime = destPlayData.playedTime;
33418
+ dstPlayCostTime = playedTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - playedTime : dstPlayDeltaTime;
33412
33419
  } else {
33413
33420
  // The time that has been played
33414
- var playedTime = destStateDuration - lastDestClipTime;
33421
+ var playedTime1 = destPlayData.playedTime;
33415
33422
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33416
- playedTime - dstPlayDeltaTime > transitionDuration ? playedTime - transitionDuration : dstPlayDeltaTime;
33423
+ playedTime1 - dstPlayDeltaTime > transitionDuration ? playedTime1 - transitionDuration : dstPlayDeltaTime;
33417
33424
  }
33418
33425
  var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
33419
33426
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
33420
33427
  srcPlayData.update(srcPlayCostTime);
33421
33428
  destPlayData.update(dstPlayCostTime);
33422
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
33429
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
33423
33430
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
33424
33431
  var crossFadeFinished = crossWeight === 1.0;
33425
33432
  if (crossFadeFinished) {
@@ -33469,16 +33476,18 @@
33469
33476
  var lastDestClipTime = destPlayData.clipTime, lastPlayState = destPlayData.playState;
33470
33477
  var dstPlayCostTime;
33471
33478
  if (destPlayData.isForwards) {
33472
- dstPlayCostTime = lastDestClipTime + playDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : playDeltaTime;
33479
+ // The time that has been played
33480
+ var playedTime = destPlayData.playedTime;
33481
+ dstPlayCostTime = playedTime + playDeltaTime > transitionDuration ? transitionDuration - playedTime : playDeltaTime;
33473
33482
  } else {
33474
33483
  // The time that has been played
33475
- var playedTime = stateDuration - lastDestClipTime;
33484
+ var playedTime1 = destPlayData.playedTime;
33476
33485
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33477
- playedTime - playDeltaTime > transitionDuration ? playedTime - transitionDuration : playDeltaTime;
33486
+ playedTime1 - playDeltaTime > transitionDuration ? playedTime1 - transitionDuration : playDeltaTime;
33478
33487
  }
33479
33488
  var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
33480
33489
  destPlayData.update(dstPlayCostTime);
33481
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
33490
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
33482
33491
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
33483
33492
  var crossFadeFinished = crossWeight === 1.0;
33484
33493
  if (crossFadeFinished) {
@@ -33606,10 +33615,9 @@
33606
33615
  _proto._checkSubTransition = function _checkSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
33607
33616
  var state = playState.state;
33608
33617
  var transitionIndex = playState.currentTransitionIndex;
33609
- var duration = state._getDuration();
33610
33618
  for(var n = transitions.length; transitionIndex < n; transitionIndex++){
33611
33619
  var transition = transitions[transitionIndex];
33612
- var exitTime = transition.exitTime * duration;
33620
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33613
33621
  if (exitTime > curClipTime) {
33614
33622
  break;
33615
33623
  }
@@ -33629,10 +33637,9 @@
33629
33637
  _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
33630
33638
  var state = playState.state;
33631
33639
  var transitionIndex = playState.currentTransitionIndex;
33632
- var duration = playState.state._getDuration();
33633
33640
  for(; transitionIndex >= 0; transitionIndex--){
33634
33641
  var transition = transitions[transitionIndex];
33635
- var exitTime = transition.exitTime * duration;
33642
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33636
33643
  if (exitTime < curClipTime) {
33637
33644
  break;
33638
33645
  }
@@ -34255,6 +34262,16 @@
34255
34262
  }
34256
34263
  }
34257
34264
  };
34265
+ /**
34266
+ * @internal
34267
+ */ _proto._getClipActualStartTime = function _getClipActualStartTime() {
34268
+ return this._clipStartTime * this.clip.length;
34269
+ };
34270
+ /**
34271
+ * @internal
34272
+ */ _proto._getClipActualEndTime = function _getClipActualEndTime() {
34273
+ return this._clipEndTime * this.clip.length;
34274
+ };
34258
34275
  _create_class$2(AnimatorState, [
34259
34276
  {
34260
34277
  key: "transitions",
@@ -48146,7 +48163,7 @@
48146
48163
  ], EXT_texture_webp);
48147
48164
 
48148
48165
  //@ts-ignore
48149
- var version = "1.3.12";
48166
+ var version = "1.3.15";
48150
48167
  console.log("Galacean engine version: " + version);
48151
48168
  for(var key in CoreObjects){
48152
48169
  Loader.registerClass(key, CoreObjects[key]);