@galacean/engine-physics-lite 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.
@@ -12996,6 +12996,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
12996
12996
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
12997
12997
  var _this;
12998
12998
  _this = MeshRenderer.call(this, entity) || this;
12999
+ _this._supportSkinning = false;
12999
13000
  _this._hasInitSkin = false;
13000
13001
  _this._jointDataCreateCache = new miniprogram$7.Vector2(-1, -1);
13001
13002
  _this._localBounds = new miniprogram$7.BoundingBox();
@@ -13005,7 +13006,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13005
13006
  // Limit size to 256 to avoid some problem:
13006
13007
  // 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!
13007
13008
  // 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.
13008
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
13009
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13009
13010
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13010
13011
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13011
13012
  var localBounds = _this._localBounds;
@@ -13024,9 +13025,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13024
13025
  this._initSkin();
13025
13026
  this._hasInitSkin = true;
13026
13027
  }
13027
- var skin = this._skin;
13028
- if (skin) {
13029
- var ibms = skin.inverseBindMatrices;
13028
+ if (this._supportSkinning) {
13029
+ var ibms = this._skin.inverseBindMatrices;
13030
13030
  var worldToLocal = this._rootBone.getInvModelMatrix();
13031
13031
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13032
13032
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13045,8 +13045,6 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13045
13045
  * @override
13046
13046
  */ _proto._updateShaderData = function _updateShaderData(context) {
13047
13047
  var entity = this.entity;
13048
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13049
- this._updateTransformShaderData(context, worldMatrix);
13050
13048
  var shaderData = this.shaderData;
13051
13049
  var mesh = this.mesh;
13052
13050
  var blendShapeManager = mesh._blendShapeManager;
@@ -13073,12 +13071,18 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13073
13071
  shaderData.disableMacro("O3_JOINTS_NUM");
13074
13072
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13075
13073
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13074
+ this._supportSkinning = true;
13076
13075
  } else {
13077
- 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);
13076
+ var _this__jointTexture1;
13077
+ this._supportSkinning = false;
13078
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13079
+ shaderData.disableMacro("O3_HAS_SKIN");
13080
+ 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);
13078
13081
  }
13079
13082
  } else {
13080
- var _this__jointTexture1;
13081
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13083
+ var _this__jointTexture2;
13084
+ this._supportSkinning = true;
13085
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13082
13086
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13083
13087
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13084
13088
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13089,6 +13093,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13089
13093
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13090
13094
  }
13091
13095
  }
13096
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13097
+ this._updateTransformShaderData(context, worldMatrix);
13092
13098
  var layer = entity.layer;
13093
13099
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13094
13100
  };
@@ -13283,6 +13289,9 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13283
13289
  (function() {
13284
13290
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13285
13291
  })();
13292
+ __decorate$1([
13293
+ ignoreClone
13294
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13286
13295
  __decorate$1([
13287
13296
  ignoreClone
13288
13297
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -35346,7 +35355,8 @@ exports.WebGLMode = void 0;
35346
35355
  webGLMode: 0,
35347
35356
  alpha: false,
35348
35357
  stencil: true,
35349
- _forceFlush: false
35358
+ _forceFlush: false,
35359
+ _maxAllowSkinUniformVectorCount: 256
35350
35360
  }, initializeOptions);
35351
35361
  if (miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPhone || miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPad) {
35352
35362
  var version = miniprogram$1$1.SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
@@ -35651,7 +35661,7 @@ function _interopNamespace(e) {
35651
35661
  }
35652
35662
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35653
35663
  //@ts-ignore
35654
- var version = "0.9.1";
35664
+ var version = "0.9.2";
35655
35665
  console.log("Galacean engine version: " + version);
35656
35666
  for(var key in CoreObjects__namespace){
35657
35667
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);