@galacean/effects-threejs 2.1.0-alpha.9 → 2.1.0
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/README.md +1 -1
- package/dist/index.js +1385 -668
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1386 -669
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.1.0
|
|
6
|
+
* Version: v2.1.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -1116,39 +1116,39 @@ function _inherits(subClass, superClass) {
|
|
|
1116
1116
|
})(MaskMode || (MaskMode = {}));
|
|
1117
1117
|
/**
|
|
1118
1118
|
* 发射器形状
|
|
1119
|
-
*/ var
|
|
1120
|
-
(function(
|
|
1119
|
+
*/ var ParticleEmitterShapeType;
|
|
1120
|
+
(function(ParticleEmitterShapeType) {
|
|
1121
1121
|
/**
|
|
1122
1122
|
* 没有类型
|
|
1123
|
-
*/
|
|
1123
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
|
|
1124
1124
|
/**
|
|
1125
1125
|
* 圆球
|
|
1126
|
-
*/
|
|
1126
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
|
|
1127
1127
|
/**
|
|
1128
1128
|
* 圆锥
|
|
1129
|
-
*/
|
|
1129
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
|
|
1130
1130
|
/**
|
|
1131
1131
|
* 半球
|
|
1132
|
-
*/
|
|
1132
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
|
|
1133
1133
|
/**
|
|
1134
1134
|
* 圆
|
|
1135
|
-
*/
|
|
1135
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
|
|
1136
1136
|
/**
|
|
1137
1137
|
* 圆环
|
|
1138
|
-
*/
|
|
1138
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
|
|
1139
1139
|
/**
|
|
1140
1140
|
* 矩形
|
|
1141
|
-
*/
|
|
1141
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
|
|
1142
1142
|
/**
|
|
1143
1143
|
* 矩形框
|
|
1144
|
-
*/
|
|
1144
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
|
|
1145
1145
|
/**
|
|
1146
1146
|
* 直线
|
|
1147
|
-
*/
|
|
1147
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
|
|
1148
1148
|
/**
|
|
1149
1149
|
* 贴图
|
|
1150
|
-
*/
|
|
1151
|
-
})(
|
|
1150
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
|
|
1151
|
+
})(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
|
|
1152
1152
|
/**
|
|
1153
1153
|
* 插件类型
|
|
1154
1154
|
*/ var PluginType;
|
|
@@ -1244,6 +1244,12 @@ function _inherits(subClass, superClass) {
|
|
|
1244
1244
|
/**
|
|
1245
1245
|
* 特效元素
|
|
1246
1246
|
*/ ItemType["effect"] = "effect";
|
|
1247
|
+
/**
|
|
1248
|
+
* 形状元素
|
|
1249
|
+
*/ ItemType["shape"] = "shape";
|
|
1250
|
+
/**
|
|
1251
|
+
* 后处理元素
|
|
1252
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
1247
1253
|
/**
|
|
1248
1254
|
* 节点元素
|
|
1249
1255
|
*/ ItemType["node"] = "node";
|
|
@@ -1253,6 +1259,9 @@ function _inherits(subClass, superClass) {
|
|
|
1253
1259
|
/**
|
|
1254
1260
|
* 音频元素
|
|
1255
1261
|
*/ ItemType["audio"] = "audio";
|
|
1262
|
+
/**
|
|
1263
|
+
* 富文本元素
|
|
1264
|
+
*/ ItemType["richtext"] = "richtext";
|
|
1256
1265
|
})(ItemType || (ItemType = {}));
|
|
1257
1266
|
/**
|
|
1258
1267
|
* 渲染模式
|
|
@@ -1628,6 +1637,58 @@ var TextAlignment;
|
|
|
1628
1637
|
*/ FontStyle["oblique"] = "oblique";
|
|
1629
1638
|
})(FontStyle || (FontStyle = {}));
|
|
1630
1639
|
|
|
1640
|
+
var BuiltinObjectGUID = {
|
|
1641
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
1642
|
+
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1643
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
1644
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* 矢量图形类型
|
|
1649
|
+
*/ var ShapePrimitiveType;
|
|
1650
|
+
(function(ShapePrimitiveType) {
|
|
1651
|
+
/**
|
|
1652
|
+
* 自定义图形
|
|
1653
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
1654
|
+
/**
|
|
1655
|
+
* 矩形
|
|
1656
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
1657
|
+
/**
|
|
1658
|
+
* 椭圆
|
|
1659
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
1660
|
+
/**
|
|
1661
|
+
* 多边形
|
|
1662
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
1663
|
+
/**
|
|
1664
|
+
* 星形
|
|
1665
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1666
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1667
|
+
|
|
1668
|
+
// 本期无该功能 待补充
|
|
1669
|
+
var ShapeConnectType;
|
|
1670
|
+
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
1671
|
+
// @待补充
|
|
1672
|
+
var ShapePointType;
|
|
1673
|
+
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* 动态换图类型
|
|
1677
|
+
* @since 1.1.0
|
|
1678
|
+
*/ var BackgroundType;
|
|
1679
|
+
(function(BackgroundType) {
|
|
1680
|
+
BackgroundType["video"] = "video";
|
|
1681
|
+
BackgroundType["image"] = "image";
|
|
1682
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1683
|
+
/**
|
|
1684
|
+
* 多媒体资源类型
|
|
1685
|
+
* @since 2.1.0
|
|
1686
|
+
*/ var MultimediaType;
|
|
1687
|
+
(function(MultimediaType) {
|
|
1688
|
+
MultimediaType["video"] = "video";
|
|
1689
|
+
MultimediaType["audio"] = "audio";
|
|
1690
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1691
|
+
|
|
1631
1692
|
var DataType;
|
|
1632
1693
|
(function(DataType) {
|
|
1633
1694
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1638,8 +1699,10 @@ var DataType;
|
|
|
1638
1699
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1639
1700
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1640
1701
|
DataType["CameraController"] = "CameraController";
|
|
1702
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1641
1703
|
DataType["Geometry"] = "Geometry";
|
|
1642
1704
|
DataType["Texture"] = "Texture";
|
|
1705
|
+
DataType["Image"] = "Image";
|
|
1643
1706
|
DataType["AnimationClip"] = "AnimationClip";
|
|
1644
1707
|
DataType["TextComponent"] = "TextComponent";
|
|
1645
1708
|
DataType["BinaryAsset"] = "BinaryAsset";
|
|
@@ -1660,7 +1723,6 @@ var DataType;
|
|
|
1660
1723
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1661
1724
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1662
1725
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1663
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1664
1726
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1665
1727
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1666
1728
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1671,9 +1733,13 @@ var DataType;
|
|
|
1671
1733
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1672
1734
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1673
1735
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1736
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1737
|
+
DataType["OrientationComponent"] = "OrientationComponent";
|
|
1738
|
+
DataType["ShapeComponent"] = "ShapeComponent";
|
|
1674
1739
|
// Non-EffectObject
|
|
1675
1740
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1676
1741
|
})(DataType || (DataType = {}));
|
|
1742
|
+
|
|
1677
1743
|
var GeometryType;
|
|
1678
1744
|
(function(GeometryType) {
|
|
1679
1745
|
/**
|
|
@@ -1758,37 +1824,13 @@ var VertexBufferSemantic;
|
|
|
1758
1824
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1759
1825
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1760
1826
|
|
|
1761
|
-
var BuiltinObjectGUID = {
|
|
1762
|
-
WhiteTexture: "whitetexture00000000000000000000",
|
|
1763
|
-
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1764
|
-
PBRShader: "pbr00000000000000000000000000000",
|
|
1765
|
-
UnlitShader: "unlit000000000000000000000000000"
|
|
1766
|
-
};
|
|
1767
|
-
|
|
1768
|
-
/**
|
|
1769
|
-
* 动态换图类型
|
|
1770
|
-
* @since 1.1.0
|
|
1771
|
-
*/ var BackgroundType;
|
|
1772
|
-
(function(BackgroundType) {
|
|
1773
|
-
BackgroundType["video"] = "video";
|
|
1774
|
-
BackgroundType["image"] = "image";
|
|
1775
|
-
})(BackgroundType || (BackgroundType = {}));
|
|
1776
|
-
/**
|
|
1777
|
-
* 多媒体资源类型
|
|
1778
|
-
* @since 2.1.0
|
|
1779
|
-
*/ var MultimediaType;
|
|
1780
|
-
(function(MultimediaType) {
|
|
1781
|
-
MultimediaType["video"] = "video";
|
|
1782
|
-
MultimediaType["audio"] = "audio";
|
|
1783
|
-
})(MultimediaType || (MultimediaType = {}));
|
|
1784
|
-
|
|
1785
1827
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1786
1828
|
__proto__: null,
|
|
1787
1829
|
get RenderLevel () { return RenderLevel; },
|
|
1788
1830
|
get BlendingMode () { return BlendingMode; },
|
|
1789
1831
|
get SideMode () { return SideMode; },
|
|
1790
1832
|
get MaskMode () { return MaskMode; },
|
|
1791
|
-
get
|
|
1833
|
+
get ParticleEmitterShapeType () { return ParticleEmitterShapeType; },
|
|
1792
1834
|
get PluginType () { return PluginType; },
|
|
1793
1835
|
get InteractType () { return InteractType; },
|
|
1794
1836
|
get InteractBehavior () { return InteractBehavior; },
|
|
@@ -1826,14 +1868,17 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1826
1868
|
get TextAlignment () { return TextAlignment; },
|
|
1827
1869
|
get TextWeight () { return TextWeight; },
|
|
1828
1870
|
get FontStyle () { return FontStyle; },
|
|
1871
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1872
|
+
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
1873
|
+
get ShapeConnectType () { return ShapeConnectType; },
|
|
1874
|
+
get ShapePointType () { return ShapePointType; },
|
|
1875
|
+
get BackgroundType () { return BackgroundType; },
|
|
1876
|
+
get MultimediaType () { return MultimediaType; },
|
|
1829
1877
|
get DataType () { return DataType; },
|
|
1830
1878
|
get GeometryType () { return GeometryType; },
|
|
1831
1879
|
get VertexFormatType () { return VertexFormatType; },
|
|
1832
1880
|
get IndexFormatType () { return IndexFormatType; },
|
|
1833
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1834
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1835
|
-
get BackgroundType () { return BackgroundType; },
|
|
1836
|
-
get MultimediaType () { return MultimediaType; }
|
|
1881
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1837
1882
|
});
|
|
1838
1883
|
|
|
1839
1884
|
function _defineProperties(target, props) {
|
|
@@ -1921,15 +1966,23 @@ function getDirectStore(target) {
|
|
|
1921
1966
|
this.engine.addInstance(this);
|
|
1922
1967
|
}
|
|
1923
1968
|
var _proto = EffectsObject.prototype;
|
|
1924
|
-
|
|
1969
|
+
/**
|
|
1970
|
+
*
|
|
1971
|
+
* @returns
|
|
1972
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1925
1973
|
return this.guid;
|
|
1926
1974
|
};
|
|
1927
|
-
|
|
1975
|
+
/**
|
|
1976
|
+
*
|
|
1977
|
+
* @param guid
|
|
1978
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1928
1979
|
this.engine.removeInstance(this.guid);
|
|
1929
1980
|
this.guid = guid;
|
|
1930
1981
|
this.engine.addInstance(this);
|
|
1931
1982
|
};
|
|
1932
|
-
|
|
1983
|
+
/**
|
|
1984
|
+
*
|
|
1985
|
+
*/ _proto.toData = function toData() {};
|
|
1933
1986
|
/**
|
|
1934
1987
|
* 反序列化函数
|
|
1935
1988
|
*
|
|
@@ -1939,8 +1992,14 @@ function getDirectStore(target) {
|
|
|
1939
1992
|
this.setInstanceId(data.id);
|
|
1940
1993
|
}
|
|
1941
1994
|
};
|
|
1942
|
-
|
|
1943
|
-
|
|
1995
|
+
/**
|
|
1996
|
+
*
|
|
1997
|
+
*/ _proto.dispose = function dispose() {};
|
|
1998
|
+
/**
|
|
1999
|
+
*
|
|
2000
|
+
* @param obj
|
|
2001
|
+
* @returns
|
|
2002
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1944
2003
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1945
2004
|
};
|
|
1946
2005
|
return EffectsObject;
|
|
@@ -2020,7 +2079,7 @@ function getDirectStore(target) {
|
|
|
2020
2079
|
this.onAwake();
|
|
2021
2080
|
this.isAwakeCalled = true;
|
|
2022
2081
|
}
|
|
2023
|
-
if (item.
|
|
2082
|
+
if (item.isActive && this.enabled) {
|
|
2024
2083
|
this.start();
|
|
2025
2084
|
this.enable();
|
|
2026
2085
|
}
|
|
@@ -2065,7 +2124,7 @@ function getDirectStore(target) {
|
|
|
2065
2124
|
get: /**
|
|
2066
2125
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2067
2126
|
*/ function get() {
|
|
2068
|
-
return this.item.
|
|
2127
|
+
return this.item.isActive && this.enabled;
|
|
2069
2128
|
}
|
|
2070
2129
|
},
|
|
2071
2130
|
{
|
|
@@ -2133,6 +2192,14 @@ __decorate([
|
|
|
2133
2192
|
Component.prototype.setVFXItem.call(this, item);
|
|
2134
2193
|
this.item.rendererComponents.push(this);
|
|
2135
2194
|
};
|
|
2195
|
+
_proto.onEnable = function onEnable() {
|
|
2196
|
+
var _this_item_composition;
|
|
2197
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
|
|
2198
|
+
};
|
|
2199
|
+
_proto.onDisable = function onDisable() {
|
|
2200
|
+
var _this_item_composition;
|
|
2201
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
2202
|
+
};
|
|
2136
2203
|
_proto.fromData = function fromData(data) {
|
|
2137
2204
|
Component.prototype.fromData.call(this, data);
|
|
2138
2205
|
};
|
|
@@ -3694,7 +3761,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3694
3761
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3695
3762
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3696
3763
|
|
|
3697
|
-
|
|
3764
|
+
/**
|
|
3765
|
+
* Mesh 组件
|
|
3766
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3698
3767
|
_inherits(MeshComponent, RendererComponent);
|
|
3699
3768
|
function MeshComponent() {
|
|
3700
3769
|
var _this;
|
|
@@ -3704,7 +3773,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3704
3773
|
*/ _this.meshCollider = new MeshCollider();
|
|
3705
3774
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3706
3775
|
_this.getHitTestParams = function(force) {
|
|
3707
|
-
var
|
|
3776
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3777
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3778
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3708
3779
|
if (area) {
|
|
3709
3780
|
return {
|
|
3710
3781
|
type: area.type,
|
|
@@ -3724,8 +3795,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3724
3795
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3725
3796
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3726
3797
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3727
|
-
var
|
|
3728
|
-
return
|
|
3798
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3799
|
+
return boundingBox;
|
|
3729
3800
|
};
|
|
3730
3801
|
return MeshComponent;
|
|
3731
3802
|
}(RendererComponent);
|
|
@@ -3763,24 +3834,29 @@ exports.EffectComponent = __decorate([
|
|
|
3763
3834
|
|
|
3764
3835
|
exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3765
3836
|
_inherits(PostProcessVolume, Behaviour);
|
|
3766
|
-
function PostProcessVolume() {
|
|
3837
|
+
function PostProcessVolume(engine) {
|
|
3767
3838
|
var _this;
|
|
3768
|
-
_this = Behaviour.
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
_this.
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
_this.
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3839
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3840
|
+
_this.bloom = {
|
|
3841
|
+
threshold: 0,
|
|
3842
|
+
intensity: 0,
|
|
3843
|
+
active: false
|
|
3844
|
+
};
|
|
3845
|
+
_this.vignette = {
|
|
3846
|
+
intensity: 0,
|
|
3847
|
+
smoothness: 0,
|
|
3848
|
+
roundness: 0,
|
|
3849
|
+
active: false
|
|
3850
|
+
};
|
|
3851
|
+
_this.tonemapping = {
|
|
3852
|
+
active: false
|
|
3853
|
+
};
|
|
3854
|
+
_this.colorAdjustments = {
|
|
3855
|
+
brightness: 0,
|
|
3856
|
+
saturation: 0,
|
|
3857
|
+
contrast: 0,
|
|
3858
|
+
active: false
|
|
3859
|
+
};
|
|
3784
3860
|
return _this;
|
|
3785
3861
|
}
|
|
3786
3862
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3794,36 +3870,18 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3794
3870
|
}(Behaviour);
|
|
3795
3871
|
__decorate([
|
|
3796
3872
|
serialize()
|
|
3797
|
-
], exports.PostProcessVolume.prototype, "
|
|
3798
|
-
__decorate([
|
|
3799
|
-
serialize()
|
|
3800
|
-
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
3801
|
-
__decorate([
|
|
3802
|
-
serialize()
|
|
3803
|
-
], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
3804
|
-
__decorate([
|
|
3805
|
-
serialize()
|
|
3806
|
-
], exports.PostProcessVolume.prototype, "brightness", void 0);
|
|
3873
|
+
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
3807
3874
|
__decorate([
|
|
3808
3875
|
serialize()
|
|
3809
|
-
], exports.PostProcessVolume.prototype, "
|
|
3876
|
+
], exports.PostProcessVolume.prototype, "vignette", void 0);
|
|
3810
3877
|
__decorate([
|
|
3811
3878
|
serialize()
|
|
3812
|
-
], exports.PostProcessVolume.prototype, "
|
|
3879
|
+
], exports.PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3813
3880
|
__decorate([
|
|
3814
3881
|
serialize()
|
|
3815
|
-
], exports.PostProcessVolume.prototype, "
|
|
3816
|
-
__decorate([
|
|
3817
|
-
serialize()
|
|
3818
|
-
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
3819
|
-
__decorate([
|
|
3820
|
-
serialize()
|
|
3821
|
-
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
3822
|
-
__decorate([
|
|
3823
|
-
serialize()
|
|
3824
|
-
], exports.PostProcessVolume.prototype, "toneMappingEnabled", void 0);
|
|
3882
|
+
], exports.PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3825
3883
|
exports.PostProcessVolume = __decorate([
|
|
3826
|
-
effectsClass(
|
|
3884
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3827
3885
|
], exports.PostProcessVolume);
|
|
3828
3886
|
|
|
3829
3887
|
function _assert_this_initialized(self) {
|
|
@@ -6910,6 +6968,7 @@ exports.MaterialRenderType = void 0;
|
|
|
6910
6968
|
_this.enabledMacros = {};
|
|
6911
6969
|
_this.destroyed = false;
|
|
6912
6970
|
_this.initialized = false;
|
|
6971
|
+
_this.shaderDirty = true;
|
|
6913
6972
|
if (props) {
|
|
6914
6973
|
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$9++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
6915
6974
|
_this.name = name;
|
|
@@ -6937,6 +6996,41 @@ exports.MaterialRenderType = void 0;
|
|
|
6937
6996
|
// OVERRIDE
|
|
6938
6997
|
};
|
|
6939
6998
|
_create_class(Material, [
|
|
6999
|
+
{
|
|
7000
|
+
key: "shader",
|
|
7001
|
+
get: function get() {
|
|
7002
|
+
return this._shader;
|
|
7003
|
+
},
|
|
7004
|
+
set: function set(value) {
|
|
7005
|
+
if (this._shader === value) {
|
|
7006
|
+
return;
|
|
7007
|
+
}
|
|
7008
|
+
this._shader = value;
|
|
7009
|
+
this.shaderDirty = true;
|
|
7010
|
+
}
|
|
7011
|
+
},
|
|
7012
|
+
{
|
|
7013
|
+
key: "mainTexture",
|
|
7014
|
+
get: /**
|
|
7015
|
+
* 材质的主纹理
|
|
7016
|
+
*/ function get() {
|
|
7017
|
+
return this.getTexture("_MainTex");
|
|
7018
|
+
},
|
|
7019
|
+
set: function set(value) {
|
|
7020
|
+
this.setTexture("_MainTex", value);
|
|
7021
|
+
}
|
|
7022
|
+
},
|
|
7023
|
+
{
|
|
7024
|
+
key: "color",
|
|
7025
|
+
get: /**
|
|
7026
|
+
* 材质的主颜色
|
|
7027
|
+
*/ function get() {
|
|
7028
|
+
return this.getColor("_Color");
|
|
7029
|
+
},
|
|
7030
|
+
set: function set(value) {
|
|
7031
|
+
this.setColor("_Color", value);
|
|
7032
|
+
}
|
|
7033
|
+
},
|
|
6940
7034
|
{
|
|
6941
7035
|
key: "blending",
|
|
6942
7036
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10073,7 +10167,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10073
10167
|
|
|
10074
10168
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10075
10169
|
|
|
10076
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10170
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10077
10171
|
|
|
10078
10172
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
10079
10173
|
|
|
@@ -10304,15 +10398,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10304
10398
|
renderer.setFramebuffer(this.framebuffer);
|
|
10305
10399
|
};
|
|
10306
10400
|
_proto.execute = function execute(renderer) {
|
|
10307
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10401
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10308
10402
|
renderer.clear({
|
|
10309
10403
|
colorAction: exports.TextureStoreAction.clear,
|
|
10310
10404
|
depthAction: exports.TextureStoreAction.clear,
|
|
10311
10405
|
stencilAction: exports.TextureStoreAction.clear
|
|
10312
10406
|
});
|
|
10313
10407
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10314
|
-
var
|
|
10315
|
-
var threshold = (
|
|
10408
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10409
|
+
var threshold = (_renderer_renderingData_currentFrame_globalVolume_bloom_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : (_renderer_renderingData_currentFrame_globalVolume_bloom = _renderer_renderingData_currentFrame_globalVolume.bloom) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume_bloom.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_bloom_threshold : 1.0;
|
|
10316
10410
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10317
10411
|
renderer.renderMeshes([
|
|
10318
10412
|
this.screenMesh
|
|
@@ -10525,25 +10619,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10525
10619
|
depthAction: exports.TextureStoreAction.clear,
|
|
10526
10620
|
stencilAction: exports.TextureStoreAction.clear
|
|
10527
10621
|
});
|
|
10528
|
-
var
|
|
10529
|
-
var
|
|
10622
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10623
|
+
var bloom = _extends({
|
|
10624
|
+
threshold: 0,
|
|
10625
|
+
intensity: 0,
|
|
10626
|
+
active: false
|
|
10627
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10628
|
+
var vignette = _extends({
|
|
10629
|
+
intensity: 0,
|
|
10630
|
+
smoothness: 0,
|
|
10631
|
+
roundness: 0,
|
|
10632
|
+
active: false
|
|
10633
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10634
|
+
var colorAdjustments = _extends({
|
|
10635
|
+
brightness: 0,
|
|
10636
|
+
saturation: 0,
|
|
10637
|
+
contrast: 0,
|
|
10638
|
+
active: false
|
|
10639
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10640
|
+
var tonemapping = _extends({
|
|
10641
|
+
active: false
|
|
10642
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10530
10643
|
this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
|
|
10531
|
-
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
10532
|
-
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
10533
|
-
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
10534
|
-
this.screenMesh.material.setInt("_UseBloom", Number(
|
|
10535
|
-
if (
|
|
10644
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10645
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10646
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10647
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10648
|
+
if (bloom.active) {
|
|
10536
10649
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10537
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10650
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10538
10651
|
}
|
|
10539
|
-
if (
|
|
10540
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10541
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10542
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10652
|
+
if (vignette.intensity > 0) {
|
|
10653
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10654
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10655
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10543
10656
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10544
10657
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10545
10658
|
}
|
|
10546
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10659
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10547
10660
|
renderer.renderMeshes([
|
|
10548
10661
|
this.screenMesh
|
|
10549
10662
|
]);
|
|
@@ -10583,6 +10696,9 @@ var seed$6 = 1;
|
|
|
10583
10696
|
this.renderer = renderer;
|
|
10584
10697
|
if (postProcessingEnabled) {
|
|
10585
10698
|
var enableHDR = true;
|
|
10699
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10700
|
+
throw new Error("Half float texture is not supported.");
|
|
10701
|
+
}
|
|
10586
10702
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10587
10703
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10588
10704
|
attachments = [
|
|
@@ -10604,16 +10720,16 @@ var seed$6 = 1;
|
|
|
10604
10720
|
depthAction: exports.TextureLoadAction.clear
|
|
10605
10721
|
};
|
|
10606
10722
|
}
|
|
10607
|
-
|
|
10723
|
+
this.drawObjectPass = new RenderPass(renderer, {
|
|
10724
|
+
name: RENDER_PASS_NAME_PREFIX,
|
|
10725
|
+
priority: RenderPassPriorityNormal,
|
|
10726
|
+
meshOrder: exports.OrderType.ascending,
|
|
10727
|
+
depthStencilAttachment: depthStencilAttachment,
|
|
10728
|
+
attachments: attachments,
|
|
10729
|
+
clearAction: drawObjectPassClearAction
|
|
10730
|
+
});
|
|
10608
10731
|
var renderPasses = [
|
|
10609
|
-
|
|
10610
|
-
name: RENDER_PASS_NAME_PREFIX,
|
|
10611
|
-
priority: RenderPassPriorityNormal,
|
|
10612
|
-
meshOrder: exports.OrderType.ascending,
|
|
10613
|
-
depthStencilAttachment: depthStencilAttachment,
|
|
10614
|
-
attachments: attachments,
|
|
10615
|
-
clearAction: drawObjectPassClearAction
|
|
10616
|
-
})
|
|
10732
|
+
this.drawObjectPass
|
|
10617
10733
|
];
|
|
10618
10734
|
this.setRenderPasses(renderPasses);
|
|
10619
10735
|
if (postProcessingEnabled) {
|
|
@@ -10735,216 +10851,15 @@ var seed$6 = 1;
|
|
|
10735
10851
|
* 根据 Mesh 优先级添加到 RenderPass
|
|
10736
10852
|
* @param mesh - 要添加的 Mesh 对象
|
|
10737
10853
|
*/ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
|
|
10738
|
-
|
|
10739
|
-
return;
|
|
10740
|
-
}
|
|
10741
|
-
this.renderPasses[0].addMesh(mesh);
|
|
10742
|
-
// const renderPasses = this.renderPasses;
|
|
10743
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10744
|
-
// const { priority } = mesh;
|
|
10745
|
-
// for (let i = 1; i < renderPasses.length; i++) {
|
|
10746
|
-
// const renderPass = renderPasses[i - 1];
|
|
10747
|
-
// const info = infoMap.get(renderPasses[i])!;
|
|
10748
|
-
// if (info && info.listStart > priority && (priority > infoMap.get(renderPass)!.listEnd || i === 1)) {
|
|
10749
|
-
// return this.addToRenderPass(renderPass, mesh);
|
|
10750
|
-
// }
|
|
10751
|
-
// }
|
|
10752
|
-
// // TODO: diff逻辑待优化,有时会添加进找不到的元素
|
|
10753
|
-
// let last = renderPasses[renderPasses.length - 1];
|
|
10754
|
-
// // TODO: 是否添加mesh到pass的判断方式需要优化,先通过长度判断是否有postprocess
|
|
10755
|
-
// for (const pass of renderPasses) {
|
|
10756
|
-
// if (!(pass instanceof HQGaussianDownSamplePass
|
|
10757
|
-
// || pass instanceof BloomThresholdPass
|
|
10758
|
-
// || pass instanceof ToneMappingPass
|
|
10759
|
-
// || pass instanceof HQGaussianUpSamplePass
|
|
10760
|
-
// || pass.name === 'mars-final-copy')) {
|
|
10761
|
-
// last = pass;
|
|
10762
|
-
// }
|
|
10763
|
-
// }
|
|
10764
|
-
// // if (priority > infoMap.get(last)!.listStart || renderPasses.length === 1) {
|
|
10765
|
-
// // return this.addToRenderPass(last, mesh);
|
|
10766
|
-
// // }
|
|
10767
|
-
// return this.addToRenderPass(last, mesh);
|
|
10768
|
-
// if (false) {
|
|
10769
|
-
// throw Error('render pass not found');
|
|
10770
|
-
// }
|
|
10854
|
+
this.drawObjectPass.addMesh(mesh);
|
|
10771
10855
|
};
|
|
10772
10856
|
/**
|
|
10773
10857
|
* 把 Mesh 从 RenderPass 中移除,
|
|
10774
10858
|
* 如果 renderPass 中没有 mesh,此 renderPass 会被删除
|
|
10775
10859
|
* @param mesh - 要删除的 Mesh 对象
|
|
10776
10860
|
*/ _proto.removeMeshFromDefaultRenderPass = function removeMeshFromDefaultRenderPass(mesh) {
|
|
10777
|
-
|
|
10778
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10779
|
-
// for (let i = renderPasses.length - 1; i >= 0; i--) {
|
|
10780
|
-
// const renderPass = renderPasses[i];
|
|
10781
|
-
// const info = infoMap.get(renderPass)!;
|
|
10782
|
-
// // 只有渲染场景物体的pass才有 info
|
|
10783
|
-
// if (!info) {
|
|
10784
|
-
// continue;
|
|
10785
|
-
// }
|
|
10786
|
-
// if (info.listStart <= mesh.priority && info.listEnd >= mesh.priority) {
|
|
10787
|
-
// const idx = renderPass.meshes.indexOf(mesh);
|
|
10788
|
-
// if (idx === -1) {
|
|
10789
|
-
// return;
|
|
10790
|
-
// }
|
|
10791
|
-
// // TODO hack: 现在的除了rp1和finalcopy pass,所有renderpass的meshes是一个copy加上一个filter mesh,这里的判断当filter mesh被删除后当前pass需不需要删除,
|
|
10792
|
-
// // 判断需要更鲁棒。
|
|
10793
|
-
// const shouldRestoreRenderPass = idx === 1 && renderPass.meshes[0].name === MARS_COPY_MESH_NAME;
|
|
10794
|
-
// renderPass.removeMesh(mesh);
|
|
10795
|
-
// if (shouldRestoreRenderPass) {
|
|
10796
|
-
// const nextRenderPass = renderPasses[i + 1];
|
|
10797
|
-
// const meshes = renderPass.meshes;
|
|
10798
|
-
// if (!info.intermedia) {
|
|
10799
|
-
// info.preRenderPass?.resetColorAttachments([]);
|
|
10800
|
-
// //this.renderer.extension.resetColorAttachments?.(info.preRenderPass, []);
|
|
10801
|
-
// }
|
|
10802
|
-
// for (let j = 1; j < meshes.length; j++) {
|
|
10803
|
-
// info.preRenderPass?.addMesh(meshes[j]);
|
|
10804
|
-
// }
|
|
10805
|
-
// const cp = renderPass.attachments[0]?.texture;
|
|
10806
|
-
// const keepColor = cp === this.resource.color_a || cp === this.resource.color_b;
|
|
10807
|
-
// renderPass.dispose({
|
|
10808
|
-
// meshes: DestroyOptions.keep,
|
|
10809
|
-
// colorAttachment: keepColor ? RenderPassDestroyAttachmentType.keep : RenderPassDestroyAttachmentType.destroy,
|
|
10810
|
-
// depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
|
|
10811
|
-
// });
|
|
10812
|
-
// removeItem(renderPasses, renderPass);
|
|
10813
|
-
// this.removeRenderPass(renderPass);
|
|
10814
|
-
// infoMap.delete(renderPass);
|
|
10815
|
-
// if (nextRenderPass) {
|
|
10816
|
-
// this.updateRenderInfo(nextRenderPass);
|
|
10817
|
-
// }
|
|
10818
|
-
// if (info.preRenderPass) {
|
|
10819
|
-
// this.updateRenderInfo(info.preRenderPass);
|
|
10820
|
-
// }
|
|
10821
|
-
// if (info.prePasses) {
|
|
10822
|
-
// info.prePasses.forEach(rp => {
|
|
10823
|
-
// this.removeRenderPass(rp.pass);
|
|
10824
|
-
// if (rp?.destroyOptions !== false) {
|
|
10825
|
-
// rp.pass.attachments.forEach(c => {
|
|
10826
|
-
// if (c.texture !== this.resource.color_b || c.texture !== this.resource.color_a) {
|
|
10827
|
-
// c.texture.dispose();
|
|
10828
|
-
// }
|
|
10829
|
-
// });
|
|
10830
|
-
// const options: RenderPassDestroyOptions = {
|
|
10831
|
-
// ...(rp?.destroyOptions ? rp.destroyOptions as RenderPassDestroyOptions : {}),
|
|
10832
|
-
// depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
|
|
10833
|
-
// };
|
|
10834
|
-
// rp.pass.dispose(options);
|
|
10835
|
-
// }
|
|
10836
|
-
// });
|
|
10837
|
-
// }
|
|
10838
|
-
// this.resetRenderPassDefaultAttachment(renderPasses, Math.max(i - 1, 0));
|
|
10839
|
-
// if (renderPasses.length === 1) {
|
|
10840
|
-
// renderPasses[0].resetColorAttachments([]);
|
|
10841
|
-
// //this.renderer.extension.resetColorAttachments?.(renderPasses[0], []);
|
|
10842
|
-
// this.removeRenderPass(this.resource.finalCopyRP);
|
|
10843
|
-
// }
|
|
10844
|
-
// }
|
|
10845
|
-
// return this.resetClearActions();
|
|
10846
|
-
// }
|
|
10847
|
-
// }
|
|
10861
|
+
this.drawObjectPass.removeMesh(mesh);
|
|
10848
10862
|
};
|
|
10849
|
-
// /**
|
|
10850
|
-
// * 将 Mesh 所有在 RenderPass 进行切分
|
|
10851
|
-
// * @param mesh - 目标 Mesh 对象
|
|
10852
|
-
// * @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
|
|
10853
|
-
// */
|
|
10854
|
-
// splitDefaultRenderPassByMesh (mesh: Mesh, options: RenderPassSplitOptions): RenderPass {
|
|
10855
|
-
// const index = this.findMeshRenderPassIndex(mesh);
|
|
10856
|
-
// const renderPass = this.renderPasses[index];
|
|
10857
|
-
// if (false) {
|
|
10858
|
-
// if (!renderPass) {
|
|
10859
|
-
// throw Error('RenderPassNotFound');
|
|
10860
|
-
// }
|
|
10861
|
-
// }
|
|
10862
|
-
// this.createResource();
|
|
10863
|
-
// const meshIndex = renderPass.meshes.indexOf(mesh);
|
|
10864
|
-
// const ms0 = renderPass.meshes.slice(0, meshIndex);
|
|
10865
|
-
// const ms1 = renderPass.meshes.slice(meshIndex);
|
|
10866
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10867
|
-
// // TODO 为什么要加这个判断?
|
|
10868
|
-
// // if (renderPass.attachments[0] && this.renderPasses[index + 1] !== this.resource.finalCopyRP) {
|
|
10869
|
-
// // throw Error('not implement');
|
|
10870
|
-
// // } else {
|
|
10871
|
-
// if (!options.attachments?.length) {
|
|
10872
|
-
// throw Error('should include at least one color attachment');
|
|
10873
|
-
// }
|
|
10874
|
-
// const defRPS = this.renderPasses;
|
|
10875
|
-
// const defIndex = defRPS.indexOf(renderPass);
|
|
10876
|
-
// const lastDefRP = defRPS[defIndex - 1];
|
|
10877
|
-
// removeItem(defRPS, renderPass);
|
|
10878
|
-
// const lastInfo = infoMap.get(renderPass);
|
|
10879
|
-
// infoMap.delete(renderPass);
|
|
10880
|
-
// const filter = GPUCapability.getInstance().level === 2 ? glContext.LINEAR : glContext.NEAREST;
|
|
10881
|
-
// const rp0 = new RenderPass({
|
|
10882
|
-
// name: RENDER_PASS_NAME_PREFIX + defIndex,
|
|
10883
|
-
// priority: renderPass.priority,
|
|
10884
|
-
// attachments: [{
|
|
10885
|
-
// texture: {
|
|
10886
|
-
// sourceType: TextureSourceType.framebuffer,
|
|
10887
|
-
// format: glContext.RGBA,
|
|
10888
|
-
// name: 'frame_a',
|
|
10889
|
-
// minFilter: filter,
|
|
10890
|
-
// magFilter: filter,
|
|
10891
|
-
// },
|
|
10892
|
-
// }],
|
|
10893
|
-
// clearAction: renderPass.clearAction || { colorAction: TextureLoadAction.clear },
|
|
10894
|
-
// storeAction: renderPass.storeAction,
|
|
10895
|
-
// depthStencilAttachment: this.resource.depthStencil,
|
|
10896
|
-
// meshes: ms0,
|
|
10897
|
-
// meshOrder: OrderType.ascending,
|
|
10898
|
-
// });
|
|
10899
|
-
// ms1.unshift(this.createCopyMesh());
|
|
10900
|
-
// const renderPasses = this.renderPasses;
|
|
10901
|
-
// renderPasses[index] = rp0;
|
|
10902
|
-
// const prePasses: RenderPass[] = [];
|
|
10903
|
-
// const restMeshes = ms1.slice();
|
|
10904
|
-
// if (options.prePasses) {
|
|
10905
|
-
// options.prePasses.forEach((pass, i) => {
|
|
10906
|
-
// pass.priority = renderPass.priority + 1 + i;
|
|
10907
|
-
// pass.setMeshes(ms1);
|
|
10908
|
-
// prePasses.push(pass);
|
|
10909
|
-
// });
|
|
10910
|
-
// renderPasses.splice(index + 1, 0, ...prePasses);
|
|
10911
|
-
// restMeshes.splice(0, 2);
|
|
10912
|
-
// }
|
|
10913
|
-
// const copyRP = this.resource.finalCopyRP;
|
|
10914
|
-
// if (!renderPasses.includes(copyRP)) {
|
|
10915
|
-
// renderPasses.push(copyRP);
|
|
10916
|
-
// }
|
|
10917
|
-
// // let sourcePass = (prePasses.length && !options.useLastDefaultPassColor) ? prePasses[prePasses.length - 1] : rp0;
|
|
10918
|
-
// const finalFilterPass = prePasses[prePasses.length - 1];
|
|
10919
|
-
// finalFilterPass.initialize(this.renderer);
|
|
10920
|
-
// // 不切RT,接着上一个pass的渲染结果渲染
|
|
10921
|
-
// const rp1 = new RenderPass({
|
|
10922
|
-
// name: RENDER_PASS_NAME_PREFIX + (defIndex + 1),
|
|
10923
|
-
// priority: renderPass.priority + 1 + (options.prePasses?.length || 0),
|
|
10924
|
-
// meshes: restMeshes,
|
|
10925
|
-
// meshOrder: OrderType.ascending,
|
|
10926
|
-
// depthStencilAttachment: this.resource.depthStencil,
|
|
10927
|
-
// storeAction: options.storeAction,
|
|
10928
|
-
// clearAction: {
|
|
10929
|
-
// depthAction: TextureLoadAction.whatever,
|
|
10930
|
-
// stencilAction: TextureLoadAction.whatever,
|
|
10931
|
-
// colorAction: TextureLoadAction.whatever,
|
|
10932
|
-
// },
|
|
10933
|
-
// });
|
|
10934
|
-
// renderPasses.splice(index + 1 + (options.prePasses?.length || 0), 0, rp1);
|
|
10935
|
-
// this.setRenderPasses(renderPasses);
|
|
10936
|
-
// this.updateRenderInfo(finalFilterPass);
|
|
10937
|
-
// this.updateRenderInfo(rp0);
|
|
10938
|
-
// this.updateRenderInfo(rp1);
|
|
10939
|
-
// // 目的是删除滤镜元素后,把之前滤镜用到的prePass给删除,逻辑有些复杂,考虑优化
|
|
10940
|
-
// infoMap.get(rp0)!.prePasses = lastInfo!.prePasses;
|
|
10941
|
-
// prePasses.pop();
|
|
10942
|
-
// infoMap.get(finalFilterPass)!.prePasses = prePasses.map((pass, i) => {
|
|
10943
|
-
// return { pass, destroyOptions: false };
|
|
10944
|
-
// });
|
|
10945
|
-
// this.resetClearActions();
|
|
10946
|
-
// return finalFilterPass;
|
|
10947
|
-
// }
|
|
10948
10863
|
/**
|
|
10949
10864
|
* 销毁 RenderFrame
|
|
10950
10865
|
* @param options - 可以有选择销毁一些对象
|
|
@@ -11064,45 +10979,6 @@ var seed$6 = 1;
|
|
|
11064
10979
|
this.clearAction.colorAction = exports.TextureLoadAction.whatever;
|
|
11065
10980
|
}
|
|
11066
10981
|
};
|
|
11067
|
-
// protected updateRenderInfo (renderPass: RenderPass): RenderPassInfo {
|
|
11068
|
-
// const map = this.renderPassInfoMap;
|
|
11069
|
-
// const passes = this.renderPasses;
|
|
11070
|
-
// let info: RenderPassInfo;
|
|
11071
|
-
// if (!map.has(renderPass)) {
|
|
11072
|
-
// info = {
|
|
11073
|
-
// intermedia: false,
|
|
11074
|
-
// renderPass: renderPass,
|
|
11075
|
-
// listStart: 0,
|
|
11076
|
-
// listEnd: 0,
|
|
11077
|
-
// };
|
|
11078
|
-
// map.set(renderPass, info);
|
|
11079
|
-
// } else {
|
|
11080
|
-
// info = map.get(renderPass)!;
|
|
11081
|
-
// }
|
|
11082
|
-
// info.intermedia = renderPass.attachments.length > 0;
|
|
11083
|
-
// const meshes = renderPass.meshes;
|
|
11084
|
-
// if (meshes[0]) {
|
|
11085
|
-
// info.listStart = (meshes[0].name === MARS_COPY_MESH_NAME ? meshes[1] : meshes[0]).priority;
|
|
11086
|
-
// info.listEnd = meshes[meshes.length - 1].priority;
|
|
11087
|
-
// } else {
|
|
11088
|
-
// info.listStart = 0;
|
|
11089
|
-
// info.listEnd = 0;
|
|
11090
|
-
// }
|
|
11091
|
-
// const index = passes.indexOf(renderPass);
|
|
11092
|
-
// const depthStencilActon = index === 0 ? TextureLoadAction.clear : TextureLoadAction.whatever;
|
|
11093
|
-
// if (index === 0) {
|
|
11094
|
-
// renderPass.clearAction.colorAction = TextureLoadAction.clear;
|
|
11095
|
-
// }
|
|
11096
|
-
// renderPass.clearAction.depthAction = depthStencilActon;
|
|
11097
|
-
// renderPass.clearAction.stencilAction = depthStencilActon;
|
|
11098
|
-
// if (index > -1) {
|
|
11099
|
-
// renderPass.semantics.setSemantic('EDITOR_TRANSFORM', () => this.editorTransform);
|
|
11100
|
-
// } else {
|
|
11101
|
-
// renderPass.semantics.setSemantic('EDITOR_TRANSFORM', undefined);
|
|
11102
|
-
// }
|
|
11103
|
-
// info.preRenderPass = passes[index - 1];
|
|
11104
|
-
// return info;
|
|
11105
|
-
// }
|
|
11106
10982
|
/**
|
|
11107
10983
|
* 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
|
|
11108
10984
|
* @param passes - RenderPass 数组
|
|
@@ -11303,7 +11179,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
11303
11179
|
var GlobalUniforms = function GlobalUniforms() {
|
|
11304
11180
|
this.floats = {};
|
|
11305
11181
|
this.ints = {};
|
|
11306
|
-
|
|
11182
|
+
this.vector3s = {};
|
|
11307
11183
|
this.vector4s = {};
|
|
11308
11184
|
this.matrices = {};
|
|
11309
11185
|
//...
|
|
@@ -11544,6 +11420,9 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
11544
11420
|
_proto.setGlobalVector4 = function setGlobalVector4(name, value) {
|
|
11545
11421
|
// OVERRIDE
|
|
11546
11422
|
};
|
|
11423
|
+
_proto.setGlobalVector3 = function setGlobalVector3(name, value) {
|
|
11424
|
+
// OVERRIDE
|
|
11425
|
+
};
|
|
11547
11426
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
11548
11427
|
// OVERRIDE
|
|
11549
11428
|
};
|
|
@@ -13209,10 +13088,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13209
13088
|
}
|
|
13210
13089
|
var _proto = Vector4Curve.prototype;
|
|
13211
13090
|
_proto.onCreate = function onCreate(arg) {
|
|
13212
|
-
this.xCurve = createValueGetter(arg
|
|
13213
|
-
this.yCurve = createValueGetter(arg
|
|
13214
|
-
this.zCurve = createValueGetter(arg
|
|
13215
|
-
this.wCurve = createValueGetter(arg
|
|
13091
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13092
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13093
|
+
this.zCurve = createValueGetter(arg[2]);
|
|
13094
|
+
this.wCurve = createValueGetter(arg[3]);
|
|
13216
13095
|
};
|
|
13217
13096
|
_proto.getValue = function getValue(t) {
|
|
13218
13097
|
var x = this.xCurve.getValue(t);
|
|
@@ -13232,8 +13111,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
|
|
|
13232
13111
|
var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
|
|
13233
13112
|
var PLAYER_OPTIONS_ENV_EDITOR = "editor";
|
|
13234
13113
|
var HELP_LINK = {
|
|
13235
|
-
"Item duration can't be less than 0": "https://galacean.
|
|
13236
|
-
"ValueType: 21/22 is not supported": "https://galacean.
|
|
13114
|
+
"Item duration can't be less than 0": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
|
|
13115
|
+
"ValueType: 21/22 is not supported": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"
|
|
13237
13116
|
};
|
|
13238
13117
|
|
|
13239
13118
|
var _obj$4;
|
|
@@ -13312,10 +13191,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13312
13191
|
}
|
|
13313
13192
|
var _proto = ColorCurve.prototype;
|
|
13314
13193
|
_proto.onCreate = function onCreate(arg) {
|
|
13315
|
-
this.rCurve = createValueGetter(arg
|
|
13316
|
-
this.gCurve = createValueGetter(arg
|
|
13317
|
-
this.bCurve = createValueGetter(arg
|
|
13318
|
-
this.aCurve = createValueGetter(arg
|
|
13194
|
+
this.rCurve = createValueGetter(arg[0]);
|
|
13195
|
+
this.gCurve = createValueGetter(arg[1]);
|
|
13196
|
+
this.bCurve = createValueGetter(arg[2]);
|
|
13197
|
+
this.aCurve = createValueGetter(arg[3]);
|
|
13319
13198
|
};
|
|
13320
13199
|
_proto.getValue = function getValue(t) {
|
|
13321
13200
|
var r = this.rCurve.getValue(t);
|
|
@@ -13328,7 +13207,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13328
13207
|
return ColorCurve;
|
|
13329
13208
|
}(ValueGetter);
|
|
13330
13209
|
|
|
13331
|
-
|
|
13210
|
+
/**
|
|
13211
|
+
* @since 2.1.0
|
|
13212
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13332
13213
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13333
13214
|
function BaseRenderComponent(engine) {
|
|
13334
13215
|
var _this;
|
|
@@ -13415,7 +13296,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13415
13296
|
* @param texture - 纹理对象
|
|
13416
13297
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13417
13298
|
this.renderer.texture = texture;
|
|
13418
|
-
this.material.setTexture("
|
|
13299
|
+
this.material.setTexture("_MainTex", texture);
|
|
13419
13300
|
};
|
|
13420
13301
|
/**
|
|
13421
13302
|
* @internal
|
|
@@ -13494,51 +13375,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13494
13375
|
geometry.setIndexData(indexData);
|
|
13495
13376
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13496
13377
|
geometry.setDrawCount(data.index.length);
|
|
13497
|
-
|
|
13498
|
-
var texture1 = textures[i];
|
|
13499
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13500
|
-
}
|
|
13501
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13502
|
-
var emptyTexture = this.emptyTexture;
|
|
13503
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13504
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13505
|
-
}
|
|
13378
|
+
material.setTexture("_MainTex", texture);
|
|
13506
13379
|
};
|
|
13507
13380
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13508
|
-
this.
|
|
13509
|
-
|
|
13510
|
-
0.
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
0
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
2,
|
|
13528
|
-
1,
|
|
13529
|
-
3
|
|
13530
|
-
],
|
|
13531
|
-
atlasOffset: [
|
|
13381
|
+
var renderer = this.renderer;
|
|
13382
|
+
if (renderer.shape) {
|
|
13383
|
+
var _renderer_shape = renderer.shape, _renderer_shape_index = _renderer_shape.index, index = _renderer_shape_index === void 0 ? [] : _renderer_shape_index, _renderer_shape_aPoint = _renderer_shape.aPoint, aPoint = _renderer_shape_aPoint === void 0 ? [] : _renderer_shape_aPoint;
|
|
13384
|
+
var point = new Float32Array(aPoint);
|
|
13385
|
+
var position = [];
|
|
13386
|
+
var atlasOffset = [];
|
|
13387
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13388
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13389
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13390
|
+
}
|
|
13391
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13392
|
+
return {
|
|
13393
|
+
index: index,
|
|
13394
|
+
atlasOffset: atlasOffset
|
|
13395
|
+
};
|
|
13396
|
+
} else {
|
|
13397
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13398
|
+
-0.5,
|
|
13399
|
+
0.5,
|
|
13532
13400
|
0,
|
|
13533
|
-
|
|
13401
|
+
-0.5,
|
|
13402
|
+
-0.5,
|
|
13534
13403
|
0,
|
|
13404
|
+
0.5,
|
|
13405
|
+
0.5,
|
|
13535
13406
|
0,
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
1,
|
|
13407
|
+
0.5,
|
|
13408
|
+
-0.5,
|
|
13539
13409
|
0
|
|
13540
|
-
]
|
|
13541
|
-
|
|
13410
|
+
]));
|
|
13411
|
+
return {
|
|
13412
|
+
index: [
|
|
13413
|
+
0,
|
|
13414
|
+
1,
|
|
13415
|
+
2,
|
|
13416
|
+
2,
|
|
13417
|
+
1,
|
|
13418
|
+
3
|
|
13419
|
+
],
|
|
13420
|
+
atlasOffset: [
|
|
13421
|
+
0,
|
|
13422
|
+
1,
|
|
13423
|
+
0,
|
|
13424
|
+
0,
|
|
13425
|
+
1,
|
|
13426
|
+
1,
|
|
13427
|
+
1,
|
|
13428
|
+
0
|
|
13429
|
+
]
|
|
13430
|
+
};
|
|
13431
|
+
}
|
|
13542
13432
|
};
|
|
13543
13433
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13544
13434
|
return Geometry.create(this.engine, {
|
|
@@ -13603,7 +13493,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13603
13493
|
setBlendMode(material, states.blendMode);
|
|
13604
13494
|
setMaskMode(material, states.maskMode);
|
|
13605
13495
|
setSideMode(material, states.side);
|
|
13606
|
-
material.shader.shaderData.properties = '
|
|
13496
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13607
13497
|
if (!material.hasUniform("_Color")) {
|
|
13608
13498
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13609
13499
|
}
|
|
@@ -15197,6 +15087,473 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15197
15087
|
return Ellipse;
|
|
15198
15088
|
}(ShapePrimitive);
|
|
15199
15089
|
|
|
15090
|
+
var StarType;
|
|
15091
|
+
(function(StarType) {
|
|
15092
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15093
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15094
|
+
})(StarType || (StarType = {}));
|
|
15095
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15096
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15097
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15098
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15099
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15100
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15101
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15102
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15103
|
+
if (starType === void 0) starType = 0;
|
|
15104
|
+
var _this;
|
|
15105
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15106
|
+
_this.pointCount = pointCount;
|
|
15107
|
+
_this.outerRadius = outerRadius;
|
|
15108
|
+
_this.innerRadius = innerRadius;
|
|
15109
|
+
_this.outerRoundness = outerRoundness;
|
|
15110
|
+
_this.innerRoundness = innerRoundness;
|
|
15111
|
+
_this.starType = starType;
|
|
15112
|
+
_this.v = [];
|
|
15113
|
+
_this.in = [];
|
|
15114
|
+
_this.out = [];
|
|
15115
|
+
return _this;
|
|
15116
|
+
}
|
|
15117
|
+
var _proto = PolyStar.prototype;
|
|
15118
|
+
_proto.clone = function clone() {
|
|
15119
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15120
|
+
return polyStar;
|
|
15121
|
+
};
|
|
15122
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15123
|
+
this.pointCount = source.pointCount;
|
|
15124
|
+
this.outerRadius = source.outerRadius;
|
|
15125
|
+
this.innerRadius = source.innerRadius;
|
|
15126
|
+
this.outerRoundness = source.outerRoundness;
|
|
15127
|
+
this.innerRoundness = source.innerRoundness;
|
|
15128
|
+
this.starType = source.starType;
|
|
15129
|
+
};
|
|
15130
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15131
|
+
destination.copyFrom(this);
|
|
15132
|
+
};
|
|
15133
|
+
_proto.build = function build(points) {
|
|
15134
|
+
switch(this.starType){
|
|
15135
|
+
case 0:
|
|
15136
|
+
{
|
|
15137
|
+
this.buildStarPath();
|
|
15138
|
+
break;
|
|
15139
|
+
}
|
|
15140
|
+
case 1:
|
|
15141
|
+
{
|
|
15142
|
+
this.buildPolygonPath();
|
|
15143
|
+
break;
|
|
15144
|
+
}
|
|
15145
|
+
}
|
|
15146
|
+
var smoothness = 1;
|
|
15147
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15148
|
+
buildAdaptiveBezier(points, this.v[i], this.v[i + 1], this.out[i], this.out[i + 1], this.in[i + 2], this.in[i + 3], this.v[i + 2], this.v[i + 3], smoothness);
|
|
15149
|
+
}
|
|
15150
|
+
// draw last curve
|
|
15151
|
+
var lastIndex = this.v.length - 1;
|
|
15152
|
+
buildAdaptiveBezier(points, this.v[lastIndex - 1], this.v[lastIndex], this.out[lastIndex - 1], this.out[lastIndex], this.in[0], this.in[1], this.v[0], this.v[1], smoothness);
|
|
15153
|
+
};
|
|
15154
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15155
|
+
var triangles = triangulate([
|
|
15156
|
+
points
|
|
15157
|
+
]);
|
|
15158
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15159
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15160
|
+
}
|
|
15161
|
+
var vertexCount = triangles.length / 2;
|
|
15162
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15163
|
+
indices[indicesOffset + i1] = i1;
|
|
15164
|
+
}
|
|
15165
|
+
};
|
|
15166
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15167
|
+
this.v = [];
|
|
15168
|
+
this.in = [];
|
|
15169
|
+
this.out = [];
|
|
15170
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15171
|
+
var angle = Math.PI * 2 / numPts;
|
|
15172
|
+
var longFlag = true;
|
|
15173
|
+
var longRad = this.outerRadius;
|
|
15174
|
+
var shortRad = this.innerRadius;
|
|
15175
|
+
var longRound = this.outerRoundness / 100;
|
|
15176
|
+
var shortRound = this.innerRoundness / 100;
|
|
15177
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15178
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15179
|
+
var i;
|
|
15180
|
+
var rad;
|
|
15181
|
+
var roundness;
|
|
15182
|
+
var perimSegment;
|
|
15183
|
+
var currentAng = -Math.PI / 2;
|
|
15184
|
+
var dir = 1;
|
|
15185
|
+
for(i = 0; i < numPts; i++){
|
|
15186
|
+
rad = longFlag ? longRad : shortRad;
|
|
15187
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15188
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15189
|
+
var x = rad * Math.cos(currentAng);
|
|
15190
|
+
var y = rad * Math.sin(currentAng);
|
|
15191
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15192
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15193
|
+
var offset = i * 2;
|
|
15194
|
+
this.v[offset] = x;
|
|
15195
|
+
this.v[offset + 1] = y;
|
|
15196
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15197
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15198
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15199
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15200
|
+
longFlag = !longFlag;
|
|
15201
|
+
currentAng += angle * dir;
|
|
15202
|
+
}
|
|
15203
|
+
};
|
|
15204
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15205
|
+
this.v = [];
|
|
15206
|
+
this.in = [];
|
|
15207
|
+
this.out = [];
|
|
15208
|
+
var numPts = Math.floor(this.pointCount);
|
|
15209
|
+
var angle = Math.PI * 2 / numPts;
|
|
15210
|
+
var rad = this.outerRadius;
|
|
15211
|
+
var roundness = this.outerRoundness / 100;
|
|
15212
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15213
|
+
var i;
|
|
15214
|
+
var currentAng = -Math.PI * 0.5;
|
|
15215
|
+
var dir = 1;
|
|
15216
|
+
for(i = 0; i < numPts; i++){
|
|
15217
|
+
var x = rad * Math.cos(currentAng);
|
|
15218
|
+
var y = rad * Math.sin(currentAng);
|
|
15219
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15220
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15221
|
+
var offset = i * 2;
|
|
15222
|
+
this.v[offset] = x;
|
|
15223
|
+
this.v[offset + 1] = y;
|
|
15224
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15225
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15226
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15227
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15228
|
+
currentAng += angle * dir;
|
|
15229
|
+
}
|
|
15230
|
+
};
|
|
15231
|
+
return PolyStar;
|
|
15232
|
+
}(ShapePrimitive);
|
|
15233
|
+
|
|
15234
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15235
|
+
/**
|
|
15236
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
15237
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15238
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15239
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15240
|
+
function Rectangle(x, y, width, height) {
|
|
15241
|
+
if (x === void 0) x = 0;
|
|
15242
|
+
if (y === void 0) y = 0;
|
|
15243
|
+
if (width === void 0) width = 0;
|
|
15244
|
+
if (height === void 0) height = 0;
|
|
15245
|
+
var _this;
|
|
15246
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15247
|
+
_this.x = Number(x);
|
|
15248
|
+
_this.y = Number(y);
|
|
15249
|
+
_this.width = Number(width);
|
|
15250
|
+
_this.height = Number(height);
|
|
15251
|
+
return _this;
|
|
15252
|
+
}
|
|
15253
|
+
var _proto = Rectangle.prototype;
|
|
15254
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15255
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15256
|
+
};
|
|
15257
|
+
/**
|
|
15258
|
+
* Creates a clone of this Rectangle
|
|
15259
|
+
* @returns a copy of the rectangle
|
|
15260
|
+
*/ _proto.clone = function clone() {
|
|
15261
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15262
|
+
};
|
|
15263
|
+
/**
|
|
15264
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15265
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15266
|
+
* @returns Returns itself.
|
|
15267
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15268
|
+
// this.x = bounds.minX;
|
|
15269
|
+
// this.y = bounds.minY;
|
|
15270
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15271
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15272
|
+
// return this;
|
|
15273
|
+
// }
|
|
15274
|
+
/**
|
|
15275
|
+
* Copies another rectangle to this one.
|
|
15276
|
+
* @param rectangle - The rectangle to copy from.
|
|
15277
|
+
* @returns Returns itself.
|
|
15278
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15279
|
+
this.x = rectangle.x;
|
|
15280
|
+
this.y = rectangle.y;
|
|
15281
|
+
this.width = rectangle.width;
|
|
15282
|
+
this.height = rectangle.height;
|
|
15283
|
+
return this;
|
|
15284
|
+
};
|
|
15285
|
+
/**
|
|
15286
|
+
* Copies this rectangle to another one.
|
|
15287
|
+
* @param rectangle - The rectangle to copy to.
|
|
15288
|
+
* @returns Returns given parameter.
|
|
15289
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15290
|
+
rectangle.copyFrom(this);
|
|
15291
|
+
return rectangle;
|
|
15292
|
+
};
|
|
15293
|
+
/**
|
|
15294
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15295
|
+
* @param x - The X coordinate of the point to test
|
|
15296
|
+
* @param y - The Y coordinate of the point to test
|
|
15297
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15298
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15299
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15300
|
+
return false;
|
|
15301
|
+
}
|
|
15302
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15303
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15304
|
+
return true;
|
|
15305
|
+
}
|
|
15306
|
+
}
|
|
15307
|
+
return false;
|
|
15308
|
+
};
|
|
15309
|
+
/**
|
|
15310
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15311
|
+
* @param x - The X coordinate of the point to test
|
|
15312
|
+
* @param y - The Y coordinate of the point to test
|
|
15313
|
+
* @param strokeWidth - The width of the line to check
|
|
15314
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15315
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15316
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15317
|
+
if (width <= 0 || height <= 0) {
|
|
15318
|
+
return false;
|
|
15319
|
+
}
|
|
15320
|
+
var _x = this.x;
|
|
15321
|
+
var _y = this.y;
|
|
15322
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15323
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15324
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15325
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15326
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15327
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15328
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15329
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15330
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15331
|
+
};
|
|
15332
|
+
/**
|
|
15333
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15334
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15335
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15336
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15337
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15338
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15339
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15340
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15341
|
+
// if (!transform) {
|
|
15342
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15343
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15344
|
+
// if (x1 <= x0) {
|
|
15345
|
+
// return false;
|
|
15346
|
+
// }
|
|
15347
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15348
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15349
|
+
// return y1 > y0;
|
|
15350
|
+
// }
|
|
15351
|
+
// const x0 = this.left;
|
|
15352
|
+
// const x1 = this.right;
|
|
15353
|
+
// const y0 = this.top;
|
|
15354
|
+
// const y1 = this.bottom;
|
|
15355
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15356
|
+
// return false;
|
|
15357
|
+
// }
|
|
15358
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15359
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15360
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15361
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15362
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15363
|
+
// return false;
|
|
15364
|
+
// }
|
|
15365
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15366
|
+
// if (s === 0) {
|
|
15367
|
+
// return false;
|
|
15368
|
+
// }
|
|
15369
|
+
// transform.apply(lt, lt);
|
|
15370
|
+
// transform.apply(lb, lb);
|
|
15371
|
+
// transform.apply(rt, rt);
|
|
15372
|
+
// transform.apply(rb, rb);
|
|
15373
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15374
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15375
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15376
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15377
|
+
// return false;
|
|
15378
|
+
// }
|
|
15379
|
+
// const nx = s * (lb.y - lt.y);
|
|
15380
|
+
// const ny = s * (lt.x - lb.x);
|
|
15381
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15382
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15383
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15384
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15385
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15386
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15387
|
+
// return false;
|
|
15388
|
+
// }
|
|
15389
|
+
// const mx = s * (lt.y - rt.y);
|
|
15390
|
+
// const my = s * (rt.x - lt.x);
|
|
15391
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15392
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15393
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15394
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15395
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15396
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15397
|
+
// return false;
|
|
15398
|
+
// }
|
|
15399
|
+
// return true;
|
|
15400
|
+
// }
|
|
15401
|
+
/**
|
|
15402
|
+
* Pads the rectangle making it grow in all directions.
|
|
15403
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15404
|
+
* @param paddingX - The horizontal padding amount.
|
|
15405
|
+
* @param paddingY - The vertical padding amount.
|
|
15406
|
+
* @returns Returns itself.
|
|
15407
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15408
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15409
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15410
|
+
this.x -= paddingX;
|
|
15411
|
+
this.y -= paddingY;
|
|
15412
|
+
this.width += paddingX * 2;
|
|
15413
|
+
this.height += paddingY * 2;
|
|
15414
|
+
return this;
|
|
15415
|
+
};
|
|
15416
|
+
/**
|
|
15417
|
+
* Fits this rectangle around the passed one.
|
|
15418
|
+
* @param rectangle - The rectangle to fit.
|
|
15419
|
+
* @returns Returns itself.
|
|
15420
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15421
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15422
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15423
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15424
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15425
|
+
this.x = x1;
|
|
15426
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15427
|
+
this.y = y1;
|
|
15428
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15429
|
+
return this;
|
|
15430
|
+
};
|
|
15431
|
+
/**
|
|
15432
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15433
|
+
* @param resolution - resolution
|
|
15434
|
+
* @param eps - precision
|
|
15435
|
+
* @returns Returns itself.
|
|
15436
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15437
|
+
if (resolution === void 0) resolution = 1;
|
|
15438
|
+
if (eps === void 0) eps = 0.001;
|
|
15439
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15440
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15441
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15442
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15443
|
+
this.width = x2 - this.x;
|
|
15444
|
+
this.height = y2 - this.y;
|
|
15445
|
+
return this;
|
|
15446
|
+
};
|
|
15447
|
+
/**
|
|
15448
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15449
|
+
* @param rectangle - The rectangle to include.
|
|
15450
|
+
* @returns Returns itself.
|
|
15451
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15452
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15453
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15454
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15455
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15456
|
+
this.x = x1;
|
|
15457
|
+
this.width = x2 - x1;
|
|
15458
|
+
this.y = y1;
|
|
15459
|
+
this.height = y2 - y1;
|
|
15460
|
+
return this;
|
|
15461
|
+
};
|
|
15462
|
+
/**
|
|
15463
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15464
|
+
* @param out - optional rectangle to store the result
|
|
15465
|
+
* @returns The framing rectangle
|
|
15466
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15467
|
+
out = out || new Rectangle();
|
|
15468
|
+
out.copyFrom(this);
|
|
15469
|
+
return out;
|
|
15470
|
+
};
|
|
15471
|
+
_proto.getX = function getX() {
|
|
15472
|
+
return this.x;
|
|
15473
|
+
};
|
|
15474
|
+
_proto.getY = function getY() {
|
|
15475
|
+
return this.y;
|
|
15476
|
+
};
|
|
15477
|
+
_proto.build = function build(points) {
|
|
15478
|
+
var x = this.x;
|
|
15479
|
+
var y = this.y;
|
|
15480
|
+
var width = this.width;
|
|
15481
|
+
var height = this.height;
|
|
15482
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15483
|
+
return points;
|
|
15484
|
+
}
|
|
15485
|
+
points[0] = x;
|
|
15486
|
+
points[1] = y;
|
|
15487
|
+
points[2] = x + width;
|
|
15488
|
+
points[3] = y;
|
|
15489
|
+
points[4] = x + width;
|
|
15490
|
+
points[5] = y + height;
|
|
15491
|
+
points[6] = x;
|
|
15492
|
+
points[7] = y + height;
|
|
15493
|
+
return points;
|
|
15494
|
+
};
|
|
15495
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15496
|
+
var count = 0;
|
|
15497
|
+
var verticesStride = 2;
|
|
15498
|
+
verticesOffset *= verticesStride;
|
|
15499
|
+
vertices[verticesOffset + count] = points[0];
|
|
15500
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15501
|
+
count += verticesStride;
|
|
15502
|
+
vertices[verticesOffset + count] = points[2];
|
|
15503
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15504
|
+
count += verticesStride;
|
|
15505
|
+
vertices[verticesOffset + count] = points[6];
|
|
15506
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15507
|
+
count += verticesStride;
|
|
15508
|
+
vertices[verticesOffset + count] = points[4];
|
|
15509
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15510
|
+
count += verticesStride;
|
|
15511
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15512
|
+
// triangle 1
|
|
15513
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15514
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15515
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15516
|
+
// triangle 2
|
|
15517
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15518
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15519
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15520
|
+
};
|
|
15521
|
+
_create_class(Rectangle, [
|
|
15522
|
+
{
|
|
15523
|
+
key: "left",
|
|
15524
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15525
|
+
return this.x;
|
|
15526
|
+
}
|
|
15527
|
+
},
|
|
15528
|
+
{
|
|
15529
|
+
key: "right",
|
|
15530
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15531
|
+
return this.x + this.width;
|
|
15532
|
+
}
|
|
15533
|
+
},
|
|
15534
|
+
{
|
|
15535
|
+
key: "top",
|
|
15536
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15537
|
+
return this.y;
|
|
15538
|
+
}
|
|
15539
|
+
},
|
|
15540
|
+
{
|
|
15541
|
+
key: "bottom",
|
|
15542
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15543
|
+
return this.y + this.height;
|
|
15544
|
+
}
|
|
15545
|
+
}
|
|
15546
|
+
], [
|
|
15547
|
+
{
|
|
15548
|
+
key: "EMPTY",
|
|
15549
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15550
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15551
|
+
}
|
|
15552
|
+
}
|
|
15553
|
+
]);
|
|
15554
|
+
return Rectangle;
|
|
15555
|
+
}(ShapePrimitive);
|
|
15556
|
+
|
|
15200
15557
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15201
15558
|
function ShapePath(graphicsPath) {
|
|
15202
15559
|
this.graphicsPath = graphicsPath;
|
|
@@ -15228,6 +15585,16 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15228
15585
|
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15229
15586
|
break;
|
|
15230
15587
|
}
|
|
15588
|
+
case "polyStar":
|
|
15589
|
+
{
|
|
15590
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15591
|
+
break;
|
|
15592
|
+
}
|
|
15593
|
+
case "rect":
|
|
15594
|
+
{
|
|
15595
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15596
|
+
break;
|
|
15597
|
+
}
|
|
15231
15598
|
}
|
|
15232
15599
|
}
|
|
15233
15600
|
this.endPoly();
|
|
@@ -15268,6 +15635,22 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15268
15635
|
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15269
15636
|
return this;
|
|
15270
15637
|
};
|
|
15638
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15639
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15640
|
+
return this;
|
|
15641
|
+
};
|
|
15642
|
+
/**
|
|
15643
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15644
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15645
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15646
|
+
* @param w - The width of the rectangle.
|
|
15647
|
+
* @param h - The height of the rectangle.
|
|
15648
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15649
|
+
* @returns The instance of the current object for chaining.
|
|
15650
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15651
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15652
|
+
return this;
|
|
15653
|
+
};
|
|
15271
15654
|
/**
|
|
15272
15655
|
* Draws a given shape on the canvas.
|
|
15273
15656
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
@@ -15404,8 +15787,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15404
15787
|
};
|
|
15405
15788
|
/**
|
|
15406
15789
|
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15407
|
-
* @param x - The x-coordinate of the
|
|
15408
|
-
* @param y - The y-coordinate of the
|
|
15790
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15791
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15409
15792
|
* @param w - The width of the rectangle.
|
|
15410
15793
|
* @param h - The height of the rectangle.
|
|
15411
15794
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
@@ -15424,6 +15807,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15424
15807
|
this.dirty = true;
|
|
15425
15808
|
return this;
|
|
15426
15809
|
};
|
|
15810
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15811
|
+
this.instructions.push({
|
|
15812
|
+
action: "polyStar",
|
|
15813
|
+
data: [
|
|
15814
|
+
pointCount,
|
|
15815
|
+
outerRadius,
|
|
15816
|
+
innerRadius,
|
|
15817
|
+
outerRoundness,
|
|
15818
|
+
innerRoundness,
|
|
15819
|
+
starType,
|
|
15820
|
+
transform
|
|
15821
|
+
]
|
|
15822
|
+
});
|
|
15823
|
+
this.dirty = true;
|
|
15824
|
+
return this;
|
|
15825
|
+
};
|
|
15427
15826
|
_proto.clear = function clear() {
|
|
15428
15827
|
this.instructions.length = 0;
|
|
15429
15828
|
this.dirty = true;
|
|
@@ -15459,7 +15858,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15459
15858
|
_this.curveValues = [];
|
|
15460
15859
|
_this.animated = true;
|
|
15461
15860
|
_this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
|
|
15462
|
-
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n gl_FragColor = color;\n}\n";
|
|
15861
|
+
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
|
|
15463
15862
|
if (!_this.geometry) {
|
|
15464
15863
|
_this.geometry = Geometry.create(engine, {
|
|
15465
15864
|
attributes: {
|
|
@@ -15501,7 +15900,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15501
15900
|
};
|
|
15502
15901
|
_this.material = Material.create(engine, materialProps);
|
|
15503
15902
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15504
|
-
_this.material.depthMask =
|
|
15903
|
+
_this.material.depthMask = false;
|
|
15505
15904
|
_this.material.depthTest = true;
|
|
15506
15905
|
_this.material.blending = true;
|
|
15507
15906
|
}
|
|
@@ -15566,16 +15965,18 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15566
15965
|
};
|
|
15567
15966
|
_proto.buildPath = function buildPath(data) {
|
|
15568
15967
|
this.path.clear();
|
|
15569
|
-
|
|
15570
|
-
|
|
15968
|
+
var shapeData = data;
|
|
15969
|
+
switch(shapeData.type){
|
|
15970
|
+
case ShapePrimitiveType.Custom:
|
|
15571
15971
|
{
|
|
15572
|
-
var customData =
|
|
15573
|
-
var points = customData.
|
|
15574
|
-
var easingIns = customData.
|
|
15575
|
-
var easingOuts = customData.
|
|
15972
|
+
var customData = shapeData;
|
|
15973
|
+
var points = customData.points;
|
|
15974
|
+
var easingIns = customData.easingIns;
|
|
15975
|
+
var easingOuts = customData.easingOuts;
|
|
15576
15976
|
this.curveValues = [];
|
|
15577
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
15977
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15578
15978
|
var shape = _step.value;
|
|
15979
|
+
this.setFillColor(shape.fill);
|
|
15579
15980
|
var indices = shape.indexes;
|
|
15580
15981
|
for(var i = 1; i < indices.length; i++){
|
|
15581
15982
|
var pointIndex = indices[i];
|
|
@@ -15603,46 +16004,185 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15603
16004
|
}
|
|
15604
16005
|
break;
|
|
15605
16006
|
}
|
|
15606
|
-
case
|
|
16007
|
+
case ShapePrimitiveType.Ellipse:
|
|
15607
16008
|
{
|
|
15608
|
-
var ellipseData =
|
|
15609
|
-
|
|
15610
|
-
this.
|
|
16009
|
+
var ellipseData = shapeData;
|
|
16010
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16011
|
+
this.setFillColor(ellipseData.fill);
|
|
15611
16012
|
break;
|
|
15612
16013
|
}
|
|
16014
|
+
case ShapePrimitiveType.Rectangle:
|
|
16015
|
+
{
|
|
16016
|
+
var rectangleData = shapeData;
|
|
16017
|
+
this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16018
|
+
this.setFillColor(rectangleData.fill);
|
|
16019
|
+
break;
|
|
16020
|
+
}
|
|
16021
|
+
case ShapePrimitiveType.Star:
|
|
16022
|
+
{
|
|
16023
|
+
var starData = shapeData;
|
|
16024
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16025
|
+
this.setFillColor(starData.fill);
|
|
16026
|
+
break;
|
|
16027
|
+
}
|
|
16028
|
+
case ShapePrimitiveType.Polygon:
|
|
16029
|
+
{
|
|
16030
|
+
var polygonData = shapeData;
|
|
16031
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16032
|
+
this.setFillColor(polygonData.fill);
|
|
16033
|
+
break;
|
|
16034
|
+
}
|
|
16035
|
+
}
|
|
16036
|
+
};
|
|
16037
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16038
|
+
if (fill) {
|
|
16039
|
+
var color = fill.color;
|
|
16040
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
15613
16041
|
}
|
|
15614
16042
|
};
|
|
15615
16043
|
_proto.fromData = function fromData(data) {
|
|
15616
16044
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15617
16045
|
this.data = data;
|
|
16046
|
+
var material = this.material;
|
|
16047
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16048
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16049
|
+
data.renderer.mask,
|
|
16050
|
+
data.renderer.mask
|
|
16051
|
+
] : undefined;
|
|
16052
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16053
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15618
16054
|
};
|
|
15619
16055
|
return ShapeComponent;
|
|
15620
16056
|
}(MeshComponent);
|
|
15621
16057
|
exports.ShapeComponent = __decorate([
|
|
15622
16058
|
effectsClass("ShapeComponent")
|
|
15623
16059
|
], exports.ShapeComponent);
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
16060
|
+
|
|
16061
|
+
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16062
|
+
_inherits(Fake3DComponent, Component);
|
|
16063
|
+
function Fake3DComponent() {
|
|
16064
|
+
var _this;
|
|
16065
|
+
_this = Component.apply(this, arguments) || this;
|
|
16066
|
+
_this.loop = false;
|
|
16067
|
+
_this.amountOfMotion = 1.0;
|
|
16068
|
+
_this.animationLength = 2.0;
|
|
16069
|
+
_this.mode = 1;
|
|
16070
|
+
_this.startPositionX = 0;
|
|
16071
|
+
_this.startPositionY = 0;
|
|
16072
|
+
_this.startPositionZ = 0;
|
|
16073
|
+
_this.endPositionX = 0;
|
|
16074
|
+
_this.endPositionY = 0;
|
|
16075
|
+
_this.endPositionZ = 0;
|
|
16076
|
+
_this.amplitudeX = 0;
|
|
16077
|
+
_this.amplitudeY = 0;
|
|
16078
|
+
_this.amplitudeZ = 0;
|
|
16079
|
+
_this.phaseX = 0;
|
|
16080
|
+
_this.phaseY = 0;
|
|
16081
|
+
_this.phaseZ = 0;
|
|
16082
|
+
return _this;
|
|
16083
|
+
}
|
|
16084
|
+
var _proto = Fake3DComponent.prototype;
|
|
16085
|
+
_proto.onStart = function onStart() {
|
|
16086
|
+
this.effectComponent = this.item.getComponent(exports.EffectComponent);
|
|
16087
|
+
};
|
|
16088
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16089
|
+
this.updateFake3D();
|
|
16090
|
+
};
|
|
16091
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16092
|
+
if (!this.effectComponent) {
|
|
16093
|
+
return;
|
|
16094
|
+
}
|
|
16095
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16096
|
+
var _PosX = 0;
|
|
16097
|
+
var _PosY = 0;
|
|
16098
|
+
var _PosZ = 0;
|
|
16099
|
+
switch(this.mode){
|
|
16100
|
+
case 0:
|
|
16101
|
+
{
|
|
16102
|
+
var PI = Math.PI;
|
|
16103
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16104
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16105
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16106
|
+
break;
|
|
16107
|
+
}
|
|
16108
|
+
case 1:
|
|
16109
|
+
{
|
|
16110
|
+
var localTime = time;
|
|
16111
|
+
if (this.loop) {
|
|
16112
|
+
if (localTime > 0.5) {
|
|
16113
|
+
localTime = 1 - localTime;
|
|
16114
|
+
}
|
|
16115
|
+
localTime *= 2;
|
|
16116
|
+
}
|
|
16117
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16118
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16119
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16120
|
+
break;
|
|
16121
|
+
}
|
|
16122
|
+
}
|
|
16123
|
+
var material = this.effectComponent.material;
|
|
16124
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16125
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16126
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16127
|
+
};
|
|
16128
|
+
return Fake3DComponent;
|
|
16129
|
+
}(Component);
|
|
16130
|
+
__decorate([
|
|
16131
|
+
serialize()
|
|
16132
|
+
], exports.Fake3DComponent.prototype, "loop", void 0);
|
|
16133
|
+
__decorate([
|
|
16134
|
+
serialize()
|
|
16135
|
+
], exports.Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16136
|
+
__decorate([
|
|
16137
|
+
serialize()
|
|
16138
|
+
], exports.Fake3DComponent.prototype, "animationLength", void 0);
|
|
16139
|
+
__decorate([
|
|
16140
|
+
serialize()
|
|
16141
|
+
], exports.Fake3DComponent.prototype, "mode", void 0);
|
|
16142
|
+
__decorate([
|
|
16143
|
+
serialize()
|
|
16144
|
+
], exports.Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16145
|
+
__decorate([
|
|
16146
|
+
serialize()
|
|
16147
|
+
], exports.Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16148
|
+
__decorate([
|
|
16149
|
+
serialize()
|
|
16150
|
+
], exports.Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16151
|
+
__decorate([
|
|
16152
|
+
serialize()
|
|
16153
|
+
], exports.Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16154
|
+
__decorate([
|
|
16155
|
+
serialize()
|
|
16156
|
+
], exports.Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16157
|
+
__decorate([
|
|
16158
|
+
serialize()
|
|
16159
|
+
], exports.Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16160
|
+
__decorate([
|
|
16161
|
+
serialize()
|
|
16162
|
+
], exports.Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16163
|
+
__decorate([
|
|
16164
|
+
serialize()
|
|
16165
|
+
], exports.Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16166
|
+
__decorate([
|
|
16167
|
+
serialize()
|
|
16168
|
+
], exports.Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16169
|
+
__decorate([
|
|
16170
|
+
serialize()
|
|
16171
|
+
], exports.Fake3DComponent.prototype, "phaseX", void 0);
|
|
16172
|
+
__decorate([
|
|
16173
|
+
serialize()
|
|
16174
|
+
], exports.Fake3DComponent.prototype, "phaseY", void 0);
|
|
16175
|
+
__decorate([
|
|
16176
|
+
serialize()
|
|
16177
|
+
], exports.Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16178
|
+
exports.Fake3DComponent = __decorate([
|
|
16179
|
+
effectsClass("Fake3DComponent")
|
|
16180
|
+
], exports.Fake3DComponent);
|
|
16181
|
+
exports.Fake3DAnimationMode = void 0;
|
|
16182
|
+
(function(Fake3DAnimationMode) {
|
|
16183
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16184
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16185
|
+
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
15646
16186
|
|
|
15647
16187
|
exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15648
16188
|
_inherits(CameraController, Behaviour);
|
|
@@ -16014,8 +16554,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16014
16554
|
0
|
|
16015
16555
|
]
|
|
16016
16556
|
};
|
|
16557
|
+
_this.duringPlay = false;
|
|
16017
16558
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
16018
|
-
_this.hasBeenAddedToComposition = false;
|
|
16019
16559
|
_this.getHitTestParams = function(force) {
|
|
16020
16560
|
if (!_this.clickable) {
|
|
16021
16561
|
return;
|
|
@@ -16052,7 +16592,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16052
16592
|
];
|
|
16053
16593
|
};
|
|
16054
16594
|
_proto.onStart = function onStart() {
|
|
16055
|
-
var _this = this;
|
|
16056
16595
|
var options = this.item.props.content.options;
|
|
16057
16596
|
var env = this.item.engine.renderer.env;
|
|
16058
16597
|
var composition = this.item.composition;
|
|
@@ -16075,33 +16614,38 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16075
16614
|
this.previewContent.mesh.item = this.item;
|
|
16076
16615
|
this.materials = this.previewContent.mesh.materials;
|
|
16077
16616
|
}
|
|
16078
|
-
this.item.getHitTestParams = this.getHitTestParams;
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
(
|
|
16086
|
-
|
|
16087
|
-
}
|
|
16088
|
-
|
|
16617
|
+
this.item.getHitTestParams = this.getHitTestParams;
|
|
16618
|
+
};
|
|
16619
|
+
_proto.onDisable = function onDisable() {
|
|
16620
|
+
RendererComponent.prototype.onDisable.call(this);
|
|
16621
|
+
if (this.item && this.item.composition) {
|
|
16622
|
+
var _this_previewContent;
|
|
16623
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16624
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16625
|
+
this.duringPlay = false;
|
|
16626
|
+
}
|
|
16627
|
+
this.clickable = false;
|
|
16628
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16629
|
+
this.endDragTarget();
|
|
16630
|
+
}
|
|
16631
|
+
};
|
|
16632
|
+
_proto.onEnable = function onEnable() {
|
|
16633
|
+
RendererComponent.prototype.onEnable.call(this);
|
|
16634
|
+
var type = this.interactData.options.type;
|
|
16635
|
+
if (type === InteractType.CLICK) {
|
|
16636
|
+
this.clickable = true;
|
|
16637
|
+
}
|
|
16089
16638
|
};
|
|
16090
16639
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16091
16640
|
var _this_previewContent;
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16097
|
-
var type = this.interactData.options.type;
|
|
16098
|
-
if (type === InteractType.CLICK) {
|
|
16099
|
-
this.clickable = true;
|
|
16100
|
-
}
|
|
16641
|
+
this.duringPlay = true;
|
|
16642
|
+
// trigger messageBegin when item enter
|
|
16643
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16644
|
+
var _this_item_composition;
|
|
16101
16645
|
var options = this.item.props.content.options;
|
|
16102
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16103
|
-
this.hasBeenAddedToComposition = true;
|
|
16646
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16104
16647
|
}
|
|
16648
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16105
16649
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16106
16650
|
return;
|
|
16107
16651
|
}
|
|
@@ -16269,7 +16813,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16269
16813
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16270
16814
|
}
|
|
16271
16815
|
|
|
16272
|
-
|
|
16816
|
+
/**
|
|
16817
|
+
*
|
|
16818
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16273
16819
|
function MeshCollider() {
|
|
16274
16820
|
this.triangles = [];
|
|
16275
16821
|
}
|
|
@@ -16277,6 +16823,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16277
16823
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16278
16824
|
return this.boundingBoxData;
|
|
16279
16825
|
};
|
|
16826
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
16827
|
+
var maxX = -Number.MAX_VALUE;
|
|
16828
|
+
var maxY = -Number.MAX_VALUE;
|
|
16829
|
+
var minX = Number.MAX_VALUE;
|
|
16830
|
+
var minY = Number.MAX_VALUE;
|
|
16831
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
16832
|
+
var triangle = _step.value;
|
|
16833
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
16834
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
16835
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
16836
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
16837
|
+
}
|
|
16838
|
+
var area = [];
|
|
16839
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
16840
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
16841
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
16842
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
16843
|
+
area.push({
|
|
16844
|
+
p0: point0,
|
|
16845
|
+
p1: point1,
|
|
16846
|
+
p2: point2
|
|
16847
|
+
});
|
|
16848
|
+
area.push({
|
|
16849
|
+
p0: point0,
|
|
16850
|
+
p1: point2,
|
|
16851
|
+
p2: point3
|
|
16852
|
+
});
|
|
16853
|
+
return {
|
|
16854
|
+
type: exports.HitTestType.triangle,
|
|
16855
|
+
area: area
|
|
16856
|
+
};
|
|
16857
|
+
};
|
|
16280
16858
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16281
16859
|
if (this.geometry !== geometry) {
|
|
16282
16860
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16481,6 +17059,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16481
17059
|
if (inputCount === void 0) inputCount = 0;
|
|
16482
17060
|
this.onPlayablePlayFlag = true;
|
|
16483
17061
|
this.onPlayablePauseFlag = false;
|
|
17062
|
+
this.duration = 0;
|
|
16484
17063
|
this.destroyed = false;
|
|
16485
17064
|
this.inputs = [];
|
|
16486
17065
|
this.inputOuputPorts = [];
|
|
@@ -16573,6 +17152,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16573
17152
|
_proto.getTime = function getTime() {
|
|
16574
17153
|
return this.time;
|
|
16575
17154
|
};
|
|
17155
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17156
|
+
this.duration = duration;
|
|
17157
|
+
};
|
|
17158
|
+
_proto.getDuration = function getDuration() {
|
|
17159
|
+
return this.duration;
|
|
17160
|
+
};
|
|
16576
17161
|
_proto.getPlayState = function getPlayState() {
|
|
16577
17162
|
return this.playState;
|
|
16578
17163
|
};
|
|
@@ -16724,7 +17309,9 @@ var PlayableTraversalMode;
|
|
|
16724
17309
|
var tempQuat$1 = new Quaternion();
|
|
16725
17310
|
var seed$4 = 1;
|
|
16726
17311
|
// TODO 继承 Component
|
|
16727
|
-
|
|
17312
|
+
/**
|
|
17313
|
+
*
|
|
17314
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16728
17315
|
function Transform(props, parent) {
|
|
16729
17316
|
if (props === void 0) props = {};
|
|
16730
17317
|
this.taggedProperties = {};
|
|
@@ -17189,7 +17776,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17189
17776
|
return Transform;
|
|
17190
17777
|
}();
|
|
17191
17778
|
|
|
17192
|
-
|
|
17779
|
+
/**
|
|
17780
|
+
*
|
|
17781
|
+
*/ /**
|
|
17782
|
+
* 事件监听器
|
|
17783
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17193
17784
|
var _this = this;
|
|
17194
17785
|
var _this1 = this;
|
|
17195
17786
|
this.listeners = {};
|
|
@@ -17283,17 +17874,15 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17283
17874
|
/**
|
|
17284
17875
|
* 元素动画结束时行为(如何处理元素)
|
|
17285
17876
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17286
|
-
/**
|
|
17287
|
-
* 元素是否可用
|
|
17288
|
-
*/ _this.ended = false;
|
|
17289
|
-
_this.reusable = false;
|
|
17290
17877
|
_this.type = ItemType.base;
|
|
17291
17878
|
_this.isDuringPlay = false;
|
|
17292
17879
|
_this.components = [];
|
|
17293
17880
|
_this.rendererComponents = [];
|
|
17294
17881
|
/**
|
|
17295
|
-
*
|
|
17296
|
-
|
|
17882
|
+
* 元素是否激活
|
|
17883
|
+
*/ _this.active = true;
|
|
17884
|
+
/**
|
|
17885
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17297
17886
|
*/ _this.visible = true;
|
|
17298
17887
|
/**
|
|
17299
17888
|
* 元素动画的速度
|
|
@@ -17424,12 +18013,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17424
18013
|
}
|
|
17425
18014
|
};
|
|
17426
18015
|
/**
|
|
17427
|
-
* 元素动画结束播放时回调函数
|
|
17428
|
-
* @override
|
|
17429
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17430
|
-
// OVERRIDE
|
|
17431
|
-
};
|
|
17432
|
-
/**
|
|
17433
18016
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17434
18017
|
* @param {number} r
|
|
17435
18018
|
* @param {number} g
|
|
@@ -17442,17 +18025,27 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17442
18025
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17443
18026
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17444
18027
|
/**
|
|
17445
|
-
*
|
|
17446
|
-
*/ _proto.
|
|
17447
|
-
|
|
18028
|
+
* 激活或停用 VFXItem
|
|
18029
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18030
|
+
if (this.active !== value) {
|
|
18031
|
+
this.active = !!value;
|
|
18032
|
+
this.onActiveChanged();
|
|
18033
|
+
}
|
|
17448
18034
|
};
|
|
17449
18035
|
/**
|
|
17450
|
-
*
|
|
18036
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17451
18037
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
18038
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18039
|
+
var component = _step.value;
|
|
18040
|
+
component.enabled = visible;
|
|
17455
18041
|
}
|
|
18042
|
+
this.visible = visible;
|
|
18043
|
+
};
|
|
18044
|
+
/**
|
|
18045
|
+
* 元素组件显隐状态
|
|
18046
|
+
* @deprecated use isVisible instead
|
|
18047
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18048
|
+
return this.visible;
|
|
17456
18049
|
};
|
|
17457
18050
|
/**
|
|
17458
18051
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17534,14 +18127,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17534
18127
|
this.transform.assignWorldTRS(pos);
|
|
17535
18128
|
return pos;
|
|
17536
18129
|
};
|
|
17537
|
-
/**
|
|
17538
|
-
* 是否到达元素的结束时间
|
|
17539
|
-
* @param now
|
|
17540
|
-
* @returns
|
|
17541
|
-
*/ _proto.isEnded = function isEnded(now) {
|
|
17542
|
-
// at least 1 ms
|
|
17543
|
-
return now - this.duration > 0.001;
|
|
17544
|
-
};
|
|
17545
18130
|
_proto.find = function find(name) {
|
|
17546
18131
|
var _queue;
|
|
17547
18132
|
if (this.name === name) {
|
|
@@ -17565,7 +18150,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17565
18150
|
* @internal
|
|
17566
18151
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17567
18152
|
this.isDuringPlay = true;
|
|
17568
|
-
if (this.composition && this.
|
|
18153
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17569
18154
|
this.onEnable();
|
|
17570
18155
|
}
|
|
17571
18156
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17659,7 +18244,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17659
18244
|
options: {}
|
|
17660
18245
|
};
|
|
17661
18246
|
}
|
|
17662
|
-
if (duration
|
|
18247
|
+
if (duration < 0) {
|
|
17663
18248
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
17664
18249
|
}
|
|
17665
18250
|
this.rendererComponents.length = 0;
|
|
@@ -17749,25 +18334,54 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17749
18334
|
// }
|
|
17750
18335
|
// }
|
|
17751
18336
|
};
|
|
17752
|
-
|
|
18337
|
+
/**
|
|
18338
|
+
*
|
|
18339
|
+
* @param item
|
|
18340
|
+
* @returns
|
|
18341
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17753
18342
|
return item.type === ItemType.composition;
|
|
17754
18343
|
};
|
|
17755
|
-
|
|
18344
|
+
/**
|
|
18345
|
+
*
|
|
18346
|
+
* @param item
|
|
18347
|
+
* @returns
|
|
18348
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17756
18349
|
return item.type === ItemType.sprite;
|
|
17757
18350
|
};
|
|
17758
|
-
|
|
18351
|
+
/**
|
|
18352
|
+
*
|
|
18353
|
+
* @param item
|
|
18354
|
+
* @returns
|
|
18355
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17759
18356
|
return item.type === ItemType.particle;
|
|
17760
18357
|
};
|
|
17761
|
-
|
|
18358
|
+
/**
|
|
18359
|
+
*
|
|
18360
|
+
* @param item
|
|
18361
|
+
* @returns
|
|
18362
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17762
18363
|
return item.type === ItemType.null;
|
|
17763
18364
|
};
|
|
17764
|
-
|
|
18365
|
+
/**
|
|
18366
|
+
*
|
|
18367
|
+
* @param item
|
|
18368
|
+
* @returns
|
|
18369
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17765
18370
|
return item.type === ItemType.tree;
|
|
17766
18371
|
};
|
|
17767
|
-
|
|
18372
|
+
/**
|
|
18373
|
+
*
|
|
18374
|
+
* @param item
|
|
18375
|
+
* @returns
|
|
18376
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17768
18377
|
return item.type === ItemType.camera;
|
|
17769
18378
|
};
|
|
17770
|
-
|
|
18379
|
+
/**
|
|
18380
|
+
*
|
|
18381
|
+
* @param ancestorCandidate
|
|
18382
|
+
* @param descendantCandidate
|
|
18383
|
+
* @returns
|
|
18384
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17771
18385
|
var current = descendantCandidate.parent;
|
|
17772
18386
|
while(current){
|
|
17773
18387
|
if (current === ancestorCandidate) {
|
|
@@ -17812,6 +18426,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17812
18426
|
}
|
|
17813
18427
|
}
|
|
17814
18428
|
}
|
|
18429
|
+
},
|
|
18430
|
+
{
|
|
18431
|
+
key: "isActive",
|
|
18432
|
+
get: /**
|
|
18433
|
+
* 当前 VFXItem 是否激活
|
|
18434
|
+
*/ function get() {
|
|
18435
|
+
return this.active;
|
|
18436
|
+
}
|
|
18437
|
+
},
|
|
18438
|
+
{
|
|
18439
|
+
key: "isVisible",
|
|
18440
|
+
get: /**
|
|
18441
|
+
* 元素组件显隐状态
|
|
18442
|
+
*/ function get() {
|
|
18443
|
+
return this.visible;
|
|
18444
|
+
}
|
|
17815
18445
|
}
|
|
17816
18446
|
]);
|
|
17817
18447
|
return VFXItem;
|
|
@@ -17975,6 +18605,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
17975
18605
|
}
|
|
17976
18606
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
17977
18607
|
var ta = this.textureSheetAnimation;
|
|
18608
|
+
var video = this.renderer.texture.source.video;
|
|
18609
|
+
if (video) {
|
|
18610
|
+
if (time === 0) {
|
|
18611
|
+
video.pause();
|
|
18612
|
+
} else {
|
|
18613
|
+
video.play().catch(function(e) {
|
|
18614
|
+
_this.engine.renderErrors.add(e);
|
|
18615
|
+
});
|
|
18616
|
+
}
|
|
18617
|
+
}
|
|
17978
18618
|
if (ta) {
|
|
17979
18619
|
var _this_material_getVector4;
|
|
17980
18620
|
var total = ta.total || ta.row * ta.col;
|
|
@@ -18029,21 +18669,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18029
18669
|
dy
|
|
18030
18670
|
]);
|
|
18031
18671
|
}
|
|
18032
|
-
var video = this.renderer.texture.source.video;
|
|
18033
|
-
if (video) {
|
|
18034
|
-
if (time === 0 || time === this.item.duration) {
|
|
18035
|
-
video.pause();
|
|
18036
|
-
} else {
|
|
18037
|
-
video.play().catch(function(e) {
|
|
18038
|
-
_this.engine.renderErrors.add(e);
|
|
18039
|
-
});
|
|
18040
|
-
}
|
|
18041
|
-
}
|
|
18042
18672
|
};
|
|
18043
18673
|
_proto.onDestroy = function onDestroy() {
|
|
18674
|
+
var textures = this.getTextures();
|
|
18044
18675
|
if (this.item && this.item.composition) {
|
|
18045
|
-
this.item.composition.destroyTextures(
|
|
18676
|
+
this.item.composition.destroyTextures(textures);
|
|
18046
18677
|
}
|
|
18678
|
+
textures.forEach(function(texture) {
|
|
18679
|
+
var source = texture.source;
|
|
18680
|
+
if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
|
|
18681
|
+
source.video.pause();
|
|
18682
|
+
source.video.src = "";
|
|
18683
|
+
source.video.load();
|
|
18684
|
+
}
|
|
18685
|
+
});
|
|
18047
18686
|
};
|
|
18048
18687
|
_proto.createGeometry = function createGeometry(mode) {
|
|
18049
18688
|
var maxVertex = 12 * this.splits.length;
|
|
@@ -18482,7 +19121,7 @@ var ShapeNone = /*#__PURE__*/ function() {
|
|
|
18482
19121
|
return ShapeNone;
|
|
18483
19122
|
}();
|
|
18484
19123
|
var _obj$3;
|
|
18485
|
-
var map = (_obj$3 = {}, _obj$3[
|
|
19124
|
+
var map = (_obj$3 = {}, _obj$3[ParticleEmitterShapeType.NONE] = ShapeNone, _obj$3[ParticleEmitterShapeType.CONE] = Cone, _obj$3[ParticleEmitterShapeType.SPHERE] = Sphere, _obj$3[ParticleEmitterShapeType.HEMISPHERE] = Hemisphere, _obj$3[ParticleEmitterShapeType.CIRCLE] = Circle, _obj$3[ParticleEmitterShapeType.DONUT] = Donut, _obj$3[ParticleEmitterShapeType.RECTANGLE] = Rectangle, _obj$3[ParticleEmitterShapeType.EDGE] = Edge, _obj$3[ParticleEmitterShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$3[ParticleEmitterShapeType.TEXTURE] = TextureShape, _obj$3);
|
|
18486
19125
|
function createShape(shapeOptions) {
|
|
18487
19126
|
if (!shapeOptions) {
|
|
18488
19127
|
return new ShapeNone();
|
|
@@ -18499,7 +19138,7 @@ function createShape(shapeOptions) {
|
|
|
18499
19138
|
throw new Error("Invalid shape: " + type + ".");
|
|
18500
19139
|
}
|
|
18501
19140
|
var ctrl = new Ctrl(options);
|
|
18502
|
-
if (type !==
|
|
19141
|
+
if (type !== ParticleEmitterShapeType.NONE) {
|
|
18503
19142
|
var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
|
|
18504
19143
|
0,
|
|
18505
19144
|
0,
|
|
@@ -22576,6 +23215,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22576
23215
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22577
23216
|
var timelineClip = _step.value;
|
|
22578
23217
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23218
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22579
23219
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22580
23220
|
runtimeClips.push(clip);
|
|
22581
23221
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22679,14 +23319,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22679
23319
|
this.playable.setTime(clipTime);
|
|
22680
23320
|
// 判断动画是否结束
|
|
22681
23321
|
if (ended) {
|
|
22682
|
-
if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
|
|
22683
|
-
boundObject.ended = true;
|
|
22684
|
-
boundObject.onEnd();
|
|
22685
|
-
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
22686
|
-
boundObject.dispose();
|
|
22687
|
-
this.playable.dispose();
|
|
22688
|
-
}
|
|
22689
|
-
}
|
|
22690
23322
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22691
23323
|
this.playable.pause();
|
|
22692
23324
|
}
|
|
@@ -22729,26 +23361,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22729
23361
|
}
|
|
22730
23362
|
if (hasInput) {
|
|
22731
23363
|
boundItem.transform.setValid(true);
|
|
22732
|
-
|
|
23364
|
+
boundItem.setActive(true);
|
|
22733
23365
|
} else {
|
|
22734
23366
|
boundItem.transform.setValid(false);
|
|
22735
|
-
|
|
22736
|
-
}
|
|
22737
|
-
};
|
|
22738
|
-
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
22739
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22740
|
-
var rendererComponent = _step.value;
|
|
22741
|
-
if (rendererComponent.enabled) {
|
|
22742
|
-
rendererComponent.enabled = false;
|
|
22743
|
-
}
|
|
22744
|
-
}
|
|
22745
|
-
};
|
|
22746
|
-
_proto.showRendererComponents = function showRendererComponents(item) {
|
|
22747
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22748
|
-
var rendererComponent = _step.value;
|
|
22749
|
-
if (!rendererComponent.enabled) {
|
|
22750
|
-
rendererComponent.enabled = true;
|
|
22751
|
-
}
|
|
23367
|
+
boundItem.setActive(false);
|
|
22752
23368
|
}
|
|
22753
23369
|
};
|
|
22754
23370
|
return ActivationMixerPlayable;
|
|
@@ -22776,7 +23392,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22776
23392
|
}
|
|
22777
23393
|
var _proto = PropertyClipPlayable.prototype;
|
|
22778
23394
|
_proto.processFrame = function processFrame(context) {
|
|
22779
|
-
this.value = this.curve.getValue(this.time);
|
|
23395
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22780
23396
|
};
|
|
22781
23397
|
return PropertyClipPlayable;
|
|
22782
23398
|
}(Playable);
|
|
@@ -23294,9 +23910,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23294
23910
|
var track = _step.value;
|
|
23295
23911
|
var boundObject = track.boundObject;
|
|
23296
23912
|
if (_instanceof1(boundObject, exports.VFXItem)) {
|
|
23297
|
-
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
23298
|
-
boundObject.reusable = value;
|
|
23299
|
-
}
|
|
23300
23913
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23301
23914
|
if (subCompositionComponent) {
|
|
23302
23915
|
subCompositionComponent.setReusable(value);
|
|
@@ -23341,16 +23954,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23341
23954
|
}
|
|
23342
23955
|
}
|
|
23343
23956
|
};
|
|
23344
|
-
_proto.
|
|
23957
|
+
_proto.onEnable = function onEnable() {
|
|
23345
23958
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23346
23959
|
var item = _step.value;
|
|
23347
|
-
item.
|
|
23960
|
+
item.setActive(true);
|
|
23348
23961
|
}
|
|
23349
23962
|
};
|
|
23350
|
-
_proto.
|
|
23963
|
+
_proto.onDisable = function onDisable() {
|
|
23351
23964
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23352
23965
|
var item = _step.value;
|
|
23353
|
-
item.
|
|
23966
|
+
item.setActive(false);
|
|
23354
23967
|
}
|
|
23355
23968
|
};
|
|
23356
23969
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23366,7 +23979,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23366
23979
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23367
23980
|
var _this, _loop = function(i) {
|
|
23368
23981
|
var item = _this.items[i];
|
|
23369
|
-
if (item.
|
|
23982
|
+
if (item.isActive && item.transform.getValid() && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
23370
23983
|
var hitParams = item.getHitTestParams(force);
|
|
23371
23984
|
if (hitParams) {
|
|
23372
23985
|
var success = false;
|
|
@@ -23455,9 +24068,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23455
24068
|
var sceneBinding = _step.value;
|
|
23456
24069
|
sceneBinding.key.boundObject = sceneBinding.value;
|
|
23457
24070
|
}
|
|
23458
|
-
//
|
|
24071
|
+
// 为了通过帧对比,需要保证和原有的 update 时机一致。
|
|
23459
24072
|
// 因此这边更新一次对象绑定,后续 timeline playable 中 sort tracks 的排序才能和原先的版本对上。
|
|
23460
|
-
// 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline
|
|
24073
|
+
// 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline asset 中的 sortTracks 都能去掉。
|
|
23461
24074
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
|
|
23462
24075
|
var masterTrack = _step1.value;
|
|
23463
24076
|
this.updateTrackAnimatedObject(masterTrack);
|
|
@@ -23508,9 +24121,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23508
24121
|
}
|
|
23509
24122
|
}
|
|
23510
24123
|
if (hasInput) {
|
|
23511
|
-
compositionComponent.
|
|
24124
|
+
compositionComponent.item.setActive(true);
|
|
23512
24125
|
} else {
|
|
23513
|
-
compositionComponent.
|
|
24126
|
+
compositionComponent.item.setActive(false);
|
|
23514
24127
|
}
|
|
23515
24128
|
};
|
|
23516
24129
|
return SubCompositionMixerPlayable;
|
|
@@ -23561,6 +24174,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23561
24174
|
return Vector4PropertyMixerPlayable;
|
|
23562
24175
|
}(Playable);
|
|
23563
24176
|
|
|
24177
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
24178
|
+
_inherits(ColorPropertyMixerPlayable, Playable);
|
|
24179
|
+
function ColorPropertyMixerPlayable() {
|
|
24180
|
+
var _this;
|
|
24181
|
+
_this = Playable.apply(this, arguments) || this;
|
|
24182
|
+
_this.propertyName = "";
|
|
24183
|
+
return _this;
|
|
24184
|
+
}
|
|
24185
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
24186
|
+
_proto.processFrame = function processFrame(context) {
|
|
24187
|
+
var boundObject = context.output.getUserData();
|
|
24188
|
+
if (!boundObject) {
|
|
24189
|
+
return;
|
|
24190
|
+
}
|
|
24191
|
+
var hasInput = false;
|
|
24192
|
+
var value = boundObject[this.propertyName];
|
|
24193
|
+
if (!_instanceof1(value, Color)) {
|
|
24194
|
+
return;
|
|
24195
|
+
}
|
|
24196
|
+
value.setZero();
|
|
24197
|
+
// evaluate the curve
|
|
24198
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
24199
|
+
var weight = this.getInputWeight(i);
|
|
24200
|
+
if (weight > 0) {
|
|
24201
|
+
var propertyClipPlayable = this.getInput(i);
|
|
24202
|
+
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
24203
|
+
console.error("ColorPropertyMixerPlayable received incompatible input");
|
|
24204
|
+
continue;
|
|
24205
|
+
}
|
|
24206
|
+
var curveValue = propertyClipPlayable.value;
|
|
24207
|
+
value.r += curveValue.r * weight;
|
|
24208
|
+
value.g += curveValue.g * weight;
|
|
24209
|
+
value.b += curveValue.b * weight;
|
|
24210
|
+
value.a += curveValue.a * weight;
|
|
24211
|
+
hasInput = true;
|
|
24212
|
+
}
|
|
24213
|
+
}
|
|
24214
|
+
// set value
|
|
24215
|
+
if (hasInput) {
|
|
24216
|
+
boundObject[this.propertyName] = value;
|
|
24217
|
+
}
|
|
24218
|
+
};
|
|
24219
|
+
return ColorPropertyMixerPlayable;
|
|
24220
|
+
}(Playable);
|
|
24221
|
+
|
|
23564
24222
|
var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
23565
24223
|
_inherits(PropertyTrack, TrackAsset);
|
|
23566
24224
|
function PropertyTrack() {
|
|
@@ -23720,7 +24378,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
23720
24378
|
}
|
|
23721
24379
|
var _proto = ColorPropertyTrack.prototype;
|
|
23722
24380
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
23723
|
-
var mixer = new
|
|
24381
|
+
var mixer = new ColorPropertyMixerPlayable(graph);
|
|
23724
24382
|
var propertyNames = this.propertyNames;
|
|
23725
24383
|
if (propertyNames.length > 0) {
|
|
23726
24384
|
var propertyName = propertyNames[propertyNames.length - 1];
|
|
@@ -23734,6 +24392,27 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
23734
24392
|
effectsClass(DataType.ColorPropertyTrack)
|
|
23735
24393
|
], exports.ColorPropertyTrack);
|
|
23736
24394
|
|
|
24395
|
+
exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24396
|
+
_inherits(ColorPropertyPlayableAsset, PlayableAsset);
|
|
24397
|
+
function ColorPropertyPlayableAsset() {
|
|
24398
|
+
return PlayableAsset.apply(this, arguments);
|
|
24399
|
+
}
|
|
24400
|
+
var _proto = ColorPropertyPlayableAsset.prototype;
|
|
24401
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24402
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24403
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24404
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24405
|
+
return clipPlayable;
|
|
24406
|
+
};
|
|
24407
|
+
return ColorPropertyPlayableAsset;
|
|
24408
|
+
}(PlayableAsset);
|
|
24409
|
+
__decorate([
|
|
24410
|
+
serialize()
|
|
24411
|
+
], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24412
|
+
exports.ColorPropertyPlayableAsset = __decorate([
|
|
24413
|
+
effectsClass(DataType.ColorPropertyPlayableAsset)
|
|
24414
|
+
], exports.ColorPropertyPlayableAsset);
|
|
24415
|
+
|
|
23737
24416
|
exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
23738
24417
|
_inherits(FloatPropertyPlayableAsset, PlayableAsset);
|
|
23739
24418
|
function FloatPropertyPlayableAsset() {
|
|
@@ -23793,6 +24472,7 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
23793
24472
|
var _this;
|
|
23794
24473
|
_this = PlayableAsset.apply(this, arguments) || this;
|
|
23795
24474
|
_this.tracks = [];
|
|
24475
|
+
_this.cacheFlattenedTracks = null;
|
|
23796
24476
|
return _this;
|
|
23797
24477
|
}
|
|
23798
24478
|
var _proto = TimelineAsset.prototype;
|
|
@@ -23805,16 +24485,62 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
23805
24485
|
track.create(this);
|
|
23806
24486
|
}
|
|
23807
24487
|
}
|
|
23808
|
-
|
|
24488
|
+
this.sortTracks(this.tracks);
|
|
24489
|
+
timelinePlayable.compileTracks(graph, this.flattenedTracks);
|
|
23809
24490
|
return timelinePlayable;
|
|
23810
24491
|
};
|
|
23811
24492
|
_proto.createTrack = function createTrack(classConstructor, parent, name) {
|
|
23812
24493
|
var newTrack = new classConstructor(this.engine);
|
|
23813
24494
|
newTrack.name = name ? name : classConstructor.name;
|
|
23814
24495
|
parent.addChild(newTrack);
|
|
24496
|
+
this.invalidate();
|
|
23815
24497
|
return newTrack;
|
|
23816
24498
|
};
|
|
24499
|
+
/**
|
|
24500
|
+
* Invalidates the asset, called when tracks data changed
|
|
24501
|
+
*/ _proto.invalidate = function invalidate() {
|
|
24502
|
+
this.cacheFlattenedTracks = null;
|
|
24503
|
+
};
|
|
24504
|
+
_proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
|
|
24505
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
24506
|
+
var subTrack = _step.value;
|
|
24507
|
+
allTracks.push(subTrack);
|
|
24508
|
+
}
|
|
24509
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
|
|
24510
|
+
var subTrack1 = _step1.value;
|
|
24511
|
+
this.addSubTracksRecursive(subTrack1, allTracks);
|
|
24512
|
+
}
|
|
24513
|
+
};
|
|
24514
|
+
_proto.sortTracks = function sortTracks(tracks) {
|
|
24515
|
+
var sortedTracks = [];
|
|
24516
|
+
for(var i = 0; i < tracks.length; i++){
|
|
24517
|
+
sortedTracks.push(new TrackSortWrapper(tracks[i], i));
|
|
24518
|
+
}
|
|
24519
|
+
sortedTracks.sort(compareTracks);
|
|
24520
|
+
tracks.length = 0;
|
|
24521
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
|
|
24522
|
+
var trackWrapper = _step.value;
|
|
24523
|
+
tracks.push(trackWrapper.track);
|
|
24524
|
+
}
|
|
24525
|
+
};
|
|
23817
24526
|
_proto.fromData = function fromData(data) {};
|
|
24527
|
+
_create_class(TimelineAsset, [
|
|
24528
|
+
{
|
|
24529
|
+
key: "flattenedTracks",
|
|
24530
|
+
get: function get() {
|
|
24531
|
+
if (!this.cacheFlattenedTracks) {
|
|
24532
|
+
this.cacheFlattenedTracks = [];
|
|
24533
|
+
// flatten track tree
|
|
24534
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
24535
|
+
var masterTrack = _step.value;
|
|
24536
|
+
this.cacheFlattenedTracks.push(masterTrack);
|
|
24537
|
+
this.addSubTracksRecursive(masterTrack, this.cacheFlattenedTracks);
|
|
24538
|
+
}
|
|
24539
|
+
}
|
|
24540
|
+
return this.cacheFlattenedTracks;
|
|
24541
|
+
}
|
|
24542
|
+
}
|
|
24543
|
+
]);
|
|
23818
24544
|
return TimelineAsset;
|
|
23819
24545
|
}(PlayableAsset);
|
|
23820
24546
|
__decorate([
|
|
@@ -23847,18 +24573,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23847
24573
|
}
|
|
23848
24574
|
};
|
|
23849
24575
|
_proto.compileTracks = function compileTracks(graph, tracks) {
|
|
23850
|
-
|
|
23851
|
-
var outputTrack = [];
|
|
23852
|
-
// flatten track tree
|
|
23853
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
23854
|
-
var masterTrack = _step.value;
|
|
23855
|
-
outputTrack.push(masterTrack);
|
|
23856
|
-
this.addSubTracksRecursive(masterTrack, outputTrack);
|
|
23857
|
-
}
|
|
24576
|
+
var outputTrack = tracks;
|
|
23858
24577
|
// map for searching track instance with track asset guid
|
|
23859
24578
|
var trackInstanceMap = {};
|
|
23860
|
-
for(var
|
|
23861
|
-
var track =
|
|
24579
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(outputTrack), _step; !(_step = _iterator()).done;){
|
|
24580
|
+
var track = _step.value;
|
|
23862
24581
|
// create track mixer and track output
|
|
23863
24582
|
var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
|
|
23864
24583
|
this.addInput(trackMixPlayable, 0);
|
|
@@ -23874,11 +24593,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23874
24593
|
}
|
|
23875
24594
|
}
|
|
23876
24595
|
// build trackInstance tree
|
|
23877
|
-
for(var
|
|
23878
|
-
var track1 =
|
|
24596
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
|
|
24597
|
+
var track1 = _step1.value;
|
|
23879
24598
|
var trackInstance1 = trackInstanceMap[track1.getInstanceId()];
|
|
23880
|
-
for(var
|
|
23881
|
-
var child =
|
|
24599
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step2; !(_step2 = _iterator2()).done;){
|
|
24600
|
+
var child = _step2.value;
|
|
23882
24601
|
var childTrackInstance = trackInstanceMap[child.getInstanceId()];
|
|
23883
24602
|
trackInstance1.addChild(childTrackInstance);
|
|
23884
24603
|
}
|
|
@@ -23895,28 +24614,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23895
24614
|
this.updateTrackAnimatedObject(trackInstance.children);
|
|
23896
24615
|
}
|
|
23897
24616
|
};
|
|
23898
|
-
_proto.sortTracks = function sortTracks(tracks) {
|
|
23899
|
-
var sortedTracks = [];
|
|
23900
|
-
for(var i = 0; i < tracks.length; i++){
|
|
23901
|
-
sortedTracks.push(new TrackSortWrapper(tracks[i], i));
|
|
23902
|
-
}
|
|
23903
|
-
sortedTracks.sort(compareTracks);
|
|
23904
|
-
tracks.length = 0;
|
|
23905
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
|
|
23906
|
-
var trackWrapper = _step.value;
|
|
23907
|
-
tracks.push(trackWrapper.track);
|
|
23908
|
-
}
|
|
23909
|
-
};
|
|
23910
|
-
_proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
|
|
23911
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23912
|
-
var subTrack = _step.value;
|
|
23913
|
-
allTracks.push(subTrack);
|
|
23914
|
-
}
|
|
23915
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
|
|
23916
|
-
var subTrack1 = _step1.value;
|
|
23917
|
-
this.addSubTracksRecursive(subTrack1, allTracks);
|
|
23918
|
-
}
|
|
23919
|
-
};
|
|
23920
24617
|
return TimelinePlayable;
|
|
23921
24618
|
}(Playable);
|
|
23922
24619
|
var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
@@ -23938,6 +24635,27 @@ function compareTracks(a, b) {
|
|
|
23938
24635
|
}
|
|
23939
24636
|
}
|
|
23940
24637
|
|
|
24638
|
+
exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24639
|
+
_inherits(Vector4PropertyPlayableAsset, PlayableAsset);
|
|
24640
|
+
function Vector4PropertyPlayableAsset() {
|
|
24641
|
+
return PlayableAsset.apply(this, arguments);
|
|
24642
|
+
}
|
|
24643
|
+
var _proto = Vector4PropertyPlayableAsset.prototype;
|
|
24644
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24645
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24646
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24647
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24648
|
+
return clipPlayable;
|
|
24649
|
+
};
|
|
24650
|
+
return Vector4PropertyPlayableAsset;
|
|
24651
|
+
}(PlayableAsset);
|
|
24652
|
+
__decorate([
|
|
24653
|
+
serialize()
|
|
24654
|
+
], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24655
|
+
exports.Vector4PropertyPlayableAsset = __decorate([
|
|
24656
|
+
effectsClass("Vector4PropertyPlayableAsset")
|
|
24657
|
+
], exports.Vector4PropertyPlayableAsset);
|
|
24658
|
+
|
|
23941
24659
|
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
23942
24660
|
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
23943
24661
|
function ObjectBindingTrack() {
|
|
@@ -23975,7 +24693,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
23975
24693
|
function TextLayout(options) {
|
|
23976
24694
|
this.width = 0;
|
|
23977
24695
|
this.height = 0;
|
|
23978
|
-
var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign,
|
|
24696
|
+
var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
|
|
23979
24697
|
var tempWidth = fontSize + letterSpace;
|
|
23980
24698
|
this.autoWidth = autoWidth;
|
|
23981
24699
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -24175,6 +24893,8 @@ exports.TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24175
24893
|
/**
|
|
24176
24894
|
* 文本行数
|
|
24177
24895
|
*/ _this.lineCount = 0;
|
|
24896
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24897
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24178
24898
|
_this.name = "MText" + seed$2++;
|
|
24179
24899
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24180
24900
|
if (props) {
|
|
@@ -24540,7 +25260,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24540
25260
|
}
|
|
24541
25261
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24542
25262
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24543
|
-
this.material.setTexture("
|
|
25263
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24544
25264
|
data: new Uint8Array(imageData.data),
|
|
24545
25265
|
width: imageData.width,
|
|
24546
25266
|
height: imageData.height
|
|
@@ -25868,13 +26588,13 @@ function getStandardParticleContent(particle) {
|
|
|
25868
26588
|
var options = particle.options;
|
|
25869
26589
|
var transform = particle.transform;
|
|
25870
26590
|
var shape = {
|
|
25871
|
-
type:
|
|
26591
|
+
type: ParticleEmitterShapeType.NONE
|
|
25872
26592
|
};
|
|
25873
26593
|
if (particle.shape) {
|
|
25874
26594
|
var _particle_shape_shape;
|
|
25875
26595
|
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
25876
26596
|
shape = _extends({}, particle.shape, {
|
|
25877
|
-
type:
|
|
26597
|
+
type: ParticleEmitterShapeType[shapeType]
|
|
25878
26598
|
});
|
|
25879
26599
|
if (particle.shape.upDirection) {
|
|
25880
26600
|
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
@@ -27738,7 +28458,8 @@ var listOrder = 0;
|
|
|
27738
28458
|
var itemProps = sourceItemData;
|
|
27739
28459
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27740
28460
|
itemProps.listIndex = listOrder++;
|
|
27741
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle
|
|
28461
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
|
|
28462
|
+
itemProps.type === ItemType.shape) {
|
|
27742
28463
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27743
28464
|
var componentPath = _step2.value;
|
|
27744
28465
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27778,8 +28499,10 @@ var listOrder = 0;
|
|
|
27778
28499
|
shapeData = shape;
|
|
27779
28500
|
}
|
|
27780
28501
|
if (shapeData !== undefined) {
|
|
27781
|
-
|
|
27782
|
-
|
|
28502
|
+
if (!("aPoint" in shapeData && "index" in shapeData)) {
|
|
28503
|
+
// @ts-expect-error 类型转换问题
|
|
28504
|
+
renderContent.renderer.shape = getGeometryByShape(shapeData, split);
|
|
28505
|
+
}
|
|
27783
28506
|
}
|
|
27784
28507
|
}
|
|
27785
28508
|
if ("trails" in renderContent && renderContent.trails !== undefined) {
|
|
@@ -27834,13 +28557,18 @@ var listOrder = 0;
|
|
|
27834
28557
|
return CompositionSourceManager;
|
|
27835
28558
|
}();
|
|
27836
28559
|
|
|
27837
|
-
|
|
28560
|
+
/**
|
|
28561
|
+
*
|
|
28562
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27838
28563
|
function SceneTicking() {
|
|
27839
28564
|
this.update = new UpdateTickData();
|
|
27840
28565
|
this.lateUpdate = new LateUpdateTickData();
|
|
27841
28566
|
}
|
|
27842
28567
|
var _proto = SceneTicking.prototype;
|
|
27843
|
-
|
|
28568
|
+
/**
|
|
28569
|
+
*
|
|
28570
|
+
* @param obj
|
|
28571
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27844
28572
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27845
28573
|
this.update.addComponent(obj);
|
|
27846
28574
|
}
|
|
@@ -27848,7 +28576,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27848
28576
|
this.lateUpdate.addComponent(obj);
|
|
27849
28577
|
}
|
|
27850
28578
|
};
|
|
27851
|
-
|
|
28579
|
+
/**
|
|
28580
|
+
*
|
|
28581
|
+
* @param obj
|
|
28582
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27852
28583
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27853
28584
|
this.update.removeComponent(obj);
|
|
27854
28585
|
}
|
|
@@ -27856,7 +28587,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27856
28587
|
this.lateUpdate.removeComponent(obj);
|
|
27857
28588
|
}
|
|
27858
28589
|
};
|
|
27859
|
-
|
|
28590
|
+
/**
|
|
28591
|
+
*
|
|
28592
|
+
*/ _proto.clear = function clear() {
|
|
27860
28593
|
this.update.clear();
|
|
27861
28594
|
this.lateUpdate.clear();
|
|
27862
28595
|
};
|
|
@@ -27947,11 +28680,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27947
28680
|
var _this;
|
|
27948
28681
|
var _scene_jsonScene_renderSettings;
|
|
27949
28682
|
_this = EventEmitter.call(this) || this;
|
|
27950
|
-
|
|
28683
|
+
/**
|
|
28684
|
+
*
|
|
28685
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27951
28686
|
/**
|
|
27952
28687
|
* 动画播放速度
|
|
27953
28688
|
*/ _this.speed = 1;
|
|
27954
28689
|
/**
|
|
28690
|
+
* 合成是否结束
|
|
28691
|
+
*/ _this.isEnded = false;
|
|
28692
|
+
/**
|
|
27955
28693
|
* 用于保存与当前合成相关的插件数据
|
|
27956
28694
|
*/ _this.loaderData = {};
|
|
27957
28695
|
/**
|
|
@@ -27973,6 +28711,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27973
28711
|
* 合成暂停/播放 标识
|
|
27974
28712
|
*/ _this.paused = false;
|
|
27975
28713
|
_this.lastVideoUpdateTime = 0;
|
|
28714
|
+
_this.isEndCalled = false;
|
|
27976
28715
|
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
27977
28716
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27978
28717
|
if (reusable) {
|
|
@@ -28062,7 +28801,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28062
28801
|
* @param visible - 是否可见
|
|
28063
28802
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28064
28803
|
this.items.forEach(function(item) {
|
|
28065
|
-
item.
|
|
28804
|
+
item.setActive(visible);
|
|
28066
28805
|
});
|
|
28067
28806
|
};
|
|
28068
28807
|
/**
|
|
@@ -28072,7 +28811,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28072
28811
|
return this.speed;
|
|
28073
28812
|
};
|
|
28074
28813
|
_proto.play = function play() {
|
|
28075
|
-
if (this.
|
|
28814
|
+
if (this.isEnded && this.reusable) {
|
|
28076
28815
|
this.restart();
|
|
28077
28816
|
}
|
|
28078
28817
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28130,16 +28869,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28130
28869
|
if (pause) {
|
|
28131
28870
|
this.resume();
|
|
28132
28871
|
}
|
|
28133
|
-
if (!this.rootComposition.isStartCalled) {
|
|
28134
|
-
this.rootComposition.onStart();
|
|
28135
|
-
this.rootComposition.isStartCalled = true;
|
|
28136
|
-
}
|
|
28137
28872
|
this.setSpeed(1);
|
|
28138
28873
|
this.forwardTime(time + this.startTime);
|
|
28139
28874
|
this.setSpeed(speed);
|
|
28140
28875
|
if (pause) {
|
|
28141
28876
|
this.pause();
|
|
28142
28877
|
}
|
|
28878
|
+
this.emit("goto", {
|
|
28879
|
+
time: time
|
|
28880
|
+
});
|
|
28143
28881
|
};
|
|
28144
28882
|
_proto.addItem = function addItem(item) {
|
|
28145
28883
|
this.items.push(item);
|
|
@@ -28163,37 +28901,24 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28163
28901
|
* 重置状态函数
|
|
28164
28902
|
*/ _proto.reset = function reset() {
|
|
28165
28903
|
this.rendererOptions = null;
|
|
28166
|
-
this.
|
|
28904
|
+
this.isEnded = false;
|
|
28905
|
+
this.isEndCalled = false;
|
|
28167
28906
|
this.rootComposition.time = 0;
|
|
28168
28907
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28169
28908
|
};
|
|
28170
28909
|
_proto.prepareRender = function prepareRender() {
|
|
28171
28910
|
var _this = this;
|
|
28172
28911
|
var frame = this.renderFrame;
|
|
28173
|
-
frame._renderPasses[0].meshes.length = 0;
|
|
28174
28912
|
this.postLoaders.length = 0;
|
|
28175
28913
|
this.pluginSystem.plugins.forEach(function(loader) {
|
|
28176
28914
|
if (loader.prepareRenderFrame(_this, frame)) {
|
|
28177
28915
|
_this.postLoaders.push(loader);
|
|
28178
28916
|
}
|
|
28179
28917
|
});
|
|
28180
|
-
this.gatherRendererComponent(this.rootItem, frame);
|
|
28181
28918
|
this.postLoaders.forEach(function(loader) {
|
|
28182
28919
|
return loader.postProcessFrame(_this, frame);
|
|
28183
28920
|
});
|
|
28184
28921
|
};
|
|
28185
|
-
_proto.gatherRendererComponent = function gatherRendererComponent(vfxItem, renderFrame) {
|
|
28186
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(vfxItem.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
28187
|
-
var rendererComponent = _step.value;
|
|
28188
|
-
if (rendererComponent.isActiveAndEnabled) {
|
|
28189
|
-
renderFrame.addMeshToDefaultRenderPass(rendererComponent);
|
|
28190
|
-
}
|
|
28191
|
-
}
|
|
28192
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(vfxItem.children), _step1; !(_step1 = _iterator1()).done;){
|
|
28193
|
-
var item = _step1.value;
|
|
28194
|
-
this.gatherRendererComponent(item, renderFrame);
|
|
28195
|
-
}
|
|
28196
|
-
};
|
|
28197
28922
|
/**
|
|
28198
28923
|
* 合成更新,针对所有 item 的更新
|
|
28199
28924
|
* @param deltaTime - 更新的时间步长
|
|
@@ -28215,12 +28940,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28215
28940
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28216
28941
|
this.updateCamera();
|
|
28217
28942
|
this.prepareRender();
|
|
28943
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
28944
|
+
this.isEndCalled = true;
|
|
28945
|
+
this.emit("end", {
|
|
28946
|
+
composition: this
|
|
28947
|
+
});
|
|
28948
|
+
}
|
|
28218
28949
|
if (this.shouldDispose()) {
|
|
28219
28950
|
this.dispose();
|
|
28220
28951
|
}
|
|
28221
28952
|
};
|
|
28222
28953
|
_proto.shouldDispose = function shouldDispose() {
|
|
28223
|
-
return this.
|
|
28954
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28224
28955
|
};
|
|
28225
28956
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28226
28957
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28311,11 +29042,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28311
29042
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28312
29043
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28313
29044
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28314
|
-
var
|
|
29045
|
+
var isEnded = false;
|
|
28315
29046
|
var duration = this.rootItem.duration;
|
|
28316
29047
|
var endBehavior = this.rootItem.endBehavior;
|
|
28317
29048
|
if (localTime - duration > 0.001) {
|
|
28318
|
-
|
|
29049
|
+
isEnded = true;
|
|
28319
29050
|
switch(endBehavior){
|
|
28320
29051
|
case EndBehavior.restart:
|
|
28321
29052
|
{
|
|
@@ -28339,11 +29070,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28339
29070
|
}
|
|
28340
29071
|
}
|
|
28341
29072
|
this.rootComposition.time = localTime;
|
|
28342
|
-
|
|
28343
|
-
|
|
28344
|
-
|
|
28345
|
-
|
|
28346
|
-
}
|
|
29073
|
+
// end state changed, handle onEnd flags
|
|
29074
|
+
if (this.isEnded !== isEnded) {
|
|
29075
|
+
if (isEnded) {
|
|
29076
|
+
this.isEnded = true;
|
|
29077
|
+
} else {
|
|
29078
|
+
this.isEnded = false;
|
|
29079
|
+
this.isEndCalled = false;
|
|
29080
|
+
}
|
|
28347
29081
|
}
|
|
28348
29082
|
}
|
|
28349
29083
|
};
|
|
@@ -30669,7 +31403,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
30669
31403
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
30670
31404
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
30671
31405
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
30672
|
-
var version$1 = "2.1.0
|
|
31406
|
+
var version$1 = "2.1.0";
|
|
30673
31407
|
logger.info("Core version: " + version$1 + ".");
|
|
30674
31408
|
|
|
30675
31409
|
var _obj;
|
|
@@ -30705,22 +31439,7 @@ var _obj3;
|
|
|
30705
31439
|
* 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
|
|
30706
31440
|
*/ var TEXTURE_UNIFORM_MAP = [
|
|
30707
31441
|
"uMaskTex",
|
|
30708
|
-
"
|
|
30709
|
-
"uSampler1",
|
|
30710
|
-
"uSampler2",
|
|
30711
|
-
"uSampler3",
|
|
30712
|
-
"uSampler4",
|
|
30713
|
-
"uSampler5",
|
|
30714
|
-
"uSampler6",
|
|
30715
|
-
"uSampler7",
|
|
30716
|
-
"uSampler8",
|
|
30717
|
-
"uSampler9",
|
|
30718
|
-
"uSampler10",
|
|
30719
|
-
"uSampler11",
|
|
30720
|
-
"uSampler12",
|
|
30721
|
-
"uSampler13",
|
|
30722
|
-
"uSampler14",
|
|
30723
|
-
"uSampler15",
|
|
31442
|
+
"_MainTex",
|
|
30724
31443
|
"uColorOverLifetime",
|
|
30725
31444
|
"uColorOverTrail"
|
|
30726
31445
|
];
|
|
@@ -30751,9 +31470,7 @@ var _obj3;
|
|
|
30751
31470
|
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
30752
31471
|
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
30753
31472
|
});
|
|
30754
|
-
|
|
30755
|
-
_this.uniforms["uSampler" + i] = new THREE__namespace.Uniform(null);
|
|
30756
|
-
}
|
|
31473
|
+
_this.uniforms["_MainTex"] = new THREE__namespace.Uniform(null);
|
|
30757
31474
|
_this.uniforms["uEditorTransform"] = new THREE__namespace.Uniform([
|
|
30758
31475
|
1,
|
|
30759
31476
|
1,
|
|
@@ -32313,7 +33030,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
32313
33030
|
*/ Mesh.create = function(engine, props) {
|
|
32314
33031
|
return new ThreeMesh(engine, props);
|
|
32315
33032
|
};
|
|
32316
|
-
var version = "2.1.0
|
|
33033
|
+
var version = "2.1.0";
|
|
32317
33034
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
32318
33035
|
|
|
32319
33036
|
exports.AbstractPlugin = AbstractPlugin;
|