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