@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/module.js
CHANGED
|
@@ -371,28 +371,33 @@ function _inherits(subClass, superClass) {
|
|
|
371
371
|
return Color;
|
|
372
372
|
}();
|
|
373
373
|
|
|
374
|
-
/******************************************************************************
|
|
375
|
-
Copyright (c) Microsoft Corporation.
|
|
376
|
-
|
|
377
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
378
|
-
purpose with or without fee is hereby granted.
|
|
379
|
-
|
|
380
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
381
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
382
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
383
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
384
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
385
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
386
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
387
|
-
***************************************************************************** */
|
|
388
|
-
|
|
389
|
-
function __decorate(decorators, target, key, desc) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
374
|
+
/******************************************************************************
|
|
375
|
+
Copyright (c) Microsoft Corporation.
|
|
376
|
+
|
|
377
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
378
|
+
purpose with or without fee is hereby granted.
|
|
379
|
+
|
|
380
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
381
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
382
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
383
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
384
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
385
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
386
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
387
|
+
***************************************************************************** */
|
|
388
|
+
|
|
389
|
+
function __decorate(decorators, target, key, desc) {
|
|
390
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
391
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
392
|
+
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;
|
|
393
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
397
|
+
var e = new Error(message);
|
|
398
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
399
|
+
};
|
|
400
|
+
|
|
396
401
|
function _instanceof(left, right) {
|
|
397
402
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
398
403
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -1594,6 +1599,11 @@ var Logger = {
|
|
|
1594
1599
|
subFont.nativeFontString = fontString;
|
|
1595
1600
|
for(var i = 0, n = subTexts.length; i < n; i++){
|
|
1596
1601
|
var subText = subTexts[i];
|
|
1602
|
+
// If subText is empty, push an empty line directly
|
|
1603
|
+
if (subText.length === 0) {
|
|
1604
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, "", 0, 0, 0);
|
|
1605
|
+
continue;
|
|
1606
|
+
}
|
|
1597
1607
|
var word = "";
|
|
1598
1608
|
var wordWidth = 0;
|
|
1599
1609
|
var wordMaxAscent = 0;
|
|
@@ -1621,7 +1631,10 @@ var Logger = {
|
|
|
1621
1631
|
// If it is a word before, need to handle the previous word and line
|
|
1622
1632
|
if (word.length > 0) {
|
|
1623
1633
|
if (lineWidth + wordWidth > wrapWidth) {
|
|
1624
|
-
|
|
1634
|
+
// Push if before line is not empty
|
|
1635
|
+
if (lineWidth > 0) {
|
|
1636
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
|
|
1637
|
+
}
|
|
1625
1638
|
textWidth = Math.max(textWidth, lineWidth);
|
|
1626
1639
|
notFirstLine = true;
|
|
1627
1640
|
line = word;
|
|
@@ -1666,7 +1679,10 @@ var Logger = {
|
|
|
1666
1679
|
line = "";
|
|
1667
1680
|
lineWidth = lineMaxAscent = lineMaxDescent = 0;
|
|
1668
1681
|
}
|
|
1669
|
-
|
|
1682
|
+
// Push if before word is not empty
|
|
1683
|
+
if (wordWidth > 0) {
|
|
1684
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
|
|
1685
|
+
}
|
|
1670
1686
|
textWidth = Math.max(textWidth, wordWidth);
|
|
1671
1687
|
notFirstLine = true;
|
|
1672
1688
|
word = char;
|
|
@@ -1685,11 +1701,15 @@ var Logger = {
|
|
|
1685
1701
|
// If the total width from line and word exceed wrap width
|
|
1686
1702
|
if (lineWidth + wordWidth > wrapWidth) {
|
|
1687
1703
|
// Push chars to a single line
|
|
1688
|
-
|
|
1704
|
+
if (lineWidth > 0) {
|
|
1705
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, lineWidth, lineMaxAscent, lineMaxDescent);
|
|
1706
|
+
}
|
|
1689
1707
|
textWidth = Math.max(textWidth, lineWidth);
|
|
1690
1708
|
lineWidth = 0;
|
|
1691
1709
|
// Push word to a single line
|
|
1692
|
-
|
|
1710
|
+
if (wordWidth > 0) {
|
|
1711
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, word, wordWidth, wordMaxAscent, wordMaxDescent);
|
|
1712
|
+
}
|
|
1693
1713
|
textWidth = Math.max(textWidth, wordWidth);
|
|
1694
1714
|
} else {
|
|
1695
1715
|
// Merge to chars
|
|
@@ -1721,23 +1741,20 @@ var Logger = {
|
|
|
1721
1741
|
var subFont = renderer._subFont;
|
|
1722
1742
|
var fontString = subFont.nativeFontString;
|
|
1723
1743
|
var fontSizeInfo = TextUtils.measureFont(fontString);
|
|
1724
|
-
var
|
|
1725
|
-
var
|
|
1744
|
+
var subTexts = renderer.text.split(/(?:\r\n|\r|\n)/);
|
|
1745
|
+
var textCount = subTexts.length;
|
|
1746
|
+
var lines = new Array();
|
|
1726
1747
|
var lineWidths = new Array();
|
|
1727
1748
|
var lineMaxSizes = new Array();
|
|
1728
1749
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
1729
1750
|
var lineHeight = fontSizeInfo.size + renderer.lineSpacing * _pixelsPerUnit;
|
|
1730
1751
|
var width = 0;
|
|
1731
|
-
var height = renderer.height * _pixelsPerUnit;
|
|
1732
|
-
if (renderer.overflowMode === OverflowMode.Overflow) {
|
|
1733
|
-
height = lineHeight * lineCount;
|
|
1734
|
-
}
|
|
1735
1752
|
subFont.nativeFontString = fontString;
|
|
1736
|
-
for(var i = 0; i <
|
|
1737
|
-
var line =
|
|
1753
|
+
for(var i = 0; i < textCount; ++i){
|
|
1754
|
+
var line = subTexts[i];
|
|
1738
1755
|
var curWidth = 0;
|
|
1739
|
-
var maxAscent =
|
|
1740
|
-
var maxDescent =
|
|
1756
|
+
var maxAscent = 0;
|
|
1757
|
+
var maxDescent = 0;
|
|
1741
1758
|
for(var j = 0, m = line.length; j < m; ++j){
|
|
1742
1759
|
var charInfo = TextUtils._getCharInfo(line[j], fontString, subFont);
|
|
1743
1760
|
curWidth += charInfo.xAdvance;
|
|
@@ -1748,16 +1765,15 @@ var Logger = {
|
|
|
1748
1765
|
maxAscent < ascent && (maxAscent = ascent);
|
|
1749
1766
|
maxDescent < descent && (maxDescent = descent);
|
|
1750
1767
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
descent: maxDescent,
|
|
1755
|
-
size: maxAscent + maxDescent
|
|
1756
|
-
};
|
|
1757
|
-
if (curWidth > width) {
|
|
1758
|
-
width = curWidth;
|
|
1768
|
+
if (curWidth > 0) {
|
|
1769
|
+
this._pushLine(lines, lineWidths, lineMaxSizes, line, curWidth, maxAscent, maxDescent);
|
|
1770
|
+
width = Math.max(width, curWidth);
|
|
1759
1771
|
}
|
|
1760
1772
|
}
|
|
1773
|
+
var height = renderer.height * _pixelsPerUnit;
|
|
1774
|
+
if (renderer.overflowMode === OverflowMode.Overflow) {
|
|
1775
|
+
height = lineHeight * lines.length;
|
|
1776
|
+
}
|
|
1761
1777
|
return {
|
|
1762
1778
|
width: width,
|
|
1763
1779
|
height: height,
|
|
@@ -2610,7 +2626,6 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2610
2626
|
function EventDispatcher() {
|
|
2611
2627
|
this._events = Object.create(null);
|
|
2612
2628
|
this._eventCount = 0;
|
|
2613
|
-
this._dispatchingListeners = [];
|
|
2614
2629
|
}
|
|
2615
2630
|
var _proto = EventDispatcher.prototype;
|
|
2616
2631
|
/**
|
|
@@ -2650,7 +2665,8 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2650
2665
|
if (Array.isArray(listeners)) {
|
|
2651
2666
|
var count = listeners.length;
|
|
2652
2667
|
// cloning list to avoid structure breaking
|
|
2653
|
-
var
|
|
2668
|
+
var pool = EventDispatcher._dispatchingListenersPool;
|
|
2669
|
+
var dispatchingListeners = pool.length > 0 ? pool.pop() : [];
|
|
2654
2670
|
dispatchingListeners.length = count;
|
|
2655
2671
|
for(var i = 0; i < count; i++){
|
|
2656
2672
|
dispatchingListeners[i] = listeners[i];
|
|
@@ -2664,6 +2680,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2664
2680
|
}
|
|
2665
2681
|
// remove hooked function to avoid gc problem
|
|
2666
2682
|
dispatchingListeners.length = 0;
|
|
2683
|
+
pool.push(dispatchingListeners);
|
|
2667
2684
|
} else {
|
|
2668
2685
|
if (listeners.once) this.off(event, listeners.fn);
|
|
2669
2686
|
listeners.fn(data);
|
|
@@ -2764,6 +2781,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2764
2781
|
};
|
|
2765
2782
|
return EventDispatcher;
|
|
2766
2783
|
}();
|
|
2784
|
+
(function() {
|
|
2785
|
+
EventDispatcher._dispatchingListenersPool = [];
|
|
2786
|
+
})();
|
|
2767
2787
|
|
|
2768
2788
|
/**
|
|
2769
2789
|
* Shader property.
|
|
@@ -3935,6 +3955,23 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
3935
3955
|
scale.z < 0 && (isInvert = !isInvert);
|
|
3936
3956
|
return isInvert;
|
|
3937
3957
|
};
|
|
3958
|
+
_proto._onDestroy = function _onDestroy() {
|
|
3959
|
+
Component.prototype._onDestroy.call(this);
|
|
3960
|
+
//@ts-ignore
|
|
3961
|
+
this._worldPosition._onValueChanged = null;
|
|
3962
|
+
//@ts-ignore
|
|
3963
|
+
this._rotation._onValueChanged = null;
|
|
3964
|
+
//@ts-ignore
|
|
3965
|
+
this._worldRotation._onValueChanged = null;
|
|
3966
|
+
//@ts-ignore
|
|
3967
|
+
this._rotationQuaternion._onValueChanged = null;
|
|
3968
|
+
//@ts-ignore
|
|
3969
|
+
this._worldRotationQuaternion._onValueChanged = null;
|
|
3970
|
+
//@ts-ignore
|
|
3971
|
+
this._position._onValueChanged = null;
|
|
3972
|
+
//@ts-ignore
|
|
3973
|
+
this._scale._onValueChanged = null;
|
|
3974
|
+
};
|
|
3938
3975
|
/**
|
|
3939
3976
|
* Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
|
|
3940
3977
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
@@ -4628,6 +4665,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4628
4665
|
return component;
|
|
4629
4666
|
}
|
|
4630
4667
|
}
|
|
4668
|
+
return null;
|
|
4631
4669
|
};
|
|
4632
4670
|
/**
|
|
4633
4671
|
* Get components which match the type.
|
|
@@ -13731,6 +13769,15 @@ var VertexChangedFlags;
|
|
|
13731
13769
|
};
|
|
13732
13770
|
/**
|
|
13733
13771
|
* @internal
|
|
13772
|
+
*/ _proto._prepareRender = function _prepareRender(context) {
|
|
13773
|
+
if (!this._mesh) {
|
|
13774
|
+
Logger.error("mesh is null.");
|
|
13775
|
+
return;
|
|
13776
|
+
}
|
|
13777
|
+
Renderer.prototype._prepareRender.call(this, context);
|
|
13778
|
+
};
|
|
13779
|
+
/**
|
|
13780
|
+
* @internal
|
|
13734
13781
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13735
13782
|
Renderer.prototype._cloneTo.call(this, target);
|
|
13736
13783
|
target.mesh = this._mesh;
|
|
@@ -13752,49 +13799,45 @@ var VertexChangedFlags;
|
|
|
13752
13799
|
* @internal
|
|
13753
13800
|
*/ _proto._render = function _render(context) {
|
|
13754
13801
|
var mesh = this._mesh;
|
|
13755
|
-
if (
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
break;
|
|
13781
|
-
}
|
|
13802
|
+
if (this._dirtyUpdateFlag & 0x2) {
|
|
13803
|
+
var shaderData = this.shaderData;
|
|
13804
|
+
var vertexElements = mesh._vertexElements;
|
|
13805
|
+
shaderData.disableMacro(MeshRenderer._uvMacro);
|
|
13806
|
+
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13807
|
+
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13808
|
+
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13809
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13810
|
+
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13811
|
+
switch(vertexElements[i].semantic){
|
|
13812
|
+
case "TEXCOORD_0":
|
|
13813
|
+
shaderData.enableMacro(MeshRenderer._uvMacro);
|
|
13814
|
+
break;
|
|
13815
|
+
case "TEXCOORD_1":
|
|
13816
|
+
shaderData.enableMacro(MeshRenderer._uv1Macro);
|
|
13817
|
+
break;
|
|
13818
|
+
case "NORMAL":
|
|
13819
|
+
shaderData.enableMacro(MeshRenderer._normalMacro);
|
|
13820
|
+
break;
|
|
13821
|
+
case "TANGENT":
|
|
13822
|
+
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13823
|
+
break;
|
|
13824
|
+
case "COLOR_0":
|
|
13825
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13826
|
+
break;
|
|
13782
13827
|
}
|
|
13783
|
-
this._dirtyUpdateFlag &= ~0x2;
|
|
13784
13828
|
}
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
Logger.error("mesh is null.");
|
|
13829
|
+
this._dirtyUpdateFlag &= ~0x2;
|
|
13830
|
+
}
|
|
13831
|
+
var materials = this._materials;
|
|
13832
|
+
var subMeshes = mesh.subMeshes;
|
|
13833
|
+
var renderPipeline = context.camera._renderPipeline;
|
|
13834
|
+
var meshRenderDataPool = this._engine._meshRenderDataPool;
|
|
13835
|
+
for(var i1 = 0, n1 = subMeshes.length; i1 < n1; i1++){
|
|
13836
|
+
var material = materials[i1];
|
|
13837
|
+
if (!material) continue;
|
|
13838
|
+
var renderData = meshRenderDataPool.getFromPool();
|
|
13839
|
+
renderData.set(this, material, mesh, subMeshes[i1]);
|
|
13840
|
+
renderPipeline.pushRenderData(context, renderData);
|
|
13798
13841
|
}
|
|
13799
13842
|
};
|
|
13800
13843
|
_proto._setMesh = function _setMesh(mesh) {
|
|
@@ -19553,18 +19596,10 @@ var defaultInterval = 500;
|
|
|
19553
19596
|
var _config_type;
|
|
19554
19597
|
config.type = (_config_type = config.type) != null ? _config_type : getMimeTypeFromUrl(url);
|
|
19555
19598
|
var realRequest = config.type === "image" ? requestImage : requestRes;
|
|
19556
|
-
var lastError;
|
|
19557
19599
|
var executor = new MultiExecutor(function() {
|
|
19558
|
-
return realRequest(url, config).onProgress(setProgress)
|
|
19559
|
-
resolve(res);
|
|
19560
|
-
executor.stop();
|
|
19561
|
-
}).catch(function(err) {
|
|
19562
|
-
return lastError = err;
|
|
19563
|
-
});
|
|
19600
|
+
return realRequest(url, config).onProgress(setProgress);
|
|
19564
19601
|
}, retryCount, retryInterval);
|
|
19565
|
-
executor.start(
|
|
19566
|
-
reject(lastError);
|
|
19567
|
-
});
|
|
19602
|
+
executor.start().onError(reject).onComplete(resolve);
|
|
19568
19603
|
});
|
|
19569
19604
|
}
|
|
19570
19605
|
function requestImage(url, config) {
|
|
@@ -19651,23 +19686,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19651
19686
|
this.exec = this.exec.bind(this);
|
|
19652
19687
|
}
|
|
19653
19688
|
var _proto = MultiExecutor.prototype;
|
|
19654
|
-
_proto.start = function start(
|
|
19655
|
-
this.done = done;
|
|
19689
|
+
_proto.start = function start() {
|
|
19656
19690
|
this.exec();
|
|
19691
|
+
return this;
|
|
19657
19692
|
};
|
|
19658
|
-
_proto.
|
|
19659
|
-
|
|
19693
|
+
_proto.onComplete = function onComplete(func) {
|
|
19694
|
+
this._onComplete = func;
|
|
19695
|
+
return this;
|
|
19696
|
+
};
|
|
19697
|
+
_proto.onError = function onError(func) {
|
|
19698
|
+
this._onError = func;
|
|
19699
|
+
return this;
|
|
19700
|
+
};
|
|
19701
|
+
_proto.cancel = function cancel() {
|
|
19702
|
+
window.clearTimeout(this._timeoutId);
|
|
19660
19703
|
};
|
|
19661
19704
|
_proto.exec = function exec() {
|
|
19662
19705
|
var _this = this;
|
|
19663
19706
|
if (this._currentCount >= this.totalCount) {
|
|
19664
|
-
this.
|
|
19707
|
+
this._onError && this._onError(this._error);
|
|
19665
19708
|
return;
|
|
19666
19709
|
}
|
|
19667
19710
|
this._currentCount++;
|
|
19668
|
-
this.execFunc(this._currentCount).then(function() {
|
|
19669
|
-
|
|
19670
|
-
|
|
19711
|
+
this.execFunc(this._currentCount).then(function(result) {
|
|
19712
|
+
return _this._onComplete && _this._onComplete(result);
|
|
19713
|
+
}).catch(function(e) {
|
|
19714
|
+
_this._error = e;
|
|
19715
|
+
_this._timeoutId = window.setTimeout(_this.exec, _this.interval);
|
|
19671
19716
|
});
|
|
19672
19717
|
};
|
|
19673
19718
|
return MultiExecutor;
|
|
@@ -22300,92 +22345,97 @@ var /**
|
|
|
22300
22345
|
}
|
|
22301
22346
|
};
|
|
22302
22347
|
_proto._updateLocalData = function _updateLocalData() {
|
|
22303
|
-
var _this = this, color = _this.color,
|
|
22348
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
22304
22349
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
22305
|
-
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22306
|
-
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22307
|
-
var charFont = this._subFont;
|
|
22308
|
-
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22309
|
-
var halfRendererWidth = rendererWidth * 0.5;
|
|
22310
|
-
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22311
22350
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
22312
22351
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
22313
22352
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
22314
|
-
var halfLineHeight = lineHeight * 0.5;
|
|
22315
22353
|
var linesLen = lines.length;
|
|
22316
|
-
var startY = 0;
|
|
22317
|
-
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22318
|
-
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22319
|
-
switch(verticalAlignment){
|
|
22320
|
-
case TextVerticalAlignment.Top:
|
|
22321
|
-
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22322
|
-
break;
|
|
22323
|
-
case TextVerticalAlignment.Center:
|
|
22324
|
-
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22325
|
-
break;
|
|
22326
|
-
case TextVerticalAlignment.Bottom:
|
|
22327
|
-
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22328
|
-
break;
|
|
22329
|
-
}
|
|
22330
22354
|
var renderDataCount = 0;
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
var
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
|
|
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
|
-
|
|
22355
|
+
if (linesLen > 0) {
|
|
22356
|
+
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
22357
|
+
var horizontalAlignment = this.horizontalAlignment;
|
|
22358
|
+
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
22359
|
+
var rendererWidth = this.width * _pixelsPerUnit;
|
|
22360
|
+
var halfRendererWidth = rendererWidth * 0.5;
|
|
22361
|
+
var rendererHeight = this.height * _pixelsPerUnit;
|
|
22362
|
+
var halfLineHeight = lineHeight * 0.5;
|
|
22363
|
+
var startY = 0;
|
|
22364
|
+
var topDiff = lineHeight * 0.5 - lineMaxSizes[0].ascent;
|
|
22365
|
+
var bottomDiff = lineHeight * 0.5 - lineMaxSizes[linesLen - 1].descent - 1;
|
|
22366
|
+
switch(this.verticalAlignment){
|
|
22367
|
+
case TextVerticalAlignment.Top:
|
|
22368
|
+
startY = rendererHeight * 0.5 - halfLineHeight + topDiff;
|
|
22369
|
+
break;
|
|
22370
|
+
case TextVerticalAlignment.Center:
|
|
22371
|
+
startY = height * 0.5 - halfLineHeight - (bottomDiff - topDiff) * 0.5;
|
|
22372
|
+
break;
|
|
22373
|
+
case TextVerticalAlignment.Bottom:
|
|
22374
|
+
startY = height - rendererHeight * 0.5 - halfLineHeight - bottomDiff;
|
|
22375
|
+
break;
|
|
22376
|
+
}
|
|
22377
|
+
var firstLine = -1;
|
|
22378
|
+
var minX = Number.MAX_SAFE_INTEGER;
|
|
22379
|
+
var minY = Number.MAX_SAFE_INTEGER;
|
|
22380
|
+
var maxX = Number.MIN_SAFE_INTEGER;
|
|
22381
|
+
var maxY = Number.MIN_SAFE_INTEGER;
|
|
22382
|
+
for(var i = 0; i < linesLen; ++i){
|
|
22383
|
+
var lineWidth = lineWidths[i];
|
|
22384
|
+
if (lineWidth > 0) {
|
|
22385
|
+
var line = lines[i];
|
|
22386
|
+
var startX = 0;
|
|
22387
|
+
var firstRow = -1;
|
|
22388
|
+
if (firstLine < 0) {
|
|
22389
|
+
firstLine = i;
|
|
22390
|
+
}
|
|
22391
|
+
switch(horizontalAlignment){
|
|
22392
|
+
case TextHorizontalAlignment.Left:
|
|
22393
|
+
startX = -halfRendererWidth;
|
|
22394
|
+
break;
|
|
22395
|
+
case TextHorizontalAlignment.Center:
|
|
22396
|
+
startX = -lineWidth * 0.5;
|
|
22397
|
+
break;
|
|
22398
|
+
case TextHorizontalAlignment.Right:
|
|
22399
|
+
startX = halfRendererWidth - lineWidth;
|
|
22400
|
+
break;
|
|
22401
|
+
}
|
|
22402
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
22403
|
+
var char = line[j];
|
|
22404
|
+
var charInfo = charFont._getCharInfo(char);
|
|
22405
|
+
if (charInfo.h > 0) {
|
|
22406
|
+
var _charRenderDatas, _ref;
|
|
22407
|
+
firstRow < 0 && (firstRow = j);
|
|
22408
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
22409
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
22410
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
22411
|
+
renderData.color = color;
|
|
22412
|
+
renderData.uvs = charInfo.uvs;
|
|
22413
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
22414
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
22415
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
22416
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
22417
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
22418
|
+
localPositions.set(left, top, right, bottom);
|
|
22419
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
22420
|
+
minY = Math.min(minY, bottom);
|
|
22421
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
22422
|
+
maxX = Math.max(maxX, right);
|
|
22423
|
+
}
|
|
22424
|
+
startX += charInfo.xAdvance;
|
|
22377
22425
|
}
|
|
22378
|
-
startX += charInfo.xAdvance;
|
|
22379
22426
|
}
|
|
22427
|
+
startY -= lineHeight;
|
|
22380
22428
|
}
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22429
|
+
if (firstLine < 0) {
|
|
22430
|
+
min.set(0, 0, 0);
|
|
22431
|
+
max.set(0, 0, 0);
|
|
22432
|
+
} else {
|
|
22433
|
+
min.set(minX, minY, 0);
|
|
22434
|
+
max.set(maxX, maxY, 0);
|
|
22435
|
+
}
|
|
22436
|
+
} else {
|
|
22384
22437
|
min.set(0, 0, 0);
|
|
22385
22438
|
max.set(0, 0, 0);
|
|
22386
|
-
} else {
|
|
22387
|
-
min.set(minX, minY, 0);
|
|
22388
|
-
max.set(maxX, maxY, 0);
|
|
22389
22439
|
}
|
|
22390
22440
|
// Revert excess render data to pool.
|
|
22391
22441
|
var lastRenderDataCount = charRenderDatas.length;
|
|
@@ -24401,7 +24451,8 @@ var AnimatorLayerBlendingMode;
|
|
|
24401
24451
|
};
|
|
24402
24452
|
_proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
|
|
24403
24453
|
var eventHandlerPool = this._animationEventHandlerPool;
|
|
24404
|
-
var scripts =
|
|
24454
|
+
var scripts = [];
|
|
24455
|
+
this._entity.getComponents(Script, scripts);
|
|
24405
24456
|
var scriptCount = scripts.length;
|
|
24406
24457
|
var eventHandlers = animatorStateData.eventHandlers;
|
|
24407
24458
|
var events = state.clip.events;
|
|
@@ -24414,7 +24465,7 @@ var AnimatorLayerBlendingMode;
|
|
|
24414
24465
|
eventHandler.event = event;
|
|
24415
24466
|
handlers.length = 0;
|
|
24416
24467
|
for(var j = scriptCount - 1; j >= 0; j--){
|
|
24417
|
-
var handler = scripts
|
|
24468
|
+
var handler = scripts[j][funcName];
|
|
24418
24469
|
handler && handlers.push(handler);
|
|
24419
24470
|
}
|
|
24420
24471
|
eventHandlers.push(eventHandler);
|