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