@galacean/engine 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/browser.js CHANGED
@@ -2759,22 +2759,17 @@
2759
2759
  var m11 = e[0];
2760
2760
  var m12 = e[1];
2761
2761
  var m13 = e[2];
2762
- var m14 = e[3];
2763
2762
  var m21 = e[4];
2764
2763
  var m22 = e[5];
2765
2764
  var m23 = e[6];
2766
- var m24 = e[7];
2767
2765
  var m31 = e[8];
2768
2766
  var m32 = e[9];
2769
2767
  var m33 = e[10];
2770
- var m34 = e[11];
2771
2768
  translation.set(e[12], e[13], e[14]);
2772
- var xs = Math.sign(m11 * m12 * m13 * m14) < 0 ? -1 : 1;
2773
- var ys = Math.sign(m21 * m22 * m23 * m24) < 0 ? -1 : 1;
2774
- var zs = Math.sign(m31 * m32 * m33 * m34) < 0 ? -1 : 1;
2775
- var sx = xs * Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2776
- var sy = ys * Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2777
- var sz = zs * Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2769
+ var sx = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);
2770
+ var sy = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);
2771
+ var sz = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
2772
+ if (this.determinant() < 0) sx = -sx;
2778
2773
  scale.set(sx, sy, sz);
2779
2774
  if (Math.abs(sx) < MathUtil$1.zeroTolerance || Math.abs(sy) < MathUtil$1.zeroTolerance || Math.abs(sz) < MathUtil$1.zeroTolerance) {
2780
2775
  rotation.identity();
@@ -5532,6 +5527,9 @@
5532
5527
  if (sourceProperty._cloneTo) {
5533
5528
  sourceProperty._cloneTo(targetOProperty);
5534
5529
  }
5530
+ if (sourceProperty.copyFrom) {
5531
+ targetOProperty.copyFrom(sourceProperty);
5532
+ }
5535
5533
  break;
5536
5534
  }
5537
5535
  } else {
@@ -9133,7 +9131,11 @@
9133
9131
  }
9134
9132
  cloneEntity.layer = srcEntity.layer;
9135
9133
  cloneEntity._isActive = srcEntity._isActive;
9136
- cloneEntity.transform.localMatrix = srcEntity.transform.localMatrix;
9134
+ var cloneTransform = cloneEntity.transform;
9135
+ var srcTransform = srcEntity.transform;
9136
+ cloneTransform.position = srcTransform.position;
9137
+ cloneTransform.rotation = srcTransform.rotation;
9138
+ cloneTransform.scale = srcTransform.scale;
9137
9139
  var children = srcEntity._children;
9138
9140
  for(var i = 0, n = srcEntity._children.length; i < n; i++){
9139
9141
  cloneEntity.addChild(this._createCloneEntity(children[i]));
@@ -16555,8 +16557,8 @@
16555
16557
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
16556
16558
  var _this;
16557
16559
  _this = MeshRenderer1.call(this, entity) || this;
16558
- _this._jointDataCreateCache = new Vector2(-1, -1);
16559
16560
  _this._localBounds = new BoundingBox();
16561
+ _this._jointDataCreateCache = new Vector2(-1, -1);
16560
16562
  _this._skin = null;
16561
16563
  var rhi = _this.entity.engine._hardwareRenderer;
16562
16564
  var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
@@ -16861,6 +16863,9 @@
16861
16863
  (function() {
16862
16864
  SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
16863
16865
  })();
16866
+ __decorate$1([
16867
+ deepClone
16868
+ ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
16864
16869
  __decorate$1([
16865
16870
  ignoreClone
16866
16871
  ], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
@@ -16873,9 +16878,6 @@
16873
16878
  __decorate$1([
16874
16879
  ignoreClone
16875
16880
  ], SkinnedMeshRenderer.prototype, "_rootBone", void 0);
16876
- __decorate$1([
16877
- ignoreClone
16878
- ], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
16879
16881
  __decorate$1([
16880
16882
  ignoreClone
16881
16883
  ], SkinnedMeshRenderer.prototype, "_jointMatrices", void 0);
@@ -17991,12 +17993,12 @@
17991
17993
  */ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
17992
17994
  this._loaders[type] = loader;
17993
17995
  for(var i = 0, len = extNames.length; i < len; i++){
17994
- this._extTypeMapping[extNames[i]] = type;
17996
+ this._extTypeMapping[extNames[i].toLowerCase()] = type;
17995
17997
  }
17996
17998
  };
17997
17999
  ResourceManager._getTypeByUrl = function _getTypeByUrl(url) {
17998
18000
  var path = url.split("?")[0];
17999
- return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1)];
18001
+ return this._extTypeMapping[path.substring(path.lastIndexOf(".") + 1).toLowerCase()];
18000
18002
  };
18001
18003
  return ResourceManager;
18002
18004
  }();
@@ -29130,9 +29132,7 @@
29130
29132
  this.property = property;
29131
29133
  this.component = target.getComponent(type);
29132
29134
  this.cureType = cureType;
29133
- var isBlendShape = _instanceof1$2(this.component, SkinnedMeshRenderer);
29134
- // @todo: Temp solution with blendShape
29135
- this._isCopyMode = cureType._isCopyMode && !isBlendShape;
29135
+ this._isBlendShape = _instanceof1$2(this.component, SkinnedMeshRenderer);
29136
29136
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
29137
29137
  this._assembler = new assemblerType();
29138
29138
  this._assembler.initialize(this);
@@ -29164,7 +29164,7 @@
29164
29164
  this._assembler.setTargetValue(this.defaultValue);
29165
29165
  };
