@galacean/engine-physics-lite 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.
@@ -12773,6 +12773,7 @@ var VertexChangedFlags;
12773
12773
  var MeshRenderer = function MeshRenderer(entity) {
12774
12774
  var _this;
12775
12775
  _this = Renderer.call(this, entity) || this;
12776
+ _this._enableVertexColor = false;
12776
12777
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
12777
12778
  return _this;
12778
12779
  };
@@ -12835,7 +12836,7 @@ var VertexChangedFlags;
12835
12836
  shaderData.enableMacro(MeshRenderer._tangentMacro);
12836
12837
  break;
12837
12838
  case "COLOR_0":
12838
- shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12839
+ this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12839
12840
  break;
12840
12841
  }
12841
12842
  }
@@ -12890,6 +12891,20 @@ var VertexChangedFlags;
12890
12891
  this._setMesh(value);
12891
12892
  }
12892
12893
  }
12894
+ },
12895
+ {
12896
+ key: "enableVertexColor",
12897
+ get: /**
12898
+ * Whether enable vertex color.
12899
+ */ function get() {
12900
+ return this._enableVertexColor;
12901
+ },
12902
+ set: function set(value) {
12903
+ if (value !== this._enableVertexColor) {
12904
+ this._dirtyUpdateFlag |= 0x2;
12905
+ this._enableVertexColor = value;
12906
+ }
12907
+ }
12893
12908
  }
12894
12909
  ]);
12895
12910
  return MeshRenderer;
@@ -12996,6 +13011,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
12996
13011
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
12997
13012
  var _this;
12998
13013
  _this = MeshRenderer.call(this, entity) || this;
13014
+ _this._supportSkinning = false;
12999
13015
  _this._hasInitSkin = false;
13000
13016
  _this._jointDataCreateCache = new miniprogram$7.Vector2(-1, -1);
13001
13017
  _this._localBounds = new miniprogram$7.BoundingBox();
@@ -13005,7 +13021,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13005
13021
  // Limit size to 256 to avoid some problem:
13006
13022
  // 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
13023
  // 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);
13024
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13009
13025
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13010
13026
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13011
13027
  var localBounds = _this._localBounds;
@@ -13024,9 +13040,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13024
13040
  this._initSkin();
13025
13041
  this._hasInitSkin = true;
13026
13042
  }
13027
- var skin = this._skin;
13028
- if (skin) {
13029
- var ibms = skin.inverseBindMatrices;
13043
+ if (this._supportSkinning) {
13044
+ var ibms = this._skin.inverseBindMatrices;
13030
13045
  var worldToLocal = this._rootBone.getInvModelMatrix();
13031
13046
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13032
13047
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13045,8 +13060,6 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13045
13060
  * @override
13046
13061
  */ _proto._updateShaderData = function _updateShaderData(context) {
13047
13062
  var entity = this.entity;
13048
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13049
- this._updateTransformShaderData(context, worldMatrix);
13050
13063
  var shaderData = this.shaderData;
13051
13064
  var mesh = this.mesh;
13052
13065
  var blendShapeManager = mesh._blendShapeManager;
@@ -13073,12 +13086,18 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13073
13086
  shaderData.disableMacro("O3_JOINTS_NUM");
13074
13087
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13075
13088
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13089
+ this._supportSkinning = true;
13076
13090
  } 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);
13091
+ var _this__jointTexture1;
13092
+ this._supportSkinning = false;
13093
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13094
+ shaderData.disableMacro("O3_HAS_SKIN");
13095
+ 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
13096
  }
13079
13097
  } else {
13080
- var _this__jointTexture1;
13081
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13098
+ var _this__jointTexture2;
13099
+ this._supportSkinning = true;
13100
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13082
13101
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13083
13102
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13084
13103
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13089,6 +13108,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13089
13108
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13090
13109
  }
13091
13110
  }
13111
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13112
+ this._updateTransformShaderData(context, worldMatrix);
13092
13113
  var layer = entity.layer;
13093
13114
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13094
13115
  };
@@ -13283,6 +13304,9 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
13283
13304
  (function() {
13284
13305
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13285
13306
  })();
13307
+ __decorate$1([
13308
+ ignoreClone
13309
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13286
13310
  __decorate$1([
13287
13311
  ignoreClone
13288
13312
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -26584,6 +26608,12 @@ var SceneParser$1 = /*#__PURE__*/ function(Parser1) {
26584
26608
  } else {
26585
26609
  var material = (materials == null ? void 0 : materials[materialIndex]) || SceneParser._getDefaultMaterial(engine);
26586
26610
  renderer.setMaterial(material);
26611
+ // Enable vertex color if mesh has COLOR_0 vertex element
26612
+ mesh.vertexElements.forEach(function(element) {
26613
+ if (element.semantic === "COLOR_0") {
26614
+ renderer.enableVertexColor = true;
26615
+ }
26616
+ });
26587
26617
  }
26588
26618
  var _gltfMeshPrimitives_i = gltfMeshPrimitives[i], _gltfMeshPrimitives_i_extensions = _gltfMeshPrimitives_i.extensions, extensions = _gltfMeshPrimitives_i_extensions === void 0 ? {} : _gltfMeshPrimitives_i_extensions;
26589
26619
  var KHR_materials_variants = extensions.KHR_materials_variants;
@@ -35346,7 +35376,8 @@ exports.WebGLMode = void 0;
35346
35376
  webGLMode: 0,
35347
35377
  alpha: false,
35348
35378
  stencil: true,
35349
- _forceFlush: false
35379
+ _forceFlush: false,
35380
+ _maxAllowSkinUniformVectorCount: 256
35350
35381
  }, initializeOptions);
35351
35382
  if (miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPhone || miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPad) {
35352
35383
  var version = miniprogram$1$1.SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
@@ -35651,7 +35682,7 @@ function _interopNamespace(e) {
35651
35682
  }
35652
35683
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35653
35684
  //@ts-ignore
35654
- var version = "0.9.1";
35685
+ var version = "0.9.3";
35655
35686
  console.log("Galacean engine version: " + version);
35656
35687
  for(var key in CoreObjects__namespace){
35657
35688
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);