@galacean/engine-core 1.1.0-beta.14 → 1.1.0-beta.16

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
@@ -565,6 +565,9 @@ function _instanceof(left, right) {
565
565
  if (sourceProperty._cloneTo) {
566
566
  sourceProperty._cloneTo(targetOProperty);
567
567
  }
568
+ if (sourceProperty.copyFrom) {
569
+ targetOProperty.copyFrom(sourceProperty);
570
+ }
568
571
  break;
569
572
  }
570
573
  } else {
@@ -4207,7 +4210,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
4207
4210
  }
4208
4211
  cloneEntity.layer = srcEntity.layer;
4209
4212
  cloneEntity._isActive = srcEntity._isActive;
4210
- cloneEntity.transform.localMatrix = srcEntity.transform.localMatrix;
4213
+ var cloneTransform = cloneEntity.transform;
4214
+ var srcTransform = srcEntity.transform;
4215
+ cloneTransform.position = srcTransform.position;
4216
+ cloneTransform.rotation = srcTransform.rotation;
4217
+ cloneTransform.scale = srcTransform.scale;
4211
4218
  var children = srcEntity._children;
4212
4219
  for(var i = 0, n = srcEntity._children.length; i < n; i++){
4213
4220
  cloneEntity.addChild(this._createCloneEntity(children[i]));
@@ -11776,8 +11783,8 @@ var PrimitiveType;
11776
11783
  function SkinnedMeshRenderer(entity) {
11777
11784
  var _this;
11778
11785
  _this = MeshRenderer1.call(this, entity) || this;
11779
- _this._jointDataCreateCache = new engineMath.Vector2(-1, -1);
11780
11786
  _this._localBounds = new engineMath.BoundingBox();
11787
+ _this._jointDataCreateCache = new engineMath.Vector2(-1, -1);
11781
11788
  _this._skin = null;
11782
11789
  var rhi = _this.entity.engine._hardwareRenderer;
11783
11790
  var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
@@ -12081,6 +12088,9 @@ var PrimitiveType;
12081
12088
  (function() {
12082
12089
  SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
12083
12090
  })();
12091
+ __decorate([
12092
+ deepClone
12093
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12084
12094
  __decorate([
12085
12095
  ignoreClone
12086
12096
  ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
@@ -12093,9 +12103,6 @@ __decorate([
12093
12103
  __decorate([
12094
12104
  ignoreClone
12095
12105
  ], SkinnedMeshRenderer.prototype, "_rootBone", void 0);
12096
- __decorate([
12097
- ignoreClone
12098
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
12099
12106
  __decorate([
12100
12107
  ignoreClone
12101
12108
  ], SkinnedMeshRenderer.prototype, "_jointMatrices", void 0);
@@ -13223,12 +13230,12 @@ var /** @internal */ PromiseState;
13223
13230
  */ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
13224
13231
  this._loaders[type] = loader;
13225
13232
  for(var i = 0, len = extNames.length; i < len; i++){
13226
- this._extTypeMapping[extNames[i]] = type;
13233
+ this._extTypeMapping[extNames[i].toLowerCase()] = type;
13227
13234
  }
13228
13235
  };
13229
13236
  ResourceManager._getTypeByUrl = function _getTypeByUrl(url) {
13230
13237
  var path = url.split("?")[0];
13231
- return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1)];
13238
+ return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1).toLowerCase()];
13232
13239
  };
13233
13240
  return ResourceManager;
13234
13241
  }();
@@ -24485,9 +24492,7 @@ var DirtyFlag;
24485
24492
  this.property = property;
24486
24493
  this.component = target.getComponent(type);
24487
24494
  this.cureType = cureType;
24488
- var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24489
- // @todo: Temp solution with blendShape
24490
- this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24495
+ this._isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24491
24496
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24492
24497
  this._assembler = new assemblerType();
24493
24498
  this._assembler.initialize(this);
@@ -24519,7 +24524,7 @@ var DirtyFlag;
24519
24524
  this._assembler.setTargetValue(this.defaultValue);
24520
24525
  };
24521
24526
  _proto.getEvaluateValue = function getEvaluateValue(out) {
24522
- if (this._isCopyMode) {
24527
+ if (this.cureType._isCopyMode) {
24523
24528
  this.cureType._setValue(this.baseEvaluateData.value, out);
24524
24529
  return out;
24525
24530
  } else {
@@ -24527,14 +24532,14 @@ var DirtyFlag;
24527
24532
  }
24528
24533
  };
24529
24534
  _proto.saveDefaultValue = function saveDefaultValue() {
24530
- if (this._isCopyMode) {
24535
+ if (this.cureType._isCopyMode) {
24531
24536
  this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
24532
24537
  } else {
24533
24538
  this.defaultValue = this._assembler.getTargetValue();
24534
24539
  }
24535
24540
  };
24536
24541
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
24537
- if (this._isCopyMode) {
24542
+ if (this.cureType._isCopyMode) {
24538
24543
  this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
24539
24544
  } else {
24540
24545
  this.fixedPoseValue = this._assembler.getTargetValue();
@@ -24543,25 +24548,37 @@ var DirtyFlag;
24543
24548
  _proto.applyValue = function applyValue(value, weight, additive) {
24544
24549
  var cureType = this.cureType;
24545
24550
  if (additive) {
24546
- if (this._isCopyMode) {
24547
- cureType._additiveValue(value, weight, this.referenceTargetValue);
24551
+ var assembler = this._assembler;
24552
+ if (cureType._isCopyMode) {
24553
+ var additiveValue = cureType._additiveValue(value, weight, this.referenceTargetValue);
24554
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
24555
+ if (this._isBlendShape) {
24556
+ assembler.setTargetValue(additiveValue);
24557
+ }
24548
24558
  } else {
24549
- var assembler = this._assembler;
24550
24559
  var originValue = assembler.getTargetValue();
24551
- var additiveValue = cureType._additiveValue(value, weight, originValue);
24552
- assembler.setTargetValue(additiveValue);
24560
+ var additiveValue1 = cureType._additiveValue(value, weight, originValue);
24561
+ assembler.setTargetValue(additiveValue1);
24553
24562
  }
24554
24563
  } else {
24555
24564
  if (weight === 1.0) {
24556
- if (this._isCopyMode) {
24565
+ if (cureType._isCopyMode) {
24557
24566
  cureType._setValue(value, this.referenceTargetValue);
24567
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
24568
+ if (this._isBlendShape) {
24569
+ this._assembler.setTargetValue(this.referenceTargetValue);
24570
+ }
24558
24571
  } else {
24559
24572
  this._assembler.setTargetValue(value);
24560
24573
  }
24561
24574
  } else {
24562
- if (this._isCopyMode) {
24575
+ if (cureType._isCopyMode) {
24563
24576
  var targetValue = this.referenceTargetValue;
24564
24577
  cureType._lerpValue(targetValue, value, weight, targetValue);
24578
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
24579
+ if (this._isBlendShape) {
24580
+ this._assembler.setTargetValue(targetValue);
24581
+ }
24565
24582
  } else {
24566
24583
  var originValue1 = this._assembler.getTargetValue();
24567
24584
  var lerpValue = cureType._lerpValue(originValue1, value, weight);
@@ -24571,7 +24588,7 @@ var DirtyFlag;
24571
24588
  }
24572
24589
  };
24573
24590
  _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
24574
- if (this._isCopyMode) {
24591
+ if (this.cureType._isCopyMode) {
24575
24592
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24576
24593
  } else {
24577
24594
  this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
@@ -27432,6 +27449,7 @@ exports.ParticleStopMode = void 0;
27432
27449
  context.camera._renderPipeline.pushRenderData(context, renderData);
27433
27450
  };
27434
27451
  _proto._onDestroy = function _onDestroy() {
27452
+ Renderer1.prototype._onDestroy.call(this);
27435
27453
  this.generator._destroy();
27436
27454
  };
27437
27455
  _create_class(ParticleRenderer, [
@@ -28031,8 +28049,8 @@ __decorate([
28031
28049
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
28032
28050
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
28033
28051
  /** @internal */ _this._shapeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Shape);
28052
+ /** @internal */ _this._frameRateTime = 0;
28034
28053
  _this._bursts = [];
28035
- _this._frameRateTime = 0;
28036
28054
  _this._currentBurstIndex = 0;
28037
28055
  _this._burstRand = new engineMath.Rand(0, ParticleRandomSubSeeds.Burst);
28038
28056
  return _this;
@@ -28081,7 +28099,8 @@ __decorate([
28081
28099
  };
28082
28100
  /**
28083
28101
  * @internal
28084
- */ _proto._resetBurst = function _resetBurst() {
28102
+ */ _proto._reset = function _reset() {
28103
+ this._frameRateTime = 0;
28085
28104
  this._currentBurstIndex = 0;
28086
28105
  };
28087
28106
  _proto._emitByRateOverTime = function _emitByRateOverTime(playTime) {
@@ -29039,7 +29058,7 @@ __decorate([
29039
29058
  this._firstActiveElement = firstFreeElement;
29040
29059
  this._firstNewElement = firstFreeElement;
29041
29060
  this._playTime = 0;
29042
- this.emission._resetBurst();
29061
+ this.emission._reset();
29043
29062
  }
29044
29063
  }
29045
29064
  };
@@ -29074,19 +29093,23 @@ __decorate([
29074
29093
  /**
29075
29094
  * @internal
29076
29095
  */ _proto._update = function _update(elapsedTime) {
29096
+ var _this = this, main = _this.main, emission = _this.emission;
29097
+ var duration = main.duration;
29077
29098
  var lastPlayTime = this._playTime;
29078
29099
  this._playTime += elapsedTime;
29079
29100
  this._retireActiveParticles();
29080
29101
  this._freeRetiredParticles();
29081
- if (this.emission.enabled && this._isPlaying) {
29082
- this.emission._emit(lastPlayTime, this._playTime);
29083
- if (!this.main.isLoop && this._playTime > this.main.duration) {
29102
+ if (emission.enabled && this._isPlaying) {
29103
+ emission._emit(lastPlayTime, this._playTime);
29104
+ if (!main.isLoop && this._playTime > duration) {
29084
29105
  this._isPlaying = false;
29085
29106
  }
29086
29107
  }
29087
29108
  // Reset play time when is not playing and no active particles to avoid potential precision problems in GPU
29088
29109
  if (!this.isAlive) {
29089
- this._playTime = 0;
29110
+ var discardTime = Math.min(emission._frameRateTime, Math.floor(this._playTime / duration) * duration);
29111
+ this._playTime -= discardTime;
29112
+ emission._frameRateTime -= discardTime;
29090
29113
  }
29091
29114
  // Add new particles to vertex buffer when has wait process retired element or new particle
29092
29115
  //