@galacean/engine-core 1.0.0-beta.17 → 1.0.0-beta.19
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 +231 -180
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +231 -180
- package/dist/module.js +231 -180
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Entity.d.ts +1 -1
- package/types/RenderPipeline/CullingResults.d.ts +1 -0
- package/types/RenderPipeline/DepthOnlyPass.d.ts +1 -0
- package/types/RenderPipeline/PipelinePass.d.ts +16 -0
- package/types/RenderPipeline/PipelineUtils.d.ts +1 -0
- package/types/Transform.d.ts +1 -0
- package/types/asset/LoadItem.d.ts +16 -9
- package/types/asset/request.d.ts +7 -3
- package/types/base/EventDispatcher.d.ts +1 -1
- package/types/enums/DepthTextureMode.d.ts +7 -0
- package/types/index.d.ts +1 -1
- package/types/shader/enums/RenderStateElementKey.d.ts +58 -0
- package/types/SafeLoopArray.d.ts +0 -37
package/dist/main.js
CHANGED
|
@@ -375,28 +375,33 @@ function _inherits(subClass, superClass) {
|
|
|
375
375
|
return Color;
|
|
376
376
|
}();
|
|
377
377
|
|
|
378
|
-
/******************************************************************************
|
|
379
|
-
Copyright (c) Microsoft Corporation.
|
|
380
|
-
|
|
381
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
382
|
-
purpose with or without fee is hereby granted.
|
|
383
|
-
|
|
384
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
385
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
386
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
387
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
388
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
389
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
390
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
391
|
-
***************************************************************************** */
|
|
392
|
-
|
|
393
|
-
function __decorate(decorators, target, key, desc) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
378
|
+
/******************************************************************************
|
|
379
|
+
Copyright (c) Microsoft Corporation.
|
|
380
|
+
|
|
381
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
382
|
+
purpose with or without fee is hereby granted.
|
|
383
|
+
|
|
384
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
385
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
386
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
387
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
388
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
389
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
390
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
391
|
+
***************************************************************************** */
|
|
392
|
+
|
|
393
|
+
function __decorate(decorators, target, key, desc) {
|
|
394
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
395
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
396
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
397
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
401
|
+
var e = new Error(message);
|
|
402
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
403
|
+
};
|
|
404
|
+
|
|
400
405
|
function _instanceof(left, right) {
|
|
401
406
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
402
407
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -1598,6 +1603,11 @@ var Logger = {
|
|
|
1598
1603
|
subFont.nativeFontString = fontString;
|
|
1599
1604
|
for(var i = 0, n = subTexts.length; i < n; i++){
|
|
1600
1605
|
var subText = subTexts[i];
|
|
1606
|
+
// If subText is empty, push an empty line directly
|
|
1607
|
+
if (subText.length === 0) {
|
|
1608
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, "", 0, 0, 0);
|
|
1609
|
+
continue;
|
|
1610
|
+
}
|
|
1601
1611
|
var word = "";
|
|
1602
1612
|
var wordWidth = 0;
|
|
1603
1613
|
var wordMaxAscent = 0;
|
|
@@ -1625,7 +1635,10 @@ var Logger = {
|
|
|
1625
1635
|
// If it is a word before, need to handle the previous word and line
|
|
1626
1636
|
if (word.length > 0) {
|
|
1627
1637
|
if (lineWidth + wordWidth > wrapWidth) {
|
|
1628
|
-
|
|
1638
|
+
// Push if before line is not empty
|
|
1639
|
+
if (lineWidth > 0) {
|
|
1640
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
|
|
1641
|
+
}
|
|
1629
1642
|
textWidth = Math.max(textWidth, lineWidth);
|
|
1630
1643
|
notFirstLine = true;
|
|
1631
1644
|
line = word;
|
|
@@ -1670,7 +1683,10 @@ var Logger = {
|
|
|
1670
1683
|
line = "";
|
|
1671
1684
|
lineWidth = lineMaxAscent = lineMaxDescent = 0;
|
|
1672
1685
|
}
|
|
1673
|
-
|
|
1686
|
+
// Push if before word is not empty
|
|
1687
|
+
if (wordWidth > 0) {
|
|
1688
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
|
|
1689
|
+
}
|
|
1674
1690
|
textWidth = Math.max(textWidth, wordWidth);
|
|
1675
1691
|
notFirstLine = true;
|
|
1676
1692
|
word = char;
|
|
@@ -1689,11 +1705,15 @@ var Logger = {
|
|
|
1689
1705
|
// If the total width from line and word exceed wrap width
|
|
1690
1706
|
if (lineWidth + wordWidth > wrapWidth) {
|
|
1691
1707
|
// Push chars to a single line
|
|
1692
|
-
|
|
1708
|
+
if (lineWidth > 0) {
|
|
1709
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
|
|
1710
|
+
}
|
|
1693
1711
|
textWidth = Math.max(textWidth, lineWidth);
|
|
1694
1712
|
lineWidth = 0;
|
|
1695
1713
|
// Push word to a single line
|
|
1696
|
-
|
|
1714
|
+
if (wordWidth > 0) {
|
|
1715
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
|
|
1716
|
+
}
|
|
1697
1717
|
textWidth = Math.max(textWidth, wordWidth);
|
|
1698
1718
|
} else {
|
|
1699
1719
|
// Merge to chars
|
|
@@ -1725,23 +1745,20 @@ var Logger = {
|
|
|
1725
1745
|
var subFont = renderer._subFont;
|
|
1726
1746
|
var fontString = subFont.nativeFontString;
|
|
1727
1747
|
var fontSizeInfo = TextUtils.measureFont(fontString);
|
|
1728
|
-
var
|
|
1729
|
-
var
|
|
1748
|
+
var subTexts = renderer.text.split(/(?:\r\n|\r|\n)/);
|
|
1749
|
+
var textCount = subTexts.length;
|
|
1750
|
+
var lines = new Array();
|
|
1730
1751
|
var lineWidths = new Array();
|
|
1731
1752
|
var lineMaxSizes = new Array();
|
|
1732
1753
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
1733
1754
|
var lineHeight = fontSizeInfo.size + renderer.lineSpacing * _pixelsPerUnit;
|
|
1734
1755
|
var width = 0;
|
|
1735
|
-
var height = renderer.height * _pixelsPerUnit;
|
|
1736
|
-
if (renderer.overflowMode === exports.OverflowMode.Overflow) {
|
|
1737
|
-
height = lineHeight * lineCount;
|
|
1738
|
-
}
|
|
1739
1756
|
subFont.nativeFontString = fontString;
|
|
1740
|
-
for(var i = 0; i <
|
|
1741
|
-
var line =
|
|
1757
|
+
for(var i = 0; i < textCount; ++i){
|
|
1758
|
+
var line = subTexts[i];
|
|
1742
1759
|
var curWidth = 0;
|
|
1743
|
-
var maxAscent =
|
|
1744
|
-
var maxDescent =
|
|
1760
|
+
var maxAscent = 0;
|
|
1761
|
+
var maxDescent = 0;
|
|
1745
1762
|
for(var j = 0, m = line.length; j < m; ++j){
|
|
1746
1763
|
var charInfo = TextUtils._getCharInfo(line[j], fontString, subFont);
|
|
1747
1764
|
curWidth += charInfo.xAdvance;
|
|
@@ -1752,16 +1769,15 @@ var Logger = {
|
|
|
1752
1769
|
maxAscent < ascent && (maxAscent = ascent);
|
|
1753
1770
|
maxDescent < descent && (maxDescent = descent);
|
|
1754
1771
|
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
descent: maxDescent,
|
|
1759
|
-
size: maxAscent + maxDescent
|
|
1760
|
-
};
|
|
1761
|
-
if (curWidth > width) {
|
|
1762
|
-
width = curWidth;
|
|
1772
|
+
if (curWidth > 0) {
|
|
1773
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, curWidth, maxAscent, maxDescent);
|
|
1774
|
+
width = Math.max(width, curWidth);
|
|
1763
1775
|
}
|
|
1764
1776
|
}
|
|
1777
|
+
var height = renderer.height * _pixelsPerUnit;
|
|
1778
|
+
if (renderer.overflowMode === exports.OverflowMode.Overflow) {
|
|
1779
|
+
height = lineHeight * lines.length;
|
|
1780
|
+
}
|
|
1765
1781
|
return {
|
|
1766
1782
|
width: width,
|
|
1767
1783
|
height: height,
|
|
@@ -2614,7 +2630,6 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2614
2630
|
function EventDispatcher() {
|
|
2615
2631
|
this._events = Object.create(null);
|
|
2616
2632
|
this._eventCount = 0;
|
|
2617
|
-
this._dispatchingListeners = [];
|
|
2618
2633
|
}
|
|
2619
2634
|
var _proto = EventDispatcher.prototype;
|
|
2620
2635
|
/**
|
|
@@ -2654,7 +2669,8 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2654
2669
|
if (Array.isArray(listeners)) {
|
|
2655
2670
|
var count = listeners.length;
|
|
2656
2671
|
// cloning list to avoid structure breaking
|
|
2657
|
-
var
|
|
2672
|
+
var pool = EventDispatcher._dispatchingListenersPool;
|
|
2673
|
+
var dispatchingListeners = pool.length > 0 ? pool.pop() : [];
|
|
2658
2674
|
dispatchingListeners.length = count;
|
|
2659
2675
|
for(var i = 0; i < count; i++){
|
|
2660
2676
|
dispatchingListeners[i] = listeners[i];
|
|
@@ -2668,6 +2684,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2668
2684
|
}
|
|
2669
2685
|
// remove hooked function to avoid gc problem
|
|
2670
2686
|
dispatchingListeners.length = 0;
|
|
2687
|
+
pool.push(dispatchingListeners);
|
|
2671
2688
|
} else {
|
|
2672
2689
|
if (listeners.once) this.off(event, listeners.fn);
|
|
2673
2690
|
listeners.fn(data);
|
|
@@ -2768,6 +2785,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2768
2785
|
};
|
|
2769
2786
|
return EventDispatcher;
|
|
2770
2787
|
}();
|
|
2788
|
+
(function() {
|
|
2789
|
+
EventDispatcher._dispatchingListenersPool = [];
|
|
2790
|
+
})();
|
|
2771
2791
|
|
|
2772
2792
|
/**
|
|
2773
2793
|
* Shader property.
|
|
@@ -3939,6 +3959,23 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
3939
3959
|
scale.z < 0 && (isInvert = !isInvert);
|
|
3940
3960
|
return isInvert;
|
|
3941
3961
|
};
|
|
3962
|
+
_proto._onDestroy = function _onDestroy() {
|
|
3963
|
+
Component.prototype._onDestroy.call(this);
|
|
3964
|
+
//@ts-ignore
|
|
3965
|
+
this._worldPosition._onValueChanged = null;
|
|
3966
|
+
//@ts-ignore
|
|
3967
|
+
this._rotation._onValueChanged = null;
|
|
3968
|
+
//@ts-ignore
|
|
3969
|
+
this._worldRotation._onValueChanged = null;
|
|
3970
|
+
//@ts-ignore
|
|
3971
|
+
this._rotationQuaternion._onValueChanged = null;
|
|
3972
|
+
//@ts-ignore
|
|
3973
|
+
this._worldRotationQuaternion._onValueChanged = null;
|
|
3974
|
+
//@ts-ignore
|
|
3975
|
+
this._position._onValueChanged = null;
|
|
3976
|
+
//@ts-ignore
|
|
3977
|
+
this._scale._onValueChanged = null;
|
|
3978
|
+
};
|
|
3942
3979
|
/**
|
|
3943
3980
|
* Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
|
|
3944
3981
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
@@ -4632,6 +4669,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4632
4669
|
return component;
|
|
4633
4670
|
}
|
|
4634
4671
|
}
|
|
4672
|
+
return null;
|
|
4635
4673
|
};
|
|
4636
4674
|
/**
|
|
4637
4675
|
* Get components which match the type.
|
|
@@ -13735,6 +13773,15 @@ var VertexChangedFlags;
|
|
|
13735
13773
|
};
|
|
13736
13774
|
/**
|
|
13737
13775
|
* @internal
|
|
13776
|
+
*/ _proto._prepareRender = function _prepareRender(context) {
|
|
13777
|
+
if (!this._mesh) {
|
|
13778
|
+
Logger.error("mesh is null.");
|
|
13779
|
+
return;
|
|
13780
|
+
}
|
|
13781
|
+
Renderer.prototype._prepareRender.call(this, context);
|
|
13782
|
+
};
|
|
13783
|
+
/**
|
|
13784
|
+
* @internal
|
|
13738
13785
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13739
13786
|
Renderer.prototype._cloneTo.call(this, target);
|
|
13740
13787
|
target.mesh = this._mesh;
|
|
@@ -13756,49 +13803,45 @@ var VertexChangedFlags;
|
|
|
13756
13803
|
* @internal
|
|
13757
13804
|
*/ _proto._render = function _render(context) {
|
|
13758
13805
|
var mesh = this._mesh;
|
|
13759
|
-
if (
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
break;
|
|
13785
|
-
}
|
|
13806
|
+
if (this._dirtyUpdateFlag & 0x2) {
|
|
13807
|
+
var shaderData = this.shaderData;
|
|
13808
|
+
var vertexElements = mesh._vertexElements;
|
|
13809
|
+
shaderData.disableMacro(MeshRenderer._uvMacro);
|
|
13810
|
+
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13811
|
+
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13812
|
+
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13813
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13814
|
+
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13815
|
+
switch(vertexElements[i].semantic){
|
|
13816
|
+
case "TEXCOORD_0":
|
|
13817
|
+
shaderData.enableMacro(MeshRenderer._uvMacro);
|
|
13818
|
+
break;
|
|
13819
|
+
case "TEXCOORD_1":
|
|
13820
|
+
shaderData.enableMacro(MeshRenderer._uv1Macro);
|
|
13821
|
+
break;
|
|
13822
|
+
case "NORMAL":
|
|
13823
|
+
shaderData.enableMacro(MeshRenderer._normalMacro);
|
|
13824
|
+
break;
|
|
13825
|
+
case "TANGENT":
|
|
13826
|
+
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13827
|
+
break;
|
|
13828
|
+
case "COLOR_0":
|
|
13829
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13830
|
+
break;
|
|
13786
13831
|
}
|
|
13787
|
-
this._dirtyUpdateFlag &= ~0x2;
|
|
13788
13832
|
}
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
Logger.error("mesh is null.");
|
|
13833
|
+
this._dirtyUpdateFlag &= ~0x2;
|
|
13834
|
+
}
|
|
13835
|
+
var materials = this._materials;
|
|
13836
|
+
var subMeshes = mesh.subMeshes;
|
|
13837
|
+
var renderPipeline = context.camera._renderPipeline;
|
|
13838
|
+
var meshRenderDataPool = this._engine._meshRenderDataPool;
|
|
13839
|
+
for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
|
|
13840
|
+
var material = materials[i1];
|
|
13841
|
+
if (!material) continue;
|
|
13842
|
+
var renderData = meshRenderDataPool.getFromPool();
|
|
13843
|
+
renderData.set(this, material, mesh, subMeshes[i1]);
|
|
13844
|
+
renderPipeline.pushRenderData(context, renderData);
|
|
13802
13845
|
}
|
|
13803
13846
|
};
|
|
13804
13847
|
_proto._setMesh = function _setMesh(mesh) {
|
|
@@ -19557,18 +19600,10 @@ var defaultInterval = 500;
|
|
|
19557
19600
|
var _config_type;
|
|
19558
19601
|
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
19559
19602
|
var realRequest = config.type === "image" ? requestImage : requestRes;
|
|
19560
|
-
var lastError;
|
|
19561
19603
|
var executor = new MultiExecutor(function() {
|
|
19562
|
-
return realRequest(url, config).onProgress(setProgress)
|
|
19563
|
-
resolve(res);
|
|
19564
|
-
executor.stop();
|
|
19565
|
-
}).catch(function(err) {
|
|
19566
|
-
return lastError = err;
|
|
19567
|
-
});
|
|
19604
|
+
return realRequest(url, config).onProgress(setProgress);
|
|
19568
19605
|
}, retryCount, retryInterval);
|
|
19569
|
-
executor.start(
|
|
19570
|
-
reject(lastError);
|
|
19571
|
-
});
|
|
19606
|
+
executor.start().onError(reject).onComplete(resolve);
|
|
19572
19607
|
});
|
|
19573
19608
|
}
|
|
19574
19609
|
function requestImage(url, config) {
|
|
@@ -19655,23 +19690,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19655
19690
|
this.exec = this.exec.bind(this);
|
|
19656
19691
|
}
|
|
19657
19692
|
var _proto = MultiExecutor.prototype;
|
|
19658
|
-
_proto.start = function start(
|
|
19659
|
-
this.done = done;
|
|
19693
|
+
_proto.start = function start() {
|
|
19660
19694
|
this.exec();
|
|
19695
|
+
return this;
|
|
19661
19696
|
};
|
|
19662
|
-
_proto.
|
|
19663
|
-
|
|
19697
|
+
_proto.onComplete = function onComplete(func) {
|
|
19698
|
+
this._onComplete = func;
|
|
19699
|
+
return this;
|
|
19700
|
+
};
|
|
19701
|
+
_proto.onError = function onError(func) {
|
|
19702
|
+
this._onError = func;
|
|
19703
|
+
return this;
|
|
19704
|
+
};
|
|
19705
|
+
_proto.cancel = function cancel() {
|
|
19706
|
+
window.clearTimeout(this._timeoutId);
|
|
19664
19707
|
};
|
|
19665
19708
|
_proto.exec = function exec() {
|
|
19666
19709
|
var _this = this;
|
|
19667
19710
|
if (this._currentCount >= this.totalCount) {
|
|
19668
|
-
this.
|
|
19711
|
+
this._onError && this._onError(this._error);
|
|
19669
19712
|
return;
|
|
19670
19713
|
}
|
|
19671
19714
|
this._currentCount++;
|
|
19672
|
-
this.execFunc(this._currentCount).then(function() {
|
|
19673
|
-
|
|
19674
|
-
|
|
19715
|
+
this.execFunc(this._currentCount).then(function(result) {
|
|
19716
|
+
return _this._onComplete && _this._onComplete(result);
|
|
19717
|
+
}).catch(function(e) {
|
|
19718
|
+
_this._error = e;
|
|
19719
|
+
_this._timeoutId = window.setTimeout(_this.exec, _this.interval);
|
|
19675
19720
|
});
|
|
19676
19721
|
};
|
|
19677
19722
|
return MultiExecutor;
|
|
@@ -22304,92 +22349,97 @@ var /**
|
|
|
22304
22349
|
}
|
|
22305
22350
|
};
|
|
22306
22351
|
_proto._updateLocalData = function _updateLocalData() {
|
|
22307
|
-
var _this = this, color = _this.color,
|
|
22352
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
22308
22353
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
22309
|
-
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22310
|
-
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22311
|
-
var charFont = this._subFont;
|
|
22312
|
-
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22313
|
-
var halfRendererWidth = rendererWidth * 0.5;
|
|
22314
|
-
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22315
22354
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
22316
22355
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
22317
22356
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
22318
|
-
var halfLineHeight = lineHeight * 0.5;
|
|
22319
22357
|
var linesLen = lines.length;
|
|
22320
|
-
var startY = 0;
|
|
22321
|
-
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22322
|
-
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22323
|
-
switch(verticalAlignment){
|
|
22324
|
-
case exports.TextVerticalAlignment.Top:
|
|
22325
|
-
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22326
|
-
break;
|
|
22327
|
-
case exports.TextVerticalAlignment.Center:
|
|
22328
|
-
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22329
|
-
break;
|
|
22330
|
-
case exports.TextVerticalAlignment.Bottom:
|
|
22331
|
-
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22332
|
-
break;
|
|
22333
|
-
}
|
|
22334
22358
|
var renderDataCount = 0;
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
var
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
|
|
22351
|
-
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22359
|
+
if (linesLen > 0) {
|
|
22360
|
+
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22361
|
+
var horizontalAlignment = this.horizontalAlignment;
|
|
22362
|
+
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22363
|
+
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22364
|
+
var halfRendererWidth = rendererWidth * 0.5;
|
|
22365
|
+
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22366
|
+
var halfLineHeight = lineHeight * 0.5;
|
|
22367
|
+
var startY = 0;
|
|
22368
|
+
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22369
|
+
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22370
|
+
switch(this.verticalAlignment){
|
|
22371
|
+
case exports.TextVerticalAlignment.Top:
|
|
22372
|
+
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22373
|
+
break;
|
|
22374
|
+
case exports.TextVerticalAlignment.Center:
|
|
22375
|
+
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22376
|
+
break;
|
|
22377
|
+
case exports.TextVerticalAlignment.Bottom:
|
|
22378
|
+
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22379
|
+
break;
|
|
22380
|
+
}
|
|
22381
|
+
var firstLine = -1;
|
|
22382
|
+
var minX = Number.MAX_SAFE_INTEGER;
|
|
22383
|
+
var minY = Number.MAX_SAFE_INTEGER;
|
|
22384
|
+
var maxX = Number.MIN_SAFE_INTEGER;
|
|
22385
|
+
var maxY = Number.MIN_SAFE_INTEGER;
|
|
22386
|
+
for(var i = 0; i < linesLen; ++i){
|
|
22387
|
+
var lineWidth = lineWidths[i];
|
|
22388
|
+
if (lineWidth > 0) {
|
|
22389
|
+
var line = lines[i];
|
|
22390
|
+
var startX = 0;
|
|
22391
|
+
var firstRow = -1;
|
|
22392
|
+
if (firstLine < 0) {
|
|
22393
|
+
firstLine = i;
|
|
22394
|
+
}
|
|
22395
|
+
switch(horizontalAlignment){
|
|
22396
|
+
case exports.TextHorizontalAlignment.Left:
|
|
22397
|
+
startX = -halfRendererWidth;
|
|
22398
|
+
break;
|
|
22399
|
+
case exports.TextHorizontalAlignment.Center:
|
|
22400
|
+
startX = -lineWidth * 0.5;
|
|
22401
|
+
break;
|
|
22402
|
+
case exports.TextHorizontalAlignment.Right:
|
|
22403
|
+
startX = halfRendererWidth - lineWidth;
|
|
22404
|
+
break;
|
|
22405
|
+
}
|
|
22406
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
22407
|
+
var char = line[j];
|
|
22408
|
+
var charInfo = charFont._getCharInfo(char);
|
|
22409
|
+
if (charInfo.h > 0) {
|
|
22410
|
+
var _charRenderDatas, _ref;
|
|
22411
|
+
firstRow < 0 && (firstRow = j);
|
|
22412
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
22413
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
22414
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
22415
|
+
renderData.color = color;
|
|
22416
|
+
renderData.uvs = charInfo.uvs;
|
|
22417
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
22418
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
22419
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
22420
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
22421
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
22422
|
+
localPositions.set(left, top, right, bottom);
|
|
22423
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
22424
|
+
minY = Math.min(minY, bottom);
|
|
22425
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
22426
|
+
maxX = Math.max(maxX, right);
|
|
22427
|
+
}
|
|
22428
|
+
startX += charInfo.xAdvance;
|
|
22381
22429
|
}
|
|
22382
|
-
startX += charInfo.xAdvance;
|
|
22383
22430
|
}
|
|
22431
|
+
startY -= lineHeight;
|
|
22384
22432
|
}
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22433
|
+
if (firstLine < 0) {
|
|
22434
|
+
min.set(0, 0, 0);
|
|
22435
|
+
max.set(0, 0, 0);
|
|
22436
|
+
} else {
|
|
22437
|
+
min.set(minX, minY, 0);
|
|
22438
|
+
max.set(maxX, maxY, 0);
|
|
22439
|
+
}
|
|
22440
|
+
} else {
|
|
22388
22441
|
min.set(0, 0, 0);
|
|
22389
22442
|
max.set(0, 0, 0);
|
|
22390
|
-
} else {
|
|
22391
|
-
min.set(minX, minY, 0);
|
|
22392
|
-
max.set(maxX, maxY, 0);
|
|
22393
22443
|
}
|
|
22394
22444
|
// Revert excess render data to pool.
|
|
22395
22445
|
var lastRenderDataCount = charRenderDatas.length;
|
|
@@ -24405,7 +24455,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24405
24455
|
};
|
|
24406
24456
|
_proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
|
|
24407
24457
|
var eventHandlerPool = this._animationEventHandlerPool;
|
|
24408
|
-
var scripts =
|
|
24458
|
+
var scripts = [];
|
|
24459
|
+
this._entity.getComponents(Script, scripts);
|
|
24409
24460
|
var scriptCount = scripts.length;
|
|
24410
24461
|
var eventHandlers = animatorStateData.eventHandlers;
|
|
24411
24462
|
var events = state.clip.events;
|
|
@@ -24418,7 +24469,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24418
24469
|
eventHandler.event = event;
|
|
24419
24470
|
handlers.length = 0;
|
|
24420
24471
|
for(var j = scriptCount - 1; j >= 0; j--){
|
|
24421
|
-
var handler = scripts
|
|
24472
|
+
var handler = scripts[j][funcName];
|
|
24422
24473
|
handler && handlers.push(handler);
|
|
24423
24474
|
}
|
|
24424
24475
|
eventHandlers.push(eventHandler);
|