@galacean/engine-core 0.0.0-experimental-uploadSameBuffer.0 → 0.0.0-experimental-renderSort.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.
- package/dist/main.js +53 -10
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +53 -10
- package/dist/module.js +53 -10
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +2 -0
- package/types/2d/text/TextRenderer.d.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -1947,13 +1947,15 @@ var Logger = {
|
|
|
1947
1947
|
];
|
|
1948
1948
|
})();
|
|
1949
1949
|
(function() {
|
|
1950
|
-
|
|
1950
|
+
// _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
|
|
1951
|
+
// so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
|
|
1952
|
+
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
1951
1953
|
})();
|
|
1952
1954
|
(function() {
|
|
1953
|
-
TextUtils.
|
|
1955
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
1954
1956
|
})();
|
|
1955
1957
|
(function() {
|
|
1956
|
-
TextUtils.
|
|
1958
|
+
TextUtils._measureBaseline = "M";
|
|
1957
1959
|
})();
|
|
1958
1960
|
(function() {
|
|
1959
1961
|
TextUtils._baselineMultiplier = 1.4;
|
|
@@ -2037,7 +2039,7 @@ var Logger = {
|
|
|
2037
2039
|
var _this = this, engine = _this._engine;
|
|
2038
2040
|
var fontAtlas = new FontAtlas(engine);
|
|
2039
2041
|
var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
|
|
2040
|
-
texture.filterMode = exports.TextureFilterMode.
|
|
2042
|
+
texture.filterMode = exports.TextureFilterMode.Bilinear;
|
|
2041
2043
|
fontAtlas.texture = texture;
|
|
2042
2044
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
2043
2045
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -12609,6 +12611,8 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
12609
12611
|
}
|
|
12610
12612
|
mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
|
|
12611
12613
|
batchedQueue[curMeshIndex] = preElement;
|
|
12614
|
+
// Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
|
|
12615
|
+
// Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
|
|
12612
12616
|
this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
|
|
12613
12617
|
this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
|
|
12614
12618
|
};
|
|
@@ -18539,7 +18543,7 @@ var /**
|
|
|
18539
18543
|
/**
|
|
18540
18544
|
* @internal
|
|
18541
18545
|
*/ _proto._render = function _render(context) {
|
|
18542
|
-
if (this.
|
|
18546
|
+
if (this._isTextNoVisible()) {
|
|
18543
18547
|
return;
|
|
18544
18548
|
}
|
|
18545
18549
|
if (this._isContainDirtyFlag(0x10)) {
|
|
@@ -18631,8 +18635,8 @@ var /**
|
|
|
18631
18635
|
}
|
|
18632
18636
|
};
|
|
18633
18637
|
_proto._updateLocalData = function _updateLocalData() {
|
|
18634
|
-
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18635
18638
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
18639
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
18636
18640
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
18637
18641
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
18638
18642
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
@@ -18700,7 +18704,7 @@ var /**
|
|
|
18700
18704
|
var left = startX * pixelsPerUnitReciprocal;
|
|
18701
18705
|
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
18702
18706
|
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
18703
|
-
var bottom = (startY - descent
|
|
18707
|
+
var bottom = (startY - descent) * pixelsPerUnitReciprocal;
|
|
18704
18708
|
localPositions.set(left, top, right, bottom);
|
|
18705
18709
|
i === firstLine && (maxY = Math.max(maxY, top));
|
|
18706
18710
|
minY = Math.min(minY, bottom);
|
|
@@ -18741,6 +18745,9 @@ var /**
|
|
|
18741
18745
|
Renderer1.prototype._onTransformChanged.call(this, bit);
|
|
18742
18746
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
18743
18747
|
};
|
|
18748
|
+
_proto._isTextNoVisible = function _isTextNoVisible() {
|
|
18749
|
+
return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
|
|
18750
|
+
};
|
|
18744
18751
|
_create_class(TextRenderer, [
|
|
18745
18752
|
{
|
|
18746
18753
|
key: "color",
|
|
@@ -18943,6 +18950,16 @@ var /**
|
|
|
18943
18950
|
get: /**
|
|
18944
18951
|
* The bounding volume of the TextRenderer.
|
|
18945
18952
|
*/ function get() {
|
|
18953
|
+
if (this._isTextNoVisible()) {
|
|
18954
|
+
if (this._isContainDirtyFlag(0x8)) {
|
|
18955
|
+
var localBounds = this._localBounds;
|
|
18956
|
+
localBounds.min.set(0, 0, 0);
|
|
18957
|
+
localBounds.max.set(0, 0, 0);
|
|
18958
|
+
this._updateBounds(this._bounds);
|
|
18959
|
+
this._setDirtyFlagFalse(0x8);
|
|
18960
|
+
}
|
|
18961
|
+
return this._bounds;
|
|
18962
|
+
}
|
|
18946
18963
|
this._isContainDirtyFlag(0x1) && this._resetSubFont();
|
|
18947
18964
|
this._isContainDirtyFlag(0x2) && this._updateLocalData();
|
|
18948
18965
|
this._isContainDirtyFlag(0x4) && this._updatePosition();
|
|
@@ -21849,7 +21866,7 @@ var passNum = 0;
|
|
|
21849
21866
|
*/ _proto._quickSort = function _quickSort(a, from, to, compareFunc) {
|
|
21850
21867
|
while(true){
|
|
21851
21868
|
// Insertion sort is faster for short arrays.
|
|
21852
|
-
if (to - from <=
|
|
21869
|
+
if (to - from <= 10000000) {
|
|
21853
21870
|
this._insertionSort(a, from, to, compareFunc);
|
|
21854
21871
|
return;
|
|
21855
21872
|
}
|
|
@@ -21944,12 +21961,38 @@ var passNum = 0;
|
|
|
21944
21961
|
/**
|
|
21945
21962
|
* @internal
|
|
21946
21963
|
*/ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
|
|
21947
|
-
|
|
21964
|
+
var dataA = a.data;
|
|
21965
|
+
var dataB = b.data;
|
|
21966
|
+
var componentA = dataA.component;
|
|
21967
|
+
var componentB = dataB.component;
|
|
21968
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21969
|
+
if (priorityOrder !== 0) {
|
|
21970
|
+
return priorityOrder;
|
|
21971
|
+
}
|
|
21972
|
+
// make suer from the same renderer.
|
|
21973
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21974
|
+
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
21975
|
+
} else {
|
|
21976
|
+
return componentA._distanceForSort - componentB._distanceForSort;
|
|
21977
|
+
}
|
|
21948
21978
|
};
|
|
21949
21979
|
/**
|
|
21950
21980
|
* @internal
|
|
21951
21981
|
*/ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
|
|
21952
|
-
|
|
21982
|
+
var dataA = a.data;
|
|
21983
|
+
var dataB = b.data;
|
|
21984
|
+
var componentA = dataA.component;
|
|
21985
|
+
var componentB = dataB.component;
|
|
21986
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
21987
|
+
if (priorityOrder !== 0) {
|
|
21988
|
+
return priorityOrder;
|
|
21989
|
+
}
|
|
21990
|
+
// make suer from the same renderer.
|
|
21991
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
21992
|
+
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
21993
|
+
} else {
|
|
21994
|
+
return componentB._distanceForSort - componentA._distanceForSort;
|
|
21995
|
+
}
|
|
21953
21996
|
};
|
|
21954
21997
|
return RenderQueue;
|
|
21955
21998
|
}();
|