@galacean/engine 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/browser.js +67 -14
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -6907,13 +6907,15 @@
|
|
|
6907
6907
|
];
|
|
6908
6908
|
})();
|
|
6909
6909
|
(function() {
|
|
6910
|
-
|
|
6910
|
+
// _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
|
|
6911
|
+
// so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
|
|
6912
|
+
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
6911
6913
|
})();
|
|
6912
6914
|
(function() {
|
|
6913
|
-
TextUtils.
|
|
6915
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
6914
6916
|
})();
|
|
6915
6917
|
(function() {
|
|
6916
|
-
TextUtils.
|
|
6918
|
+
TextUtils._measureBaseline = "M";
|
|
6917
6919
|
})();
|
|
6918
6920
|
(function() {
|
|
6919
6921
|
TextUtils._baselineMultiplier = 1.4;
|
|
@@ -6996,7 +6998,7 @@
|
|
|
6996
6998
|
var _this = this, engine = _this._engine;
|
|
6997
6999
|
var fontAtlas = new FontAtlas(engine);
|
|
6998
7000
|
var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
|
|
6999
|
-
texture.filterMode = exports.TextureFilterMode.
|
|
7001
|
+
texture.filterMode = exports.TextureFilterMode.Bilinear;
|
|
7000
7002
|
fontAtlas.texture = texture;
|
|
7001
7003
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
7002
7004
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -17402,6 +17404,8 @@
|
|
|
17402
17404
|
}
|
|
17403
17405
|
mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
|
|
17404
17406
|
batchedQueue[curMeshIndex] = preElement;
|
|
17407
|
+
// Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
|
|
17408
|
+
// Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
|
|
17405
17409
|
this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
|
|
17406
17410
|
this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
|
|
17407
17411
|
};
|
|
@@ -23245,7 +23249,7 @@
|
|
|
23245
23249
|
/**
|
|
23246
23250
|
* @internal
|
|
23247
23251
|
*/ _proto._render = function _render(context) {
|
|
23248
|
-
if (this.
|
|
23252
|
+
if (this._isTextNoVisible()) {
|
|
23249
23253
|
return;
|
|
23250
23254
|
}
|
|
23251
23255
|
if (this._isContainDirtyFlag(0x10)) {
|
|
@@ -23337,8 +23341,8 @@
|
|
|
23337
23341
|
}
|
|
23338
23342
|
};
|
|
23339
23343
|
_proto._updateLocalData = function _updateLocalData() {
|
|
23340
|
-
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
23341
23344
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
23345
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
23342
23346
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
23343
23347
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
23344
23348
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
@@ -23406,7 +23410,7 @@
|
|
|
23406
23410
|
var left = startX * pixelsPerUnitReciprocal;
|
|
23407
23411
|
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
23408
23412
|
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
23409
|
-
var bottom = (startY - descent
|
|
23413
|
+
var bottom = (startY - descent) * pixelsPerUnitReciprocal;
|
|
23410
23414
|
localPositions.set(left, top, right, bottom);
|
|
23411
23415
|
i === firstLine && (maxY = Math.max(maxY, top));
|
|
23412
23416
|
minY = Math.min(minY, bottom);
|
|
@@ -23447,6 +23451,9 @@
|
|
|
23447
23451
|
Renderer1.prototype._onTransformChanged.call(this, bit);
|
|
23448
23452
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
23449
23453
|
};
|
|
23454
|
+
_proto._isTextNoVisible = function _isTextNoVisible() {
|
|
23455
|
+
return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
|
|
23456
|
+
};
|
|
23450
23457
|
_create_class$3(TextRenderer, [
|
|
23451
23458
|
{
|
|
23452
23459
|
key: "color",
|
|
@@ -23649,6 +23656,16 @@
|
|
|
23649
23656
|
get: /**
|
|
23650
23657
|
* The bounding volume of the TextRenderer.
|
|
23651
23658
|
*/ function get() {
|
|
23659
|
+
if (this._isTextNoVisible()) {
|
|
23660
|
+
if (this._isContainDirtyFlag(0x8)) {
|
|
23661
|
+
var localBounds = this._localBounds;
|
|
23662
|
+
localBounds.min.set(0, 0, 0);
|
|
23663
|
+
localBounds.max.set(0, 0, 0);
|
|
23664
|
+
this._updateBounds(this._bounds);
|
|
23665
|
+
this._setDirtyFlagFalse(0x8);
|
|
23666
|
+
}
|
|
23667
|
+
return this._bounds;
|
|
23668
|
+
}
|
|
23652
23669
|
this._isContainDirtyFlag(0x1) && this._resetSubFont();
|
|
23653
23670
|
this._isContainDirtyFlag(0x2) && this._updateLocalData();
|
|
23654
23671
|
this._isContainDirtyFlag(0x4) && this._updatePosition();
|
|
@@ -26532,7 +26549,7 @@
|
|
|
26532
26549
|
*/ _proto._quickSort = function _quickSort(a, from, to, compareFunc) {
|
|
26533
26550
|
while(true){
|
|
26534
26551
|
// Insertion sort is faster for short arrays.
|
|
26535
|
-
if (to - from <=
|
|
26552
|
+
if (to - from <= 10000000) {
|
|
26536
26553
|
this._insertionSort(a, from, to, compareFunc);
|
|
26537
26554
|
return;
|
|
26538
26555
|
}
|
|
@@ -26627,12 +26644,38 @@
|
|
|
26627
26644
|
/**
|
|
26628
26645
|
* @internal
|
|
26629
26646
|
*/ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
|
|
26630
|
-
|
|
26647
|
+
var dataA = a.data;
|
|
26648
|
+
var dataB = b.data;
|
|
26649
|
+
var componentA = dataA.component;
|
|
26650
|
+
var componentB = dataB.component;
|
|
26651
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
26652
|
+
if (priorityOrder !== 0) {
|
|
26653
|
+
return priorityOrder;
|
|
26654
|
+
}
|
|
26655
|
+
// make suer from the same renderer.
|
|
26656
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
26657
|
+
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
26658
|
+
} else {
|
|
26659
|
+
return componentA._distanceForSort - componentB._distanceForSort;
|
|
26660
|
+
}
|
|
26631
26661
|
};
|
|
26632
26662
|
/**
|
|
26633
26663
|
* @internal
|
|
26634
26664
|
*/ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
|
|
26635
|
-
|
|
26665
|
+
var dataA = a.data;
|
|
26666
|
+
var dataB = b.data;
|
|
26667
|
+
var componentA = dataA.component;
|
|
26668
|
+
var componentB = dataB.component;
|
|
26669
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
26670
|
+
if (priorityOrder !== 0) {
|
|
26671
|
+
return priorityOrder;
|
|
26672
|
+
}
|
|
26673
|
+
// make suer from the same renderer.
|
|
26674
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
26675
|
+
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
26676
|
+
} else {
|
|
26677
|
+
return componentB._distanceForSort - componentA._distanceForSort;
|
|
26678
|
+
}
|
|
26636
26679
|
};
|
|
26637
26680
|
return RenderQueue;
|
|
26638
26681
|
}();
|
|
@@ -43146,7 +43189,7 @@
|
|
|
43146
43189
|
};
|
|
43147
43190
|
_proto._makeSprite = function _makeSprite(engine, config, texture) {
|
|
43148
43191
|
// Generate a SpriteAtlas object.
|
|
43149
|
-
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
|
|
43192
|
+
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
|
|
43150
43193
|
var sprite = new Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
|
|
43151
43194
|
if (texture) {
|
|
43152
43195
|
var invW = 1 / texture.width;
|
|
@@ -43158,6 +43201,8 @@
|
|
|
43158
43201
|
}
|
|
43159
43202
|
config.atlasRotated && (sprite.atlasRotated = true);
|
|
43160
43203
|
}
|
|
43204
|
+
isNaN(width) || (sprite.width = width);
|
|
43205
|
+
isNaN(height) || (sprite.height = height);
|
|
43161
43206
|
return sprite;
|
|
43162
43207
|
};
|
|
43163
43208
|
return SpriteAtlasLoader;
|
|
@@ -43192,11 +43237,19 @@
|
|
|
43192
43237
|
if (data.texture) {
|
|
43193
43238
|
return resourceManager // @ts-ignore
|
|
43194
43239
|
.getResourceByRef(data.texture).then(function(texture) {
|
|
43195
|
-
|
|
43240
|
+
var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
|
|
43241
|
+
var width = data.width, height = data.height;
|
|
43242
|
+
isNaN(width) || (sprite.width = width);
|
|
43243
|
+
isNaN(height) || (sprite.height = height);
|
|
43244
|
+
return sprite;
|
|
43196
43245
|
});
|
|
43197
43246
|
} else {
|
|
43198
43247
|
return new AssetPromise(function(resolve) {
|
|
43199
|
-
|
|
43248
|
+
var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
|
|
43249
|
+
var width = data.width, height = data.height;
|
|
43250
|
+
isNaN(width) || (sprite.width = width);
|
|
43251
|
+
isNaN(height) || (sprite.height = height);
|
|
43252
|
+
resolve(sprite);
|
|
43200
43253
|
});
|
|
43201
43254
|
}
|
|
43202
43255
|
};
|
|
@@ -43975,7 +44028,7 @@
|
|
|
43975
44028
|
], GALACEAN_animation_event);
|
|
43976
44029
|
|
|
43977
44030
|
//@ts-ignore
|
|
43978
|
-
var version = "0.0.0-experimental-
|
|
44031
|
+
var version = "0.0.0-experimental-renderSort.2";
|
|
43979
44032
|
console.log("Galacean engine version: " + version);
|
|
43980
44033
|
for(var key in CoreObjects){
|
|
43981
44034
|
Loader.registerClass(key, CoreObjects[key]);
|