@galacean/engine-core 1.1.0-beta.14 → 1.1.0-beta.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.
@@ -566,6 +566,9 @@ function _instanceof(left, right) {
566
566
  if (sourceProperty._cloneTo) {
567
567
  sourceProperty._cloneTo(targetOProperty);
568
568
  }
569
+ if (sourceProperty.copyFrom) {
570
+ targetOProperty.copyFrom(sourceProperty);
571
+ }
569
572
  break;
570
573
  }
571
574
  } else {
@@ -4208,7 +4211,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
4208
4211
  }
4209
4212
  cloneEntity.layer = srcEntity.layer;
4210
4213
  cloneEntity._isActive = srcEntity._isActive;
4211
- cloneEntity.transform.localMatrix = srcEntity.transform.localMatrix;
4214
+ var cloneTransform = cloneEntity.transform;
4215
+ var srcTransform = srcEntity.transform;
4216
+ cloneTransform.position = srcTransform.position;
4217
+ cloneTransform.rotation = srcTransform.rotation;
4218
+ cloneTransform.scale = srcTransform.scale;
4212
4219
  var children = srcEntity._children;
4213
4220
  for(var i = 0, n = srcEntity._children.length; i < n; i++){
4214
4221
  cloneEntity.addChild(this._createCloneEntity(children[i]));
@@ -11777,8 +11784,8 @@ var PrimitiveType;
11777
11784
  function SkinnedMeshRenderer(entity) {
11778
11785
  var _this;
11779
11786
  _this = MeshRenderer1.call(this, entity) || this;
11780
- _this._jointDataCreateCache = new miniprogram.Vector2(-1, -1);
11781
11787
  _this._localBounds = new miniprogram.BoundingBox();
11788
+ _this._jointDataCreateCache = new miniprogram.Vector2(-1, -1);
11782
11789
  _this._skin = null;
11783
11790
  var rhi = _this.entity.engine._hardwareRenderer;
11784
11791
  var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
@@ -12082,6 +12089,9 @@ var PrimitiveType;
12082
12089
  (function() {
12083
12090
  SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
12084
12091
  })();
12092
+ __decorate([
12093
+ deepClone
12094
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12085
12095
  __decorate([
12086
12096
  ignoreClone
12087
12097
  ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
@@ -12094,9 +12104,6 @@ __decorate([
12094
12104
  __decorate([
12095
12105
  ignoreClone
12096
12106
  ], SkinnedMeshRenderer.prototype, "_rootBone", void 0);
12097
- __decorate([
12098
- ignoreClone
12099
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12100
12107
  __decorate([
12101
12108
  ignoreClone
12102
12109
  ], SkinnedMeshRenderer.prototype, "_jointMatrices", void 0);
@@ -13224,12 +13231,12 @@ var /** @internal */ PromiseState;
13224
13231
  */ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
13225
13232
  this._loaders[type] = loader;
13226
13233
  for(var i = 0, len = extNames.length; i < len; i++){
13227
- this._extTypeMapping[extNames[i]] = type;
13234
+ this._extTypeMapping[extNames[i].toLowerCase()] = type;
13228
13235
  }
13229
13236
  };
13230
13237
  ResourceManager._getTypeByUrl = function _getTypeByUrl(url) {
13231
13238
  var path = url.split("?")[0];
13232
- return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1)];
13239
+ return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1).toLowerCase()];
13233
13240
  };
13234
13241
  return ResourceManager;
13235
13242
  }();
@@ -24487,7 +24494,7 @@ var DirtyFlag;
24487
24494
  this.component = target.getComponent(type);
24488
24495
  this.cureType = cureType;
24489
24496
  var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24490
- // @todo: Temp solution with blendShape
24497
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
24491
24498
  this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24492
24499
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24493
24500
  this._assembler = new assemblerType();
@@ -24565,7 +24572,8 @@ var DirtyFlag;
24565
24572
  cureType._lerpValue(targetValue, value, weight, targetValue);
24566
24573
  } else {
24567
24574
  var originValue1 = this._assembler.getTargetValue();
24568
- var lerpValue = cureType._lerpValue(originValue1, value, weight);
24575
+ // @todo: Temp solution in PR: https://github.com/galacean/engine/pull/1840
24576
+ var lerpValue = cureType._lerpValue(originValue1, value, weight, originValue1);
24569
24577
  this._assembler.setTargetValue(lerpValue);
24570
24578
  }
24571
24579
  }
@@ -24575,7 +24583,8 @@ var DirtyFlag;
24575
24583
  if (this._isCopyMode) {
24576
24584
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24577
24585
  } else {
24578
- this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
24586
+ // @todo: Temp solution in PR: https://github.com/galacean/engine/pull/1840
24587
+ this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24579
24588
  return this.baseEvaluateData.value;
24580
24589
  }
24581
24590
  };
@@ -27433,6 +27442,7 @@ exports.ParticleStopMode = void 0;
27433
27442
  context.camera._renderPipeline.pushRenderData(context, renderData);
27434
27443
  };
