@galacean/engine 0.9.1 → 0.9.2

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
@@ -17730,6 +17730,7 @@
17730
17730
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
17731
17731
  var _this;
17732
17732
  _this = MeshRenderer.call(this, entity) || this;
17733
+ _this._supportSkinning = false;
17733
17734
  _this._hasInitSkin = false;
17734
17735
  _this._jointDataCreateCache = new Vector2(-1, -1);
17735
17736
  _this._localBounds = new BoundingBox();
@@ -17739,7 +17740,7 @@
17739
17740
  // Limit size to 256 to avoid some problem:
17740
17741
  // For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
17741
17742
  // For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
17742
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
17743
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
17743
17744
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
17744
17745
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
17745
17746
  var localBounds = _this._localBounds;
@@ -17758,9 +17759,8 @@
17758
17759
  this._initSkin();
17759
17760
  this._hasInitSkin = true;
17760
17761
  }
17761
- var skin = this._skin;
17762
- if (skin) {
17763
- var ibms = skin.inverseBindMatrices;
17762
+ if (this._supportSkinning) {
17763
+ var ibms = this._skin.inverseBindMatrices;
17764
17764
  var worldToLocal = this._rootBone.getInvModelMatrix();
17765
17765
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
17766
17766
  for(var i = joints.length - 1; i >= 0; i--){
@@ -17779,8 +17779,6 @@
17779
17779
  * @override
17780
17780
  */ _proto._updateShaderData = function _updateShaderData(context) {
17781
17781
  var entity = this.entity;
17782
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
17783
- this._updateTransformShaderData(context, worldMatrix);
17784
17782
  var shaderData = this.shaderData;
17785
17783
  var mesh = this.mesh;
17786
17784
  var blendShapeManager = mesh._blendShapeManager;
@@ -17807,12 +17805,18 @@
17807
17805
  shaderData.disableMacro("O3_JOINTS_NUM");
17808
17806
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
17809
17807
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17808
+ this._supportSkinning = true;
17810
17809
  } else {
17811
- Logger.error("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
17810
+ var _this__jointTexture1;
17811
+ this._supportSkinning = false;
17812
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
17813
+ shaderData.disableMacro("O3_HAS_SKIN");
17814
+ Logger.warn("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
17812
17815
  }
17813
17816
  } else {
17814
- var _this__jointTexture1;
17815
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
17817
+ var _this__jointTexture2;
17818
+ this._supportSkinning = true;
17819
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
17816
17820
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
17817
17821
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
17818
17822
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -17823,6 +17827,8 @@
17823
17827
  this._jointTexture.setPixelBuffer(this._jointMatrices);
17824
17828
  }
17825
17829
  }
17830
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
17831
+ this._updateTransformShaderData(context, worldMatrix);
17826
17832
  var layer = entity.layer;
17827
17833
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
17828
17834
  };
@@ -18017,6 +18023,9 @@
18017
18023
  (function() {
18018
18024
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
18019
18025
  })();
18026
+ __decorate$1([
18027
+ ignoreClone
18028
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
18020
18029
  __decorate$1([
18021
18030
  ignoreClone
18022
18031
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -31040,7 +31049,8 @@
31040
31049
  webGLMode: 0,
31041
31050
  alpha: false,
31042
31051
  stencil: true,
31043
- _forceFlush: false
31052
+ _forceFlush: false,
31053
+ _maxAllowSkinUniformVectorCount: 256
31044
31054
  }, initializeOptions);
31045
31055
  if (SystemInfo.platform === exports.Platform.IPhone || SystemInfo.platform === exports.Platform.IPad) {
31046
31056
  var version = SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
@@ -35777,7 +35787,7 @@
35777
35787
  }));
35778
35788
 
35779
35789
  //@ts-ignore
35780
- var version = "0.9.1";
35790
+ var version = "0.9.2";
35781
35791
  console.log("Galacean engine version: " + version);
35782
35792
  for(var key in CoreObjects){
35783
35793
  Loader.registerClass(key, CoreObjects[key]);