@galacean/effects-core 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/comp-vfx-item.d.ts +2 -2
- package/dist/components/base-render-component.d.ts +9 -0
- package/dist/components/fake-3d-component.d.ts +28 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/mesh-component.d.ts +3 -0
- package/dist/components/post-process-volume.d.ts +10 -10
- package/dist/components/renderer-component.d.ts +2 -0
- package/dist/components/shape-component.d.ts +7 -185
- package/dist/composition/scene-ticking.d.ts +14 -0
- package/dist/composition.d.ts +19 -10
- package/dist/effects-object.d.ts +23 -0
- package/dist/engine.d.ts +9 -0
- package/dist/events/event-emitter.d.ts +6 -0
- package/dist/events/types.d.ts +8 -1
- package/dist/index.js +1409 -675
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1406 -672
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +14 -1
- package/dist/plugins/cal/playable-graph.d.ts +3 -0
- package/dist/plugins/interact/interact-item.d.ts +4 -1
- package/dist/plugins/interact/mesh-collider.d.ts +4 -0
- package/dist/plugins/shape/graphics-path.d.ts +5 -3
- package/dist/plugins/shape/poly-star.d.ts +42 -0
- package/dist/plugins/shape/rectangle.d.ts +1 -1
- package/dist/plugins/shape/shape-path.d.ts +12 -0
- package/dist/plugins/shape/shape-primitive.d.ts +0 -3
- package/dist/plugins/sprite/sprite-item.d.ts +1 -8
- package/dist/plugins/text/text-item.d.ts +2 -0
- package/dist/plugins/timeline/playable-assets/color-property-playable-asset.d.ts +1 -1
- package/dist/plugins/timeline/playable-assets/index.d.ts +2 -0
- package/dist/plugins/timeline/playable-assets/timeline-asset.d.ts +8 -2
- package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +1 -1
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -2
- package/dist/render/render-frame.d.ts +5 -2
- package/dist/render/renderer.d.ts +2 -1
- package/dist/shape/geometry.d.ts +2 -2
- package/dist/transform.d.ts +8 -0
- package/dist/vfx-item.d.ts +63 -22
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core 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';
|
|
@@ -1094,39 +1094,39 @@ function _inherits(subClass, superClass) {
|
|
|
1094
1094
|
})(MaskMode || (MaskMode = {}));
|
|
1095
1095
|
/**
|
|
1096
1096
|
* 发射器形状
|
|
1097
|
-
*/ var
|
|
1098
|
-
(function(
|
|
1097
|
+
*/ var ParticleEmitterShapeType;
|
|
1098
|
+
(function(ParticleEmitterShapeType) {
|
|
1099
1099
|
/**
|
|
1100
1100
|
* 没有类型
|
|
1101
|
-
*/
|
|
1101
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
|
|
1102
1102
|
/**
|
|
1103
1103
|
* 圆球
|
|
1104
|
-
*/
|
|
1104
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
|
|
1105
1105
|
/**
|
|
1106
1106
|
* 圆锥
|
|
1107
|
-
*/
|
|
1107
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
|
|
1108
1108
|
/**
|
|
1109
1109
|
* 半球
|
|
1110
|
-
*/
|
|
1110
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
|
|
1111
1111
|
/**
|
|
1112
1112
|
* 圆
|
|
1113
|
-
*/
|
|
1113
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
|
|
1114
1114
|
/**
|
|
1115
1115
|
* 圆环
|
|
1116
|
-
*/
|
|
1116
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
|
|
1117
1117
|
/**
|
|
1118
1118
|
* 矩形
|
|
1119
|
-
*/
|
|
1119
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
|
|
1120
1120
|
/**
|
|
1121
1121
|
* 矩形框
|
|
1122
|
-
*/
|
|
1122
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
|
|
1123
1123
|
/**
|
|
1124
1124
|
* 直线
|
|
1125
|
-
*/
|
|
1125
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
|
|
1126
1126
|
/**
|
|
1127
1127
|
* 贴图
|
|
1128
|
-
*/
|
|
1129
|
-
})(
|
|
1128
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
|
|
1129
|
+
})(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
|
|
1130
1130
|
/**
|
|
1131
1131
|
* 插件类型
|
|
1132
1132
|
*/ var PluginType;
|
|
@@ -1222,6 +1222,12 @@ function _inherits(subClass, superClass) {
|
|
|
1222
1222
|
/**
|
|
1223
1223
|
* 特效元素
|
|
1224
1224
|
*/ ItemType["effect"] = "effect";
|
|
1225
|
+
/**
|
|
1226
|
+
* 形状元素
|
|
1227
|
+
*/ ItemType["shape"] = "shape";
|
|
1228
|
+
/**
|
|
1229
|
+
* 后处理元素
|
|
1230
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
1225
1231
|
/**
|
|
1226
1232
|
* 节点元素
|
|
1227
1233
|
*/ ItemType["node"] = "node";
|
|
@@ -1231,6 +1237,9 @@ function _inherits(subClass, superClass) {
|
|
|
1231
1237
|
/**
|
|
1232
1238
|
* 音频元素
|
|
1233
1239
|
*/ ItemType["audio"] = "audio";
|
|
1240
|
+
/**
|
|
1241
|
+
* 富文本元素
|
|
1242
|
+
*/ ItemType["richtext"] = "richtext";
|
|
1234
1243
|
})(ItemType || (ItemType = {}));
|
|
1235
1244
|
/**
|
|
1236
1245
|
* 渲染模式
|
|
@@ -1606,6 +1615,58 @@ var TextAlignment;
|
|
|
1606
1615
|
*/ FontStyle["oblique"] = "oblique";
|
|
1607
1616
|
})(FontStyle || (FontStyle = {}));
|
|
1608
1617
|
|
|
1618
|
+
var BuiltinObjectGUID = {
|
|
1619
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
1620
|
+
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1621
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
1622
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* 矢量图形类型
|
|
1627
|
+
*/ var ShapePrimitiveType;
|
|
1628
|
+
(function(ShapePrimitiveType) {
|
|
1629
|
+
/**
|
|
1630
|
+
* 自定义图形
|
|
1631
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
1632
|
+
/**
|
|
1633
|
+
* 矩形
|
|
1634
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
1635
|
+
/**
|
|
1636
|
+
* 椭圆
|
|
1637
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
1638
|
+
/**
|
|
1639
|
+
* 多边形
|
|
1640
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
1641
|
+
/**
|
|
1642
|
+
* 星形
|
|
1643
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1644
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1645
|
+
|
|
1646
|
+
// 本期无该功能 待补充
|
|
1647
|
+
var ShapeConnectType;
|
|
1648
|
+
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
1649
|
+
// @待补充
|
|
1650
|
+
var ShapePointType;
|
|
1651
|
+
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* 动态换图类型
|
|
1655
|
+
* @since 1.1.0
|
|
1656
|
+
*/ var BackgroundType;
|
|
1657
|
+
(function(BackgroundType) {
|
|
1658
|
+
BackgroundType["video"] = "video";
|
|
1659
|
+
BackgroundType["image"] = "image";
|
|
1660
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1661
|
+
/**
|
|
1662
|
+
* 多媒体资源类型
|
|
1663
|
+
* @since 2.1.0
|
|
1664
|
+
*/ var MultimediaType;
|
|
1665
|
+
(function(MultimediaType) {
|
|
1666
|
+
MultimediaType["video"] = "video";
|
|
1667
|
+
MultimediaType["audio"] = "audio";
|
|
1668
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1669
|
+
|
|
1609
1670
|
var DataType;
|
|
1610
1671
|
(function(DataType) {
|
|
1611
1672
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1616,8 +1677,10 @@ var DataType;
|
|
|
1616
1677
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1617
1678
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1618
1679
|
DataType["CameraController"] = "CameraController";
|
|
1680
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1619
1681
|
DataType["Geometry"] = "Geometry";
|
|
1620
1682
|
DataType["Texture"] = "Texture";
|
|
1683
|
+
DataType["Image"] = "Image";
|
|
1621
1684
|
DataType["AnimationClip"] = "AnimationClip";
|
|
1622
1685
|
DataType["TextComponent"] = "TextComponent";
|
|
1623
1686
|
DataType["BinaryAsset"] = "BinaryAsset";
|
|
@@ -1638,7 +1701,6 @@ var DataType;
|
|
|
1638
1701
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1639
1702
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1640
1703
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1641
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1642
1704
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1643
1705
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1644
1706
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1649,9 +1711,13 @@ var DataType;
|
|
|
1649
1711
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1650
1712
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1651
1713
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1714
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1715
|
+
DataType["OrientationComponent"] = "OrientationComponent";
|
|
1716
|
+
DataType["ShapeComponent"] = "ShapeComponent";
|
|
1652
1717
|
// Non-EffectObject
|
|
1653
1718
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1654
1719
|
})(DataType || (DataType = {}));
|
|
1720
|
+
|
|
1655
1721
|
var GeometryType;
|
|
1656
1722
|
(function(GeometryType) {
|
|
1657
1723
|
/**
|
|
@@ -1736,37 +1802,13 @@ var VertexBufferSemantic;
|
|
|
1736
1802
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1737
1803
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1738
1804
|
|
|
1739
|
-
var BuiltinObjectGUID = {
|
|
1740
|
-
WhiteTexture: "whitetexture00000000000000000000",
|
|
1741
|
-
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1742
|
-
PBRShader: "pbr00000000000000000000000000000",
|
|
1743
|
-
UnlitShader: "unlit000000000000000000000000000"
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
/**
|
|
1747
|
-
* 动态换图类型
|
|
1748
|
-
* @since 1.1.0
|
|
1749
|
-
*/ var BackgroundType;
|
|
1750
|
-
(function(BackgroundType) {
|
|
1751
|
-
BackgroundType["video"] = "video";
|
|
1752
|
-
BackgroundType["image"] = "image";
|
|
1753
|
-
})(BackgroundType || (BackgroundType = {}));
|
|
1754
|
-
/**
|
|
1755
|
-
* 多媒体资源类型
|
|
1756
|
-
* @since 2.1.0
|
|
1757
|
-
*/ var MultimediaType;
|
|
1758
|
-
(function(MultimediaType) {
|
|
1759
|
-
MultimediaType["video"] = "video";
|
|
1760
|
-
MultimediaType["audio"] = "audio";
|
|
1761
|
-
})(MultimediaType || (MultimediaType = {}));
|
|
1762
|
-
|
|
1763
1805
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1764
1806
|
__proto__: null,
|
|
1765
1807
|
get RenderLevel () { return RenderLevel; },
|
|
1766
1808
|
get BlendingMode () { return BlendingMode; },
|
|
1767
1809
|
get SideMode () { return SideMode; },
|
|
1768
1810
|
get MaskMode () { return MaskMode; },
|
|
1769
|
-
get
|
|
1811
|
+
get ParticleEmitterShapeType () { return ParticleEmitterShapeType; },
|
|
1770
1812
|
get PluginType () { return PluginType; },
|
|
1771
1813
|
get InteractType () { return InteractType; },
|
|
1772
1814
|
get InteractBehavior () { return InteractBehavior; },
|
|
@@ -1804,14 +1846,17 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1804
1846
|
get TextAlignment () { return TextAlignment; },
|
|
1805
1847
|
get TextWeight () { return TextWeight; },
|
|
1806
1848
|
get FontStyle () { return FontStyle; },
|
|
1849
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1850
|
+
get ShapePrimitiveType () { return ShapePrimitiveType; },
|
|
1851
|
+
get ShapeConnectType () { return ShapeConnectType; },
|
|
1852
|
+
get ShapePointType () { return ShapePointType; },
|
|
1853
|
+
get BackgroundType () { return BackgroundType; },
|
|
1854
|
+
get MultimediaType () { return MultimediaType; },
|
|
1807
1855
|
get DataType () { return DataType; },
|
|
1808
1856
|
get GeometryType () { return GeometryType; },
|
|
1809
1857
|
get VertexFormatType () { return VertexFormatType; },
|
|
1810
1858
|
get IndexFormatType () { return IndexFormatType; },
|
|
1811
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1812
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1813
|
-
get BackgroundType () { return BackgroundType; },
|
|
1814
|
-
get MultimediaType () { return MultimediaType; }
|
|
1859
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1815
1860
|
});
|
|
1816
1861
|
|
|
1817
1862
|
function _defineProperties(target, props) {
|
|
@@ -1899,15 +1944,23 @@ function getDirectStore(target) {
|
|
|
1899
1944
|
this.engine.addInstance(this);
|
|
1900
1945
|
}
|
|
1901
1946
|
var _proto = EffectsObject.prototype;
|
|
1902
|
-
|
|
1947
|
+
/**
|
|
1948
|
+
*
|
|
1949
|
+
* @returns
|
|
1950
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1903
1951
|
return this.guid;
|
|
1904
1952
|
};
|
|
1905
|
-
|
|
1953
|
+
/**
|
|
1954
|
+
*
|
|
1955
|
+
* @param guid
|
|
1956
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1906
1957
|
this.engine.removeInstance(this.guid);
|
|
1907
1958
|
this.guid = guid;
|
|
1908
1959
|
this.engine.addInstance(this);
|
|
1909
1960
|
};
|
|
1910
|
-
|
|
1961
|
+
/**
|
|
1962
|
+
*
|
|
1963
|
+
*/ _proto.toData = function toData() {};
|
|
1911
1964
|
/**
|
|
1912
1965
|
* 反序列化函数
|
|
1913
1966
|
*
|
|
@@ -1917,8 +1970,14 @@ function getDirectStore(target) {
|
|
|
1917
1970
|
this.setInstanceId(data.id);
|
|
1918
1971
|
}
|
|
1919
1972
|
};
|
|
1920
|
-
|
|
1921
|
-
|
|
1973
|
+
/**
|
|
1974
|
+
*
|
|
1975
|
+
*/ _proto.dispose = function dispose() {};
|
|
1976
|
+
/**
|
|
1977
|
+
*
|
|
1978
|
+
* @param obj
|
|
1979
|
+
* @returns
|
|
1980
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1922
1981
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1923
1982
|
};
|
|
1924
1983
|
return EffectsObject;
|
|
@@ -1998,7 +2057,7 @@ function getDirectStore(target) {
|
|
|
1998
2057
|
this.onAwake();
|
|
1999
2058
|
this.isAwakeCalled = true;
|
|
2000
2059
|
}
|
|
2001
|
-
if (item.
|
|
2060
|
+
if (item.isActive && this.enabled) {
|
|
2002
2061
|
this.start();
|
|
2003
2062
|
this.enable();
|
|
2004
2063
|
}
|
|
@@ -2043,7 +2102,7 @@ function getDirectStore(target) {
|
|
|
2043
2102
|
get: /**
|
|
2044
2103
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2045
2104
|
*/ function get() {
|
|
2046
|
-
return this.item.
|
|
2105
|
+
return this.item.isActive && this.enabled;
|
|
2047
2106
|
}
|
|
2048
2107
|
},
|
|
2049
2108
|
{
|
|
@@ -2111,6 +2170,14 @@ __decorate([
|
|
|
2111
2170
|
Component.prototype.setVFXItem.call(this, item);
|
|
2112
2171
|
this.item.rendererComponents.push(this);
|
|
2113
2172
|
};
|
|
2173
|
+
_proto.onEnable = function onEnable() {
|
|
2174
|
+
var _this_item_composition;
|
|
2175
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
|
|
2176
|
+
};
|
|
2177
|
+
_proto.onDisable = function onDisable() {
|
|
2178
|
+
var _this_item_composition;
|
|
2179
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
2180
|
+
};
|
|
2114
2181
|
_proto.fromData = function fromData(data) {
|
|
2115
2182
|
Component.prototype.fromData.call(this, data);
|
|
2116
2183
|
};
|
|
@@ -3672,7 +3739,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3672
3739
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3673
3740
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3674
3741
|
|
|
3675
|
-
|
|
3742
|
+
/**
|
|
3743
|
+
* Mesh 组件
|
|
3744
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3676
3745
|
_inherits(MeshComponent, RendererComponent);
|
|
3677
3746
|
function MeshComponent() {
|
|
3678
3747
|
var _this;
|
|
@@ -3682,7 +3751,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3682
3751
|
*/ _this.meshCollider = new MeshCollider();
|
|
3683
3752
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3684
3753
|
_this.getHitTestParams = function(force) {
|
|
3685
|
-
var
|
|
3754
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3755
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3756
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3686
3757
|
if (area) {
|
|
3687
3758
|
return {
|
|
3688
3759
|
type: area.type,
|
|
@@ -3702,8 +3773,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3702
3773
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3703
3774
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3704
3775
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3705
|
-
var
|
|
3706
|
-
return
|
|
3776
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3777
|
+
return boundingBox;
|
|
3707
3778
|
};
|
|
3708
3779
|
return MeshComponent;
|
|
3709
3780
|
}(RendererComponent);
|
|
@@ -3741,24 +3812,29 @@ exports.EffectComponent = __decorate([
|
|
|
3741
3812
|
|
|
3742
3813
|
exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3743
3814
|
_inherits(PostProcessVolume, Behaviour);
|
|
3744
|
-
function PostProcessVolume() {
|
|
3815
|
+
function PostProcessVolume(engine) {
|
|
3745
3816
|
var _this;
|
|
3746
|
-
_this = Behaviour.
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
_this.
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
_this.
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3817
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3818
|
+
_this.bloom = {
|
|
3819
|
+
threshold: 0,
|
|
3820
|
+
intensity: 0,
|
|
3821
|
+
active: false
|
|
3822
|
+
};
|
|
3823
|
+
_this.vignette = {
|
|
3824
|
+
intensity: 0,
|
|
3825
|
+
smoothness: 0,
|
|
3826
|
+
roundness: 0,
|
|
3827
|
+
active: false
|
|
3828
|
+
};
|
|
3829
|
+
_this.tonemapping = {
|
|
3830
|
+
active: false
|
|
3831
|
+
};
|
|
3832
|
+
_this.colorAdjustments = {
|
|
3833
|
+
brightness: 0,
|
|
3834
|
+
saturation: 0,
|
|
3835
|
+
contrast: 0,
|
|
3836
|
+
active: false
|
|
3837
|
+
};
|
|
3762
3838
|
return _this;
|
|
3763
3839
|
}
|
|
3764
3840
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3772,36 +3848,18 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3772
3848
|
}(Behaviour);
|
|
3773
3849
|
__decorate([
|
|
3774
3850
|
serialize()
|
|
3775
|
-
], exports.PostProcessVolume.prototype, "
|
|
3776
|
-
__decorate([
|
|
3777
|
-
serialize()
|
|
3778
|
-
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
3779
|
-
__decorate([
|
|
3780
|
-
serialize()
|
|
3781
|
-
], exports.PostProcessVolume.prototype, "bloomIntensity", void 0);
|
|
3782
|
-
__decorate([
|
|
3783
|
-
serialize()
|
|
3784
|
-
], exports.PostProcessVolume.prototype, "brightness", void 0);
|
|
3785
|
-
__decorate([
|
|
3786
|
-
serialize()
|
|
3787
|
-
], exports.PostProcessVolume.prototype, "saturation", void 0);
|
|
3788
|
-
__decorate([
|
|
3789
|
-
serialize()
|
|
3790
|
-
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
3791
|
-
__decorate([
|
|
3792
|
-
serialize()
|
|
3793
|
-
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
3851
|
+
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
3794
3852
|
__decorate([
|
|
3795
3853
|
serialize()
|
|
3796
|
-
], exports.PostProcessVolume.prototype, "
|
|
3854
|
+
], exports.PostProcessVolume.prototype, "vignette", void 0);
|
|
3797
3855
|
__decorate([
|
|
3798
3856
|
serialize()
|
|
3799
|
-
], exports.PostProcessVolume.prototype, "
|
|
3857
|
+
], exports.PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3800
3858
|
__decorate([
|
|
3801
3859
|
serialize()
|
|
3802
|
-
], exports.PostProcessVolume.prototype, "
|
|
3860
|
+
], exports.PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3803
3861
|
exports.PostProcessVolume = __decorate([
|
|
3804
|
-
effectsClass(
|
|
3862
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3805
3863
|
], exports.PostProcessVolume);
|
|
3806
3864
|
|
|
3807
3865
|
function _assert_this_initialized(self) {
|
|
@@ -6888,6 +6946,7 @@ exports.MaterialRenderType = void 0;
|
|
|
6888
6946
|
_this.enabledMacros = {};
|
|
6889
6947
|
_this.destroyed = false;
|
|
6890
6948
|
_this.initialized = false;
|
|
6949
|
+
_this.shaderDirty = true;
|
|
6891
6950
|
if (props) {
|
|
6892
6951
|
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$8++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
6893
6952
|
_this.name = name;
|
|
@@ -6915,6 +6974,41 @@ exports.MaterialRenderType = void 0;
|
|
|
6915
6974
|
// OVERRIDE
|
|
6916
6975
|
};
|
|
6917
6976
|
_create_class(Material, [
|
|
6977
|
+
{
|
|
6978
|
+
key: "shader",
|
|
6979
|
+
get: function get() {
|
|
6980
|
+
return this._shader;
|
|
6981
|
+
},
|
|
6982
|
+
set: function set(value) {
|
|
6983
|
+
if (this._shader === value) {
|
|
6984
|
+
return;
|
|
6985
|
+
}
|
|
6986
|
+
this._shader = value;
|
|
6987
|
+
this.shaderDirty = true;
|
|
6988
|
+
}
|
|
6989
|
+
},
|
|
6990
|
+
{
|
|
6991
|
+
key: "mainTexture",
|
|
6992
|
+
get: /**
|
|
6993
|
+
* 材质的主纹理
|
|
6994
|
+
*/ function get() {
|
|
6995
|
+
return this.getTexture("_MainTex");
|
|
6996
|
+
},
|
|
6997
|
+
set: function set(value) {
|
|
6998
|
+
this.setTexture("_MainTex", value);
|
|
6999
|
+
}
|
|
7000
|
+
},
|
|
7001
|
+
{
|
|
7002
|
+
key: "color",
|
|
7003
|
+
get: /**
|
|
7004
|
+
* 材质的主颜色
|
|
7005
|
+
*/ function get() {
|
|
7006
|
+
return this.getColor("_Color");
|
|
7007
|
+
},
|
|
7008
|
+
set: function set(value) {
|
|
7009
|
+
this.setColor("_Color", value);
|
|
7010
|
+
}
|
|
7011
|
+
},
|
|
6918
7012
|
{
|
|
6919
7013
|
key: "blending",
|
|
6920
7014
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10051,7 +10145,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10051
10145
|
|
|
10052
10146
|
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}";
|
|
10053
10147
|
|
|
10054
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10148
|
+
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;}";
|
|
10055
10149
|
|
|
10056
10150
|
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";
|
|
10057
10151
|
|
|
@@ -10282,15 +10376,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10282
10376
|
renderer.setFramebuffer(this.framebuffer);
|
|
10283
10377
|
};
|
|
10284
10378
|
_proto.execute = function execute(renderer) {
|
|
10285
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10379
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10286
10380
|
renderer.clear({
|
|
10287
10381
|
colorAction: exports.TextureStoreAction.clear,
|
|
10288
10382
|
depthAction: exports.TextureStoreAction.clear,
|
|
10289
10383
|
stencilAction: exports.TextureStoreAction.clear
|
|
10290
10384
|
});
|
|
10291
10385
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10292
|
-
var
|
|
10293
|
-
var threshold = (
|
|
10386
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10387
|
+
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;
|
|
10294
10388
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10295
10389
|
renderer.renderMeshes([
|
|
10296
10390
|
this.screenMesh
|
|
@@ -10503,25 +10597,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10503
10597
|
depthAction: exports.TextureStoreAction.clear,
|
|
10504
10598
|
stencilAction: exports.TextureStoreAction.clear
|
|
10505
10599
|
});
|
|
10506
|
-
var
|
|
10507
|
-
var
|
|
10600
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10601
|
+
var bloom = _extends({
|
|
10602
|
+
threshold: 0,
|
|
10603
|
+
intensity: 0,
|
|
10604
|
+
active: false
|
|
10605
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10606
|
+
var vignette = _extends({
|
|
10607
|
+
intensity: 0,
|
|
10608
|
+
smoothness: 0,
|
|
10609
|
+
roundness: 0,
|
|
10610
|
+
active: false
|
|
10611
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10612
|
+
var colorAdjustments = _extends({
|
|
10613
|
+
brightness: 0,
|
|
10614
|
+
saturation: 0,
|
|
10615
|
+
contrast: 0,
|
|
10616
|
+
active: false
|
|
10617
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10618
|
+
var tonemapping = _extends({
|
|
10619
|
+
active: false
|
|
10620
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10508
10621
|
this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
|
|
10509
|
-
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
10510
|
-
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
10511
|
-
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
10512
|
-
this.screenMesh.material.setInt("_UseBloom", Number(
|
|
10513
|
-
if (
|
|
10622
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10623
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10624
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10625
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10626
|
+
if (bloom.active) {
|
|
10514
10627
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10515
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10628
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10516
10629
|
}
|
|
10517
|
-
if (
|
|
10518
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10519
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10520
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10630
|
+
if (vignette.intensity > 0) {
|
|
10631
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10632
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10633
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10521
10634
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10522
10635
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10523
10636
|
}
|
|
10524
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10637
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10525
10638
|
renderer.renderMeshes([
|
|
10526
10639
|
this.screenMesh
|
|
10527
10640
|
]);
|
|
@@ -10561,6 +10674,9 @@ var seed$5 = 1;
|
|
|
10561
10674
|
this.renderer = renderer;
|
|
10562
10675
|
if (postProcessingEnabled) {
|
|
10563
10676
|
var enableHDR = true;
|
|
10677
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10678
|
+
throw new Error("Half float texture is not supported.");
|
|
10679
|
+
}
|
|
10564
10680
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10565
10681
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10566
10682
|
attachments = [
|
|
@@ -10582,16 +10698,16 @@ var seed$5 = 1;
|
|
|
10582
10698
|
depthAction: exports.TextureLoadAction.clear
|
|
10583
10699
|
};
|
|
10584
10700
|
}
|
|
10585
|
-
|
|
10701
|
+
this.drawObjectPass = new RenderPass(renderer, {
|
|
10702
|
+
name: RENDER_PASS_NAME_PREFIX,
|
|
10703
|
+
priority: RenderPassPriorityNormal,
|
|
10704
|
+
meshOrder: exports.OrderType.ascending,
|
|
10705
|
+
depthStencilAttachment: depthStencilAttachment,
|
|
10706
|
+
attachments: attachments,
|
|
10707
|
+
clearAction: drawObjectPassClearAction
|
|
10708
|
+
});
|
|
10586
10709
|
var renderPasses = [
|
|
10587
|
-
|
|
10588
|
-
name: RENDER_PASS_NAME_PREFIX,
|
|
10589
|
-
priority: RenderPassPriorityNormal,
|
|
10590
|
-
meshOrder: exports.OrderType.ascending,
|
|
10591
|
-
depthStencilAttachment: depthStencilAttachment,
|
|
10592
|
-
attachments: attachments,
|
|
10593
|
-
clearAction: drawObjectPassClearAction
|
|
10594
|
-
})
|
|
10710
|
+
this.drawObjectPass
|
|
10595
10711
|
];
|
|
10596
10712
|
this.setRenderPasses(renderPasses);
|
|
10597
10713
|
if (postProcessingEnabled) {
|
|
@@ -10713,216 +10829,15 @@ var seed$5 = 1;
|
|
|
10713
10829
|
* 根据 Mesh 优先级添加到 RenderPass
|
|
10714
10830
|
* @param mesh - 要添加的 Mesh 对象
|
|
10715
10831
|
*/ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
|
|
10716
|
-
|
|
10717
|
-
return;
|
|
10718
|
-
}
|
|
10719
|
-
this.renderPasses[0].addMesh(mesh);
|
|
10720
|
-
// const renderPasses = this.renderPasses;
|
|
10721
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10722
|
-
// const { priority } = mesh;
|
|
10723
|
-
// for (let i = 1; i < renderPasses.length; i++) {
|
|
10724
|
-
// const renderPass = renderPasses[i - 1];
|
|
10725
|
-
// const info = infoMap.get(renderPasses[i])!;
|
|
10726
|
-
// if (info && info.listStart > priority && (priority > infoMap.get(renderPass)!.listEnd || i === 1)) {
|
|
10727
|
-
// return this.addToRenderPass(renderPass, mesh);
|
|
10728
|
-
// }
|
|
10729
|
-
// }
|
|
10730
|
-
// // TODO: diff逻辑待优化,有时会添加进找不到的元素
|
|
10731
|
-
// let last = renderPasses[renderPasses.length - 1];
|
|
10732
|
-
// // TODO: 是否添加mesh到pass的判断方式需要优化,先通过长度判断是否有postprocess
|
|
10733
|
-
// for (const pass of renderPasses) {
|
|
10734
|
-
// if (!(pass instanceof HQGaussianDownSamplePass
|
|
10735
|
-
// || pass instanceof BloomThresholdPass
|
|
10736
|
-
// || pass instanceof ToneMappingPass
|
|
10737
|
-
// || pass instanceof HQGaussianUpSamplePass
|
|
10738
|
-
// || pass.name === 'mars-final-copy')) {
|
|
10739
|
-
// last = pass;
|
|
10740
|
-
// }
|
|
10741
|
-
// }
|
|
10742
|
-
// // if (priority > infoMap.get(last)!.listStart || renderPasses.length === 1) {
|
|
10743
|
-
// // return this.addToRenderPass(last, mesh);
|
|
10744
|
-
// // }
|
|
10745
|
-
// return this.addToRenderPass(last, mesh);
|
|
10746
|
-
// if (false) {
|
|
10747
|
-
// throw Error('render pass not found');
|
|
10748
|
-
// }
|
|
10832
|
+
this.drawObjectPass.addMesh(mesh);
|
|
10749
10833
|
};
|
|
10750
10834
|
/**
|
|
10751
10835
|
* 把 Mesh 从 RenderPass 中移除,
|
|
10752
10836
|
* 如果 renderPass 中没有 mesh,此 renderPass 会被删除
|
|
10753
10837
|
* @param mesh - 要删除的 Mesh 对象
|
|
10754
10838
|
*/ _proto.removeMeshFromDefaultRenderPass = function removeMeshFromDefaultRenderPass(mesh) {
|
|
10755
|
-
|
|
10756
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10757
|
-
// for (let i = renderPasses.length - 1; i >= 0; i--) {
|
|
10758
|
-
// const renderPass = renderPasses[i];
|
|
10759
|
-
// const info = infoMap.get(renderPass)!;
|
|
10760
|
-
// // 只有渲染场景物体的pass才有 info
|
|
10761
|
-
// if (!info) {
|
|
10762
|
-
// continue;
|
|
10763
|
-
// }
|
|
10764
|
-
// if (info.listStart <= mesh.priority && info.listEnd >= mesh.priority) {
|
|
10765
|
-
// const idx = renderPass.meshes.indexOf(mesh);
|
|
10766
|
-
// if (idx === -1) {
|
|
10767
|
-
// return;
|
|
10768
|
-
// }
|
|
10769
|
-
// // TODO hack: 现在的除了rp1和finalcopy pass,所有renderpass的meshes是一个copy加上一个filter mesh,这里的判断当filter mesh被删除后当前pass需不需要删除,
|
|
10770
|
-
// // 判断需要更鲁棒。
|
|
10771
|
-
// const shouldRestoreRenderPass = idx === 1 && renderPass.meshes[0].name === MARS_COPY_MESH_NAME;
|
|
10772
|
-
// renderPass.removeMesh(mesh);
|
|
10773
|
-
// if (shouldRestoreRenderPass) {
|
|
10774
|
-
// const nextRenderPass = renderPasses[i + 1];
|
|
10775
|
-
// const meshes = renderPass.meshes;
|
|
10776
|
-
// if (!info.intermedia) {
|
|
10777
|
-
// info.preRenderPass?.resetColorAttachments([]);
|
|
10778
|
-
// //this.renderer.extension.resetColorAttachments?.(info.preRenderPass, []);
|
|
10779
|
-
// }
|
|
10780
|
-
// for (let j = 1; j < meshes.length; j++) {
|
|
10781
|
-
// info.preRenderPass?.addMesh(meshes[j]);
|
|
10782
|
-
// }
|
|
10783
|
-
// const cp = renderPass.attachments[0]?.texture;
|
|
10784
|
-
// const keepColor = cp === this.resource.color_a || cp === this.resource.color_b;
|
|
10785
|
-
// renderPass.dispose({
|
|
10786
|
-
// meshes: DestroyOptions.keep,
|
|
10787
|
-
// colorAttachment: keepColor ? RenderPassDestroyAttachmentType.keep : RenderPassDestroyAttachmentType.destroy,
|
|
10788
|
-
// depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
|
|
10789
|
-
// });
|
|
10790
|
-
// removeItem(renderPasses, renderPass);
|
|
10791
|
-
// this.removeRenderPass(renderPass);
|
|
10792
|
-
// infoMap.delete(renderPass);
|
|
10793
|
-
// if (nextRenderPass) {
|
|
10794
|
-
// this.updateRenderInfo(nextRenderPass);
|
|
10795
|
-
// }
|
|
10796
|
-
// if (info.preRenderPass) {
|
|
10797
|
-
// this.updateRenderInfo(info.preRenderPass);
|
|
10798
|
-
// }
|
|
10799
|
-
// if (info.prePasses) {
|
|
10800
|
-
// info.prePasses.forEach(rp => {
|
|
10801
|
-
// this.removeRenderPass(rp.pass);
|
|
10802
|
-
// if (rp?.destroyOptions !== false) {
|
|
10803
|
-
// rp.pass.attachments.forEach(c => {
|
|
10804
|
-
// if (c.texture !== this.resource.color_b || c.texture !== this.resource.color_a) {
|
|
10805
|
-
// c.texture.dispose();
|
|
10806
|
-
// }
|
|
10807
|
-
// });
|
|
10808
|
-
// const options: RenderPassDestroyOptions = {
|
|
10809
|
-
// ...(rp?.destroyOptions ? rp.destroyOptions as RenderPassDestroyOptions : {}),
|
|
10810
|
-
// depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
|
|
10811
|
-
// };
|
|
10812
|
-
// rp.pass.dispose(options);
|
|
10813
|
-
// }
|
|
10814
|
-
// });
|
|
10815
|
-
// }
|
|
10816
|
-
// this.resetRenderPassDefaultAttachment(renderPasses, Math.max(i - 1, 0));
|
|
10817
|
-
// if (renderPasses.length === 1) {
|
|
10818
|
-
// renderPasses[0].resetColorAttachments([]);
|
|
10819
|
-
// //this.renderer.extension.resetColorAttachments?.(renderPasses[0], []);
|
|
10820
|
-
// this.removeRenderPass(this.resource.finalCopyRP);
|
|
10821
|
-
// }
|
|
10822
|
-
// }
|
|
10823
|
-
// return this.resetClearActions();
|
|
10824
|
-
// }
|
|
10825
|
-
// }
|
|
10839
|
+
this.drawObjectPass.removeMesh(mesh);
|
|
10826
10840
|
};
|
|
10827
|
-
// /**
|
|
10828
|
-
// * 将 Mesh 所有在 RenderPass 进行切分
|
|
10829
|
-
// * @param mesh - 目标 Mesh 对象
|
|
10830
|
-
// * @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
|
|
10831
|
-
// */
|
|
10832
|
-
// splitDefaultRenderPassByMesh (mesh: Mesh, options: RenderPassSplitOptions): RenderPass {
|
|
10833
|
-
// const index = this.findMeshRenderPassIndex(mesh);
|
|
10834
|
-
// const renderPass = this.renderPasses[index];
|
|
10835
|
-
// if (false) {
|
|
10836
|
-
// if (!renderPass) {
|
|
10837
|
-
// throw Error('RenderPassNotFound');
|
|
10838
|
-
// }
|
|
10839
|
-
// }
|
|
10840
|
-
// this.createResource();
|
|
10841
|
-
// const meshIndex = renderPass.meshes.indexOf(mesh);
|
|
10842
|
-
// const ms0 = renderPass.meshes.slice(0, meshIndex);
|
|
10843
|
-
// const ms1 = renderPass.meshes.slice(meshIndex);
|
|
10844
|
-
// const infoMap = this.renderPassInfoMap;
|
|
10845
|
-
// // TODO 为什么要加这个判断?
|
|
10846
|
-
// // if (renderPass.attachments[0] && this.renderPasses[index + 1] !== this.resource.finalCopyRP) {
|
|
10847
|
-
// // throw Error('not implement');
|
|
10848
|
-
// // } else {
|
|
10849
|
-
// if (!options.attachments?.length) {
|
|
10850
|
-
// throw Error('should include at least one color attachment');
|
|
10851
|
-
// }
|
|
10852
|
-
// const defRPS = this.renderPasses;
|
|
10853
|
-
// const defIndex = defRPS.indexOf(renderPass);
|
|
10854
|
-
// const lastDefRP = defRPS[defIndex - 1];
|
|
10855
|
-
// removeItem(defRPS, renderPass);
|
|
10856
|
-
// const lastInfo = infoMap.get(renderPass);
|
|
10857
|
-
// infoMap.delete(renderPass);
|
|
10858
|
-
// const filter = GPUCapability.getInstance().level === 2 ? glContext.LINEAR : glContext.NEAREST;
|
|
10859
|
-
// const rp0 = new RenderPass({
|
|
10860
|
-
// name: RENDER_PASS_NAME_PREFIX + defIndex,
|
|
10861
|
-
// priority: renderPass.priority,
|
|
10862
|
-
// attachments: [{
|
|
10863
|
-
// texture: {
|
|
10864
|
-
// sourceType: TextureSourceType.framebuffer,
|
|
10865
|
-
// format: glContext.RGBA,
|
|
10866
|
-
// name: 'frame_a',
|
|
10867
|
-
// minFilter: filter,
|
|
10868
|
-
// magFilter: filter,
|
|
10869
|
-
// },
|
|
10870
|
-
// }],
|
|
10871
|
-
// clearAction: renderPass.clearAction || { colorAction: TextureLoadAction.clear },
|
|
10872
|
-
// storeAction: renderPass.storeAction,
|
|
10873
|
-
// depthStencilAttachment: this.resource.depthStencil,
|
|
10874
|
-
// meshes: ms0,
|
|
10875
|
-
// meshOrder: OrderType.ascending,
|
|
10876
|
-
// });
|
|
10877
|
-
// ms1.unshift(this.createCopyMesh());
|
|
10878
|
-
// const renderPasses = this.renderPasses;
|
|
10879
|
-
// renderPasses[index] = rp0;
|
|
10880
|
-
// const prePasses: RenderPass[] = [];
|
|
10881
|
-
// const restMeshes = ms1.slice();
|
|
10882
|
-
// if (options.prePasses) {
|
|
10883
|
-
// options.prePasses.forEach((pass, i) => {
|
|
10884
|
-
// pass.priority = renderPass.priority + 1 + i;
|
|
10885
|
-
// pass.setMeshes(ms1);
|
|
10886
|
-
// prePasses.push(pass);
|
|
10887
|
-
// });
|
|
10888
|
-
// renderPasses.splice(index + 1, 0, ...prePasses);
|
|
10889
|
-
// restMeshes.splice(0, 2);
|
|
10890
|
-
// }
|
|
10891
|
-
// const copyRP = this.resource.finalCopyRP;
|
|
10892
|
-
// if (!renderPasses.includes(copyRP)) {
|
|
10893
|
-
// renderPasses.push(copyRP);
|
|
10894
|
-
// }
|
|
10895
|
-
// // let sourcePass = (prePasses.length && !options.useLastDefaultPassColor) ? prePasses[prePasses.length - 1] : rp0;
|
|
10896
|
-
// const finalFilterPass = prePasses[prePasses.length - 1];
|
|
10897
|
-
// finalFilterPass.initialize(this.renderer);
|
|
10898
|
-
// // 不切RT,接着上一个pass的渲染结果渲染
|
|
10899
|
-
// const rp1 = new RenderPass({
|
|
10900
|
-
// name: RENDER_PASS_NAME_PREFIX + (defIndex + 1),
|
|
10901
|
-
// priority: renderPass.priority + 1 + (options.prePasses?.length || 0),
|
|
10902
|
-
// meshes: restMeshes,
|
|
10903
|
-
// meshOrder: OrderType.ascending,
|
|
10904
|
-
// depthStencilAttachment: this.resource.depthStencil,
|
|
10905
|
-
// storeAction: options.storeAction,
|
|
10906
|
-
// clearAction: {
|
|
10907
|
-
// depthAction: TextureLoadAction.whatever,
|
|
10908
|
-
// stencilAction: TextureLoadAction.whatever,
|
|
10909
|
-
// colorAction: TextureLoadAction.whatever,
|
|
10910
|
-
// },
|
|
10911
|
-
// });
|
|
10912
|
-
// renderPasses.splice(index + 1 + (options.prePasses?.length || 0), 0, rp1);
|
|
10913
|
-
// this.setRenderPasses(renderPasses);
|
|
10914
|
-
// this.updateRenderInfo(finalFilterPass);
|
|
10915
|
-
// this.updateRenderInfo(rp0);
|
|
10916
|
-
// this.updateRenderInfo(rp1);
|
|
10917
|
-
// // 目的是删除滤镜元素后,把之前滤镜用到的prePass给删除,逻辑有些复杂,考虑优化
|
|
10918
|
-
// infoMap.get(rp0)!.prePasses = lastInfo!.prePasses;
|
|
10919
|
-
// prePasses.pop();
|
|
10920
|
-
// infoMap.get(finalFilterPass)!.prePasses = prePasses.map((pass, i) => {
|
|
10921
|
-
// return { pass, destroyOptions: false };
|
|
10922
|
-
// });
|
|
10923
|
-
// this.resetClearActions();
|
|
10924
|
-
// return finalFilterPass;
|
|
10925
|
-
// }
|
|
10926
10841
|
/**
|
|
10927
10842
|
* 销毁 RenderFrame
|
|
10928
10843
|
* @param options - 可以有选择销毁一些对象
|
|
@@ -11042,45 +10957,6 @@ var seed$5 = 1;
|
|
|
11042
10957
|
this.clearAction.colorAction = exports.TextureLoadAction.whatever;
|
|
11043
10958
|
}
|
|
11044
10959
|
};
|
|
11045
|
-
// protected updateRenderInfo (renderPass: RenderPass): RenderPassInfo {
|
|
11046
|
-
// const map = this.renderPassInfoMap;
|
|
11047
|
-
// const passes = this.renderPasses;
|
|
11048
|
-
// let info: RenderPassInfo;
|
|
11049
|
-
// if (!map.has(renderPass)) {
|
|
11050
|
-
// info = {
|
|
11051
|
-
// intermedia: false,
|
|
11052
|
-
// renderPass: renderPass,
|
|
11053
|
-
// listStart: 0,
|
|
11054
|
-
// listEnd: 0,
|
|
11055
|
-
// };
|
|
11056
|
-
// map.set(renderPass, info);
|
|
11057
|
-
// } else {
|
|
11058
|
-
// info = map.get(renderPass)!;
|
|
11059
|
-
// }
|
|
11060
|
-
// info.intermedia = renderPass.attachments.length > 0;
|
|
11061
|
-
// const meshes = renderPass.meshes;
|
|
11062
|
-
// if (meshes[0]) {
|
|
11063
|
-
// info.listStart = (meshes[0].name === MARS_COPY_MESH_NAME ? meshes[1] : meshes[0]).priority;
|
|
11064
|
-
// info.listEnd = meshes[meshes.length - 1].priority;
|
|
11065
|
-
// } else {
|
|
11066
|
-
// info.listStart = 0;
|
|
11067
|
-
// info.listEnd = 0;
|
|
11068
|
-
// }
|
|
11069
|
-
// const index = passes.indexOf(renderPass);
|
|
11070
|
-
// const depthStencilActon = index === 0 ? TextureLoadAction.clear : TextureLoadAction.whatever;
|
|
11071
|
-
// if (index === 0) {
|
|
11072
|
-
// renderPass.clearAction.colorAction = TextureLoadAction.clear;
|
|
11073
|
-
// }
|
|
11074
|
-
// renderPass.clearAction.depthAction = depthStencilActon;
|
|
11075
|
-
// renderPass.clearAction.stencilAction = depthStencilActon;
|
|
11076
|
-
// if (index > -1) {
|
|
11077
|
-
// renderPass.semantics.setSemantic('EDITOR_TRANSFORM', () => this.editorTransform);
|
|
11078
|
-
// } else {
|
|
11079
|
-
// renderPass.semantics.setSemantic('EDITOR_TRANSFORM', undefined);
|
|
11080
|
-
// }
|
|
11081
|
-
// info.preRenderPass = passes[index - 1];
|
|
11082
|
-
// return info;
|
|
11083
|
-
// }
|
|
11084
10960
|
/**
|
|
11085
10961
|
* 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
|
|
11086
10962
|
* @param passes - RenderPass 数组
|
|
@@ -11281,7 +11157,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
|
|
|
11281
11157
|
var GlobalUniforms = function GlobalUniforms() {
|
|
11282
11158
|
this.floats = {};
|
|
11283
11159
|
this.ints = {};
|
|
11284
|
-
|
|
11160
|
+
this.vector3s = {};
|
|
11285
11161
|
this.vector4s = {};
|
|
11286
11162
|
this.matrices = {};
|
|
11287
11163
|
//...
|
|
@@ -11522,6 +11398,9 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
11522
11398
|
_proto.setGlobalVector4 = function setGlobalVector4(name, value) {
|
|
11523
11399
|
// OVERRIDE
|
|
11524
11400
|
};
|
|
11401
|
+
_proto.setGlobalVector3 = function setGlobalVector3(name, value) {
|
|
11402
|
+
// OVERRIDE
|
|
11403
|
+
};
|
|
11525
11404
|
_proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
|
|
11526
11405
|
// OVERRIDE
|
|
11527
11406
|
};
|
|
@@ -13187,10 +13066,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13187
13066
|
}
|
|
13188
13067
|
var _proto = Vector4Curve.prototype;
|
|
13189
13068
|
_proto.onCreate = function onCreate(arg) {
|
|
13190
|
-
this.xCurve = createValueGetter(arg
|
|
13191
|
-
this.yCurve = createValueGetter(arg
|
|
13192
|
-
this.zCurve = createValueGetter(arg
|
|
13193
|
-
this.wCurve = createValueGetter(arg
|
|
13069
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13070
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13071
|
+
this.zCurve = createValueGetter(arg[2]);
|
|
13072
|
+
this.wCurve = createValueGetter(arg[3]);
|
|
13194
13073
|
};
|
|
13195
13074
|
_proto.getValue = function getValue(t) {
|
|
13196
13075
|
var x = this.xCurve.getValue(t);
|
|
@@ -13210,8 +13089,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
|
|
|
13210
13089
|
var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
|
|
13211
13090
|
var PLAYER_OPTIONS_ENV_EDITOR = "editor";
|
|
13212
13091
|
var HELP_LINK = {
|
|
13213
|
-
"Item duration can't be less than 0": "https://galacean.
|
|
13214
|
-
"ValueType: 21/22 is not supported": "https://galacean.
|
|
13092
|
+
"Item duration can't be less than 0": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
|
|
13093
|
+
"ValueType: 21/22 is not supported": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"
|
|
13215
13094
|
};
|
|
13216
13095
|
|
|
13217
13096
|
var _obj$3;
|
|
@@ -13290,10 +13169,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13290
13169
|
}
|
|
13291
13170
|
var _proto = ColorCurve.prototype;
|
|
13292
13171
|
_proto.onCreate = function onCreate(arg) {
|
|
13293
|
-
this.rCurve = createValueGetter(arg
|
|
13294
|
-
this.gCurve = createValueGetter(arg
|
|
13295
|
-
this.bCurve = createValueGetter(arg
|
|
13296
|
-
this.aCurve = createValueGetter(arg
|
|
13172
|
+
this.rCurve = createValueGetter(arg[0]);
|
|
13173
|
+
this.gCurve = createValueGetter(arg[1]);
|
|
13174
|
+
this.bCurve = createValueGetter(arg[2]);
|
|
13175
|
+
this.aCurve = createValueGetter(arg[3]);
|
|
13297
13176
|
};
|
|
13298
13177
|
_proto.getValue = function getValue(t) {
|
|
13299
13178
|
var r = this.rCurve.getValue(t);
|
|
@@ -13306,7 +13185,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13306
13185
|
return ColorCurve;
|
|
13307
13186
|
}(ValueGetter);
|
|
13308
13187
|
|
|
13309
|
-
|
|
13188
|
+
/**
|
|
13189
|
+
* @since 2.1.0
|
|
13190
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13310
13191
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13311
13192
|
function BaseRenderComponent(engine) {
|
|
13312
13193
|
var _this;
|
|
@@ -13393,7 +13274,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13393
13274
|
* @param texture - 纹理对象
|
|
13394
13275
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13395
13276
|
this.renderer.texture = texture;
|
|
13396
|
-
this.material.setTexture("
|
|
13277
|
+
this.material.setTexture("_MainTex", texture);
|
|
13397
13278
|
};
|
|
13398
13279
|
/**
|
|
13399
13280
|
* @internal
|
|
@@ -13472,51 +13353,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13472
13353
|
geometry.setIndexData(indexData);
|
|
13473
13354
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13474
13355
|
geometry.setDrawCount(data.index.length);
|
|
13475
|
-
|
|
13476
|
-
var texture1 = textures[i];
|
|
13477
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13478
|
-
}
|
|
13479
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13480
|
-
var emptyTexture = this.emptyTexture;
|
|
13481
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13482
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13483
|
-
}
|
|
13356
|
+
material.setTexture("_MainTex", texture);
|
|
13484
13357
|
};
|
|
13485
13358
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13486
|
-
this.
|
|
13487
|
-
|
|
13488
|
-
0.
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
0
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
2,
|
|
13506
|
-
1,
|
|
13507
|
-
3
|
|
13508
|
-
],
|
|
13509
|
-
atlasOffset: [
|
|
13359
|
+
var renderer = this.renderer;
|
|
13360
|
+
if (renderer.shape) {
|
|
13361
|
+
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;
|
|
13362
|
+
var point = new Float32Array(aPoint);
|
|
13363
|
+
var position = [];
|
|
13364
|
+
var atlasOffset = [];
|
|
13365
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13366
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13367
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13368
|
+
}
|
|
13369
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13370
|
+
return {
|
|
13371
|
+
index: index,
|
|
13372
|
+
atlasOffset: atlasOffset
|
|
13373
|
+
};
|
|
13374
|
+
} else {
|
|
13375
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13376
|
+
-0.5,
|
|
13377
|
+
0.5,
|
|
13510
13378
|
0,
|
|
13511
|
-
|
|
13379
|
+
-0.5,
|
|
13380
|
+
-0.5,
|
|
13512
13381
|
0,
|
|
13382
|
+
0.5,
|
|
13383
|
+
0.5,
|
|
13513
13384
|
0,
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
1,
|
|
13385
|
+
0.5,
|
|
13386
|
+
-0.5,
|
|
13517
13387
|
0
|
|
13518
|
-
]
|
|
13519
|
-
|
|
13388
|
+
]));
|
|
13389
|
+
return {
|
|
13390
|
+
index: [
|
|
13391
|
+
0,
|
|
13392
|
+
1,
|
|
13393
|
+
2,
|
|
13394
|
+
2,
|
|
13395
|
+
1,
|
|
13396
|
+
3
|
|
13397
|
+
],
|
|
13398
|
+
atlasOffset: [
|
|
13399
|
+
0,
|
|
13400
|
+
1,
|
|
13401
|
+
0,
|
|
13402
|
+
0,
|
|
13403
|
+
1,
|
|
13404
|
+
1,
|
|
13405
|
+
1,
|
|
13406
|
+
0
|
|
13407
|
+
]
|
|
13408
|
+
};
|
|
13409
|
+
}
|
|
13520
13410
|
};
|
|
13521
13411
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13522
13412
|
return Geometry.create(this.engine, {
|
|
@@ -13581,7 +13471,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13581
13471
|
setBlendMode(material, states.blendMode);
|
|
13582
13472
|
setMaskMode(material, states.maskMode);
|
|
13583
13473
|
setSideMode(material, states.side);
|
|
13584
|
-
material.shader.shaderData.properties = '
|
|
13474
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13585
13475
|
if (!material.hasUniform("_Color")) {
|
|
13586
13476
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13587
13477
|
}
|
|
@@ -15175,36 +15065,513 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15175
15065
|
return Ellipse;
|
|
15176
15066
|
}(ShapePrimitive);
|
|
15177
15067
|
|
|
15178
|
-
var
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15068
|
+
var StarType;
|
|
15069
|
+
(function(StarType) {
|
|
15070
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15071
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15072
|
+
})(StarType || (StarType = {}));
|
|
15073
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15074
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15075
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15076
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15077
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15078
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15079
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15080
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15081
|
+
if (starType === void 0) starType = 0;
|
|
15082
|
+
var _this;
|
|
15083
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15084
|
+
_this.pointCount = pointCount;
|
|
15085
|
+
_this.outerRadius = outerRadius;
|
|
15086
|
+
_this.innerRadius = innerRadius;
|
|
15087
|
+
_this.outerRoundness = outerRoundness;
|
|
15088
|
+
_this.innerRoundness = innerRoundness;
|
|
15089
|
+
_this.starType = starType;
|
|
15090
|
+
_this.v = [];
|
|
15091
|
+
_this.in = [];
|
|
15092
|
+
_this.out = [];
|
|
15093
|
+
return _this;
|
|
15183
15094
|
}
|
|
15184
|
-
var _proto =
|
|
15185
|
-
|
|
15186
|
-
this.
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15095
|
+
var _proto = PolyStar.prototype;
|
|
15096
|
+
_proto.clone = function clone() {
|
|
15097
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15098
|
+
return polyStar;
|
|
15099
|
+
};
|
|
15100
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15101
|
+
this.pointCount = source.pointCount;
|
|
15102
|
+
this.outerRadius = source.outerRadius;
|
|
15103
|
+
this.innerRadius = source.innerRadius;
|
|
15104
|
+
this.outerRoundness = source.outerRoundness;
|
|
15105
|
+
this.innerRoundness = source.innerRoundness;
|
|
15106
|
+
this.starType = source.starType;
|
|
15107
|
+
};
|
|
15108
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15109
|
+
destination.copyFrom(this);
|
|
15110
|
+
};
|
|
15111
|
+
_proto.build = function build(points) {
|
|
15112
|
+
switch(this.starType){
|
|
15113
|
+
case 0:
|
|
15114
|
+
{
|
|
15115
|
+
this.buildStarPath();
|
|
15116
|
+
break;
|
|
15117
|
+
}
|
|
15118
|
+
case 1:
|
|
15119
|
+
{
|
|
15120
|
+
this.buildPolygonPath();
|
|
15121
|
+
break;
|
|
15122
|
+
}
|
|
15123
|
+
}
|
|
15124
|
+
var smoothness = 1;
|
|
15125
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15126
|
+
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);
|
|
15127
|
+
}
|
|
15128
|
+
// draw last curve
|
|
15129
|
+
var lastIndex = this.v.length - 1;
|
|
15130
|
+
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);
|
|
15131
|
+
};
|
|
15132
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15133
|
+
var triangles = triangulate([
|
|
15134
|
+
points
|
|
15135
|
+
]);
|
|
15136
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15137
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15138
|
+
}
|
|
15139
|
+
var vertexCount = triangles.length / 2;
|
|
15140
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15141
|
+
indices[indicesOffset + i1] = i1;
|
|
15142
|
+
}
|
|
15143
|
+
};
|
|
15144
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15145
|
+
this.v = [];
|
|
15146
|
+
this.in = [];
|
|
15147
|
+
this.out = [];
|
|
15148
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15149
|
+
var angle = Math.PI * 2 / numPts;
|
|
15150
|
+
var longFlag = true;
|
|
15151
|
+
var longRad = this.outerRadius;
|
|
15152
|
+
var shortRad = this.innerRadius;
|
|
15153
|
+
var longRound = this.outerRoundness / 100;
|
|
15154
|
+
var shortRound = this.innerRoundness / 100;
|
|
15155
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15156
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15157
|
+
var i;
|
|
15158
|
+
var rad;
|
|
15159
|
+
var roundness;
|
|
15160
|
+
var perimSegment;
|
|
15161
|
+
var currentAng = -Math.PI / 2;
|
|
15162
|
+
var dir = 1;
|
|
15163
|
+
for(i = 0; i < numPts; i++){
|
|
15164
|
+
rad = longFlag ? longRad : shortRad;
|
|
15165
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15166
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15167
|
+
var x = rad * Math.cos(currentAng);
|
|
15168
|
+
var y = rad * Math.sin(currentAng);
|
|
15169
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15170
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15171
|
+
var offset = i * 2;
|
|
15172
|
+
this.v[offset] = x;
|
|
15173
|
+
this.v[offset + 1] = y;
|
|
15174
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15175
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15176
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15177
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15178
|
+
longFlag = !longFlag;
|
|
15179
|
+
currentAng += angle * dir;
|
|
15180
|
+
}
|
|
15181
|
+
};
|
|
15182
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15183
|
+
this.v = [];
|
|
15184
|
+
this.in = [];
|
|
15185
|
+
this.out = [];
|
|
15186
|
+
var numPts = Math.floor(this.pointCount);
|
|
15187
|
+
var angle = Math.PI * 2 / numPts;
|
|
15188
|
+
var rad = this.outerRadius;
|
|
15189
|
+
var roundness = this.outerRoundness / 100;
|
|
15190
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15191
|
+
var i;
|
|
15192
|
+
var currentAng = -Math.PI * 0.5;
|
|
15193
|
+
var dir = 1;
|
|
15194
|
+
for(i = 0; i < numPts; i++){
|
|
15195
|
+
var x = rad * Math.cos(currentAng);
|
|
15196
|
+
var y = rad * Math.sin(currentAng);
|
|
15197
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15198
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15199
|
+
var offset = i * 2;
|
|
15200
|
+
this.v[offset] = x;
|
|
15201
|
+
this.v[offset + 1] = y;
|
|
15202
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15203
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15204
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15205
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15206
|
+
currentAng += angle * dir;
|
|
15207
|
+
}
|
|
15208
|
+
};
|
|
15209
|
+
return PolyStar;
|
|
15210
|
+
}(ShapePrimitive);
|
|
15211
|
+
|
|
15212
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15213
|
+
/**
|
|
15214
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
15215
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15216
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15217
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15218
|
+
function Rectangle(x, y, width, height) {
|
|
15219
|
+
if (x === void 0) x = 0;
|
|
15220
|
+
if (y === void 0) y = 0;
|
|
15221
|
+
if (width === void 0) width = 0;
|
|
15222
|
+
if (height === void 0) height = 0;
|
|
15223
|
+
var _this;
|
|
15224
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15225
|
+
_this.x = Number(x);
|
|
15226
|
+
_this.y = Number(y);
|
|
15227
|
+
_this.width = Number(width);
|
|
15228
|
+
_this.height = Number(height);
|
|
15229
|
+
return _this;
|
|
15230
|
+
}
|
|
15231
|
+
var _proto = Rectangle.prototype;
|
|
15232
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15233
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15234
|
+
};
|
|
15235
|
+
/**
|
|
15236
|
+
* Creates a clone of this Rectangle
|
|
15237
|
+
* @returns a copy of the rectangle
|
|
15238
|
+
*/ _proto.clone = function clone() {
|
|
15239
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15240
|
+
};
|
|
15241
|
+
/**
|
|
15242
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15243
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15244
|
+
* @returns Returns itself.
|
|
15245
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15246
|
+
// this.x = bounds.minX;
|
|
15247
|
+
// this.y = bounds.minY;
|
|
15248
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15249
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15250
|
+
// return this;
|
|
15251
|
+
// }
|
|
15252
|
+
/**
|
|
15253
|
+
* Copies another rectangle to this one.
|
|
15254
|
+
* @param rectangle - The rectangle to copy from.
|
|
15255
|
+
* @returns Returns itself.
|
|
15256
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15257
|
+
this.x = rectangle.x;
|
|
15258
|
+
this.y = rectangle.y;
|
|
15259
|
+
this.width = rectangle.width;
|
|
15260
|
+
this.height = rectangle.height;
|
|
15261
|
+
return this;
|
|
15262
|
+
};
|
|
15263
|
+
/**
|
|
15264
|
+
* Copies this rectangle to another one.
|
|
15265
|
+
* @param rectangle - The rectangle to copy to.
|
|
15266
|
+
* @returns Returns given parameter.
|
|
15267
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15268
|
+
rectangle.copyFrom(this);
|
|
15269
|
+
return rectangle;
|
|
15270
|
+
};
|
|
15271
|
+
/**
|
|
15272
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15273
|
+
* @param x - The X coordinate of the point to test
|
|
15274
|
+
* @param y - The Y coordinate of the point to test
|
|
15275
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15276
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15277
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15278
|
+
return false;
|
|
15279
|
+
}
|
|
15280
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15281
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15282
|
+
return true;
|
|
15283
|
+
}
|
|
15284
|
+
}
|
|
15285
|
+
return false;
|
|
15286
|
+
};
|
|
15287
|
+
/**
|
|
15288
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15289
|
+
* @param x - The X coordinate of the point to test
|
|
15290
|
+
* @param y - The Y coordinate of the point to test
|
|
15291
|
+
* @param strokeWidth - The width of the line to check
|
|
15292
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15293
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15294
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15295
|
+
if (width <= 0 || height <= 0) {
|
|
15296
|
+
return false;
|
|
15297
|
+
}
|
|
15298
|
+
var _x = this.x;
|
|
15299
|
+
var _y = this.y;
|
|
15300
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15301
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15302
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15303
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15304
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15305
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15306
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15307
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15308
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15309
|
+
};
|
|
15310
|
+
/**
|
|
15311
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15312
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15313
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15314
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15315
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15316
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15317
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15318
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15319
|
+
// if (!transform) {
|
|
15320
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15321
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15322
|
+
// if (x1 <= x0) {
|
|
15323
|
+
// return false;
|
|
15324
|
+
// }
|
|
15325
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15326
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15327
|
+
// return y1 > y0;
|
|
15328
|
+
// }
|
|
15329
|
+
// const x0 = this.left;
|
|
15330
|
+
// const x1 = this.right;
|
|
15331
|
+
// const y0 = this.top;
|
|
15332
|
+
// const y1 = this.bottom;
|
|
15333
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15334
|
+
// return false;
|
|
15335
|
+
// }
|
|
15336
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15337
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15338
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15339
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15340
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15341
|
+
// return false;
|
|
15342
|
+
// }
|
|
15343
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15344
|
+
// if (s === 0) {
|
|
15345
|
+
// return false;
|
|
15346
|
+
// }
|
|
15347
|
+
// transform.apply(lt, lt);
|
|
15348
|
+
// transform.apply(lb, lb);
|
|
15349
|
+
// transform.apply(rt, rt);
|
|
15350
|
+
// transform.apply(rb, rb);
|
|
15351
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15352
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15353
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15354
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15355
|
+
// return false;
|
|
15356
|
+
// }
|
|
15357
|
+
// const nx = s * (lb.y - lt.y);
|
|
15358
|
+
// const ny = s * (lt.x - lb.x);
|
|
15359
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15360
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15361
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15362
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15363
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15364
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15365
|
+
// return false;
|
|
15366
|
+
// }
|
|
15367
|
+
// const mx = s * (lt.y - rt.y);
|
|
15368
|
+
// const my = s * (rt.x - lt.x);
|
|
15369
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15370
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15371
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15372
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15373
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15374
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15375
|
+
// return false;
|
|
15376
|
+
// }
|
|
15377
|
+
// return true;
|
|
15378
|
+
// }
|
|
15379
|
+
/**
|
|
15380
|
+
* Pads the rectangle making it grow in all directions.
|
|
15381
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15382
|
+
* @param paddingX - The horizontal padding amount.
|
|
15383
|
+
* @param paddingY - The vertical padding amount.
|
|
15384
|
+
* @returns Returns itself.
|
|
15385
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15386
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15387
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15388
|
+
this.x -= paddingX;
|
|
15389
|
+
this.y -= paddingY;
|
|
15390
|
+
this.width += paddingX * 2;
|
|
15391
|
+
this.height += paddingY * 2;
|
|
15392
|
+
return this;
|
|
15393
|
+
};
|
|
15394
|
+
/**
|
|
15395
|
+
* Fits this rectangle around the passed one.
|
|
15396
|
+
* @param rectangle - The rectangle to fit.
|
|
15397
|
+
* @returns Returns itself.
|
|
15398
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15399
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15400
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15401
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15402
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15403
|
+
this.x = x1;
|
|
15404
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15405
|
+
this.y = y1;
|
|
15406
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15407
|
+
return this;
|
|
15408
|
+
};
|
|
15409
|
+
/**
|
|
15410
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15411
|
+
* @param resolution - resolution
|
|
15412
|
+
* @param eps - precision
|
|
15413
|
+
* @returns Returns itself.
|
|
15414
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15415
|
+
if (resolution === void 0) resolution = 1;
|
|
15416
|
+
if (eps === void 0) eps = 0.001;
|
|
15417
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15418
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15419
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15420
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15421
|
+
this.width = x2 - this.x;
|
|
15422
|
+
this.height = y2 - this.y;
|
|
15423
|
+
return this;
|
|
15424
|
+
};
|
|
15425
|
+
/**
|
|
15426
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15427
|
+
* @param rectangle - The rectangle to include.
|
|
15428
|
+
* @returns Returns itself.
|
|
15429
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15430
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15431
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15432
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15433
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15434
|
+
this.x = x1;
|
|
15435
|
+
this.width = x2 - x1;
|
|
15436
|
+
this.y = y1;
|
|
15437
|
+
this.height = y2 - y1;
|
|
15438
|
+
return this;
|
|
15439
|
+
};
|
|
15440
|
+
/**
|
|
15441
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15442
|
+
* @param out - optional rectangle to store the result
|
|
15443
|
+
* @returns The framing rectangle
|
|
15444
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15445
|
+
out = out || new Rectangle();
|
|
15446
|
+
out.copyFrom(this);
|
|
15447
|
+
return out;
|
|
15448
|
+
};
|
|
15449
|
+
_proto.getX = function getX() {
|
|
15450
|
+
return this.x;
|
|
15451
|
+
};
|
|
15452
|
+
_proto.getY = function getY() {
|
|
15453
|
+
return this.y;
|
|
15454
|
+
};
|
|
15455
|
+
_proto.build = function build(points) {
|
|
15456
|
+
var x = this.x;
|
|
15457
|
+
var y = this.y;
|
|
15458
|
+
var width = this.width;
|
|
15459
|
+
var height = this.height;
|
|
15460
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15461
|
+
return points;
|
|
15462
|
+
}
|
|
15463
|
+
points[0] = x;
|
|
15464
|
+
points[1] = y;
|
|
15465
|
+
points[2] = x + width;
|
|
15466
|
+
points[3] = y;
|
|
15467
|
+
points[4] = x + width;
|
|
15468
|
+
points[5] = y + height;
|
|
15469
|
+
points[6] = x;
|
|
15470
|
+
points[7] = y + height;
|
|
15471
|
+
return points;
|
|
15472
|
+
};
|
|
15473
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15474
|
+
var count = 0;
|
|
15475
|
+
var verticesStride = 2;
|
|
15476
|
+
verticesOffset *= verticesStride;
|
|
15477
|
+
vertices[verticesOffset + count] = points[0];
|
|
15478
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15479
|
+
count += verticesStride;
|
|
15480
|
+
vertices[verticesOffset + count] = points[2];
|
|
15481
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15482
|
+
count += verticesStride;
|
|
15483
|
+
vertices[verticesOffset + count] = points[6];
|
|
15484
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15485
|
+
count += verticesStride;
|
|
15486
|
+
vertices[verticesOffset + count] = points[4];
|
|
15487
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15488
|
+
count += verticesStride;
|
|
15489
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15490
|
+
// triangle 1
|
|
15491
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15492
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15493
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15494
|
+
// triangle 2
|
|
15495
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15496
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15497
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15498
|
+
};
|
|
15499
|
+
_create_class(Rectangle, [
|
|
15500
|
+
{
|
|
15501
|
+
key: "left",
|
|
15502
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15503
|
+
return this.x;
|
|
15504
|
+
}
|
|
15505
|
+
},
|
|
15506
|
+
{
|
|
15507
|
+
key: "right",
|
|
15508
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15509
|
+
return this.x + this.width;
|
|
15510
|
+
}
|
|
15511
|
+
},
|
|
15512
|
+
{
|
|
15513
|
+
key: "top",
|
|
15514
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15515
|
+
return this.y;
|
|
15516
|
+
}
|
|
15517
|
+
},
|
|
15518
|
+
{
|
|
15519
|
+
key: "bottom",
|
|
15520
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15521
|
+
return this.y + this.height;
|
|
15522
|
+
}
|
|
15523
|
+
}
|
|
15524
|
+
], [
|
|
15525
|
+
{
|
|
15526
|
+
key: "EMPTY",
|
|
15527
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15528
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15529
|
+
}
|
|
15530
|
+
}
|
|
15531
|
+
]);
|
|
15532
|
+
return Rectangle;
|
|
15533
|
+
}(ShapePrimitive);
|
|
15534
|
+
|
|
15535
|
+
var ShapePath = /*#__PURE__*/ function() {
|
|
15536
|
+
function ShapePath(graphicsPath) {
|
|
15537
|
+
this.graphicsPath = graphicsPath;
|
|
15538
|
+
this.currentPoly = null;
|
|
15539
|
+
this.shapePrimitives = [];
|
|
15540
|
+
}
|
|
15541
|
+
var _proto = ShapePath.prototype;
|
|
15542
|
+
/** Builds the path. */ _proto.buildPath = function buildPath() {
|
|
15543
|
+
this.currentPoly = null;
|
|
15544
|
+
this.shapePrimitives.length = 0;
|
|
15545
|
+
var path = this.graphicsPath;
|
|
15546
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
|
|
15547
|
+
var instruction = _step.value;
|
|
15548
|
+
var action = instruction.action;
|
|
15549
|
+
var data = instruction.data;
|
|
15550
|
+
switch(action){
|
|
15551
|
+
case "bezierCurveTo":
|
|
15552
|
+
{
|
|
15553
|
+
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15554
|
+
break;
|
|
15555
|
+
}
|
|
15556
|
+
case "moveTo":
|
|
15557
|
+
{
|
|
15558
|
+
this.moveTo(data[0], data[1]);
|
|
15559
|
+
break;
|
|
15560
|
+
}
|
|
15561
|
+
case "ellipse":
|
|
15562
|
+
{
|
|
15563
|
+
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15564
|
+
break;
|
|
15565
|
+
}
|
|
15566
|
+
case "polyStar":
|
|
15567
|
+
{
|
|
15568
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15569
|
+
break;
|
|
15570
|
+
}
|
|
15571
|
+
case "rect":
|
|
15572
|
+
{
|
|
15573
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15574
|
+
break;
|
|
15208
15575
|
}
|
|
15209
15576
|
}
|
|
15210
15577
|
}
|
|
@@ -15246,6 +15613,22 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15246
15613
|
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15247
15614
|
return this;
|
|
15248
15615
|
};
|
|
15616
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15617
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15618
|
+
return this;
|
|
15619
|
+
};
|
|
15620
|
+
/**
|
|
15621
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15622
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15623
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15624
|
+
* @param w - The width of the rectangle.
|
|
15625
|
+
* @param h - The height of the rectangle.
|
|
15626
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15627
|
+
* @returns The instance of the current object for chaining.
|
|
15628
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15629
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15630
|
+
return this;
|
|
15631
|
+
};
|
|
15249
15632
|
/**
|
|
15250
15633
|
* Draws a given shape on the canvas.
|
|
15251
15634
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
@@ -15382,8 +15765,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15382
15765
|
};
|
|
15383
15766
|
/**
|
|
15384
15767
|
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15385
|
-
* @param x - The x-coordinate of the
|
|
15386
|
-
* @param y - The y-coordinate of the
|
|
15768
|
+
* @param x - The x-coordinate of the upper-left corner of the rectangle.
|
|
15769
|
+
* @param y - The y-coordinate of the upper-left corner of the rectangle.
|
|
15387
15770
|
* @param w - The width of the rectangle.
|
|
15388
15771
|
* @param h - The height of the rectangle.
|
|
15389
15772
|
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
@@ -15402,6 +15785,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15402
15785
|
this.dirty = true;
|
|
15403
15786
|
return this;
|
|
15404
15787
|
};
|
|
15788
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15789
|
+
this.instructions.push({
|
|
15790
|
+
action: "polyStar",
|
|
15791
|
+
data: [
|
|
15792
|
+
pointCount,
|
|
15793
|
+
outerRadius,
|
|
15794
|
+
innerRadius,
|
|
15795
|
+
outerRoundness,
|
|
15796
|
+
innerRoundness,
|
|
15797
|
+
starType,
|
|
15798
|
+
transform
|
|
15799
|
+
]
|
|
15800
|
+
});
|
|
15801
|
+
this.dirty = true;
|
|
15802
|
+
return this;
|
|
15803
|
+
};
|
|
15405
15804
|
_proto.clear = function clear() {
|
|
15406
15805
|
this.instructions.length = 0;
|
|
15407
15806
|
this.dirty = true;
|
|
@@ -15437,7 +15836,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15437
15836
|
_this.curveValues = [];
|
|
15438
15837
|
_this.animated = true;
|
|
15439
15838
|
_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";
|
|
15440
|
-
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n gl_FragColor = color;\n}\n";
|
|
15839
|
+
_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";
|
|
15441
15840
|
if (!_this.geometry) {
|
|
15442
15841
|
_this.geometry = Geometry.create(engine, {
|
|
15443
15842
|
attributes: {
|
|
@@ -15479,7 +15878,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15479
15878
|
};
|
|
15480
15879
|
_this.material = Material.create(engine, materialProps);
|
|
15481
15880
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15482
|
-
_this.material.depthMask =
|
|
15881
|
+
_this.material.depthMask = false;
|
|
15483
15882
|
_this.material.depthTest = true;
|
|
15484
15883
|
_this.material.blending = true;
|
|
15485
15884
|
}
|
|
@@ -15544,16 +15943,18 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15544
15943
|
};
|
|
15545
15944
|
_proto.buildPath = function buildPath(data) {
|
|
15546
15945
|
this.path.clear();
|
|
15547
|
-
|
|
15548
|
-
|
|
15946
|
+
var shapeData = data;
|
|
15947
|
+
switch(shapeData.type){
|
|
15948
|
+
case ShapePrimitiveType.Custom:
|
|
15549
15949
|
{
|
|
15550
|
-
var customData =
|
|
15551
|
-
var points = customData.
|
|
15552
|
-
var easingIns = customData.
|
|
15553
|
-
var easingOuts = customData.
|
|
15950
|
+
var customData = shapeData;
|
|
15951
|
+
var points = customData.points;
|
|
15952
|
+
var easingIns = customData.easingIns;
|
|
15953
|
+
var easingOuts = customData.easingOuts;
|
|
15554
15954
|
this.curveValues = [];
|
|
15555
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
15955
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15556
15956
|
var shape = _step.value;
|
|
15957
|
+
this.setFillColor(shape.fill);
|
|
15557
15958
|
var indices = shape.indexes;
|
|
15558
15959
|
for(var i = 1; i < indices.length; i++){
|
|
15559
15960
|
var pointIndex = indices[i];
|
|
@@ -15581,46 +15982,185 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15581
15982
|
}
|
|
15582
15983
|
break;
|
|
15583
15984
|
}
|
|
15584
|
-
case
|
|
15985
|
+
case ShapePrimitiveType.Ellipse:
|
|
15986
|
+
{
|
|
15987
|
+
var ellipseData = shapeData;
|
|
15988
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
15989
|
+
this.setFillColor(ellipseData.fill);
|
|
15990
|
+
break;
|
|
15991
|
+
}
|
|
15992
|
+
case ShapePrimitiveType.Rectangle:
|
|
15993
|
+
{
|
|
15994
|
+
var rectangleData = shapeData;
|
|
15995
|
+
this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
15996
|
+
this.setFillColor(rectangleData.fill);
|
|
15997
|
+
break;
|
|
15998
|
+
}
|
|
15999
|
+
case ShapePrimitiveType.Star:
|
|
15585
16000
|
{
|
|
15586
|
-
var
|
|
15587
|
-
|
|
15588
|
-
this.
|
|
16001
|
+
var starData = shapeData;
|
|
16002
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16003
|
+
this.setFillColor(starData.fill);
|
|
15589
16004
|
break;
|
|
15590
16005
|
}
|
|
16006
|
+
case ShapePrimitiveType.Polygon:
|
|
16007
|
+
{
|
|
16008
|
+
var polygonData = shapeData;
|
|
16009
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16010
|
+
this.setFillColor(polygonData.fill);
|
|
16011
|
+
break;
|
|
16012
|
+
}
|
|
16013
|
+
}
|
|
16014
|
+
};
|
|
16015
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16016
|
+
if (fill) {
|
|
16017
|
+
var color = fill.color;
|
|
16018
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
15591
16019
|
}
|
|
15592
16020
|
};
|
|
15593
16021
|
_proto.fromData = function fromData(data) {
|
|
15594
16022
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15595
16023
|
this.data = data;
|
|
16024
|
+
var material = this.material;
|
|
16025
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16026
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16027
|
+
data.renderer.mask,
|
|
16028
|
+
data.renderer.mask
|
|
16029
|
+
] : undefined;
|
|
16030
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16031
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15596
16032
|
};
|
|
15597
16033
|
return ShapeComponent;
|
|
15598
16034
|
}(MeshComponent);
|
|
15599
16035
|
exports.ShapeComponent = __decorate([
|
|
15600
16036
|
effectsClass("ShapeComponent")
|
|
15601
16037
|
], exports.ShapeComponent);
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
16038
|
+
|
|
16039
|
+
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16040
|
+
_inherits(Fake3DComponent, Component);
|
|
16041
|
+
function Fake3DComponent() {
|
|
16042
|
+
var _this;
|
|
16043
|
+
_this = Component.apply(this, arguments) || this;
|
|
16044
|
+
_this.loop = false;
|
|
16045
|
+
_this.amountOfMotion = 1.0;
|
|
16046
|
+
_this.animationLength = 2.0;
|
|
16047
|
+
_this.mode = 1;
|
|
16048
|
+
_this.startPositionX = 0;
|
|
16049
|
+
_this.startPositionY = 0;
|
|
16050
|
+
_this.startPositionZ = 0;
|
|
16051
|
+
_this.endPositionX = 0;
|
|
16052
|
+
_this.endPositionY = 0;
|
|
16053
|
+
_this.endPositionZ = 0;
|
|
16054
|
+
_this.amplitudeX = 0;
|
|
16055
|
+
_this.amplitudeY = 0;
|
|
16056
|
+
_this.amplitudeZ = 0;
|
|
16057
|
+
_this.phaseX = 0;
|
|
16058
|
+
_this.phaseY = 0;
|
|
16059
|
+
_this.phaseZ = 0;
|
|
16060
|
+
return _this;
|
|
16061
|
+
}
|
|
16062
|
+
var _proto = Fake3DComponent.prototype;
|
|
16063
|
+
_proto.onStart = function onStart() {
|
|
16064
|
+
this.effectComponent = this.item.getComponent(exports.EffectComponent);
|
|
16065
|
+
};
|
|
16066
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16067
|
+
this.updateFake3D();
|
|
16068
|
+
};
|
|
16069
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16070
|
+
if (!this.effectComponent) {
|
|
16071
|
+
return;
|
|
16072
|
+
}
|
|
16073
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16074
|
+
var _PosX = 0;
|
|
16075
|
+
var _PosY = 0;
|
|
16076
|
+
var _PosZ = 0;
|
|
16077
|
+
switch(this.mode){
|
|
16078
|
+
case 0:
|
|
16079
|
+
{
|
|
16080
|
+
var PI = Math.PI;
|
|
16081
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16082
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16083
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16084
|
+
break;
|
|
16085
|
+
}
|
|
16086
|
+
case 1:
|
|
16087
|
+
{
|
|
16088
|
+
var localTime = time;
|
|
16089
|
+
if (this.loop) {
|
|
16090
|
+
if (localTime > 0.5) {
|
|
16091
|
+
localTime = 1 - localTime;
|
|
16092
|
+
}
|
|
16093
|
+
localTime *= 2;
|
|
16094
|
+
}
|
|
16095
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16096
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16097
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16098
|
+
break;
|
|
16099
|
+
}
|
|
16100
|
+
}
|
|
16101
|
+
var material = this.effectComponent.material;
|
|
16102
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16103
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16104
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16105
|
+
};
|
|
16106
|
+
return Fake3DComponent;
|
|
16107
|
+
}(Component);
|
|
16108
|
+
__decorate([
|
|
16109
|
+
serialize()
|
|
16110
|
+
], exports.Fake3DComponent.prototype, "loop", void 0);
|
|
16111
|
+
__decorate([
|
|
16112
|
+
serialize()
|
|
16113
|
+
], exports.Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16114
|
+
__decorate([
|
|
16115
|
+
serialize()
|
|
16116
|
+
], exports.Fake3DComponent.prototype, "animationLength", void 0);
|
|
16117
|
+
__decorate([
|
|
16118
|
+
serialize()
|
|
16119
|
+
], exports.Fake3DComponent.prototype, "mode", void 0);
|
|
16120
|
+
__decorate([
|
|
16121
|
+
serialize()
|
|
16122
|
+
], exports.Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16123
|
+
__decorate([
|
|
16124
|
+
serialize()
|
|
16125
|
+
], exports.Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16126
|
+
__decorate([
|
|
16127
|
+
serialize()
|
|
16128
|
+
], exports.Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16129
|
+
__decorate([
|
|
16130
|
+
serialize()
|
|
16131
|
+
], exports.Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16132
|
+
__decorate([
|
|
16133
|
+
serialize()
|
|
16134
|
+
], exports.Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16135
|
+
__decorate([
|
|
16136
|
+
serialize()
|
|
16137
|
+
], exports.Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16138
|
+
__decorate([
|
|
16139
|
+
serialize()
|
|
16140
|
+
], exports.Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16141
|
+
__decorate([
|
|
16142
|
+
serialize()
|
|
16143
|
+
], exports.Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16144
|
+
__decorate([
|
|
16145
|
+
serialize()
|
|
16146
|
+
], exports.Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16147
|
+
__decorate([
|
|
16148
|
+
serialize()
|
|
16149
|
+
], exports.Fake3DComponent.prototype, "phaseX", void 0);
|
|
16150
|
+
__decorate([
|
|
16151
|
+
serialize()
|
|
16152
|
+
], exports.Fake3DComponent.prototype, "phaseY", void 0);
|
|
16153
|
+
__decorate([
|
|
16154
|
+
serialize()
|
|
16155
|
+
], exports.Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16156
|
+
exports.Fake3DComponent = __decorate([
|
|
16157
|
+
effectsClass("Fake3DComponent")
|
|
16158
|
+
], exports.Fake3DComponent);
|
|
16159
|
+
exports.Fake3DAnimationMode = void 0;
|
|
16160
|
+
(function(Fake3DAnimationMode) {
|
|
16161
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16162
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16163
|
+
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
15624
16164
|
|
|
15625
16165
|
exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15626
16166
|
_inherits(CameraController, Behaviour);
|
|
@@ -15992,8 +16532,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15992
16532
|
0
|
|
15993
16533
|
]
|
|
15994
16534
|
};
|
|
16535
|
+
_this.duringPlay = false;
|
|
15995
16536
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15996
|
-
_this.hasBeenAddedToComposition = false;
|
|
15997
16537
|
_this.getHitTestParams = function(force) {
|
|
15998
16538
|
if (!_this.clickable) {
|
|
15999
16539
|
return;
|
|
@@ -16030,7 +16570,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16030
16570
|
];
|
|
16031
16571
|
};
|
|
16032
16572
|
_proto.onStart = function onStart() {
|
|
16033
|
-
var _this = this;
|
|
16034
16573
|
var options = this.item.props.content.options;
|
|
16035
16574
|
var env = this.item.engine.renderer.env;
|
|
16036
16575
|
var composition = this.item.composition;
|
|
@@ -16054,32 +16593,37 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16054
16593
|
this.materials = this.previewContent.mesh.materials;
|
|
16055
16594
|
}
|
|
16056
16595
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
(
|
|
16064
|
-
|
|
16596
|
+
};
|
|
16597
|
+
_proto.onDisable = function onDisable() {
|
|
16598
|
+
RendererComponent.prototype.onDisable.call(this);
|
|
16599
|
+
if (this.item && this.item.composition) {
|
|
16600
|
+
var _this_previewContent;
|
|
16601
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16602
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16603
|
+
this.duringPlay = false;
|
|
16065
16604
|
}
|
|
16066
|
-
|
|
16605
|
+
this.clickable = false;
|
|
16606
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16607
|
+
this.endDragTarget();
|
|
16608
|
+
}
|
|
16609
|
+
};
|
|
16610
|
+
_proto.onEnable = function onEnable() {
|
|
16611
|
+
RendererComponent.prototype.onEnable.call(this);
|
|
16612
|
+
var type = this.interactData.options.type;
|
|
16613
|
+
if (type === InteractType.CLICK) {
|
|
16614
|
+
this.clickable = true;
|
|
16615
|
+
}
|
|
16067
16616
|
};
|
|
16068
16617
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16069
16618
|
var _this_previewContent;
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16075
|
-
var type = this.interactData.options.type;
|
|
16076
|
-
if (type === InteractType.CLICK) {
|
|
16077
|
-
this.clickable = true;
|
|
16078
|
-
}
|
|
16619
|
+
this.duringPlay = true;
|
|
16620
|
+
// trigger messageBegin when item enter
|
|
16621
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16622
|
+
var _this_item_composition;
|
|
16079
16623
|
var options = this.item.props.content.options;
|
|
16080
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16081
|
-
this.hasBeenAddedToComposition = true;
|
|
16624
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16082
16625
|
}
|
|
16626
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16083
16627
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16084
16628
|
return;
|
|
16085
16629
|
}
|
|
@@ -16247,7 +16791,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16247
16791
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16248
16792
|
}
|
|
16249
16793
|
|
|
16250
|
-
|
|
16794
|
+
/**
|
|
16795
|
+
*
|
|
16796
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16251
16797
|
function MeshCollider() {
|
|
16252
16798
|
this.triangles = [];
|
|
16253
16799
|
}
|
|
@@ -16255,6 +16801,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16255
16801
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16256
16802
|
return this.boundingBoxData;
|
|
16257
16803
|
};
|
|
16804
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
16805
|
+
var maxX = -Number.MAX_VALUE;
|
|
16806
|
+
var maxY = -Number.MAX_VALUE;
|
|
16807
|
+
var minX = Number.MAX_VALUE;
|
|
16808
|
+
var minY = Number.MAX_VALUE;
|
|
16809
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
16810
|
+
var triangle = _step.value;
|
|
16811
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
16812
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
16813
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
16814
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
16815
|
+
}
|
|
16816
|
+
var area = [];
|
|
16817
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
16818
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
16819
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
16820
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
16821
|
+
area.push({
|
|
16822
|
+
p0: point0,
|
|
16823
|
+
p1: point1,
|
|
16824
|
+
p2: point2
|
|
16825
|
+
});
|
|
16826
|
+
area.push({
|
|
16827
|
+
p0: point0,
|
|
16828
|
+
p1: point2,
|
|
16829
|
+
p2: point3
|
|
16830
|
+
});
|
|
16831
|
+
return {
|
|
16832
|
+
type: exports.HitTestType.triangle,
|
|
16833
|
+
area: area
|
|
16834
|
+
};
|
|
16835
|
+
};
|
|
16258
16836
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16259
16837
|
if (this.geometry !== geometry) {
|
|
16260
16838
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16459,6 +17037,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16459
17037
|
if (inputCount === void 0) inputCount = 0;
|
|
16460
17038
|
this.onPlayablePlayFlag = true;
|
|
16461
17039
|
this.onPlayablePauseFlag = false;
|
|
17040
|
+
this.duration = 0;
|
|
16462
17041
|
this.destroyed = false;
|
|
16463
17042
|
this.inputs = [];
|
|
16464
17043
|
this.inputOuputPorts = [];
|
|
@@ -16551,6 +17130,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16551
17130
|
_proto.getTime = function getTime() {
|
|
16552
17131
|
return this.time;
|
|
16553
17132
|
};
|
|
17133
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17134
|
+
this.duration = duration;
|
|
17135
|
+
};
|
|
17136
|
+
_proto.getDuration = function getDuration() {
|
|
17137
|
+
return this.duration;
|
|
17138
|
+
};
|
|
16554
17139
|
_proto.getPlayState = function getPlayState() {
|
|
16555
17140
|
return this.playState;
|
|
16556
17141
|
};
|
|
@@ -16702,7 +17287,9 @@ var PlayableTraversalMode;
|
|
|
16702
17287
|
var tempQuat$1 = new Quaternion();
|
|
16703
17288
|
var seed$3 = 1;
|
|
16704
17289
|
// TODO 继承 Component
|
|
16705
|
-
|
|
17290
|
+
/**
|
|
17291
|
+
*
|
|
17292
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16706
17293
|
function Transform(props, parent) {
|
|
16707
17294
|
if (props === void 0) props = {};
|
|
16708
17295
|
this.taggedProperties = {};
|
|
@@ -17167,7 +17754,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17167
17754
|
return Transform;
|
|
17168
17755
|
}();
|
|
17169
17756
|
|
|
17170
|
-
|
|
17757
|
+
/**
|
|
17758
|
+
*
|
|
17759
|
+
*/ /**
|
|
17760
|
+
* 事件监听器
|
|
17761
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17171
17762
|
var _this = this;
|
|
17172
17763
|
var _this1 = this;
|
|
17173
17764
|
this.listeners = {};
|
|
@@ -17261,17 +17852,15 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17261
17852
|
/**
|
|
17262
17853
|
* 元素动画结束时行为(如何处理元素)
|
|
17263
17854
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17264
|
-
/**
|
|
17265
|
-
* 元素是否可用
|
|
17266
|
-
*/ _this.ended = false;
|
|
17267
|
-
_this.reusable = false;
|
|
17268
17855
|
_this.type = ItemType.base;
|
|
17269
17856
|
_this.isDuringPlay = false;
|
|
17270
17857
|
_this.components = [];
|
|
17271
17858
|
_this.rendererComponents = [];
|
|
17272
17859
|
/**
|
|
17273
|
-
*
|
|
17274
|
-
|
|
17860
|
+
* 元素是否激活
|
|
17861
|
+
*/ _this.active = true;
|
|
17862
|
+
/**
|
|
17863
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17275
17864
|
*/ _this.visible = true;
|
|
17276
17865
|
/**
|
|
17277
17866
|
* 元素动画的速度
|
|
@@ -17402,12 +17991,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17402
17991
|
}
|
|
17403
17992
|
};
|
|
17404
17993
|
/**
|
|
17405
|
-
* 元素动画结束播放时回调函数
|
|
17406
|
-
* @override
|
|
17407
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17408
|
-
// OVERRIDE
|
|
17409
|
-
};
|
|
17410
|
-
/**
|
|
17411
17994
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17412
17995
|
* @param {number} r
|
|
17413
17996
|
* @param {number} g
|
|
@@ -17420,17 +18003,27 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17420
18003
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17421
18004
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17422
18005
|
/**
|
|
17423
|
-
*
|
|
17424
|
-
*/ _proto.
|
|
17425
|
-
|
|
18006
|
+
* 激活或停用 VFXItem
|
|
18007
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18008
|
+
if (this.active !== value) {
|
|
18009
|
+
this.active = !!value;
|
|
18010
|
+
this.onActiveChanged();
|
|
18011
|
+
}
|
|
17426
18012
|
};
|
|
17427
18013
|
/**
|
|
17428
|
-
*
|
|
18014
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17429
18015
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17430
|
-
|
|
17431
|
-
|
|
17432
|
-
|
|
18016
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18017
|
+
var component = _step.value;
|
|
18018
|
+
component.enabled = visible;
|
|
17433
18019
|
}
|
|
18020
|
+
this.visible = visible;
|
|
18021
|
+
};
|
|
18022
|
+
/**
|
|
18023
|
+
* 元素组件显隐状态
|
|
18024
|
+
* @deprecated use isVisible instead
|
|
18025
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18026
|
+
return this.visible;
|
|
17434
18027
|
};
|
|
17435
18028
|
/**
|
|
17436
18029
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17512,14 +18105,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17512
18105
|
this.transform.assignWorldTRS(pos);
|
|
17513
18106
|
return pos;
|
|
17514
18107
|
};
|
|
17515
|
-
/**
|
|
17516
|
-
* 是否到达元素的结束时间
|
|
17517
|
-
* @param now
|
|
17518
|
-
* @returns
|
|
17519
|
-
*/ _proto.isEnded = function isEnded(now) {
|
|
17520
|
-
// at least 1 ms
|
|
17521
|
-
return now - this.duration > 0.001;
|
|
17522
|
-
};
|
|
17523
18108
|
_proto.find = function find(name) {
|
|
17524
18109
|
var _queue;
|
|
17525
18110
|
if (this.name === name) {
|
|
@@ -17543,7 +18128,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17543
18128
|
* @internal
|
|
17544
18129
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17545
18130
|
this.isDuringPlay = true;
|
|
17546
|
-
if (this.composition && this.
|
|
18131
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17547
18132
|
this.onEnable();
|
|
17548
18133
|
}
|
|
17549
18134
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17637,7 +18222,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17637
18222
|
options: {}
|
|
17638
18223
|
};
|
|
17639
18224
|
}
|
|
17640
|
-
if (duration
|
|
18225
|
+
if (duration < 0) {
|
|
17641
18226
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
17642
18227
|
}
|
|
17643
18228
|
this.rendererComponents.length = 0;
|
|
@@ -17727,25 +18312,54 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17727
18312
|
// }
|
|
17728
18313
|
// }
|
|
17729
18314
|
};
|
|
17730
|
-
|
|
18315
|
+
/**
|
|
18316
|
+
*
|
|
18317
|
+
* @param item
|
|
18318
|
+
* @returns
|
|
18319
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17731
18320
|
return item.type === ItemType.composition;
|
|
17732
18321
|
};
|
|
17733
|
-
|
|
18322
|
+
/**
|
|
18323
|
+
*
|
|
18324
|
+
* @param item
|
|
18325
|
+
* @returns
|
|
18326
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17734
18327
|
return item.type === ItemType.sprite;
|
|
17735
18328
|
};
|
|
17736
|
-
|
|
18329
|
+
/**
|
|
18330
|
+
*
|
|
18331
|
+
* @param item
|
|
18332
|
+
* @returns
|
|
18333
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17737
18334
|
return item.type === ItemType.particle;
|
|
17738
18335
|
};
|
|
17739
|
-
|
|
18336
|
+
/**
|
|
18337
|
+
*
|
|
18338
|
+
* @param item
|
|
18339
|
+
* @returns
|
|
18340
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17740
18341
|
return item.type === ItemType.null;
|
|
17741
18342
|
};
|
|
17742
|
-
|
|
18343
|
+
/**
|
|
18344
|
+
*
|
|
18345
|
+
* @param item
|
|
18346
|
+
* @returns
|
|
18347
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17743
18348
|
return item.type === ItemType.tree;
|
|
17744
18349
|
};
|
|
17745
|
-
|
|
18350
|
+
/**
|
|
18351
|
+
*
|
|
18352
|
+
* @param item
|
|
18353
|
+
* @returns
|
|
18354
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17746
18355
|
return item.type === ItemType.camera;
|
|
17747
18356
|
};
|
|
17748
|
-
|
|
18357
|
+
/**
|
|
18358
|
+
*
|
|
18359
|
+
* @param ancestorCandidate
|
|
18360
|
+
* @param descendantCandidate
|
|
18361
|
+
* @returns
|
|
18362
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17749
18363
|
var current = descendantCandidate.parent;
|
|
17750
18364
|
while(current){
|
|
17751
18365
|
if (current === ancestorCandidate) {
|
|
@@ -17790,6 +18404,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17790
18404
|
}
|
|
17791
18405
|
}
|
|
17792
18406
|
}
|
|
18407
|
+
},
|
|
18408
|
+
{
|
|
18409
|
+
key: "isActive",
|
|
18410
|
+
get: /**
|
|
18411
|
+
* 当前 VFXItem 是否激活
|
|
18412
|
+
*/ function get() {
|
|
18413
|
+
return this.active;
|
|
18414
|
+
}
|
|
18415
|
+
},
|
|
18416
|
+
{
|
|
18417
|
+
key: "isVisible",
|
|
18418
|
+
get: /**
|
|
18419
|
+
* 元素组件显隐状态
|
|
18420
|
+
*/ function get() {
|
|
18421
|
+
return this.visible;
|
|
18422
|
+
}
|
|
17793
18423
|
}
|
|
17794
18424
|
]);
|
|
17795
18425
|
return VFXItem;
|
|
@@ -17953,6 +18583,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
17953
18583
|
}
|
|
17954
18584
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
17955
18585
|
var ta = this.textureSheetAnimation;
|
|
18586
|
+
var video = this.renderer.texture.source.video;
|
|
18587
|
+
if (video) {
|
|
18588
|
+
if (time === 0) {
|
|
18589
|
+
video.pause();
|
|
18590
|
+
} else {
|
|
18591
|
+
video.play().catch(function(e) {
|
|
18592
|
+
_this.engine.renderErrors.add(e);
|
|
18593
|
+
});
|
|
18594
|
+
}
|
|
18595
|
+
}
|
|
17956
18596
|
if (ta) {
|
|
17957
18597
|
var _this_material_getVector4;
|
|
17958
18598
|
var total = ta.total || ta.row * ta.col;
|
|
@@ -18007,21 +18647,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
18007
18647
|
dy
|
|
18008
18648
|
]);
|
|
18009
18649
|
}
|
|
18010
|
-
var video = this.renderer.texture.source.video;
|
|
18011
|
-
if (video) {
|
|
18012
|
-
if (time === 0 || time === this.item.duration) {
|
|
18013
|
-
video.pause();
|
|
18014
|
-
} else {
|
|
18015
|
-
video.play().catch(function(e) {
|
|
18016
|
-
_this.engine.renderErrors.add(e);
|
|
18017
|
-
});
|
|
18018
|
-
}
|
|
18019
|
-
}
|
|
18020
18650
|
};
|
|
18021
18651
|
_proto.onDestroy = function onDestroy() {
|
|
18652
|
+
var textures = this.getTextures();
|
|
18022
18653
|
if (this.item && this.item.composition) {
|
|
18023
|
-
this.item.composition.destroyTextures(
|
|
18654
|
+
this.item.composition.destroyTextures(textures);
|
|
18024
18655
|
}
|
|
18656
|
+
textures.forEach(function(texture) {
|
|
18657
|
+
var source = texture.source;
|
|
18658
|
+
if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
|
|
18659
|
+
source.video.pause();
|
|
18660
|
+
source.video.src = "";
|
|
18661
|
+
source.video.load();
|
|
18662
|
+
}
|
|
18663
|
+
});
|
|
18025
18664
|
};
|
|
18026
18665
|
_proto.createGeometry = function createGeometry(mode) {
|
|
18027
18666
|
var maxVertex = 12 * this.splits.length;
|
|
@@ -18460,7 +19099,7 @@ var ShapeNone = /*#__PURE__*/ function() {
|
|
|
18460
19099
|
return ShapeNone;
|
|
18461
19100
|
}();
|
|
18462
19101
|
var _obj$2;
|
|
18463
|
-
var map = (_obj$2 = {}, _obj$2[
|
|
19102
|
+
var map = (_obj$2 = {}, _obj$2[ParticleEmitterShapeType.NONE] = ShapeNone, _obj$2[ParticleEmitterShapeType.CONE] = Cone, _obj$2[ParticleEmitterShapeType.SPHERE] = Sphere, _obj$2[ParticleEmitterShapeType.HEMISPHERE] = Hemisphere, _obj$2[ParticleEmitterShapeType.CIRCLE] = Circle, _obj$2[ParticleEmitterShapeType.DONUT] = Donut, _obj$2[ParticleEmitterShapeType.RECTANGLE] = Rectangle, _obj$2[ParticleEmitterShapeType.EDGE] = Edge, _obj$2[ParticleEmitterShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$2[ParticleEmitterShapeType.TEXTURE] = TextureShape, _obj$2);
|
|
18464
19103
|
function createShape(shapeOptions) {
|
|
18465
19104
|
if (!shapeOptions) {
|
|
18466
19105
|
return new ShapeNone();
|
|
@@ -18477,7 +19116,7 @@ function createShape(shapeOptions) {
|
|
|
18477
19116
|
throw new Error("Invalid shape: " + type + ".");
|
|
18478
19117
|
}
|
|
18479
19118
|
var ctrl = new Ctrl(options);
|
|
18480
|
-
if (type !==
|
|
19119
|
+
if (type !== ParticleEmitterShapeType.NONE) {
|
|
18481
19120
|
var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
|
|
18482
19121
|
0,
|
|
18483
19122
|
0,
|
|
@@ -22554,6 +23193,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22554
23193
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22555
23194
|
var timelineClip = _step.value;
|
|
22556
23195
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23196
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22557
23197
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22558
23198
|
runtimeClips.push(clip);
|
|
22559
23199
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22657,14 +23297,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22657
23297
|
this.playable.setTime(clipTime);
|
|
22658
23298
|
// 判断动画是否结束
|
|
22659
23299
|
if (ended) {
|
|
22660
|
-
if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
|
|
22661
|
-
boundObject.ended = true;
|
|
22662
|
-
boundObject.onEnd();
|
|
22663
|
-
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
22664
|
-
boundObject.dispose();
|
|
22665
|
-
this.playable.dispose();
|
|
22666
|
-
}
|
|
22667
|
-
}
|
|
22668
23300
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22669
23301
|
this.playable.pause();
|
|
22670
23302
|
}
|
|
@@ -22707,26 +23339,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22707
23339
|
}
|
|
22708
23340
|
if (hasInput) {
|
|
22709
23341
|
boundItem.transform.setValid(true);
|
|
22710
|
-
|
|
23342
|
+
boundItem.setActive(true);
|
|
22711
23343
|
} else {
|
|
22712
23344
|
boundItem.transform.setValid(false);
|
|
22713
|
-
|
|
22714
|
-
}
|
|
22715
|
-
};
|
|
22716
|
-
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
22717
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22718
|
-
var rendererComponent = _step.value;
|
|
22719
|
-
if (rendererComponent.enabled) {
|
|
22720
|
-
rendererComponent.enabled = false;
|
|
22721
|
-
}
|
|
22722
|
-
}
|
|
22723
|
-
};
|
|
22724
|
-
_proto.showRendererComponents = function showRendererComponents(item) {
|
|
22725
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22726
|
-
var rendererComponent = _step.value;
|
|
22727
|
-
if (!rendererComponent.enabled) {
|
|
22728
|
-
rendererComponent.enabled = true;
|
|
22729
|
-
}
|
|
23345
|
+
boundItem.setActive(false);
|
|
22730
23346
|
}
|
|
22731
23347
|
};
|
|
22732
23348
|
return ActivationMixerPlayable;
|
|
@@ -22754,7 +23370,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22754
23370
|
}
|
|
22755
23371
|
var _proto = PropertyClipPlayable.prototype;
|
|
22756
23372
|
_proto.processFrame = function processFrame(context) {
|
|
22757
|
-
this.value = this.curve.getValue(this.time);
|
|
23373
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22758
23374
|
};
|
|
22759
23375
|
return PropertyClipPlayable;
|
|
22760
23376
|
}(Playable);
|
|
@@ -23272,9 +23888,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23272
23888
|
var track = _step.value;
|
|
23273
23889
|
var boundObject = track.boundObject;
|
|
23274
23890
|
if (_instanceof1(boundObject, exports.VFXItem)) {
|
|
23275
|
-
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
23276
|
-
boundObject.reusable = value;
|
|
23277
|
-
}
|
|
23278
23891
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23279
23892
|
if (subCompositionComponent) {
|
|
23280
23893
|
subCompositionComponent.setReusable(value);
|
|
@@ -23319,16 +23932,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23319
23932
|
}
|
|
23320
23933
|
}
|
|
23321
23934
|
};
|
|
23322
|
-
_proto.
|
|
23935
|
+
_proto.onEnable = function onEnable() {
|
|
23323
23936
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23324
23937
|
var item = _step.value;
|
|
23325
|
-
item.
|
|
23938
|
+
item.setActive(true);
|
|
23326
23939
|
}
|
|
23327
23940
|
};
|
|
23328
|
-
_proto.
|
|
23941
|
+
_proto.onDisable = function onDisable() {
|
|
23329
23942
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23330
23943
|
var item = _step.value;
|
|
23331
|
-
item.
|
|
23944
|
+
item.setActive(false);
|
|
23332
23945
|
}
|
|
23333
23946
|
};
|
|
23334
23947
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23344,7 +23957,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23344
23957
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23345
23958
|
var _this, _loop = function(i) {
|
|
23346
23959
|
var item = _this.items[i];
|
|
23347
|
-
if (item.
|
|
23960
|
+
if (item.isActive && item.transform.getValid() && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
23348
23961
|
var hitParams = item.getHitTestParams(force);
|
|
23349
23962
|
if (hitParams) {
|
|
23350
23963
|
var success = false;
|
|
@@ -23433,9 +24046,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23433
24046
|
var sceneBinding = _step.value;
|
|
23434
24047
|
sceneBinding.key.boundObject = sceneBinding.value;
|
|
23435
24048
|
}
|
|
23436
|
-
//
|
|
24049
|
+
// 为了通过帧对比,需要保证和原有的 update 时机一致。
|
|
23437
24050
|
// 因此这边更新一次对象绑定,后续 timeline playable 中 sort tracks 的排序才能和原先的版本对上。
|
|
23438
|
-
// 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline
|
|
24051
|
+
// 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline asset 中的 sortTracks 都能去掉。
|
|
23439
24052
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
|
|
23440
24053
|
var masterTrack = _step1.value;
|
|
23441
24054
|
this.updateTrackAnimatedObject(masterTrack);
|
|
@@ -23486,9 +24099,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23486
24099
|
}
|
|
23487
24100
|
}
|
|
23488
24101
|
if (hasInput) {
|
|
23489
|
-
compositionComponent.
|
|
24102
|
+
compositionComponent.item.setActive(true);
|
|
23490
24103
|
} else {
|
|
23491
|
-
compositionComponent.
|
|
24104
|
+
compositionComponent.item.setActive(false);
|
|
23492
24105
|
}
|
|
23493
24106
|
};
|
|
23494
24107
|
return SubCompositionMixerPlayable;
|
|
@@ -23539,6 +24152,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23539
24152
|
return Vector4PropertyMixerPlayable;
|
|
23540
24153
|
}(Playable);
|
|
23541
24154
|
|
|
24155
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
24156
|
+
_inherits(ColorPropertyMixerPlayable, Playable);
|
|
24157
|
+
function ColorPropertyMixerPlayable() {
|
|
24158
|
+
var _this;
|
|
24159
|
+
_this = Playable.apply(this, arguments) || this;
|
|
24160
|
+
_this.propertyName = "";
|
|
24161
|
+
return _this;
|
|
24162
|
+
}
|
|
24163
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
24164
|
+
_proto.processFrame = function processFrame(context) {
|
|
24165
|
+
var boundObject = context.output.getUserData();
|
|
24166
|
+
if (!boundObject) {
|
|
24167
|
+
return;
|
|
24168
|
+
}
|
|
24169
|
+
var hasInput = false;
|
|
24170
|
+
var value = boundObject[this.propertyName];
|
|
24171
|
+
if (!_instanceof1(value, Color)) {
|
|
24172
|
+
return;
|
|
24173
|
+
}
|
|
24174
|
+
value.setZero();
|
|
24175
|
+
// evaluate the curve
|
|
24176
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
24177
|
+
var weight = this.getInputWeight(i);
|
|
24178
|
+
if (weight > 0) {
|
|
24179
|
+
var propertyClipPlayable = this.getInput(i);
|
|
24180
|
+
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
24181
|
+
console.error("ColorPropertyMixerPlayable received incompatible input");
|
|
24182
|
+
continue;
|
|
24183
|
+
}
|
|
24184
|
+
var curveValue = propertyClipPlayable.value;
|
|
24185
|
+
value.r += curveValue.r * weight;
|
|
24186
|
+
value.g += curveValue.g * weight;
|
|
24187
|
+
value.b += curveValue.b * weight;
|
|
24188
|
+
value.a += curveValue.a * weight;
|
|
24189
|
+
hasInput = true;
|
|
24190
|
+
}
|
|
24191
|
+
}
|
|
24192
|
+
// set value
|
|
24193
|
+
if (hasInput) {
|
|
24194
|
+
boundObject[this.propertyName] = value;
|
|
24195
|
+
}
|
|
24196
|
+
};
|
|
24197
|
+
return ColorPropertyMixerPlayable;
|
|
24198
|
+
}(Playable);
|
|
24199
|
+
|
|
23542
24200
|
var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
23543
24201
|
_inherits(PropertyTrack, TrackAsset);
|
|
23544
24202
|
function PropertyTrack() {
|
|
@@ -23698,7 +24356,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
23698
24356
|
}
|
|
23699
24357
|
var _proto = ColorPropertyTrack.prototype;
|
|
23700
24358
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
23701
|
-
var mixer = new
|
|
24359
|
+
var mixer = new ColorPropertyMixerPlayable(graph);
|
|
23702
24360
|
var propertyNames = this.propertyNames;
|
|
23703
24361
|
if (propertyNames.length > 0) {
|
|
23704
24362
|
var propertyName = propertyNames[propertyNames.length - 1];
|
|
@@ -23712,6 +24370,27 @@ exports.ColorPropertyTrack = __decorate([
|
|
|
23712
24370
|
effectsClass(DataType.ColorPropertyTrack)
|
|
23713
24371
|
], exports.ColorPropertyTrack);
|
|
23714
24372
|
|
|
24373
|
+
exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24374
|
+
_inherits(ColorPropertyPlayableAsset, PlayableAsset);
|
|
24375
|
+
function ColorPropertyPlayableAsset() {
|
|
24376
|
+
return PlayableAsset.apply(this, arguments);
|
|
24377
|
+
}
|
|
24378
|
+
var _proto = ColorPropertyPlayableAsset.prototype;
|
|
24379
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24380
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24381
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24382
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24383
|
+
return clipPlayable;
|
|
24384
|
+
};
|
|
24385
|
+
return ColorPropertyPlayableAsset;
|
|
24386
|
+
}(PlayableAsset);
|
|
24387
|
+
__decorate([
|
|
24388
|
+
serialize()
|
|
24389
|
+
], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24390
|
+
exports.ColorPropertyPlayableAsset = __decorate([
|
|
24391
|
+
effectsClass(DataType.ColorPropertyPlayableAsset)
|
|
24392
|
+
], exports.ColorPropertyPlayableAsset);
|
|
24393
|
+
|
|
23715
24394
|
exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
23716
24395
|
_inherits(FloatPropertyPlayableAsset, PlayableAsset);
|
|
23717
24396
|
function FloatPropertyPlayableAsset() {
|
|
@@ -23771,6 +24450,7 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
23771
24450
|
var _this;
|
|
23772
24451
|
_this = PlayableAsset.apply(this, arguments) || this;
|
|
23773
24452
|
_this.tracks = [];
|
|
24453
|
+
_this.cacheFlattenedTracks = null;
|
|
23774
24454
|
return _this;
|
|
23775
24455
|
}
|
|
23776
24456
|
var _proto = TimelineAsset.prototype;
|
|
@@ -23783,16 +24463,62 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
23783
24463
|
track.create(this);
|
|
23784
24464
|
}
|
|
23785
24465
|
}
|
|
23786
|
-
|
|
24466
|
+
this.sortTracks(this.tracks);
|
|
24467
|
+
timelinePlayable.compileTracks(graph, this.flattenedTracks);
|
|
23787
24468
|
return timelinePlayable;
|
|
23788
24469
|
};
|
|
23789
24470
|
_proto.createTrack = function createTrack(classConstructor, parent, name) {
|
|
23790
24471
|
var newTrack = new classConstructor(this.engine);
|
|
23791
24472
|
newTrack.name = name ? name : classConstructor.name;
|
|
23792
24473
|
parent.addChild(newTrack);
|
|
24474
|
+
this.invalidate();
|
|
23793
24475
|
return newTrack;
|
|
23794
24476
|
};
|
|
24477
|
+
/**
|
|
24478
|
+
* Invalidates the asset, called when tracks data changed
|
|
24479
|
+
*/ _proto.invalidate = function invalidate() {
|
|
24480
|
+
this.cacheFlattenedTracks = null;
|
|
24481
|
+
};
|
|
24482
|
+
_proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
|
|
24483
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
24484
|
+
var subTrack = _step.value;
|
|
24485
|
+
allTracks.push(subTrack);
|
|
24486
|
+
}
|
|
24487
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
|
|
24488
|
+
var subTrack1 = _step1.value;
|
|
24489
|
+
this.addSubTracksRecursive(subTrack1, allTracks);
|
|
24490
|
+
}
|
|
24491
|
+
};
|
|
24492
|
+
_proto.sortTracks = function sortTracks(tracks) {
|
|
24493
|
+
var sortedTracks = [];
|
|
24494
|
+
for(var i = 0; i < tracks.length; i++){
|
|
24495
|
+
sortedTracks.push(new TrackSortWrapper(tracks[i], i));
|
|
24496
|
+
}
|
|
24497
|
+
sortedTracks.sort(compareTracks);
|
|
24498
|
+
tracks.length = 0;
|
|
24499
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
|
|
24500
|
+
var trackWrapper = _step.value;
|
|
24501
|
+
tracks.push(trackWrapper.track);
|
|
24502
|
+
}
|
|
24503
|
+
};
|
|
23795
24504
|
_proto.fromData = function fromData(data) {};
|
|
24505
|
+
_create_class(TimelineAsset, [
|
|
24506
|
+
{
|
|
24507
|
+
key: "flattenedTracks",
|
|
24508
|
+
get: function get() {
|
|
24509
|
+
if (!this.cacheFlattenedTracks) {
|
|
24510
|
+
this.cacheFlattenedTracks = [];
|
|
24511
|
+
// flatten track tree
|
|
24512
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
24513
|
+
var masterTrack = _step.value;
|
|
24514
|
+
this.cacheFlattenedTracks.push(masterTrack);
|
|
24515
|
+
this.addSubTracksRecursive(masterTrack, this.cacheFlattenedTracks);
|
|
24516
|
+
}
|
|
24517
|
+
}
|
|
24518
|
+
return this.cacheFlattenedTracks;
|
|
24519
|
+
}
|
|
24520
|
+
}
|
|
24521
|
+
]);
|
|
23796
24522
|
return TimelineAsset;
|
|
23797
24523
|
}(PlayableAsset);
|
|
23798
24524
|
__decorate([
|
|
@@ -23825,18 +24551,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23825
24551
|
}
|
|
23826
24552
|
};
|
|
23827
24553
|
_proto.compileTracks = function compileTracks(graph, tracks) {
|
|
23828
|
-
|
|
23829
|
-
var outputTrack = [];
|
|
23830
|
-
// flatten track tree
|
|
23831
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
23832
|
-
var masterTrack = _step.value;
|
|
23833
|
-
outputTrack.push(masterTrack);
|
|
23834
|
-
this.addSubTracksRecursive(masterTrack, outputTrack);
|
|
23835
|
-
}
|
|
24554
|
+
var outputTrack = tracks;
|
|
23836
24555
|
// map for searching track instance with track asset guid
|
|
23837
24556
|
var trackInstanceMap = {};
|
|
23838
|
-
for(var
|
|
23839
|
-
var track =
|
|
24557
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(outputTrack), _step; !(_step = _iterator()).done;){
|
|
24558
|
+
var track = _step.value;
|
|
23840
24559
|
// create track mixer and track output
|
|
23841
24560
|
var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
|
|
23842
24561
|
this.addInput(trackMixPlayable, 0);
|
|
@@ -23852,11 +24571,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23852
24571
|
}
|
|
23853
24572
|
}
|
|
23854
24573
|
// build trackInstance tree
|
|
23855
|
-
for(var
|
|
23856
|
-
var track1 =
|
|
24574
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
|
|
24575
|
+
var track1 = _step1.value;
|
|
23857
24576
|
var trackInstance1 = trackInstanceMap[track1.getInstanceId()];
|
|
23858
|
-
for(var
|
|
23859
|
-
var child =
|
|
24577
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step2; !(_step2 = _iterator2()).done;){
|
|
24578
|
+
var child = _step2.value;
|
|
23860
24579
|
var childTrackInstance = trackInstanceMap[child.getInstanceId()];
|
|
23861
24580
|
trackInstance1.addChild(childTrackInstance);
|
|
23862
24581
|
}
|
|
@@ -23873,28 +24592,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23873
24592
|
this.updateTrackAnimatedObject(trackInstance.children);
|
|
23874
24593
|
}
|
|
23875
24594
|
};
|
|
23876
|
-
_proto.sortTracks = function sortTracks(tracks) {
|
|
23877
|
-
var sortedTracks = [];
|
|
23878
|
-
for(var i = 0; i < tracks.length; i++){
|
|
23879
|
-
sortedTracks.push(new TrackSortWrapper(tracks[i], i));
|
|
23880
|
-
}
|
|
23881
|
-
sortedTracks.sort(compareTracks);
|
|
23882
|
-
tracks.length = 0;
|
|
23883
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
|
|
23884
|
-
var trackWrapper = _step.value;
|
|
23885
|
-
tracks.push(trackWrapper.track);
|
|
23886
|
-
}
|
|
23887
|
-
};
|
|
23888
|
-
_proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
|
|
23889
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
23890
|
-
var subTrack = _step.value;
|
|
23891
|
-
allTracks.push(subTrack);
|
|
23892
|
-
}
|
|
23893
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
|
|
23894
|
-
var subTrack1 = _step1.value;
|
|
23895
|
-
this.addSubTracksRecursive(subTrack1, allTracks);
|
|
23896
|
-
}
|
|
23897
|
-
};
|
|
23898
24595
|
return TimelinePlayable;
|
|
23899
24596
|
}(Playable);
|
|
23900
24597
|
var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
@@ -23916,6 +24613,27 @@ function compareTracks(a, b) {
|
|
|
23916
24613
|
}
|
|
23917
24614
|
}
|
|
23918
24615
|
|
|
24616
|
+
exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
24617
|
+
_inherits(Vector4PropertyPlayableAsset, PlayableAsset);
|
|
24618
|
+
function Vector4PropertyPlayableAsset() {
|
|
24619
|
+
return PlayableAsset.apply(this, arguments);
|
|
24620
|
+
}
|
|
24621
|
+
var _proto = Vector4PropertyPlayableAsset.prototype;
|
|
24622
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
24623
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
24624
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
24625
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
24626
|
+
return clipPlayable;
|
|
24627
|
+
};
|
|
24628
|
+
return Vector4PropertyPlayableAsset;
|
|
24629
|
+
}(PlayableAsset);
|
|
24630
|
+
__decorate([
|
|
24631
|
+
serialize()
|
|
24632
|
+
], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24633
|
+
exports.Vector4PropertyPlayableAsset = __decorate([
|
|
24634
|
+
effectsClass("Vector4PropertyPlayableAsset")
|
|
24635
|
+
], exports.Vector4PropertyPlayableAsset);
|
|
24636
|
+
|
|
23919
24637
|
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
23920
24638
|
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
23921
24639
|
function ObjectBindingTrack() {
|
|
@@ -23953,7 +24671,7 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
23953
24671
|
function TextLayout(options) {
|
|
23954
24672
|
this.width = 0;
|
|
23955
24673
|
this.height = 0;
|
|
23956
|
-
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,
|
|
24674
|
+
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;
|
|
23957
24675
|
var tempWidth = fontSize + letterSpace;
|
|
23958
24676
|
this.autoWidth = autoWidth;
|
|
23959
24677
|
this.maxTextWidth = text.length * tempWidth;
|
|
@@ -24153,6 +24871,8 @@ exports.TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24153
24871
|
/**
|
|
24154
24872
|
* 文本行数
|
|
24155
24873
|
*/ _this.lineCount = 0;
|
|
24874
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24875
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24156
24876
|
_this.name = "MText" + seed$1++;
|
|
24157
24877
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24158
24878
|
if (props) {
|
|
@@ -24518,7 +25238,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24518
25238
|
}
|
|
24519
25239
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24520
25240
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24521
|
-
this.material.setTexture("
|
|
25241
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24522
25242
|
data: new Uint8Array(imageData.data),
|
|
24523
25243
|
width: imageData.width,
|
|
24524
25244
|
height: imageData.height
|
|
@@ -25846,13 +26566,13 @@ function getStandardParticleContent(particle) {
|
|
|
25846
26566
|
var options = particle.options;
|
|
25847
26567
|
var transform = particle.transform;
|
|
25848
26568
|
var shape = {
|
|
25849
|
-
type:
|
|
26569
|
+
type: ParticleEmitterShapeType.NONE
|
|
25850
26570
|
};
|
|
25851
26571
|
if (particle.shape) {
|
|
25852
26572
|
var _particle_shape_shape;
|
|
25853
26573
|
var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
|
|
25854
26574
|
shape = _extends({}, particle.shape, {
|
|
25855
|
-
type:
|
|
26575
|
+
type: ParticleEmitterShapeType[shapeType]
|
|
25856
26576
|
});
|
|
25857
26577
|
if (particle.shape.upDirection) {
|
|
25858
26578
|
var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
|
|
@@ -27716,7 +28436,8 @@ var listOrder = 0;
|
|
|
27716
28436
|
var itemProps = sourceItemData;
|
|
27717
28437
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27718
28438
|
itemProps.listIndex = listOrder++;
|
|
27719
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle
|
|
28439
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
|
|
28440
|
+
itemProps.type === ItemType.shape) {
|
|
27720
28441
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27721
28442
|
var componentPath = _step2.value;
|
|
27722
28443
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27756,8 +28477,10 @@ var listOrder = 0;
|
|
|
27756
28477
|
shapeData = shape;
|
|
27757
28478
|
}
|
|
27758
28479
|
if (shapeData !== undefined) {
|
|
27759
|
-
|
|
27760
|
-
|
|
28480
|
+
if (!("aPoint" in shapeData && "index" in shapeData)) {
|
|
28481
|
+
// @ts-expect-error 类型转换问题
|
|
28482
|
+
renderContent.renderer.shape = getGeometryByShape(shapeData, split);
|
|
28483
|
+
}
|
|
27761
28484
|
}
|
|
27762
28485
|
}
|
|
27763
28486
|
if ("trails" in renderContent && renderContent.trails !== undefined) {
|
|
@@ -27812,13 +28535,18 @@ var listOrder = 0;
|
|
|
27812
28535
|
return CompositionSourceManager;
|
|
27813
28536
|
}();
|
|
27814
28537
|
|
|
27815
|
-
|
|
28538
|
+
/**
|
|
28539
|
+
*
|
|
28540
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27816
28541
|
function SceneTicking() {
|
|
27817
28542
|
this.update = new UpdateTickData();
|
|
27818
28543
|
this.lateUpdate = new LateUpdateTickData();
|
|
27819
28544
|
}
|
|
27820
28545
|
var _proto = SceneTicking.prototype;
|
|
27821
|
-
|
|
28546
|
+
/**
|
|
28547
|
+
*
|
|
28548
|
+
* @param obj
|
|
28549
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27822
28550
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27823
28551
|
this.update.addComponent(obj);
|
|
27824
28552
|
}
|
|
@@ -27826,7 +28554,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27826
28554
|
this.lateUpdate.addComponent(obj);
|
|
27827
28555
|
}
|
|
27828
28556
|
};
|
|
27829
|
-
|
|
28557
|
+
/**
|
|
28558
|
+
*
|
|
28559
|
+
* @param obj
|
|
28560
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27830
28561
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27831
28562
|
this.update.removeComponent(obj);
|
|
27832
28563
|
}
|
|
@@ -27834,7 +28565,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27834
28565
|
this.lateUpdate.removeComponent(obj);
|
|
27835
28566
|
}
|
|
27836
28567
|
};
|
|
27837
|
-
|
|
28568
|
+
/**
|
|
28569
|
+
*
|
|
28570
|
+
*/ _proto.clear = function clear() {
|
|
27838
28571
|
this.update.clear();
|
|
27839
28572
|
this.lateUpdate.clear();
|
|
27840
28573
|
};
|
|
@@ -27925,11 +28658,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27925
28658
|
var _this;
|
|
27926
28659
|
var _scene_jsonScene_renderSettings;
|
|
27927
28660
|
_this = EventEmitter.call(this) || this;
|
|
27928
|
-
|
|
28661
|
+
/**
|
|
28662
|
+
*
|
|
28663
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27929
28664
|
/**
|
|
27930
28665
|
* 动画播放速度
|
|
27931
28666
|
*/ _this.speed = 1;
|
|
27932
28667
|
/**
|
|
28668
|
+
* 合成是否结束
|
|
28669
|
+
*/ _this.isEnded = false;
|
|
28670
|
+
/**
|
|
27933
28671
|
* 用于保存与当前合成相关的插件数据
|
|
27934
28672
|
*/ _this.loaderData = {};
|
|
27935
28673
|
/**
|
|
@@ -27951,6 +28689,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27951
28689
|
* 合成暂停/播放 标识
|
|
27952
28690
|
*/ _this.paused = false;
|
|
27953
28691
|
_this.lastVideoUpdateTime = 0;
|
|
28692
|
+
_this.isEndCalled = false;
|
|
27954
28693
|
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;
|
|
27955
28694
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27956
28695
|
if (reusable) {
|
|
@@ -28040,7 +28779,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28040
28779
|
* @param visible - 是否可见
|
|
28041
28780
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28042
28781
|
this.items.forEach(function(item) {
|
|
28043
|
-
item.
|
|
28782
|
+
item.setActive(visible);
|
|
28044
28783
|
});
|
|
28045
28784
|
};
|
|
28046
28785
|
/**
|
|
@@ -28050,7 +28789,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28050
28789
|
return this.speed;
|
|
28051
28790
|
};
|
|
28052
28791
|
_proto.play = function play() {
|
|
28053
|
-
if (this.
|
|
28792
|
+
if (this.isEnded && this.reusable) {
|
|
28054
28793
|
this.restart();
|
|
28055
28794
|
}
|
|
28056
28795
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28108,16 +28847,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28108
28847
|
if (pause) {
|
|
28109
28848
|
this.resume();
|
|
28110
28849
|
}
|
|
28111
|
-
if (!this.rootComposition.isStartCalled) {
|
|
28112
|
-
this.rootComposition.onStart();
|
|
28113
|
-
this.rootComposition.isStartCalled = true;
|
|
28114
|
-
}
|
|
28115
28850
|
this.setSpeed(1);
|
|
28116
28851
|
this.forwardTime(time + this.startTime);
|
|
28117
28852
|
this.setSpeed(speed);
|
|
28118
28853
|
if (pause) {
|
|
28119
28854
|
this.pause();
|
|
28120
28855
|
}
|
|
28856
|
+
this.emit("goto", {
|
|
28857
|
+
time: time
|
|
28858
|
+
});
|
|
28121
28859
|
};
|
|
28122
28860
|
_proto.addItem = function addItem(item) {
|
|
28123
28861
|
this.items.push(item);
|
|
@@ -28141,37 +28879,24 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28141
28879
|
* 重置状态函数
|
|
28142
28880
|
*/ _proto.reset = function reset() {
|
|
28143
28881
|
this.rendererOptions = null;
|
|
28144
|
-
this.
|
|
28882
|
+
this.isEnded = false;
|
|
28883
|
+
this.isEndCalled = false;
|
|
28145
28884
|
this.rootComposition.time = 0;
|
|
28146
28885
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28147
28886
|
};
|
|
28148
28887
|
_proto.prepareRender = function prepareRender() {
|
|
28149
28888
|
var _this = this;
|
|
28150
28889
|
var frame = this.renderFrame;
|
|
28151
|
-
frame._renderPasses[0].meshes.length = 0;
|
|
28152
28890
|
this.postLoaders.length = 0;
|
|
28153
28891
|
this.pluginSystem.plugins.forEach(function(loader) {
|
|
28154
28892
|
if (loader.prepareRenderFrame(_this, frame)) {
|
|
28155
28893
|
_this.postLoaders.push(loader);
|
|
28156
28894
|
}
|
|
28157
28895
|
});
|
|
28158
|
-
this.gatherRendererComponent(this.rootItem, frame);
|
|
28159
28896
|
this.postLoaders.forEach(function(loader) {
|
|
28160
28897
|
return loader.postProcessFrame(_this, frame);
|
|
28161
28898
|
});
|
|
28162
28899
|
};
|
|
28163
|
-
_proto.gatherRendererComponent = function gatherRendererComponent(vfxItem, renderFrame) {
|
|
28164
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(vfxItem.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
28165
|
-
var rendererComponent = _step.value;
|
|
28166
|
-
if (rendererComponent.isActiveAndEnabled) {
|
|
28167
|
-
renderFrame.addMeshToDefaultRenderPass(rendererComponent);
|
|
28168
|
-
}
|
|
28169
|
-
}
|
|
28170
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(vfxItem.children), _step1; !(_step1 = _iterator1()).done;){
|
|
28171
|
-
var item = _step1.value;
|
|
28172
|
-
this.gatherRendererComponent(item, renderFrame);
|
|
28173
|
-
}
|
|
28174
|
-
};
|
|
28175
28900
|
/**
|
|
28176
28901
|
* 合成更新,针对所有 item 的更新
|
|
28177
28902
|
* @param deltaTime - 更新的时间步长
|
|
@@ -28193,12 +28918,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28193
28918
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28194
28919
|
this.updateCamera();
|
|
28195
28920
|
this.prepareRender();
|
|
28921
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
28922
|
+
this.isEndCalled = true;
|
|
28923
|
+
this.emit("end", {
|
|
28924
|
+
composition: this
|
|
28925
|
+
});
|
|
28926
|
+
}
|
|
28196
28927
|
if (this.shouldDispose()) {
|
|
28197
28928
|
this.dispose();
|
|
28198
28929
|
}
|
|
28199
28930
|
};
|
|
28200
28931
|
_proto.shouldDispose = function shouldDispose() {
|
|
28201
|
-
return this.
|
|
28932
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28202
28933
|
};
|
|
28203
28934
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28204
28935
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28289,11 +29020,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28289
29020
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28290
29021
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28291
29022
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28292
|
-
var
|
|
29023
|
+
var isEnded = false;
|
|
28293
29024
|
var duration = this.rootItem.duration;
|
|
28294
29025
|
var endBehavior = this.rootItem.endBehavior;
|
|
28295
29026
|
if (localTime - duration > 0.001) {
|
|
28296
|
-
|
|
29027
|
+
isEnded = true;
|
|
28297
29028
|
switch(endBehavior){
|
|
28298
29029
|
case EndBehavior.restart:
|
|
28299
29030
|
{
|
|
@@ -28317,11 +29048,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28317
29048
|
}
|
|
28318
29049
|
}
|
|
28319
29050
|
this.rootComposition.time = localTime;
|
|
28320
|
-
|
|
28321
|
-
|
|
28322
|
-
|
|
28323
|
-
|
|
28324
|
-
}
|
|
29051
|
+
// end state changed, handle onEnd flags
|
|
29052
|
+
if (this.isEnded !== isEnded) {
|
|
29053
|
+
if (isEnded) {
|
|
29054
|
+
this.isEnded = true;
|
|
29055
|
+
} else {
|
|
29056
|
+
this.isEnded = false;
|
|
29057
|
+
this.isEndCalled = false;
|
|
29058
|
+
}
|
|
28325
29059
|
}
|
|
28326
29060
|
}
|
|
28327
29061
|
};
|
|
@@ -30647,7 +31381,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
30647
31381
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
30648
31382
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
30649
31383
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
30650
|
-
var version = "2.1.0
|
|
31384
|
+
var version = "2.1.0";
|
|
30651
31385
|
logger.info("Core version: " + version + ".");
|
|
30652
31386
|
|
|
30653
31387
|
exports.AbstractPlugin = AbstractPlugin;
|