27435
27444
  _proto._onDestroy = function _onDestroy() {
27445
+ Renderer1.prototype._onDestroy.call(this);
27436
27446
  this.generator._destroy();
27437
27447
  };
27438
27448
  _create_class(ParticleRenderer, [
@@ -28032,8 +28042,8 @@ __decorate([
28032
28042
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
28033
28043
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
28034
28044
  /** @internal */ _this._shapeRand = new miniprogram.Rand(0, ParticleRandomSubSeeds.Shape);
28045
+ /** @internal */ _this._frameRateTime = 0;
28035
28046
  _this._bursts = [];
28036
- _this._frameRateTime = 0;
28037
28047
  _this._currentBurstIndex = 0;
28038
28048
  _this._burstRand = new miniprogram.Rand(0, ParticleRandomSubSeeds.Burst);
28039
28049
  return _this;
@@ -28082,7 +28092,8 @@ __decorate([
28082
28092
  };
28083
28093
  /**
28084
28094
  * @internal
28085
- */ _proto._resetBurst = function _resetBurst() {
28095
+ */ _proto._reset = function _reset() {
28096
+ this._frameRateTime = 0;
28086
28097
  this._currentBurstIndex = 0;
28087
28098
  };
28088
28099
  _proto._emitByRateOverTime = function _emitByRateOverTime(playTime) {
@@ -29040,7 +29051,7 @@ __decorate([
29040
29051
  this._firstActiveElement = firstFreeElement;
29041
29052
  this._firstNewElement = firstFreeElement;
29042
29053
  this._playTime = 0;
29043
- this.emission._resetBurst();
29054
+ this.emission._reset();
29044
29055
  }
29045
29056
  }
29046
29057
  };
@@ -29075,19 +29086,23 @@ __decorate([
29075
29086
  /**
29076
29087
  * @internal
29077
29088
  */ _proto._update = function _update(elapsedTime) {
29089
+ var _this = this, main = _this.main, emission = _this.emission;
29090
+ var duration = main.duration;
29078
29091
  var lastPlayTime = this._playTime;
29079
29092
  this._playTime += elapsedTime;
29080
29093
  this._retireActiveParticles();
29081
29094
  this._freeRetiredParticles();
29082
- if (this.emission.enabled && this._isPlaying) {
29083
- this.emission._emit(lastPlayTime, this._playTime);
29084
- if (!this.main.isLoop && this._playTime > this.main.duration) {
29095
+ if (emission.enabled && this._isPlaying) {
29096
+ emission._emit(lastPlayTime, this._playTime);
29097
+ if (!main.isLoop && this._playTime > duration) {
29085
29098
  this._isPlaying = false;
29086
29099
  }
29087
29100
  }
29088
29101
  // Reset play time when is not playing and no active particles to avoid potential precision problems in GPU
29089
29102
  if (!this.isAlive) {
29090
- this._playTime = 0;
29103
+ var discardTime = Math.min(emission._frameRateTime, Math.floor(this._playTime / duration) * duration);
29104
+ this._playTime -= discardTime;
29105
+ emission._frameRateTime -= discardTime;
29091
29106
  }
29092
29107
  // Add new particles to vertex buffer when has wait process retired element or new particle
29093
29108
  //
package/dist/module.js CHANGED
@@ -561,6 +561,9 @@ function _instanceof(left, right) {
561
561
  if (sourceProperty._cloneTo) {
562
562
  sourceProperty._cloneTo(targetOProperty);
563
563
  }
564
+ if (sourceProperty.copyFrom) {
565
+ targetOProperty.copyFrom(sourceProperty);
566
+ }
564
567
  break;
565
568
  }
566
569
  } else {
@@ -4203,7 +4206,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
4203
4206
  }
4204
4207
  cloneEntity.layer = srcEntity.layer;
4205
4208
  cloneEntity._isActive = srcEntity._isActive;
4206
- cloneEntity.transform.localMatrix = srcEntity.transform.localMatrix;
4209
+ var cloneTransform = cloneEntity.transform;
4210
+ var srcTransform = srcEntity.transform;
4211
+ cloneTransform.position = srcTransform.position;
4212
+ cloneTransform.rotation = srcTransform.rotation;
4213
+ cloneTransform.scale = srcTransform.scale;
4207
4214
  var children = srcEntity._children;
4208
4215
  for(var i = 0, n = srcEntity._children.length; i < n; i++){
4209
4216
  cloneEntity.addChild(this._createCloneEntity(children[i]));
@@ -11772,8 +11779,8 @@ var PrimitiveType;
11772
11779
  function SkinnedMeshRenderer(entity) {
11773
11780
  var _this;
11774
11781
  _this = MeshRenderer1.call(this, entity) || this;
11775
- _this._jointDataCreateCache = new Vector2(-1, -1);
11776
11782
  _this._localBounds = new BoundingBox();
11783
+ _this._jointDataCreateCache = new Vector2(-1, -1);
11777
11784
  _this._skin = null;
11778
11785
  var rhi = _this.entity.engine._hardwareRenderer;
11779
11786
  var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
@@ -12077,6 +12084,9 @@ var PrimitiveType;
12077
12084
  (function() {
12078
12085
  SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
12079
12086
  })();
12087
+ __decorate([
12088
+ deepClone
12089
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12080
12090
  __decorate([
12081
12091
  ignoreClone
12082
12092
  ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
@@ -12089,9 +12099,6 @@ __decorate([
12089
12099
  __decorate([
12090
12100
  ignoreClone
12091
12101
  ], SkinnedMeshRenderer.prototype, "_rootBone", void 0);
12092
- __decorate([
12093
- ignoreClone
12094
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12095
12102
  __decorate([
12096
12103
  ignoreClone
12097
12104
  ], SkinnedMeshRenderer.prototype, "_jointMatrices", void 0);
@@ -13219,12 +13226,12 @@ var /** @internal */ PromiseState;
13219
13226
  */ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
13220
13227
  this._loaders[type] = loader;
13221
13228
  for(var i = 0, len = extNames.length; i < len; i++){
13222
- this._extTypeMapping[extNames[i]] = type;
13229
+ this._extTypeMapping[extNames[i].toLowerCase()] = type;
13223
13230
  }
13224
13231
  };
13225
13232
  ResourceManager._getTypeByUrl = function _getTypeByUrl(url) {
13226
13233
  var path = url.split("?")[0];
13227
- return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1)];
13234
+ return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1).toLowerCase()];
13228
13235
  };
13229
13236
  return ResourceManager;
13230
13237
  }();
@@ -24482,7 +24489,7 @@ var DirtyFlag;
24482
24489
  this.component = target.getComponent(type);
24483
24490
  this.cureType = cureType;
24484
24491
  var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24485
- // @todo: Temp solution with blendShape
24492
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
24486
24493
  this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24487
24494
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24488
24495
  this._assembler = new assemblerType();
@@ -24560,7 +24567,8 @@ var DirtyFlag;
24560
24567
  cureType._lerpValue(targetValue, value, weight, targetValue);
24561
24568
  } else {
24562
24569
  var originValue1 = this._assembler.getTargetValue();
24563
- var lerpValue = cureType._lerpValue(originValue1, value, weight);
24570
+ // @todo: Temp solution in PR: https://github.com/galacean/engine/pull/1840
24571
+ var lerpValue = cureType._lerpValue(originValue1, value, weight, originValue1);
24564
24572
  this._assembler.setTargetValue(lerpValue);
24565
24573
  }
24566
24574
  }
@@ -24570,7 +24578,8 @@ var DirtyFlag;
24570
24578
  if (this._isCopyMode) {
24571
24579
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24572
24580
  } else {
24573
- this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
24581
+ // @todo: Temp solution in PR: https://github.com/galacean/engine/pull/1840
24582
+ this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24574
24583
  return this.baseEvaluateData.value;
24575
24584
  }
24576
24585
  };
@@ -27428,6 +27437,7 @@ var ParticleStopMode;
27428
27437
  context.camera._renderPipeline.pushRenderData(context, renderData);
27429
27438
  };
27430
27439
  _proto._onDestroy = function _onDestroy() {
27440
+ Renderer1.prototype._onDestroy.call(this);
27431
27441
  this.generator._destroy();
27432
27442
  };
27433
27443
  _create_class(ParticleRenderer, [
@@ -28027,8 +28037,8 @@ __decorate([
28027
28037
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
28028
28038
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
28029
28039
  /** @internal */ _this._shapeRand = new Rand(0, ParticleRandomSubSeeds.Shape);
28040
+ /** @internal */ _this._frameRateTime = 0;
28030
28041
  _this._bursts = [];
28031
- _this._frameRateTime = 0;
28032
28042
  _this._currentBurstIndex = 0;
28033
28043
  _this._burstRand = new Rand(0, ParticleRandomSubSeeds.Burst);
28034
28044
  return _this;
@@ -28077,7 +28087,8 @@ __decorate([
28077
28087
  };
28078
28088
  /**
28079
28089
  * @internal
28080
- */ _proto._resetBurst = function _resetBurst() {
28090
+ */ _proto._reset = function _reset() {
28091
+ this._frameRateTime = 0;
28081
28092
  this._currentBurstIndex = 0;
28082
28093
  };
28083
28094
  _proto._emitByRateOverTime = function _emitByRateOverTime(playTime) {
@@ -29035,7 +29046,7 @@ __decorate([
29035
29046
  this._firstActiveElement = firstFreeElement;
29036
29047
  this._firstNewElement = firstFreeElement;
29037
29048
  this._playTime = 0;
29038
- this.emission._resetBurst();
29049
+ this.emission._reset();
29039
29050
  }
29040
29051
  }
29041
29052
  };
@@ -29070,19 +29081,23 @@ __decorate([
29070
29081
  /**
29071
29082
  * @internal
29072
29083
  */ _proto._update = function _update(elapsedTime) {
29084
+ var _this = this, main = _this.main, emission = _this.emission;
29085
+ var duration = main.duration;
29073
29086
  var lastPlayTime = this._playTime;
29074
29087
  this._playTime += elapsedTime;
29075
29088
  this._retireActiveParticles();
29076
29089
  this._freeRetiredParticles();
29077
- if (this.emission.enabled && this._isPlaying) {
29078
- this.emission._emit(lastPlayTime, this._playTime);
29079
- if (!this.main.isLoop && this._playTime > this.main.duration) {
29090
+ if (emission.enabled && this._isPlaying) {
29091
+ emission._emit(lastPlayTime, this._playTime);
29092
+ if (!main.isLoop && this._playTime > duration) {
29080
29093
  this._isPlaying = false;
29081
29094
  }
29082
29095
  }
29083
29096
  // Reset play time when is not playing and no active particles to avoid potential precision problems in GPU
29084
29097
  if (!this.isAlive) {
29085
- this._playTime = 0;
29098
+ var discardTime = Math.min(emission._frameRateTime, Math.floor(this._playTime / duration) * duration);
29099
+ this._playTime -= discardTime;
29100
+ emission._frameRateTime -= discardTime;
29086
29101
  }
29087
29102
  // Add new particles to vertex buffer when has wait process retired element or new particle
29088
29103
  //