@galacean/engine-core 0.9.1 → 0.9.3

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
@@ -12899,6 +12899,7 @@ var VertexChangedFlags;
12899
12899
  function MeshRenderer(entity) {
12900
12900
  var _this;
12901
12901
  _this = Renderer.call(this, entity) || this;
12902
+ _this._enableVertexColor = false;
12902
12903
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
12903
12904
  return _this;
12904
12905
  }
@@ -12960,7 +12961,7 @@ var VertexChangedFlags;
12960
12961
  shaderData.enableMacro(MeshRenderer._tangentMacro);
12961
12962
  break;
12962
12963
  case "COLOR_0":
12963
- shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12964
+ this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12964
12965
  break;
12965
12966
  }
12966
12967
  }
@@ -13015,6 +13016,20 @@ var VertexChangedFlags;
13015
13016
  this._setMesh(value);
13016
13017
  }
13017
13018
  }
13019
+ },
13020
+ {
13021
+ key: "enableVertexColor",
13022
+ get: /**
13023
+ * Whether enable vertex color.
13024
+ */ function get() {
13025
+ return this._enableVertexColor;
13026
+ },
13027
+ set: function set(value) {
13028
+ if (value !== this._enableVertexColor) {
13029
+ this._dirtyUpdateFlag |= 0x2;
13030
+ this._enableVertexColor = value;
13031
+ }
13032
+ }
13018
13033
  }
13019
13034
  ]);
13020
13035
  return MeshRenderer;
@@ -13125,6 +13140,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13125
13140
  function SkinnedMeshRenderer(entity) {
13126
13141
  var _this;
13127
13142
  _this = MeshRenderer.call(this, entity) || this;
13143
+ _this._supportSkinning = false;
13128
13144
  _this._hasInitSkin = false;
13129
13145
  _this._jointDataCreateCache = new engineMath.Vector2(-1, -1);
13130
13146
  _this._localBounds = new engineMath.BoundingBox();
@@ -13134,7 +13150,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13134
13150
  // Limit size to 256 to avoid some problem:
13135
13151
  // 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
13152
  // 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);
13153
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13138
13154
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13139
13155
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13140
13156
  var localBounds = _this._localBounds;
@@ -13152,9 +13168,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13152
13168
  this._initSkin();
13153
13169
  this._hasInitSkin = true;
13154
13170
  }
13155
- var skin = this._skin;
13156
- if (skin) {
13157
- var ibms = skin.inverseBindMatrices;
13171
+ if (this._supportSkinning) {
13172
+ var ibms = this._skin.inverseBindMatrices;
13158
13173
  var worldToLocal = this._rootBone.getInvModelMatrix();
13159
13174
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13160
13175
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13173,8 +13188,6 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13173
13188
  * @override
13174
13189
  */ _proto._updateShaderData = function _updateShaderData(context) {
13175
13190
  var entity = this.entity;
13176
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13177
- this._updateTransformShaderData(context, worldMatrix);
13178
13191
  var shaderData = this.shaderData;
13179
13192
  var mesh = this.mesh;
13180
13193
  var blendShapeManager = mesh._blendShapeManager;
@@ -13201,12 +13214,18 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13201
13214
  shaderData.disableMacro("O3_JOINTS_NUM");
13202
13215
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13203
13216
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13217
+ this._supportSkinning = true;
13204
13218
  } 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);
13219
+ var _this__jointTexture1;
13220
+ this._supportSkinning = false;
13221
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13222
+ shaderData.disableMacro("O3_HAS_SKIN");
13223
+ 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
13224
  }
13207
13225
  } else {
13208
- var _this__jointTexture1;
13209
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13226
+ var _this__jointTexture2;
13227
+ this._supportSkinning = true;
13228
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13210
13229
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13211
13230
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13212
13231
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13217,6 +13236,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13217
13236
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13218
13237
  }
13219
13238
  }
13239
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13240
+ this._updateTransformShaderData(context, worldMatrix);
13220
13241
  var layer = entity.layer;
13221
13242
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13222
13243
  };
@@ -13411,6 +13432,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13411
13432
  (function() {
13412
13433
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13413
13434
  })();
13435
+ __decorate([
13436
+ ignoreClone
13437
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13414
13438
  __decorate([
13415
13439
  ignoreClone
13416
13440
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);