@galacean/engine-core 0.9.0 → 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/main.js CHANGED
@@ -13125,6 +13125,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13125
13125
  function SkinnedMeshRenderer(entity) {
13126
13126
  var _this;
13127
13127
  _this = MeshRenderer.call(this, entity) || this;
13128
+ _this._supportSkinning = false;
13128
13129
  _this._hasInitSkin = false;
13129
13130
  _this._jointDataCreateCache = new engineMath.Vector2(-1, -1);
13130
13131
  _this._localBounds = new engineMath.BoundingBox();
@@ -13134,7 +13135,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13134
13135
  // Limit size to 256 to avoid some problem:
13135
13136
  // 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!
13136
13137
  // 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.
13137
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
13138
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13138
13139
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13139
13140
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13140
13141
  var localBounds = _this._localBounds;
@@ -13152,9 +13153,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13152
13153
  this._initSkin();
13153
13154
  this._hasInitSkin = true;
13154
13155
  }
13155
- var skin = this._skin;
13156
- if (skin) {
13157
- var ibms = skin.inverseBindMatrices;
13156
+ if (this._supportSkinning) {
13157
+ var ibms = this._skin.inverseBindMatrices;
13158
13158
  var worldToLocal = this._rootBone.getInvModelMatrix();
13159
13159
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13160
13160
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13173,8 +13173,6 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13173
13173
  * @override
13174
13174
  */ _proto._updateShaderData = function _updateShaderData(context) {
13175
13175
  var entity = this.entity;
13176
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13177
- this._updateTransformShaderData(context, worldMatrix);
13178
13176
  var shaderData = this.shaderData;
13179
13177
  var mesh = this.mesh;
13180
13178
  var blendShapeManager = mesh._blendShapeManager;
@@ -13201,12 +13199,18 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13201
13199
  shaderData.disableMacro("O3_JOINTS_NUM");
13202
13200
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13203
13201
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13202
+ this._supportSkinning = true;
13204
13203
  } else {
13205
- 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);
13204
+ var _this__jointTexture1;
13205
+ this._supportSkinning = false;
13206
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13207
+ shaderData.disableMacro("O3_HAS_SKIN");
13208
+ 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);
13206
13209
  }
13207
13210
  } else {
13208
- var _this__jointTexture1;
13209
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13211
+ var _this__jointTexture2;
13212
+ this._supportSkinning = true;
13213
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13210
13214
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13211
13215
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13212
13216
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13217,6 +13221,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13217
13221
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13218
13222
  }
13219
13223
  }
13224
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13225
+ this._updateTransformShaderData(context, worldMatrix);
13220
13226
  var layer = entity.layer;
13221
13227
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13222
13228
  };
@@ -13411,6 +13417,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13411
13417
  (function() {
13412
13418
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13413
13419
  })();
13420
+ __decorate([
13421
+ ignoreClone
13422
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13414
13423
  __decorate([
13415
13424
  ignoreClone
13416
13425
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);