@galacean/engine-physics-physx 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.
@@ -12766,6 +12766,7 @@ var VertexChangedFlags;
12766
12766
  var MeshRenderer = function MeshRenderer(entity) {
12767
12767
  var _this;
12768
12768
  _this = Renderer.call(this, entity) || this;
12769
+ _this._enableVertexColor = false;
12769
12770
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
12770
12771
  return _this;
12771
12772
  };
@@ -12828,7 +12829,7 @@ var VertexChangedFlags;
12828
12829
  shaderData.enableMacro(MeshRenderer._tangentMacro);
12829
12830
  break;
12830
12831
  case "COLOR_0":
12831
- shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12832
+ this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12832
12833
  break;
12833
12834
  }
12834
12835
  }
@@ -12883,6 +12884,20 @@ var VertexChangedFlags;
12883
12884
  this._setMesh(value);
12884
12885
  }
12885
12886
  }
12887
+ },
12888
+ {
12889
+ key: "enableVertexColor",
12890
+ get: /**
12891
+ * Whether enable vertex color.
12892
+ */ function get() {
12893
+ return this._enableVertexColor;
12894
+ },
12895
+ set: function set(value) {
12896
+ if (value !== this._enableVertexColor) {
12897
+ this._dirtyUpdateFlag |= 0x2;
12898
+ this._enableVertexColor = value;
12899
+ }
12900
+ }
12886
12901
  }
12887
12902
  ]);
12888
12903
  return MeshRenderer;
@@ -12989,6 +13004,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
12989
13004
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
12990
13005
  var _this;
12991
13006
  _this = MeshRenderer.call(this, entity) || this;
13007
+ _this._supportSkinning = false;
12992
13008
  _this._hasInitSkin = false;
12993
13009
  _this._jointDataCreateCache = new miniprogram$7.Vector2(-1, -1);
12994
13010
  _this._localBounds = new miniprogram$7.BoundingBox();
@@ -12998,7 +13014,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
12998
13014
  // Limit size to 256 to avoid some problem:
12999
13015
  // 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!
13000
13016
  // 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.
13001
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
13017
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13002
13018
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13003
13019
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13004
13020
  var localBounds = _this._localBounds;
@@ -13017,9 +13033,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13017
13033
  this._initSkin();
13018
13034
  this._hasInitSkin = true;
13019
13035
  }
13020
- var skin = this._skin;
13021
- if (skin) {
13022
- var ibms = skin.inverseBindMatrices;
13036
+ if (this._supportSkinning) {
13037
+ var ibms = this._skin.inverseBindMatrices;
13023
13038
  var worldToLocal = this._rootBone.getInvModelMatrix();
13024
13039
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13025
13040
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13038,8 +13053,6 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13038
13053
  * @override
13039
13054
  */ _proto._updateShaderData = function _updateShaderData(context) {
13040
13055
  var entity = this.entity;
13041
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13042
- this._updateTransformShaderData(context, worldMatrix);
13043
13056
  var shaderData = this.shaderData;
13044
13057
  var mesh = this.mesh;
13045
13058
  var blendShapeManager = mesh._blendShapeManager;
@@ -13066,12 +13079,18 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13066
13079
  shaderData.disableMacro("O3_JOINTS_NUM");
13067
13080
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13068
13081
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13082
+ this._supportSkinning = true;
13069
13083
  } else {
13070
- 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);
13084
+ var _this__jointTexture1;
13085
+ this._supportSkinning = false;
13086
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13087
+ shaderData.disableMacro("O3_HAS_SKIN");
13088
+ 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);
13071
13089
  }
13072
13090
  } else {
13073
- var _this__jointTexture1;
13074
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13091
+ var _this__jointTexture2;
13092
+ this._supportSkinning = true;
13093
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13075
13094
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13076
13095
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13077
13096
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13082,6 +13101,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13082
13101
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13083
13102
  }
13084
13103
  }
13104
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13105
+ this._updateTransformShaderData(context, worldMatrix);
13085
13106
  var layer = entity.layer;
13086
13107
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13087
13108
  };
@@ -13276,6 +13297,9 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13276
13297
  (function() {
13277
13298
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13278
13299
  })();
13300
+ __decorate$1([
13301
+ ignoreClone
13302
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13279
13303
  __decorate$1([
13280
13304
  ignoreClone
13281
13305
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -26577,6 +26601,12 @@ var SceneParser$1 = /*#__PURE__*/ function(Parser1) {
26577
26601
  } else {
26578
26602
  var material = (materials == null ? void 0 : materials[materialIndex]) || SceneParser._getDefaultMaterial(engine);
26579
26603
  renderer.setMaterial(material);
26604
+ // Enable vertex color if mesh has COLOR_0 vertex element
26605
+ mesh.vertexElements.forEach(function(element) {
26606
+ if (element.semantic === "COLOR_0") {
26607
+ renderer.enableVertexColor = true;
26608
+ }
26609
+ });
26580
26610
  }
26581
26611
  var _gltfMeshPrimitives_i = gltfMeshPrimitives[i], _gltfMeshPrimitives_i_extensions = _gltfMeshPrimitives_i.extensions, extensions = _gltfMeshPrimitives_i_extensions === void 0 ? {} : _gltfMeshPrimitives_i_extensions;
26582
26612
  var KHR_materials_variants = extensions.KHR_materials_variants;
@@ -35339,7 +35369,8 @@ exports.WebGLMode = void 0;
35339
35369
  webGLMode: 0,
35340
35370
  alpha: false,
35341
35371
  stencil: true,
35342
- _forceFlush: false
35372
+ _forceFlush: false,
35373
+ _maxAllowSkinUniformVectorCount: 256
35343
35374
  }, initializeOptions);
35344
35375
  if (miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPhone || miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPad) {
35345
35376
  var version = miniprogram$1$1.SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
@@ -35644,7 +35675,7 @@ function _interopNamespace(e) {
35644
35675
  }
35645
35676
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35646
35677
  //@ts-ignore
35647
- var version = "0.9.1";
35678
+ var version = "0.9.3";
35648
35679
  console.log("Galacean engine version: " + version);
35649
35680
  for(var key in CoreObjects__namespace){
35650
35681
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);