29166
29166
  _proto.getEvaluateValue = function getEvaluateValue(out) {
29167
- if (this._isCopyMode) {
29167
+ if (this.cureType._isCopyMode) {
29168
29168
  this.cureType._setValue(this.baseEvaluateData.value, out);
29169
29169
  return out;
29170
29170
  } else {
@@ -29172,14 +29172,14 @@
29172
29172
  }
29173
29173
  };
29174
29174
  _proto.saveDefaultValue = function saveDefaultValue() {
29175
- if (this._isCopyMode) {
29175
+ if (this.cureType._isCopyMode) {
29176
29176
  this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
29177
29177
  } else {
29178
29178
  this.defaultValue = this._assembler.getTargetValue();
29179
29179
  }
29180
29180
  };
29181
29181
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
29182
- if (this._isCopyMode) {
29182
+ if (this.cureType._isCopyMode) {
29183
29183
  this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
29184
29184
  } else {
29185
29185
  this.fixedPoseValue = this._assembler.getTargetValue();
@@ -29188,25 +29188,37 @@
29188
29188
  _proto.applyValue = function applyValue(value, weight, additive) {
29189
29189
  var cureType = this.cureType;
29190
29190
  if (additive) {
29191
- if (this._isCopyMode) {
29192
- cureType._additiveValue(value, weight, this.referenceTargetValue);
29191
+ var assembler = this._assembler;
29192
+ if (cureType._isCopyMode) {
29193
+ var additiveValue = cureType._additiveValue(value, weight, this.referenceTargetValue);
29194
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
29195
+ if (this._isBlendShape) {
29196
+ assembler.setTargetValue(additiveValue);
29197
+ }
29193
29198
  } else {
29194
- var assembler = this._assembler;
29195
29199
  var originValue = assembler.getTargetValue();
29196
- var additiveValue = cureType._additiveValue(value, weight, originValue);
29197
- assembler.setTargetValue(additiveValue);
29200
+ var additiveValue1 = cureType._additiveValue(value, weight, originValue);
29201
+ assembler.setTargetValue(additiveValue1);
29198
29202
  }
29199
29203
  } else {
29200
29204
  if (weight === 1.0) {
29201
- if (this._isCopyMode) {
29205
+ if (cureType._isCopyMode) {
29202
29206
  cureType._setValue(value, this.referenceTargetValue);
29207
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
29208
+ if (this._isBlendShape) {
29209
+ this._assembler.setTargetValue(this.referenceTargetValue);
29210
+ }
29203
29211
  } else {
29204
29212
  this._assembler.setTargetValue(value);
29205
29213
  }
29206
29214
  } else {
29207
- if (this._isCopyMode) {
29215
+ if (cureType._isCopyMode) {
29208
29216
  var targetValue = this.referenceTargetValue;
29209
29217
  cureType._lerpValue(targetValue, value, weight, targetValue);
29218
+ // @todo: Temp solution with blendShape bug when multi SkinnedMeshRenderer in a entity. we need to run setTargetValue to solve it.
29219
+ if (this._isBlendShape) {
29220
+ this._assembler.setTargetValue(targetValue);
29221
+ }
29210
29222
  } else {
29211
29223
  var originValue1 = this._assembler.getTargetValue();
29212
29224
  var lerpValue = cureType._lerpValue(originValue1, value, weight);
@@ -29216,7 +29228,7 @@
29216
29228
  }
29217
29229
  };
29218
29230
  _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
29219
- if (this._isCopyMode) {
29231
+ if (this.cureType._isCopyMode) {
29220
29232
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
29221
29233
  } else {
29222
29234
  this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
@@ -32029,6 +32041,7 @@
32029
32041
  context.camera._renderPipeline.pushRenderData(context, renderData);
32030
32042
  };
32031
32043
  _proto._onDestroy = function _onDestroy() {
32044
+ Renderer1.prototype._onDestroy.call(this);
32032
32045
  this.generator._destroy();
32033
32046
  };
32034
32047
  _create_class$3(ParticleRenderer, [
@@ -32617,8 +32630,8 @@
32617
32630
  /** The rate of particle emission. */ _this.rateOverTime = new ParticleCompositeCurve(10);
32618
32631
  /** The rate at which the emitter spawns new particles over distance. */ _this.rateOverDistance = new ParticleCompositeCurve(0);
32619
32632
  /** @internal */ _this._shapeRand = new Rand(0, ParticleRandomSubSeeds.Shape);
32633
+ /** @internal */ _this._frameRateTime = 0;
32620
32634
  _this._bursts = [];
32621
- _this._frameRateTime = 0;
32622
32635
  _this._currentBurstIndex = 0;
32623
32636
  _this._burstRand = new Rand(0, ParticleRandomSubSeeds.Burst);
32624
32637
  return _this;
@@ -32668,7 +32681,8 @@
32668
32681
  };
32669
32682
  /**
32670
32683
  * @internal
32671
- */ _proto._resetBurst = function _resetBurst() {
32684
+ */ _proto._reset = function _reset() {
32685
+ this._frameRateTime = 0;
32672
32686
  this._currentBurstIndex = 0;
32673
32687
  };
32674
32688
  _proto._emitByRateOverTime = function _emitByRateOverTime(playTime) {
@@ -33618,7 +33632,7 @@
33618
33632
  this._firstActiveElement = firstFreeElement;
33619
33633
  this._firstNewElement = firstFreeElement;
33620
33634
  this._playTime = 0;
33621
- this.emission._resetBurst();
33635
+ this.emission._reset();
33622
33636
  }
33623
33637
  }
33624
33638
  };
@@ -33653,19 +33667,23 @@
33653
33667
  /**
33654
33668
  * @internal
33655
33669
  */ _proto._update = function _update(elapsedTime) {
33670
+ var _this = this, main = _this.main, emission = _this.emission;
33671
+ var duration = main.duration;
33656
33672
  var lastPlayTime = this._playTime;
33657
33673
  this._playTime += elapsedTime;
33658
33674
  this._retireActiveParticles();
33659
33675
  this._freeRetiredParticles();
33660
- if (this.emission.enabled && this._isPlaying) {
33661
- this.emission._emit(lastPlayTime, this._playTime);
33662
- if (!this.main.isLoop && this._playTime > this.main.duration) {
33676
+ if (emission.enabled && this._isPlaying) {
33677
+ emission._emit(lastPlayTime, this._playTime);
33678
+ if (!main.isLoop && this._playTime > duration) {
33663
33679
  this._isPlaying = false;
33664
33680
  }
33665
33681
  }
33666
33682
  // Reset play time when is not playing and no active particles to avoid potential precision problems in GPU
33667
33683
  if (!this.isAlive) {
33668
- this._playTime = 0;
33684
+ var discardTime = Math.min(emission._frameRateTime, Math.floor(this._playTime / duration) * duration);
33685
+ this._playTime -= discardTime;
33686
+ emission._frameRateTime -= discardTime;
33669
33687
  }
33670
33688
  // Add new particles to vertex buffer when has wait process retired element or new particle
33671
33689
  //
@@ -40175,14 +40193,6 @@
40175
40193
  });
40176
40194
  };
40177
40195
  _proto._isKhronosSupported = function _isKhronosSupported(priorityFormats, engine) {
40178
- if (priorityFormats === void 0) priorityFormats = [
40179
- exports.KTX2TargetFormat.ASTC,
40180
- exports.KTX2TargetFormat.ETC,
40181
- exports.KTX2TargetFormat.BC7,
40182
- exports.KTX2TargetFormat.BC1_BC3,
40183
- exports.KTX2TargetFormat.PVRTC,
40184
- exports.KTX2TargetFormat.R8G8B8A8
40185
- ];
40186
40196
  return !!KhronosTranscoder.transcoderMap[exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats)];
40187
40197
  };
40188
40198
  /**
@@ -40266,10 +40276,21 @@
40266
40276
  };
40267
40277
  KTX2Loader1._detectSupportedFormat = function _detectSupportedFormat(renderer, priorityFormats) {
40268
40278
  for(var i = 0; i < priorityFormats.length; i++){
40269
- var capabilities = this._supportedMap[priorityFormats[i]];
40270
- for(var j = 0; j < capabilities.length; j++){
40271
- if (renderer.canIUse(capabilities[j])) {
40272
- return priorityFormats[i];
40279
+ var format = priorityFormats[i];
40280
+ var capabilities = this._supportedMap[format];
40281
+ if (capabilities) {
40282
+ for(var j = 0; j < capabilities.length; j++){
40283
+ if (renderer.canIUse(capabilities[j])) {
40284
+ return format;
40285
+ }
40286
+ }
40287
+ } else {
40288
+ switch(priorityFormats[i]){
40289
+ case exports.KTX2TargetFormat.R8G8B8A8:
40290
+ return format;
40291
+ case exports.KTX2TargetFormat.R8:
40292
+ case exports.KTX2TargetFormat.R8G8:
40293
+ if (renderer.isWebGL2) return format;
40273
40294
  }
40274
40295
  }
40275
40296
  }
@@ -40783,6 +40804,10 @@
40783
40804
  relativePath = relativePath === "" ? "" + entity.name : entity.name + "/" + relativePath;
40784
40805
  entity = entity.parent;
40785
40806
  }
40807
+ // If the target node is in the default scene, relativePath will be empty
40808
+ if (entity !== context.glTFResource.defaultSceneRoot) {
40809
+ continue;
40810
+ }
40786
40811
  var ComponentType = void 0;
40787
40812
  var propertyName = void 0;
40788
40813
  switch(target.path){
@@ -42751,27 +42776,32 @@
42751
42776
  var promises = [];
42752
42777
  // parse ambient light
42753
42778
  var ambient = data.scene.ambient;
42754
- var useCustomAmbient = ambient.specularMode === "Custom";
42755
- var useSH = ambient.diffuseMode === exports.DiffuseMode.SphericalHarmonics;
42756
- scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
42757
- scene.ambientLight.specularIntensity = ambient.specularIntensity;
42758
- scene.ambientLight.diffuseMode = ambient.diffuseMode;
42759
- scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
42760
- scene.ambientLight.specularTextureDecodeRGBM = true;
42761
- if (useCustomAmbient && ambient.customAmbientLight) {
42762
- promises.push(resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
42763
- scene.ambientLight.specularTexture = ambientLight.specularTexture;
42764
- }));
42765
- }
42766
- if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
42767
- promises.push(resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
42768
- if (!useCustomAmbient) {
42769
- scene.ambientLight.specularTexture = ambientLight.specularTexture;
42770
- }
42771
- if (useSH) {
42772
- scene.ambientLight.diffuseSphericalHarmonics = ambientLight.diffuseSphericalHarmonics;
42773
- }
42774
- }));
42779
+ if (ambient) {
42780
+ var useCustomAmbient = ambient.specularMode === "Custom";
42781
+ var useSH = ambient.diffuseMode === exports.DiffuseMode.SphericalHarmonics;
42782
+ scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
42783
+ scene.ambientLight.specularIntensity = ambient.specularIntensity;
42784
+ scene.ambientLight.diffuseMode = ambient.diffuseMode;
42785
+ scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
42786
+ scene.ambientLight.specularTextureDecodeRGBM = true;
42787
+ if (useCustomAmbient && ambient.customAmbientLight) {
42788
+ promises.push(resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
42789
+ var _ambientLight;
42790
+ scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
42791
+ }));
42792
+ }
42793
+ if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
42794
+ promises.push(resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
42795
+ if (!useCustomAmbient) {
42796
+ var _ambientLight;
42797
+ scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
42798
+ }
42799
+ if (useSH) {
42800
+ var _ambientLight1;
42801
+ scene.ambientLight.diffuseSphericalHarmonics = (_ambientLight1 = ambientLight) == null ? void 0 : _ambientLight1.diffuseSphericalHarmonics;
42802
+ }
42803
+ }));
42804
+ }
42775
42805
  }
42776
42806
  var background = data.scene.background;
42777
42807
  scene.background.mode = background.mode;
@@ -43324,7 +43354,7 @@
43324
43354
  ], GALACEAN_animation_event);
43325
43355
 
43326
43356
  //@ts-ignore
43327
- var version = "1.1.0-beta.14";
43357
+ var version = "1.1.0-beta.16";
43328
43358
  console.log("Galacean engine version: " + version);
43329
43359
  for(var key in CoreObjects){
43330
43360
  Loader.registerClass(key, CoreObjects[key]);