@galacean/engine-core 1.1.0-beta.33 → 1.1.0-beta.35

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
@@ -12609,8 +12609,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
12609
12609
  }
12610
12610
  mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
12611
12611
  batchedQueue[curMeshIndex] = preElement;
12612
- this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
12613
- this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
12612
+ // Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
12613
+ // Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
12614
+ this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
12615
+ this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
12614
12616
  };
12615
12617
  _proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
12616
12618
  var subMesh = this._subMeshPool.getFromPool();
@@ -18539,7 +18541,7 @@ var /**
18539
18541
  /**
18540
18542
  * @internal
18541
18543
  */ _proto._render = function _render(context) {
18542
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
18544
+ if (this._isTextNoVisible()) {
18543
18545
  return;
18544
18546
  }
18545
18547
  if (this._isContainDirtyFlag(0x10)) {
@@ -18631,8 +18633,8 @@ var /**
18631
18633
  }
18632
18634
  };
18633
18635
  _proto._updateLocalData = function _updateLocalData() {
18634
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18635
18636
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
18637
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
18636
18638
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
18637
18639
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
18638
18640
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -18741,6 +18743,9 @@ var /**
18741
18743
  Renderer1.prototype._onTransformChanged.call(this, bit);
18742
18744
  this._setDirtyFlagTrue(0x4 | 0x8);
18743
18745
  };
18746
+ _proto._isTextNoVisible = function _isTextNoVisible() {
18747
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
18748
+ };
18744
18749
  _create_class(TextRenderer, [
18745
18750
  {
18746
18751
  key: "color",
@@ -18943,6 +18948,16 @@ var /**
18943
18948
  get: /**
18944
18949
  * The bounding volume of the TextRenderer.
18945
18950
  */ function get() {
18951
+ if (this._isTextNoVisible()) {
18952
+ if (this._isContainDirtyFlag(0x8)) {
18953
+ var localBounds = this._localBounds;
18954
+ localBounds.min.set(0, 0, 0);
18955
+ localBounds.max.set(0, 0, 0);
18956
+ this._updateBounds(this._bounds);
18957
+ this._setDirtyFlagFalse(0x8);
18958
+ }
18959
+ return this._bounds;
18960
+ }
18946
18961
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
18947
18962
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
18948
18963
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -21944,12 +21959,38 @@ var passNum = 0;
21944
21959
  /**
21945
21960
  * @internal
21946
21961
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
21947
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
21962
+ var dataA = a.data;
21963
+ var dataB = b.data;
21964
+ var componentA = dataA.component;
21965
+ var componentB = dataB.component;
21966
+ var priorityOrder = componentA.priority - componentB.priority;
21967
+ if (priorityOrder !== 0) {
21968
+ return priorityOrder;
21969
+ }
21970
+ // make suer from the same renderer.
21971
+ if (componentA.instanceId === componentB.instanceId) {
21972
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21973
+ } else {
21974
+ return componentA._distanceForSort - componentB._distanceForSort;
21975
+ }
21948
21976
  };
21949
21977
  /**
21950
21978
  * @internal
21951
21979
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
21952
- return a.data.component.priority - b.data.component.priority || a.data.material._priority - b.data.material._priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
21980
+ var dataA = a.data;
21981
+ var dataB = b.data;
21982
+ var componentA = dataA.component;
21983
+ var componentB = dataB.component;
21984
+ var priorityOrder = componentA.priority - componentB.priority;
21985
+ if (priorityOrder !== 0) {
21986
+ return priorityOrder;
21987
+ }
21988
+ // make suer from the same renderer.
21989
+ if (componentA.instanceId === componentB.instanceId) {
21990
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21991
+ } else {
21992
+ return componentB._distanceForSort - componentA._distanceForSort;
21993
+ }
21953
21994
  };
21954
21995
  return RenderQueue;
21955
21996
  }();