@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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/comp-vfx-item.d.ts +2 -2
  3. package/dist/components/base-render-component.d.ts +9 -0
  4. package/dist/components/fake-3d-component.d.ts +28 -0
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/components/mesh-component.d.ts +3 -0
  7. package/dist/components/post-process-volume.d.ts +10 -10
  8. package/dist/components/renderer-component.d.ts +2 -0
  9. package/dist/components/shape-component.d.ts +7 -185
  10. package/dist/composition/scene-ticking.d.ts +14 -0
  11. package/dist/composition.d.ts +19 -10
  12. package/dist/effects-object.d.ts +23 -0
  13. package/dist/engine.d.ts +9 -0
  14. package/dist/events/event-emitter.d.ts +6 -0
  15. package/dist/events/types.d.ts +8 -1
  16. package/dist/index.js +1409 -675
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +1406 -672
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/material/material.d.ts +14 -1
  21. package/dist/plugins/cal/playable-graph.d.ts +3 -0
  22. package/dist/plugins/interact/interact-item.d.ts +4 -1
  23. package/dist/plugins/interact/mesh-collider.d.ts +4 -0
  24. package/dist/plugins/shape/graphics-path.d.ts +5 -3
  25. package/dist/plugins/shape/poly-star.d.ts +42 -0
  26. package/dist/plugins/shape/rectangle.d.ts +1 -1
  27. package/dist/plugins/shape/shape-path.d.ts +12 -0
  28. package/dist/plugins/shape/shape-primitive.d.ts +0 -3
  29. package/dist/plugins/sprite/sprite-item.d.ts +1 -8
  30. package/dist/plugins/text/text-item.d.ts +2 -0
  31. package/dist/plugins/timeline/playable-assets/color-property-playable-asset.d.ts +1 -1
  32. package/dist/plugins/timeline/playable-assets/index.d.ts +2 -0
  33. package/dist/plugins/timeline/playable-assets/timeline-asset.d.ts +8 -2
  34. package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +1 -1
  35. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -2
  36. package/dist/render/render-frame.d.ts +5 -2
  37. package/dist/render/renderer.d.ts +2 -1
  38. package/dist/shape/geometry.d.ts +2 -2
  39. package/dist/transform.d.ts +8 -0
  40. package/dist/vfx-item.d.ts +63 -22
  41. package/package.json +2 -2
package/dist/index.mjs 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-alpha.9
6
+ * Version: v2.1.0
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1090,39 +1090,39 @@ function _inherits(subClass, superClass) {
1090
1090
  })(MaskMode || (MaskMode = {}));
1091
1091
  /**
1092
1092
  * 发射器形状
1093
- */ var ShapeType;
1094
- (function(ShapeType) {
1093
+ */ var ParticleEmitterShapeType;
1094
+ (function(ParticleEmitterShapeType) {
1095
1095
  /**
1096
1096
  * 没有类型
1097
- */ ShapeType[ShapeType["NONE"] = 0] = "NONE";
1097
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
1098
1098
  /**
1099
1099
  * 圆球
1100
- */ ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
1100
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
1101
1101
  /**
1102
1102
  * 圆锥
1103
- */ ShapeType[ShapeType["CONE"] = 2] = "CONE";
1103
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
1104
1104
  /**
1105
1105
  * 半球
1106
- */ ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1106
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1107
1107
  /**
1108
1108
  * 圆
1109
- */ ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
1109
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
1110
1110
  /**
1111
1111
  * 圆环
1112
- */ ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
1112
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
1113
1113
  /**
1114
1114
  * 矩形
1115
- */ ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1115
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1116
1116
  /**
1117
1117
  * 矩形框
1118
- */ ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1118
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1119
1119
  /**
1120
1120
  * 直线
1121
- */ ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
1121
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
1122
1122
  /**
1123
1123
  * 贴图
1124
- */ ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
1125
- })(ShapeType || (ShapeType = {}));
1124
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
1125
+ })(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
1126
1126
  /**
1127
1127
  * 插件类型
1128
1128
  */ var PluginType;
@@ -1218,6 +1218,12 @@ function _inherits(subClass, superClass) {
1218
1218
  /**
1219
1219
  * 特效元素
1220
1220
  */ ItemType["effect"] = "effect";
1221
+ /**
1222
+ * 形状元素
1223
+ */ ItemType["shape"] = "shape";
1224
+ /**
1225
+ * 后处理元素
1226
+ */ ItemType["postProcessVolume"] = "postProcessVolume";
1221
1227
  /**
1222
1228
  * 节点元素
1223
1229
  */ ItemType["node"] = "node";
@@ -1227,6 +1233,9 @@ function _inherits(subClass, superClass) {
1227
1233
  /**
1228
1234
  * 音频元素
1229
1235
  */ ItemType["audio"] = "audio";
1236
+ /**
1237
+ * 富文本元素
1238
+ */ ItemType["richtext"] = "richtext";
1230
1239
  })(ItemType || (ItemType = {}));
1231
1240
  /**
1232
1241
  * 渲染模式
@@ -1602,6 +1611,58 @@ var TextAlignment;
1602
1611
  */ FontStyle["oblique"] = "oblique";
1603
1612
  })(FontStyle || (FontStyle = {}));
1604
1613
 
1614
+ var BuiltinObjectGUID = {
1615
+ WhiteTexture: "whitetexture00000000000000000000",
1616
+ TransparentTexture: "transparenttexture00000000000000000000",
1617
+ PBRShader: "pbr00000000000000000000000000000",
1618
+ UnlitShader: "unlit000000000000000000000000000"
1619
+ };
1620
+
1621
+ /**
1622
+ * 矢量图形类型
1623
+ */ var ShapePrimitiveType;
1624
+ (function(ShapePrimitiveType) {
1625
+ /**
1626
+ * 自定义图形
1627
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1628
+ /**
1629
+ * 矩形
1630
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1631
+ /**
1632
+ * 椭圆
1633
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1634
+ /**
1635
+ * 多边形
1636
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1637
+ /**
1638
+ * 星形
1639
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1640
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1641
+
1642
+ // 本期无该功能 待补充
1643
+ var ShapeConnectType;
1644
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1645
+ // @待补充
1646
+ var ShapePointType;
1647
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1648
+
1649
+ /**
1650
+ * 动态换图类型
1651
+ * @since 1.1.0
1652
+ */ var BackgroundType;
1653
+ (function(BackgroundType) {
1654
+ BackgroundType["video"] = "video";
1655
+ BackgroundType["image"] = "image";
1656
+ })(BackgroundType || (BackgroundType = {}));
1657
+ /**
1658
+ * 多媒体资源类型
1659
+ * @since 2.1.0
1660
+ */ var MultimediaType;
1661
+ (function(MultimediaType) {
1662
+ MultimediaType["video"] = "video";
1663
+ MultimediaType["audio"] = "audio";
1664
+ })(MultimediaType || (MultimediaType = {}));
1665
+
1605
1666
  var DataType;
1606
1667
  (function(DataType) {
1607
1668
  DataType["VFXItemData"] = "VFXItemData";
@@ -1612,8 +1673,10 @@ var DataType;
1612
1673
  DataType["ParticleSystem"] = "ParticleSystem";
1613
1674
  DataType["InteractComponent"] = "InteractComponent";
1614
1675
  DataType["CameraController"] = "CameraController";
1676
+ DataType["PostProcessVolume"] = "PostProcessVolume";
1615
1677
  DataType["Geometry"] = "Geometry";
1616
1678
  DataType["Texture"] = "Texture";
1679
+ DataType["Image"] = "Image";
1617
1680
  DataType["AnimationClip"] = "AnimationClip";
1618
1681
  DataType["TextComponent"] = "TextComponent";
1619
1682
  DataType["BinaryAsset"] = "BinaryAsset";
@@ -1634,7 +1697,6 @@ var DataType;
1634
1697
  DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
1635
1698
  DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
1636
1699
  DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
1637
- // FIXME: 先完成ECS的场景转换,后面移到spec中
1638
1700
  DataType["MeshComponent"] = "MeshComponent";
1639
1701
  DataType["SkyboxComponent"] = "SkyboxComponent";
1640
1702
  DataType["LightComponent"] = "LightComponent";
@@ -1645,9 +1707,13 @@ var DataType;
1645
1707
  DataType["SpineComponent"] = "SpineComponent";
1646
1708
  DataType["VideoComponent"] = "VideoComponent";
1647
1709
  DataType["AudioComponent"] = "AudioComponent";
1710
+ DataType["RichTextComponent"] = "RichTextComponent";
1711
+ DataType["OrientationComponent"] = "OrientationComponent";
1712
+ DataType["ShapeComponent"] = "ShapeComponent";
1648
1713
  // Non-EffectObject
1649
1714
  DataType["TimelineClip"] = "TimelineClip";
1650
1715
  })(DataType || (DataType = {}));
1716
+
1651
1717
  var GeometryType;
1652
1718
  (function(GeometryType) {
1653
1719
  /**
@@ -1732,37 +1798,13 @@ var VertexBufferSemantic;
1732
1798
  VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
1733
1799
  })(VertexBufferSemantic || (VertexBufferSemantic = {}));
1734
1800
 
1735
- var BuiltinObjectGUID = {
1736
- WhiteTexture: "whitetexture00000000000000000000",
1737
- TransparentTexture: "transparenttexture00000000000000000000",
1738
- PBRShader: "pbr00000000000000000000000000000",
1739
- UnlitShader: "unlit000000000000000000000000000"
1740
- };
1741
-
1742
- /**
1743
- * 动态换图类型
1744
- * @since 1.1.0
1745
- */ var BackgroundType;
1746
- (function(BackgroundType) {
1747
- BackgroundType["video"] = "video";
1748
- BackgroundType["image"] = "image";
1749
- })(BackgroundType || (BackgroundType = {}));
1750
- /**
1751
- * 多媒体资源类型
1752
- * @since 2.1.0
1753
- */ var MultimediaType;
1754
- (function(MultimediaType) {
1755
- MultimediaType["video"] = "video";
1756
- MultimediaType["audio"] = "audio";
1757
- })(MultimediaType || (MultimediaType = {}));
1758
-
1759
1801
  var index$1 = /*#__PURE__*/Object.freeze({
1760
1802
  __proto__: null,
1761
1803
  get RenderLevel () { return RenderLevel; },
1762
1804
  get BlendingMode () { return BlendingMode; },
1763
1805
  get SideMode () { return SideMode; },
1764
1806
  get MaskMode () { return MaskMode; },
1765
- get ShapeType () { return ShapeType; },
1807
+ get ParticleEmitterShapeType () { return ParticleEmitterShapeType; },
1766
1808
  get PluginType () { return PluginType; },
1767
1809
  get InteractType () { return InteractType; },
1768
1810
  get InteractBehavior () { return InteractBehavior; },
@@ -1800,14 +1842,17 @@ var index$1 = /*#__PURE__*/Object.freeze({
1800
1842
  get TextAlignment () { return TextAlignment; },
1801
1843
  get TextWeight () { return TextWeight; },
1802
1844
  get FontStyle () { return FontStyle; },
1845
+ BuiltinObjectGUID: BuiltinObjectGUID,
1846
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1847
+ get ShapeConnectType () { return ShapeConnectType; },
1848
+ get ShapePointType () { return ShapePointType; },
1849
+ get BackgroundType () { return BackgroundType; },
1850
+ get MultimediaType () { return MultimediaType; },
1803
1851
  get DataType () { return DataType; },
1804
1852
  get GeometryType () { return GeometryType; },
1805
1853
  get VertexFormatType () { return VertexFormatType; },
1806
1854
  get IndexFormatType () { return IndexFormatType; },
1807
- get VertexBufferSemantic () { return VertexBufferSemantic; },
1808
- BuiltinObjectGUID: BuiltinObjectGUID,
1809
- get BackgroundType () { return BackgroundType; },
1810
- get MultimediaType () { return MultimediaType; }
1855
+ get VertexBufferSemantic () { return VertexBufferSemantic; }
1811
1856
  });
1812
1857
 
1813
1858
  function _defineProperties(target, props) {
@@ -1895,15 +1940,23 @@ function getDirectStore(target) {
1895
1940
  this.engine.addInstance(this);
1896
1941
  }
1897
1942
  var _proto = EffectsObject.prototype;
1898
- _proto.getInstanceId = function getInstanceId() {
1943
+ /**
1944
+ *
1945
+ * @returns
1946
+ */ _proto.getInstanceId = function getInstanceId() {
1899
1947
  return this.guid;
1900
1948
  };
1901
- _proto.setInstanceId = function setInstanceId(guid) {
1949
+ /**
1950
+ *
1951
+ * @param guid
1952
+ */ _proto.setInstanceId = function setInstanceId(guid) {
1902
1953
  this.engine.removeInstance(this.guid);
1903
1954
  this.guid = guid;
1904
1955
  this.engine.addInstance(this);
1905
1956
  };
1906
- _proto.toData = function toData() {};
1957
+ /**
1958
+ *
1959
+ */ _proto.toData = function toData() {};
1907
1960
  /**
1908
1961
  * 反序列化函数
1909
1962
  *
@@ -1913,8 +1966,14 @@ function getDirectStore(target) {
1913
1966
  this.setInstanceId(data.id);
1914
1967
  }
1915
1968
  };
1916
- _proto.dispose = function dispose() {};
1917
- EffectsObject.is = function is(obj) {
1969
+ /**
1970
+ *
1971
+ */ _proto.dispose = function dispose() {};
1972
+ /**
1973
+ *
1974
+ * @param obj
1975
+ * @returns
1976
+ */ EffectsObject.is = function is(obj) {
1918
1977
  return _instanceof1(obj, EffectsObject) && "guid" in obj;
1919
1978
  };
1920
1979
  return EffectsObject;
@@ -1994,7 +2053,7 @@ function getDirectStore(target) {
1994
2053
  this.onAwake();
1995
2054
  this.isAwakeCalled = true;
1996
2055
  }
1997
- if (item.getVisible() && this.enabled) {
2056
+ if (item.isActive && this.enabled) {
1998
2057
  this.start();
1999
2058
  this.enable();
2000
2059
  }
@@ -2039,7 +2098,7 @@ function getDirectStore(target) {
2039
2098
  get: /**
2040
2099
  * 组件是否可以更新,true 更新,false 不更新
2041
2100
  */ function get() {
2042
- return this.item.getVisible() && this.enabled;
2101
+ return this.item.isActive && this.enabled;
2043
2102
  }
2044
2103
  },
2045
2104
  {
@@ -2107,6 +2166,14 @@ __decorate([
2107
2166
  Component.prototype.setVFXItem.call(this, item);
2108
2167
  this.item.rendererComponents.push(this);
2109
2168
  };
2169
+ _proto.onEnable = function onEnable() {
2170
+ var _this_item_composition;
2171
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
2172
+ };
2173
+ _proto.onDisable = function onDisable() {
2174
+ var _this_item_composition;
2175
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
2176
+ };
2110
2177
  _proto.fromData = function fromData(data) {
2111
2178
  Component.prototype.fromData.call(this, data);
2112
2179
  };
@@ -3668,7 +3735,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
3668
3735
  */ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
3669
3736
  Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
3670
3737
 
3671
- var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
3738
+ /**
3739
+ * Mesh 组件
3740
+ */ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
3672
3741
  _inherits(MeshComponent, RendererComponent);
3673
3742
  function MeshComponent() {
3674
3743
  var _this;
@@ -3678,7 +3747,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
3678
3747
  */ _this.meshCollider = new MeshCollider();
3679
3748
  // TODO 点击测试后续抽象一个 Collider 组件
3680
3749
  _this.getHitTestParams = function(force) {
3681
- var area = _this.getBoundingBox();
3750
+ var worldMatrix = _this.transform.getWorldMatrix();
3751
+ _this.meshCollider.setGeometry(_this.geometry, worldMatrix);
3752
+ var area = _this.meshCollider.getBoundingBoxData();
3682
3753
  if (area) {
3683
3754
  return {
3684
3755
  type: area.type,
@@ -3698,8 +3769,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
3698
3769
  _proto.getBoundingBox = function getBoundingBox() {
3699
3770
  var worldMatrix = this.transform.getWorldMatrix();
3700
3771
  this.meshCollider.setGeometry(this.geometry, worldMatrix);
3701
- var boundingBoxData = this.meshCollider.getBoundingBoxData();
3702
- return boundingBoxData;
3772
+ var boundingBox = this.meshCollider.getBoundingBox();
3773
+ return boundingBox;
3703
3774
  };
3704
3775
  return MeshComponent;
3705
3776
  }(RendererComponent);
@@ -3737,24 +3808,29 @@ EffectComponent = __decorate([
3737
3808
 
3738
3809
  var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
3739
3810
  _inherits(PostProcessVolume, Behaviour);
3740
- function PostProcessVolume() {
3811
+ function PostProcessVolume(engine) {
3741
3812
  var _this;
3742
- _this = Behaviour.apply(this, arguments) || this;
3743
- // Bloom
3744
- _this.bloomEnabled = true;
3745
- _this.threshold = 1.0;
3746
- _this.bloomIntensity = 1.0;
3747
- // ColorAdjustments
3748
- _this.brightness = 1.0;
3749
- _this.saturation = 1.0;
3750
- _this.contrast = 1.0;
3751
- // Vignette
3752
- _this.vignetteIntensity = 0.2;
3753
- _this.vignetteSmoothness = 0.4;
3754
- _this.vignetteRoundness = 1.0;
3755
- // ToneMapping
3756
- _this.toneMappingEnabled = true // 1: true, 0: false
3757
- ;
3813
+ _this = Behaviour.call(this, engine) || this;
3814
+ _this.bloom = {
3815
+ threshold: 0,
3816
+ intensity: 0,
3817
+ active: false
3818
+ };
3819
+ _this.vignette = {
3820
+ intensity: 0,
3821
+ smoothness: 0,
3822
+ roundness: 0,
3823
+ active: false
3824
+ };
3825
+ _this.tonemapping = {
3826
+ active: false
3827
+ };
3828
+ _this.colorAdjustments = {
3829
+ brightness: 0,
3830
+ saturation: 0,
3831
+ contrast: 0,
3832
+ active: false
3833
+ };
3758
3834
  return _this;
3759
3835
  }
3760
3836
  var _proto = PostProcessVolume.prototype;
@@ -3768,36 +3844,18 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
3768
3844
  }(Behaviour);
3769
3845
  __decorate([
3770
3846
  serialize()
3771
- ], PostProcessVolume.prototype, "bloomEnabled", void 0);
3772
- __decorate([
3773
- serialize()
3774
- ], PostProcessVolume.prototype, "threshold", void 0);
3775
- __decorate([
3776
- serialize()
3777
- ], PostProcessVolume.prototype, "bloomIntensity", void 0);
3778
- __decorate([
3779
- serialize()
3780
- ], PostProcessVolume.prototype, "brightness", void 0);
3781
- __decorate([
3782
- serialize()
3783
- ], PostProcessVolume.prototype, "saturation", void 0);
3784
- __decorate([
3785
- serialize()
3786
- ], PostProcessVolume.prototype, "contrast", void 0);
3787
- __decorate([
3788
- serialize()
3789
- ], PostProcessVolume.prototype, "vignetteIntensity", void 0);
3847
+ ], PostProcessVolume.prototype, "bloom", void 0);
3790
3848
  __decorate([
3791
3849
  serialize()
3792
- ], PostProcessVolume.prototype, "vignetteSmoothness", void 0);
3850
+ ], PostProcessVolume.prototype, "vignette", void 0);
3793
3851
  __decorate([
3794
3852
  serialize()
3795
- ], PostProcessVolume.prototype, "vignetteRoundness", void 0);
3853
+ ], PostProcessVolume.prototype, "tonemapping", void 0);
3796
3854
  __decorate([
3797
3855
  serialize()
3798
- ], PostProcessVolume.prototype, "toneMappingEnabled", void 0);
3856
+ ], PostProcessVolume.prototype, "colorAdjustments", void 0);
3799
3857
  PostProcessVolume = __decorate([
3800
- effectsClass("PostProcessVolume")
3858
+ effectsClass(DataType.PostProcessVolume)
3801
3859
  ], PostProcessVolume);
3802
3860
 
3803
3861
  function _assert_this_initialized(self) {
@@ -6884,6 +6942,7 @@ var MaterialRenderType;
6884
6942
  _this.enabledMacros = {};
6885
6943
  _this.destroyed = false;
6886
6944
  _this.initialized = false;
6945
+ _this.shaderDirty = true;
6887
6946
  if (props) {
6888
6947
  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;
6889
6948
  _this.name = name;
@@ -6911,6 +6970,41 @@ var MaterialRenderType;
6911
6970
  // OVERRIDE
6912
6971
  };
6913
6972
  _create_class(Material, [
6973
+ {
6974
+ key: "shader",
6975
+ get: function get() {
6976
+ return this._shader;
6977
+ },
6978
+ set: function set(value) {
6979
+ if (this._shader === value) {
6980
+ return;
6981
+ }
6982
+ this._shader = value;
6983
+ this.shaderDirty = true;
6984
+ }
6985
+ },
6986
+ {
6987
+ key: "mainTexture",
6988
+ get: /**
6989
+ * 材质的主纹理
6990
+ */ function get() {
6991
+ return this.getTexture("_MainTex");
6992
+ },
6993
+ set: function set(value) {
6994
+ this.setTexture("_MainTex", value);
6995
+ }
6996
+ },
6997
+ {
6998
+ key: "color",
6999
+ get: /**
7000
+ * 材质的主颜色
7001
+ */ function get() {
7002
+ return this.getColor("_Color");
7003
+ },
7004
+ set: function set(value) {
7005
+ this.setColor("_Color", value);
7006
+ }
7007
+ },
6914
7008
  {
6915
7009
  key: "blending",
6916
7010
  set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
@@ -10047,7 +10141,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
10047
10141
 
10048
10142
  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}";
10049
10143
 
10050
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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(uSampler0,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;}";
10144
+ 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;}";
10051
10145
 
10052
10146
  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";
10053
10147
 
@@ -10278,15 +10372,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
10278
10372
  renderer.setFramebuffer(this.framebuffer);
10279
10373
  };
10280
10374
  _proto.execute = function execute(renderer) {
10281
- var _renderer_renderingData_currentFrame_globalVolume;
10375
+ var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
10282
10376
  renderer.clear({
10283
10377
  colorAction: TextureStoreAction.clear,
10284
10378
  depthAction: TextureStoreAction.clear,
10285
10379
  stencilAction: TextureStoreAction.clear
10286
10380
  });
10287
10381
  this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
10288
- var _renderer_renderingData_currentFrame_globalVolume_threshold;
10289
- var threshold = (_renderer_renderingData_currentFrame_globalVolume_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_threshold : 1.0;
10382
+ var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
10383
+ 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;
10290
10384
  this.screenMesh.material.setFloat("_Threshold", threshold);
10291
10385
  renderer.renderMeshes([
10292
10386
  this.screenMesh
@@ -10499,25 +10593,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
10499
10593
  depthAction: TextureStoreAction.clear,
10500
10594
  stencilAction: TextureStoreAction.clear
10501
10595
  });
10502
- var _renderer_renderingData_currentFrame_globalVolume;
10503
- var _ref = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) != null ? _renderer_renderingData_currentFrame_globalVolume : {}, _ref_bloomEnabled = _ref.bloomEnabled, bloomEnabled = _ref_bloomEnabled === void 0 ? false : _ref_bloomEnabled, _ref_bloomIntensity = _ref.bloomIntensity, bloomIntensity = _ref_bloomIntensity === void 0 ? 1.0 : _ref_bloomIntensity, _ref_brightness = _ref.brightness, brightness = _ref_brightness === void 0 ? 1.0 : _ref_brightness, _ref_saturation = _ref.saturation, saturation = _ref_saturation === void 0 ? 1.0 : _ref_saturation, _ref_contrast = _ref.contrast, contrast = _ref_contrast === void 0 ? 1.0 : _ref_contrast, _ref_toneMappingEnabled = _ref.toneMappingEnabled, toneMappingEnabled = _ref_toneMappingEnabled === void 0 ? true : _ref_toneMappingEnabled, _ref_vignetteIntensity = _ref.vignetteIntensity, vignetteIntensity = _ref_vignetteIntensity === void 0 ? 0.2 : _ref_vignetteIntensity, _ref_vignetteSmoothness = _ref.vignetteSmoothness, vignetteSmoothness = _ref_vignetteSmoothness === void 0 ? 0.4 : _ref_vignetteSmoothness, _ref_vignetteRoundness = _ref.vignetteRoundness, vignetteRoundness = _ref_vignetteRoundness === void 0 ? 1.0 : _ref_vignetteRoundness;
10596
+ var globalVolume = renderer.renderingData.currentFrame.globalVolume;
10597
+ var bloom = _extends({
10598
+ threshold: 0,
10599
+ intensity: 0,
10600
+ active: false
10601
+ }, globalVolume == null ? void 0 : globalVolume.bloom);
10602
+ var vignette = _extends({
10603
+ intensity: 0,
10604
+ smoothness: 0,
10605
+ roundness: 0,
10606
+ active: false
10607
+ }, globalVolume == null ? void 0 : globalVolume.vignette);
10608
+ var colorAdjustments = _extends({
10609
+ brightness: 0,
10610
+ saturation: 0,
10611
+ contrast: 0,
10612
+ active: false
10613
+ }, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
10614
+ var tonemapping = _extends({
10615
+ active: false
10616
+ }, globalVolume == null ? void 0 : globalVolume.tonemapping);
10504
10617
  this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
10505
- this.screenMesh.material.setFloat("_Brightness", brightness);
10506
- this.screenMesh.material.setFloat("_Saturation", saturation);
10507
- this.screenMesh.material.setFloat("_Contrast", contrast);
10508
- this.screenMesh.material.setInt("_UseBloom", Number(bloomEnabled));
10509
- if (bloomEnabled) {
10618
+ this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
10619
+ this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
10620
+ this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
10621
+ this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
10622
+ if (bloom.active) {
10510
10623
  this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
10511
- this.screenMesh.material.setFloat("_BloomIntensity", bloomIntensity);
10624
+ this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
10512
10625
  }
10513
- if (vignetteIntensity > 0) {
10514
- this.screenMesh.material.setFloat("_VignetteIntensity", vignetteIntensity);
10515
- this.screenMesh.material.setFloat("_VignetteSmoothness", vignetteSmoothness);
10516
- this.screenMesh.material.setFloat("_VignetteRoundness", vignetteRoundness);
10626
+ if (vignette.intensity > 0) {
10627
+ this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
10628
+ this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
10629
+ this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
10517
10630
  this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
10518
10631
  this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
10519
10632
  }
10520
- this.screenMesh.material.setInt("_UseToneMapping", Number(toneMappingEnabled));
10633
+ this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
10521
10634
  renderer.renderMeshes([
10522
10635
  this.screenMesh
10523
10636
  ]);
@@ -10557,6 +10670,9 @@ var seed$5 = 1;
10557
10670
  this.renderer = renderer;
10558
10671
  if (postProcessingEnabled) {
10559
10672
  var enableHDR = true;
10673
+ if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
10674
+ throw new Error("Half float texture is not supported.");
10675
+ }
10560
10676
  // 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
10561
10677
  var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
10562
10678
  attachments = [
@@ -10578,16 +10694,16 @@ var seed$5 = 1;
10578
10694
  depthAction: TextureLoadAction.clear
10579
10695
  };
10580
10696
  }
10581
- // 创建 drawObjectPass
10697
+ this.drawObjectPass = new RenderPass(renderer, {
10698
+ name: RENDER_PASS_NAME_PREFIX,
10699
+ priority: RenderPassPriorityNormal,
10700
+ meshOrder: OrderType.ascending,
10701
+ depthStencilAttachment: depthStencilAttachment,
10702
+ attachments: attachments,
10703
+ clearAction: drawObjectPassClearAction
10704
+ });
10582
10705
  var renderPasses = [
10583
- new RenderPass(renderer, {
10584
- name: RENDER_PASS_NAME_PREFIX,
10585
- priority: RenderPassPriorityNormal,
10586
- meshOrder: OrderType.ascending,
10587
- depthStencilAttachment: depthStencilAttachment,
10588
- attachments: attachments,
10589
- clearAction: drawObjectPassClearAction
10590
- })
10706
+ this.drawObjectPass
10591
10707
  ];
10592
10708
  this.setRenderPasses(renderPasses);
10593
10709
  if (postProcessingEnabled) {
@@ -10709,216 +10825,15 @@ var seed$5 = 1;
10709
10825
  * 根据 Mesh 优先级添加到 RenderPass
10710
10826
  * @param mesh - 要添加的 Mesh 对象
10711
10827
  */ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
10712
- if (!mesh) {
10713
- return;
10714
- }
10715
- this.renderPasses[0].addMesh(mesh);
10716
- // const renderPasses = this.renderPasses;
10717
- // const infoMap = this.renderPassInfoMap;
10718
- // const { priority } = mesh;
10719
- // for (let i = 1; i < renderPasses.length; i++) {
10720
- // const renderPass = renderPasses[i - 1];
10721
- // const info = infoMap.get(renderPasses[i])!;
10722
- // if (info && info.listStart > priority && (priority > infoMap.get(renderPass)!.listEnd || i === 1)) {
10723
- // return this.addToRenderPass(renderPass, mesh);
10724
- // }
10725
- // }
10726
- // // TODO: diff逻辑待优化,有时会添加进找不到的元素
10727
- // let last = renderPasses[renderPasses.length - 1];
10728
- // // TODO: 是否添加mesh到pass的判断方式需要优化,先通过长度判断是否有postprocess
10729
- // for (const pass of renderPasses) {
10730
- // if (!(pass instanceof HQGaussianDownSamplePass
10731
- // || pass instanceof BloomThresholdPass
10732
- // || pass instanceof ToneMappingPass
10733
- // || pass instanceof HQGaussianUpSamplePass
10734
- // || pass.name === 'mars-final-copy')) {
10735
- // last = pass;
10736
- // }
10737
- // }
10738
- // // if (priority > infoMap.get(last)!.listStart || renderPasses.length === 1) {
10739
- // // return this.addToRenderPass(last, mesh);
10740
- // // }
10741
- // return this.addToRenderPass(last, mesh);
10742
- // if (false) {
10743
- // throw Error('render pass not found');
10744
- // }
10828
+ this.drawObjectPass.addMesh(mesh);
10745
10829
  };
10746
10830
  /**
10747
10831
  * 把 Mesh 从 RenderPass 中移除,
10748
10832
  * 如果 renderPass 中没有 mesh,此 renderPass 会被删除
10749
10833
  * @param mesh - 要删除的 Mesh 对象
10750
10834
  */ _proto.removeMeshFromDefaultRenderPass = function removeMeshFromDefaultRenderPass(mesh) {
10751
- // const renderPasses = this.renderPasses;
10752
- // const infoMap = this.renderPassInfoMap;
10753
- // for (let i = renderPasses.length - 1; i >= 0; i--) {
10754
- // const renderPass = renderPasses[i];
10755
- // const info = infoMap.get(renderPass)!;
10756
- // // 只有渲染场景物体的pass才有 info
10757
- // if (!info) {
10758
- // continue;
10759
- // }
10760
- // if (info.listStart <= mesh.priority && info.listEnd >= mesh.priority) {
10761
- // const idx = renderPass.meshes.indexOf(mesh);
10762
- // if (idx === -1) {
10763
- // return;
10764
- // }
10765
- // // TODO hack: 现在的除了rp1和finalcopy pass,所有renderpass的meshes是一个copy加上一个filter mesh,这里的判断当filter mesh被删除后当前pass需不需要删除,
10766
- // // 判断需要更鲁棒。
10767
- // const shouldRestoreRenderPass = idx === 1 && renderPass.meshes[0].name === MARS_COPY_MESH_NAME;
10768
- // renderPass.removeMesh(mesh);
10769
- // if (shouldRestoreRenderPass) {
10770
- // const nextRenderPass = renderPasses[i + 1];
10771
- // const meshes = renderPass.meshes;
10772
- // if (!info.intermedia) {
10773
- // info.preRenderPass?.resetColorAttachments([]);
10774
- // //this.renderer.extension.resetColorAttachments?.(info.preRenderPass, []);
10775
- // }
10776
- // for (let j = 1; j < meshes.length; j++) {
10777
- // info.preRenderPass?.addMesh(meshes[j]);
10778
- // }
10779
- // const cp = renderPass.attachments[0]?.texture;
10780
- // const keepColor = cp === this.resource.color_a || cp === this.resource.color_b;
10781
- // renderPass.dispose({
10782
- // meshes: DestroyOptions.keep,
10783
- // colorAttachment: keepColor ? RenderPassDestroyAttachmentType.keep : RenderPassDestroyAttachmentType.destroy,
10784
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10785
- // });
10786
- // removeItem(renderPasses, renderPass);
10787
- // this.removeRenderPass(renderPass);
10788
- // infoMap.delete(renderPass);
10789
- // if (nextRenderPass) {
10790
- // this.updateRenderInfo(nextRenderPass);
10791
- // }
10792
- // if (info.preRenderPass) {
10793
- // this.updateRenderInfo(info.preRenderPass);
10794
- // }
10795
- // if (info.prePasses) {
10796
- // info.prePasses.forEach(rp => {
10797
- // this.removeRenderPass(rp.pass);
10798
- // if (rp?.destroyOptions !== false) {
10799
- // rp.pass.attachments.forEach(c => {
10800
- // if (c.texture !== this.resource.color_b || c.texture !== this.resource.color_a) {
10801
- // c.texture.dispose();
10802
- // }
10803
- // });
10804
- // const options: RenderPassDestroyOptions = {
10805
- // ...(rp?.destroyOptions ? rp.destroyOptions as RenderPassDestroyOptions : {}),
10806
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10807
- // };
10808
- // rp.pass.dispose(options);
10809
- // }
10810
- // });
10811
- // }
10812
- // this.resetRenderPassDefaultAttachment(renderPasses, Math.max(i - 1, 0));
10813
- // if (renderPasses.length === 1) {
10814
- // renderPasses[0].resetColorAttachments([]);
10815
- // //this.renderer.extension.resetColorAttachments?.(renderPasses[0], []);
10816
- // this.removeRenderPass(this.resource.finalCopyRP);
10817
- // }
10818
- // }
10819
- // return this.resetClearActions();
10820
- // }
10821
- // }
10835
+ this.drawObjectPass.removeMesh(mesh);
10822
10836
  };
10823
- // /**
10824
- // * 将 Mesh 所有在 RenderPass 进行切分
10825
- // * @param mesh - 目标 Mesh 对象
10826
- // * @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
10827
- // */
10828
- // splitDefaultRenderPassByMesh (mesh: Mesh, options: RenderPassSplitOptions): RenderPass {
10829
- // const index = this.findMeshRenderPassIndex(mesh);
10830
- // const renderPass = this.renderPasses[index];
10831
- // if (false) {
10832
- // if (!renderPass) {
10833
- // throw Error('RenderPassNotFound');
10834
- // }
10835
- // }
10836
- // this.createResource();
10837
- // const meshIndex = renderPass.meshes.indexOf(mesh);
10838
- // const ms0 = renderPass.meshes.slice(0, meshIndex);
10839
- // const ms1 = renderPass.meshes.slice(meshIndex);
10840
- // const infoMap = this.renderPassInfoMap;
10841
- // // TODO 为什么要加这个判断?
10842
- // // if (renderPass.attachments[0] && this.renderPasses[index + 1] !== this.resource.finalCopyRP) {
10843
- // // throw Error('not implement');
10844
- // // } else {
10845
- // if (!options.attachments?.length) {
10846
- // throw Error('should include at least one color attachment');
10847
- // }
10848
- // const defRPS = this.renderPasses;
10849
- // const defIndex = defRPS.indexOf(renderPass);
10850
- // const lastDefRP = defRPS[defIndex - 1];
10851
- // removeItem(defRPS, renderPass);
10852
- // const lastInfo = infoMap.get(renderPass);
10853
- // infoMap.delete(renderPass);
10854
- // const filter = GPUCapability.getInstance().level === 2 ? glContext.LINEAR : glContext.NEAREST;
10855
- // const rp0 = new RenderPass({
10856
- // name: RENDER_PASS_NAME_PREFIX + defIndex,
10857
- // priority: renderPass.priority,
10858
- // attachments: [{
10859
- // texture: {
10860
- // sourceType: TextureSourceType.framebuffer,
10861
- // format: glContext.RGBA,
10862
- // name: 'frame_a',
10863
- // minFilter: filter,
10864
- // magFilter: filter,
10865
- // },
10866
- // }],
10867
- // clearAction: renderPass.clearAction || { colorAction: TextureLoadAction.clear },
10868
- // storeAction: renderPass.storeAction,
10869
- // depthStencilAttachment: this.resource.depthStencil,
10870
- // meshes: ms0,
10871
- // meshOrder: OrderType.ascending,
10872
- // });
10873
- // ms1.unshift(this.createCopyMesh());
10874
- // const renderPasses = this.renderPasses;
10875
- // renderPasses[index] = rp0;
10876
- // const prePasses: RenderPass[] = [];
10877
- // const restMeshes = ms1.slice();
10878
- // if (options.prePasses) {
10879
- // options.prePasses.forEach((pass, i) => {
10880
- // pass.priority = renderPass.priority + 1 + i;
10881
- // pass.setMeshes(ms1);
10882
- // prePasses.push(pass);
10883
- // });
10884
- // renderPasses.splice(index + 1, 0, ...prePasses);
10885
- // restMeshes.splice(0, 2);
10886
- // }
10887
- // const copyRP = this.resource.finalCopyRP;
10888
- // if (!renderPasses.includes(copyRP)) {
10889
- // renderPasses.push(copyRP);
10890
- // }
10891
- // // let sourcePass = (prePasses.length && !options.useLastDefaultPassColor) ? prePasses[prePasses.length - 1] : rp0;
10892
- // const finalFilterPass = prePasses[prePasses.length - 1];
10893
- // finalFilterPass.initialize(this.renderer);
10894
- // // 不切RT,接着上一个pass的渲染结果渲染
10895
- // const rp1 = new RenderPass({
10896
- // name: RENDER_PASS_NAME_PREFIX + (defIndex + 1),
10897
- // priority: renderPass.priority + 1 + (options.prePasses?.length || 0),
10898
- // meshes: restMeshes,
10899
- // meshOrder: OrderType.ascending,
10900
- // depthStencilAttachment: this.resource.depthStencil,
10901
- // storeAction: options.storeAction,
10902
- // clearAction: {
10903
- // depthAction: TextureLoadAction.whatever,
10904
- // stencilAction: TextureLoadAction.whatever,
10905
- // colorAction: TextureLoadAction.whatever,
10906
- // },
10907
- // });
10908
- // renderPasses.splice(index + 1 + (options.prePasses?.length || 0), 0, rp1);
10909
- // this.setRenderPasses(renderPasses);
10910
- // this.updateRenderInfo(finalFilterPass);
10911
- // this.updateRenderInfo(rp0);
10912
- // this.updateRenderInfo(rp1);
10913
- // // 目的是删除滤镜元素后,把之前滤镜用到的prePass给删除,逻辑有些复杂,考虑优化
10914
- // infoMap.get(rp0)!.prePasses = lastInfo!.prePasses;
10915
- // prePasses.pop();
10916
- // infoMap.get(finalFilterPass)!.prePasses = prePasses.map((pass, i) => {
10917
- // return { pass, destroyOptions: false };
10918
- // });
10919
- // this.resetClearActions();
10920
- // return finalFilterPass;
10921
- // }
10922
10837
  /**
10923
10838
  * 销毁 RenderFrame
10924
10839
  * @param options - 可以有选择销毁一些对象
@@ -11038,45 +10953,6 @@ var seed$5 = 1;
11038
10953
  this.clearAction.colorAction = TextureLoadAction.whatever;
11039
10954
  }
11040
10955
  };
11041
- // protected updateRenderInfo (renderPass: RenderPass): RenderPassInfo {
11042
- // const map = this.renderPassInfoMap;
11043
- // const passes = this.renderPasses;
11044
- // let info: RenderPassInfo;
11045
- // if (!map.has(renderPass)) {
11046
- // info = {
11047
- // intermedia: false,
11048
- // renderPass: renderPass,
11049
- // listStart: 0,
11050
- // listEnd: 0,
11051
- // };
11052
- // map.set(renderPass, info);
11053
- // } else {
11054
- // info = map.get(renderPass)!;
11055
- // }
11056
- // info.intermedia = renderPass.attachments.length > 0;
11057
- // const meshes = renderPass.meshes;
11058
- // if (meshes[0]) {
11059
- // info.listStart = (meshes[0].name === MARS_COPY_MESH_NAME ? meshes[1] : meshes[0]).priority;
11060
- // info.listEnd = meshes[meshes.length - 1].priority;
11061
- // } else {
11062
- // info.listStart = 0;
11063
- // info.listEnd = 0;
11064
- // }
11065
- // const index = passes.indexOf(renderPass);
11066
- // const depthStencilActon = index === 0 ? TextureLoadAction.clear : TextureLoadAction.whatever;
11067
- // if (index === 0) {
11068
- // renderPass.clearAction.colorAction = TextureLoadAction.clear;
11069
- // }
11070
- // renderPass.clearAction.depthAction = depthStencilActon;
11071
- // renderPass.clearAction.stencilAction = depthStencilActon;
11072
- // if (index > -1) {
11073
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', () => this.editorTransform);
11074
- // } else {
11075
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', undefined);
11076
- // }
11077
- // info.preRenderPass = passes[index - 1];
11078
- // return info;
11079
- // }
11080
10956
  /**
11081
10957
  * 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
11082
10958
  * @param passes - RenderPass 数组
@@ -11277,7 +11153,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
11277
11153
  var GlobalUniforms = function GlobalUniforms() {
11278
11154
  this.floats = {};
11279
11155
  this.ints = {};
11280
- // vector3s: Record<string, vec3> = {};
11156
+ this.vector3s = {};
11281
11157
  this.vector4s = {};
11282
11158
  this.matrices = {};
11283
11159
  //...
@@ -11518,6 +11394,9 @@ var Renderer = /*#__PURE__*/ function() {
11518
11394
  _proto.setGlobalVector4 = function setGlobalVector4(name, value) {
11519
11395
  // OVERRIDE
11520
11396
  };
11397
+ _proto.setGlobalVector3 = function setGlobalVector3(name, value) {
11398
+ // OVERRIDE
11399
+ };
11521
11400
  _proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
11522
11401
  // OVERRIDE
11523
11402
  };
@@ -13183,10 +13062,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
13183
13062
  }
13184
13063
  var _proto = Vector4Curve.prototype;
13185
13064
  _proto.onCreate = function onCreate(arg) {
13186
- this.xCurve = createValueGetter(arg.x);
13187
- this.yCurve = createValueGetter(arg.y);
13188
- this.zCurve = createValueGetter(arg.z);
13189
- this.wCurve = createValueGetter(arg.w);
13065
+ this.xCurve = createValueGetter(arg[0]);
13066
+ this.yCurve = createValueGetter(arg[1]);
13067
+ this.zCurve = createValueGetter(arg[2]);
13068
+ this.wCurve = createValueGetter(arg[3]);
13190
13069
  };
13191
13070
  _proto.getValue = function getValue(t) {
13192
13071
  var x = this.xCurve.getValue(t);
@@ -13206,8 +13085,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
13206
13085
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
13207
13086
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
13208
13087
  var HELP_LINK = {
13209
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13210
- "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13088
+ "Item duration can't be less than 0": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13089
+ "ValueType: 21/22 is not supported": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13211
13090
  };
13212
13091
 
13213
13092
  var _obj$3;
@@ -13286,10 +13165,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13286
13165
  }
13287
13166
  var _proto = ColorCurve.prototype;
13288
13167
  _proto.onCreate = function onCreate(arg) {
13289
- this.rCurve = createValueGetter(arg.r);
13290
- this.gCurve = createValueGetter(arg.g);
13291
- this.bCurve = createValueGetter(arg.b);
13292
- this.aCurve = createValueGetter(arg.a);
13168
+ this.rCurve = createValueGetter(arg[0]);
13169
+ this.gCurve = createValueGetter(arg[1]);
13170
+ this.bCurve = createValueGetter(arg[2]);
13171
+ this.aCurve = createValueGetter(arg[3]);
13293
13172
  };
13294
13173
  _proto.getValue = function getValue(t) {
13295
13174
  var r = this.rCurve.getValue(t);
@@ -13302,7 +13181,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13302
13181
  return ColorCurve;
13303
13182
  }(ValueGetter);
13304
13183
 
13305
- var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
13184
+ /**
13185
+ * @since 2.1.0
13186
+ */ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
13306
13187
  _inherits(BaseRenderComponent, RendererComponent);
13307
13188
  function BaseRenderComponent(engine) {
13308
13189
  var _this;
@@ -13389,7 +13270,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
13389
13270
  * @param texture - 纹理对象
13390
13271
  */ _proto.setTexture = function setTexture(texture) {
13391
13272
  this.renderer.texture = texture;
13392
- this.material.setTexture("uSampler0", texture);
13273
+ this.material.setTexture("_MainTex", texture);
13393
13274
  };
13394
13275
  /**
13395
13276
  * @internal
@@ -13468,51 +13349,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
13468
13349
  geometry.setIndexData(indexData);
13469
13350
  geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
13470
13351
  geometry.setDrawCount(data.index.length);
13471
- for(var i = 0; i < textures.length; i++){
13472
- var texture1 = textures[i];
13473
- material.setTexture("uSampler" + i, texture1);
13474
- }
13475
- // FIXME: 内存泄漏的临时方案,后面再调整
13476
- var emptyTexture = this.emptyTexture;
13477
- for(var k = textures.length; k < maxSpriteMeshItemCount; k++){
13478
- material.setTexture("uSampler" + k, emptyTexture);
13479
- }
13352
+ material.setTexture("_MainTex", texture);
13480
13353
  };
13481
13354
  _proto.getItemGeometryData = function getItemGeometryData() {
13482
- this.geometry.setAttributeData("aPos", new Float32Array([
13483
- -0.5,
13484
- 0.5,
13485
- 0,
13486
- -0.5,
13487
- -0.5,
13488
- 0,
13489
- 0.5,
13490
- 0.5,
13491
- 0,
13492
- 0.5,
13493
- -0.5,
13494
- 0
13495
- ]));
13496
- return {
13497
- index: [
13498
- 0,
13499
- 1,
13500
- 2,
13501
- 2,
13502
- 1,
13503
- 3
13504
- ],
13505
- atlasOffset: [
13355
+ var renderer = this.renderer;
13356
+ if (renderer.shape) {
13357
+ 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;
13358
+ var point = new Float32Array(aPoint);
13359
+ var position = [];
13360
+ var atlasOffset = [];
13361
+ for(var i = 0; i < point.length; i += 6){
13362
+ atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
13363
+ position.push(point[i], point[i + 1], 0.0);
13364
+ }
13365
+ this.geometry.setAttributeData("aPos", new Float32Array(position));
13366
+ return {
13367
+ index: index,
13368
+ atlasOffset: atlasOffset
13369
+ };
13370
+ } else {
13371
+ this.geometry.setAttributeData("aPos", new Float32Array([
13372
+ -0.5,
13373
+ 0.5,
13506
13374
  0,
13507
- 1,
13375
+ -0.5,
13376
+ -0.5,
13508
13377
  0,
13378
+ 0.5,
13379
+ 0.5,
13509
13380
  0,
13510
- 1,
13511
- 1,
13512
- 1,
13381
+ 0.5,
13382
+ -0.5,
13513
13383
  0
13514
- ]
13515
- };
13384
+ ]));
13385
+ return {
13386
+ index: [
13387
+ 0,
13388
+ 1,
13389
+ 2,
13390
+ 2,
13391
+ 1,
13392
+ 3
13393
+ ],
13394
+ atlasOffset: [
13395
+ 0,
13396
+ 1,
13397
+ 0,
13398
+ 0,
13399
+ 1,
13400
+ 1,
13401
+ 1,
13402
+ 0
13403
+ ]
13404
+ };
13405
+ }
13516
13406
  };
13517
13407
  _proto.createGeometry = function createGeometry(mode) {
13518
13408
  return Geometry.create(this.engine, {
@@ -13577,7 +13467,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
13577
13467
  setBlendMode(material, states.blendMode);
13578
13468
  setMaskMode(material, states.maskMode);
13579
13469
  setSideMode(material, states.side);
13580
- material.shader.shaderData.properties = 'uSampler0("uSampler0",2D) = "white" {}';
13470
+ material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
13581
13471
  if (!material.hasUniform("_Color")) {
13582
13472
  material.setVector4("_Color", new Vector4(0, 0, 0, 1));
13583
13473
  }
@@ -15171,37 +15061,514 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
15171
15061
  return Ellipse;
15172
15062
  }(ShapePrimitive);
15173
15063
 
15174
- var ShapePath = /*#__PURE__*/ function() {
15175
- function ShapePath(graphicsPath) {
15176
- this.graphicsPath = graphicsPath;
15177
- this.currentPoly = null;
15178
- this.shapePrimitives = [];
15064
+ var StarType;
15065
+ (function(StarType) {
15066
+ StarType[StarType["Star"] = 0] = "Star";
15067
+ StarType[StarType["Polygon"] = 1] = "Polygon";
15068
+ })(StarType || (StarType = {}));
15069
+ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
15070
+ _inherits(PolyStar, ShapePrimitive);
15071
+ function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
15072
+ if (pointCount === void 0) pointCount = 0;
15073
+ if (outerRadius === void 0) outerRadius = 0;
15074
+ if (innerRadius === void 0) innerRadius = 0;
15075
+ if (outerRoundness === void 0) outerRoundness = 0;
15076
+ if (innerRoundness === void 0) innerRoundness = 0;
15077
+ if (starType === void 0) starType = 0;
15078
+ var _this;
15079
+ _this = ShapePrimitive.call(this) || this;
15080
+ _this.pointCount = pointCount;
15081
+ _this.outerRadius = outerRadius;
15082
+ _this.innerRadius = innerRadius;
15083
+ _this.outerRoundness = outerRoundness;
15084
+ _this.innerRoundness = innerRoundness;
15085
+ _this.starType = starType;
15086
+ _this.v = [];
15087
+ _this.in = [];
15088
+ _this.out = [];
15089
+ return _this;
15179
15090
  }
15180
- var _proto = ShapePath.prototype;
15181
- /** Builds the path. */ _proto.buildPath = function buildPath() {
15182
- this.currentPoly = null;
15183
- this.shapePrimitives.length = 0;
15184
- var path = this.graphicsPath;
15185
- for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
15186
- var instruction = _step.value;
15187
- var action = instruction.action;
15188
- var data = instruction.data;
15189
- switch(action){
15190
- case "bezierCurveTo":
15191
- {
15192
- this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
15193
- break;
15194
- }
15195
- case "moveTo":
15196
- {
15197
- this.moveTo(data[0], data[1]);
15198
- break;
15199
- }
15091
+ var _proto = PolyStar.prototype;
15092
+ _proto.clone = function clone() {
15093
+ var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
15094
+ return polyStar;
15095
+ };
15096
+ _proto.copyFrom = function copyFrom(source) {
15097
+ this.pointCount = source.pointCount;
15098
+ this.outerRadius = source.outerRadius;
15099
+ this.innerRadius = source.innerRadius;
15100
+ this.outerRoundness = source.outerRoundness;
15101
+ this.innerRoundness = source.innerRoundness;
15102
+ this.starType = source.starType;
15103
+ };
15104
+ _proto.copyTo = function copyTo(destination) {
15105
+ destination.copyFrom(this);
15106
+ };
15107
+ _proto.build = function build(points) {
15108
+ switch(this.starType){
15109
+ case 0:
15110
+ {
15111
+ this.buildStarPath();
15112
+ break;
15113
+ }
15114
+ case 1:
15115
+ {
15116
+ this.buildPolygonPath();
15117
+ break;
15118
+ }
15119
+ }
15120
+ var smoothness = 1;
15121
+ for(var i = 0; i < this.v.length - 2; i += 2){
15122
+ 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);
15123
+ }
15124
+ // draw last curve
15125
+ var lastIndex = this.v.length - 1;
15126
+ 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);
15127
+ };
15128
+ _proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
15129
+ var triangles = triangulate([
15130
+ points
15131
+ ]);
15132
+ for(var i = 0; i < triangles.length; i++){
15133
+ vertices[verticesOffset + i] = triangles[i];
15134
+ }
15135
+ var vertexCount = triangles.length / 2;
15136
+ for(var i1 = 0; i1 < vertexCount; i1++){
15137
+ indices[indicesOffset + i1] = i1;
15138
+ }
15139
+ };
15140
+ _proto.buildStarPath = function buildStarPath() {
15141
+ this.v = [];
15142
+ this.in = [];
15143
+ this.out = [];
15144
+ var numPts = Math.floor(this.pointCount) * 2;
15145
+ var angle = Math.PI * 2 / numPts;
15146
+ var longFlag = true;
15147
+ var longRad = this.outerRadius;
15148
+ var shortRad = this.innerRadius;
15149
+ var longRound = this.outerRoundness / 100;
15150
+ var shortRound = this.innerRoundness / 100;
15151
+ var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
15152
+ var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
15153
+ var i;
15154
+ var rad;
15155
+ var roundness;
15156
+ var perimSegment;
15157
+ var currentAng = -Math.PI / 2;
15158
+ var dir = 1;
15159
+ for(i = 0; i < numPts; i++){
15160
+ rad = longFlag ? longRad : shortRad;
15161
+ roundness = longFlag ? longRound : shortRound;
15162
+ perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
15163
+ var x = rad * Math.cos(currentAng);
15164
+ var y = rad * Math.sin(currentAng);
15165
+ var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
15166
+ var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
15167
+ var offset = i * 2;
15168
+ this.v[offset] = x;
15169
+ this.v[offset + 1] = y;
15170
+ this.in[offset] = x + ox * perimSegment * roundness * dir;
15171
+ this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
15172
+ this.out[offset] = x - ox * perimSegment * roundness * dir;
15173
+ this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
15174
+ longFlag = !longFlag;
15175
+ currentAng += angle * dir;
15176
+ }
15177
+ };
15178
+ _proto.buildPolygonPath = function buildPolygonPath() {
15179
+ this.v = [];
15180
+ this.in = [];
15181
+ this.out = [];
15182
+ var numPts = Math.floor(this.pointCount);
15183
+ var angle = Math.PI * 2 / numPts;
15184
+ var rad = this.outerRadius;
15185
+ var roundness = this.outerRoundness / 100;
15186
+ var perimSegment = 2 * Math.PI * rad / (numPts * 4);
15187
+ var i;
15188
+ var currentAng = -Math.PI * 0.5;
15189
+ var dir = 1;
15190
+ for(i = 0; i < numPts; i++){
15191
+ var x = rad * Math.cos(currentAng);
15192
+ var y = rad * Math.sin(currentAng);
15193
+ var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
15194
+ var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
15195
+ var offset = i * 2;
15196
+ this.v[offset] = x;
15197
+ this.v[offset + 1] = y;
15198
+ this.in[offset] = x + ox * perimSegment * roundness * dir;
15199
+ this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
15200
+ this.out[offset] = x - ox * perimSegment * roundness * dir;
15201
+ this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
15202
+ currentAng += angle * dir;
15203
+ }
15204
+ };
15205
+ return PolyStar;
15206
+ }(ShapePrimitive);
15207
+
15208
+ // const tempPoints = [new Point(), new Point(), new Point(), new Point()];
15209
+ /**
15210
+ * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
15211
+ * point (`x`, `y`) and by its `width` and its `height`.
15212
+ */ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
15213
+ _inherits(Rectangle, ShapePrimitive);
15214
+ function Rectangle(x, y, width, height) {
15215
+ if (x === void 0) x = 0;
15216
+ if (y === void 0) y = 0;
15217
+ if (width === void 0) width = 0;
15218
+ if (height === void 0) height = 0;
15219
+ var _this;
15220
+ _this = ShapePrimitive.call(this) || this;
15221
+ _this.x = Number(x);
15222
+ _this.y = Number(y);
15223
+ _this.width = Number(width);
15224
+ _this.height = Number(height);
15225
+ return _this;
15226
+ }
15227
+ var _proto = Rectangle.prototype;
15228
+ /** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
15229
+ return this.left === this.right || this.top === this.bottom;
15230
+ };
15231
+ /**
15232
+ * Creates a clone of this Rectangle
15233
+ * @returns a copy of the rectangle
15234
+ */ _proto.clone = function clone() {
15235
+ return new Rectangle(this.x, this.y, this.width, this.height);
15236
+ };
15237
+ /**
15238
+ * Converts a Bounds object to a Rectangle object.
15239
+ * @param bounds - The bounds to copy and convert to a rectangle.
15240
+ * @returns Returns itself.
15241
+ */ // copyFromBounds (bounds: Bounds): this {
15242
+ // this.x = bounds.minX;
15243
+ // this.y = bounds.minY;
15244
+ // this.width = bounds.maxX - bounds.minX;
15245
+ // this.height = bounds.maxY - bounds.minY;
15246
+ // return this;
15247
+ // }
15248
+ /**
15249
+ * Copies another rectangle to this one.
15250
+ * @param rectangle - The rectangle to copy from.
15251
+ * @returns Returns itself.
15252
+ */ _proto.copyFrom = function copyFrom(rectangle) {
15253
+ this.x = rectangle.x;
15254
+ this.y = rectangle.y;
15255
+ this.width = rectangle.width;
15256
+ this.height = rectangle.height;
15257
+ return this;
15258
+ };
15259
+ /**
15260
+ * Copies this rectangle to another one.
15261
+ * @param rectangle - The rectangle to copy to.
15262
+ * @returns Returns given parameter.
15263
+ */ _proto.copyTo = function copyTo(rectangle) {
15264
+ rectangle.copyFrom(this);
15265
+ return rectangle;
15266
+ };
15267
+ /**
15268
+ * Checks whether the x and y coordinates given are contained within this Rectangle
15269
+ * @param x - The X coordinate of the point to test
15270
+ * @param y - The Y coordinate of the point to test
15271
+ * @returns Whether the x/y coordinates are within this Rectangle
15272
+ */ _proto.contains = function contains(x, y) {
15273
+ if (this.width <= 0 || this.height <= 0) {
15274
+ return false;
15275
+ }
15276
+ if (x >= this.x && x < this.x + this.width) {
15277
+ if (y >= this.y && y < this.y + this.height) {
15278
+ return true;
15279
+ }
15280
+ }
15281
+ return false;
15282
+ };
15283
+ /**
15284
+ * Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
15285
+ * @param x - The X coordinate of the point to test
15286
+ * @param y - The Y coordinate of the point to test
15287
+ * @param strokeWidth - The width of the line to check
15288
+ * @returns Whether the x/y coordinates are within this rectangle
15289
+ */ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
15290
+ var _this = this, width = _this.width, height = _this.height;
15291
+ if (width <= 0 || height <= 0) {
15292
+ return false;
15293
+ }
15294
+ var _x = this.x;
15295
+ var _y = this.y;
15296
+ var outerLeft = _x - strokeWidth / 2;
15297
+ var outerRight = _x + width + strokeWidth / 2;
15298
+ var outerTop = _y - strokeWidth / 2;
15299
+ var outerBottom = _y + height + strokeWidth / 2;
15300
+ var innerLeft = _x + strokeWidth / 2;
15301
+ var innerRight = _x + width - strokeWidth / 2;
15302
+ var innerTop = _y + strokeWidth / 2;
15303
+ var innerBottom = _y + height - strokeWidth / 2;
15304
+ return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
15305
+ };
15306
+ /**
15307
+ * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
15308
+ * Returns true only if the area of the intersection is >0, this means that Rectangles
15309
+ * sharing a side are not overlapping. Another side effect is that an arealess rectangle
15310
+ * (width or height equal to zero) can't intersect any other rectangle.
15311
+ * @param {Rectangle} other - The Rectangle to intersect with `this`.
15312
+ * @param {Matrix} transform - The transformation matrix of `other`.
15313
+ * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
15314
+ */ // intersects (other: Rectangle, transform?: Matrix4): boolean {
15315
+ // if (!transform) {
15316
+ // const x0 = this.x < other.x ? other.x : this.x;
15317
+ // const x1 = this.right > other.right ? other.right : this.right;
15318
+ // if (x1 <= x0) {
15319
+ // return false;
15320
+ // }
15321
+ // const y0 = this.y < other.y ? other.y : this.y;
15322
+ // const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
15323
+ // return y1 > y0;
15324
+ // }
15325
+ // const x0 = this.left;
15326
+ // const x1 = this.right;
15327
+ // const y0 = this.top;
15328
+ // const y1 = this.bottom;
15329
+ // if (x1 <= x0 || y1 <= y0) {
15330
+ // return false;
15331
+ // }
15332
+ // const lt = tempPoints[0].set(other.left, other.top);
15333
+ // const lb = tempPoints[1].set(other.left, other.bottom);
15334
+ // const rt = tempPoints[2].set(other.right, other.top);
15335
+ // const rb = tempPoints[3].set(other.right, other.bottom);
15336
+ // if (rt.x <= lt.x || lb.y <= lt.y) {
15337
+ // return false;
15338
+ // }
15339
+ // const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
15340
+ // if (s === 0) {
15341
+ // return false;
15342
+ // }
15343
+ // transform.apply(lt, lt);
15344
+ // transform.apply(lb, lb);
15345
+ // transform.apply(rt, rt);
15346
+ // transform.apply(rb, rb);
15347
+ // if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
15348
+ // || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
15349
+ // || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
15350
+ // || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
15351
+ // return false;
15352
+ // }
15353
+ // const nx = s * (lb.y - lt.y);
15354
+ // const ny = s * (lt.x - lb.x);
15355
+ // const n00 = (nx * x0) + (ny * y0);
15356
+ // const n10 = (nx * x1) + (ny * y0);
15357
+ // const n01 = (nx * x0) + (ny * y1);
15358
+ // const n11 = (nx * x1) + (ny * y1);
15359
+ // if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
15360
+ // || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
15361
+ // return false;
15362
+ // }
15363
+ // const mx = s * (lt.y - rt.y);
15364
+ // const my = s * (rt.x - lt.x);
15365
+ // const m00 = (mx * x0) + (my * y0);
15366
+ // const m10 = (mx * x1) + (my * y0);
15367
+ // const m01 = (mx * x0) + (my * y1);
15368
+ // const m11 = (mx * x1) + (my * y1);
15369
+ // if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
15370
+ // || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
15371
+ // return false;
15372
+ // }
15373
+ // return true;
15374
+ // }
15375
+ /**
15376
+ * Pads the rectangle making it grow in all directions.
15377
+ * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
15378
+ * @param paddingX - The horizontal padding amount.
15379
+ * @param paddingY - The vertical padding amount.
15380
+ * @returns Returns itself.
15381
+ */ _proto.pad = function pad(paddingX, paddingY) {
15382
+ if (paddingX === void 0) paddingX = 0;
15383
+ if (paddingY === void 0) paddingY = paddingX;
15384
+ this.x -= paddingX;
15385
+ this.y -= paddingY;
15386
+ this.width += paddingX * 2;
15387
+ this.height += paddingY * 2;
15388
+ return this;
15389
+ };
15390
+ /**
15391
+ * Fits this rectangle around the passed one.
15392
+ * @param rectangle - The rectangle to fit.
15393
+ * @returns Returns itself.
15394
+ */ _proto.fit = function fit(rectangle) {
15395
+ var x1 = Math.max(this.x, rectangle.x);
15396
+ var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
15397
+ var y1 = Math.max(this.y, rectangle.y);
15398
+ var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
15399
+ this.x = x1;
15400
+ this.width = Math.max(x2 - x1, 0);
15401
+ this.y = y1;
15402
+ this.height = Math.max(y2 - y1, 0);
15403
+ return this;
15404
+ };
15405
+ /**
15406
+ * Enlarges rectangle that way its corners lie on grid
15407
+ * @param resolution - resolution
15408
+ * @param eps - precision
15409
+ * @returns Returns itself.
15410
+ */ _proto.ceil = function ceil(resolution, eps) {
15411
+ if (resolution === void 0) resolution = 1;
15412
+ if (eps === void 0) eps = 0.001;
15413
+ var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
15414
+ var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
15415
+ this.x = Math.floor((this.x + eps) * resolution) / resolution;
15416
+ this.y = Math.floor((this.y + eps) * resolution) / resolution;
15417
+ this.width = x2 - this.x;
15418
+ this.height = y2 - this.y;
15419
+ return this;
15420
+ };
15421
+ /**
15422
+ * Enlarges this rectangle to include the passed rectangle.
15423
+ * @param rectangle - The rectangle to include.
15424
+ * @returns Returns itself.
15425
+ */ _proto.enlarge = function enlarge(rectangle) {
15426
+ var x1 = Math.min(this.x, rectangle.x);
15427
+ var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
15428
+ var y1 = Math.min(this.y, rectangle.y);
15429
+ var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
15430
+ this.x = x1;
15431
+ this.width = x2 - x1;
15432
+ this.y = y1;
15433
+ this.height = y2 - y1;
15434
+ return this;
15435
+ };
15436
+ /**
15437
+ * Returns the framing rectangle of the rectangle as a Rectangle object
15438
+ * @param out - optional rectangle to store the result
15439
+ * @returns The framing rectangle
15440
+ */ _proto.getBounds = function getBounds(out) {
15441
+ out = out || new Rectangle();
15442
+ out.copyFrom(this);
15443
+ return out;
15444
+ };
15445
+ _proto.getX = function getX() {
15446
+ return this.x;
15447
+ };
15448
+ _proto.getY = function getY() {
15449
+ return this.y;
15450
+ };
15451
+ _proto.build = function build(points) {
15452
+ var x = this.x;
15453
+ var y = this.y;
15454
+ var width = this.width;
15455
+ var height = this.height;
15456
+ if (!(width >= 0 && height >= 0)) {
15457
+ return points;
15458
+ }
15459
+ points[0] = x;
15460
+ points[1] = y;
15461
+ points[2] = x + width;
15462
+ points[3] = y;
15463
+ points[4] = x + width;
15464
+ points[5] = y + height;
15465
+ points[6] = x;
15466
+ points[7] = y + height;
15467
+ return points;
15468
+ };
15469
+ _proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
15470
+ var count = 0;
15471
+ var verticesStride = 2;
15472
+ verticesOffset *= verticesStride;
15473
+ vertices[verticesOffset + count] = points[0];
15474
+ vertices[verticesOffset + count + 1] = points[1];
15475
+ count += verticesStride;
15476
+ vertices[verticesOffset + count] = points[2];
15477
+ vertices[verticesOffset + count + 1] = points[3];
15478
+ count += verticesStride;
15479
+ vertices[verticesOffset + count] = points[6];
15480
+ vertices[verticesOffset + count + 1] = points[7];
15481
+ count += verticesStride;
15482
+ vertices[verticesOffset + count] = points[4];
15483
+ vertices[verticesOffset + count + 1] = points[5];
15484
+ count += verticesStride;
15485
+ var verticesIndex = verticesOffset / verticesStride;
15486
+ // triangle 1
15487
+ indices[indicesOffset++] = verticesIndex;
15488
+ indices[indicesOffset++] = verticesIndex + 1;
15489
+ indices[indicesOffset++] = verticesIndex + 2;
15490
+ // triangle 2
15491
+ indices[indicesOffset++] = verticesIndex + 1;
15492
+ indices[indicesOffset++] = verticesIndex + 3;
15493
+ indices[indicesOffset++] = verticesIndex + 2;
15494
+ };
15495
+ _create_class(Rectangle, [
15496
+ {
15497
+ key: "left",
15498
+ get: /** Returns the left edge of the rectangle. */ function get() {
15499
+ return this.x;
15500
+ }
15501
+ },
15502
+ {
15503
+ key: "right",
15504
+ get: /** Returns the right edge of the rectangle. */ function get() {
15505
+ return this.x + this.width;
15506
+ }
15507
+ },
15508
+ {
15509
+ key: "top",
15510
+ get: /** Returns the top edge of the rectangle. */ function get() {
15511
+ return this.y;
15512
+ }
15513
+ },
15514
+ {
15515
+ key: "bottom",
15516
+ get: /** Returns the bottom edge of the rectangle. */ function get() {
15517
+ return this.y + this.height;
15518
+ }
15519
+ }
15520
+ ], [
15521
+ {
15522
+ key: "EMPTY",
15523
+ get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
15524
+ return new Rectangle(0, 0, 0, 0);
15525
+ }
15526
+ }
15527
+ ]);
15528
+ return Rectangle;
15529
+ }(ShapePrimitive);
15530
+
15531
+ var ShapePath = /*#__PURE__*/ function() {
15532
+ function ShapePath(graphicsPath) {
15533
+ this.graphicsPath = graphicsPath;
15534
+ this.currentPoly = null;
15535
+ this.shapePrimitives = [];
15536
+ }
15537
+ var _proto = ShapePath.prototype;
15538
+ /** Builds the path. */ _proto.buildPath = function buildPath() {
15539
+ this.currentPoly = null;
15540
+ this.shapePrimitives.length = 0;
15541
+ var path = this.graphicsPath;
15542
+ for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
15543
+ var instruction = _step.value;
15544
+ var action = instruction.action;
15545
+ var data = instruction.data;
15546
+ switch(action){
15547
+ case "bezierCurveTo":
15548
+ {
15549
+ this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
15550
+ break;
15551
+ }
15552
+ case "moveTo":
15553
+ {
15554
+ this.moveTo(data[0], data[1]);
15555
+ break;
15556
+ }
15200
15557
  case "ellipse":
15201
15558
  {
15202
15559
  this.ellipse(data[0], data[1], data[2], data[3], data[4]);
15203
15560
  break;
15204
15561
  }
15562
+ case "polyStar":
15563
+ {
15564
+ this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
15565
+ break;
15566
+ }
15567
+ case "rect":
15568
+ {
15569
+ this.rect(data[0], data[1], data[2], data[3], data[4]);
15570
+ break;
15571
+ }
15205
15572
  }
15206
15573
  }
15207
15574
  this.endPoly();
@@ -15242,6 +15609,22 @@ var ShapePath = /*#__PURE__*/ function() {
15242
15609
  this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
15243
15610
  return this;
15244
15611
  };
15612
+ _proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
15613
+ this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
15614
+ return this;
15615
+ };
15616
+ /**
15617
+ * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15618
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15619
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15620
+ * @param w - The width of the rectangle.
15621
+ * @param h - The height of the rectangle.
15622
+ * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
15623
+ * @returns The instance of the current object for chaining.
15624
+ */ _proto.rect = function rect(x, y, w, h, transform) {
15625
+ this.drawShape(new Rectangle$1(x, y, w, h), transform);
15626
+ return this;
15627
+ };
15245
15628
  /**
15246
15629
  * Draws a given shape on the canvas.
15247
15630
  * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
@@ -15378,8 +15761,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
15378
15761
  };
15379
15762
  /**
15380
15763
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15381
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15382
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15764
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15765
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15383
15766
  * @param w - The width of the rectangle.
15384
15767
  * @param h - The height of the rectangle.
15385
15768
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -15398,6 +15781,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
15398
15781
  this.dirty = true;
15399
15782
  return this;
15400
15783
  };
15784
+ _proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
15785
+ this.instructions.push({
15786
+ action: "polyStar",
15787
+ data: [
15788
+ pointCount,
15789
+ outerRadius,
15790
+ innerRadius,
15791
+ outerRoundness,
15792
+ innerRoundness,
15793
+ starType,
15794
+ transform
15795
+ ]
15796
+ });
15797
+ this.dirty = true;
15798
+ return this;
15799
+ };
15401
15800
  _proto.clear = function clear() {
15402
15801
  this.instructions.length = 0;
15403
15802
  this.dirty = true;
@@ -15433,7 +15832,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15433
15832
  _this.curveValues = [];
15434
15833
  _this.animated = true;
15435
15834
  _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";
15436
- _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n gl_FragColor = color;\n}\n";
15835
+ _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";
15437
15836
  if (!_this.geometry) {
15438
15837
  _this.geometry = Geometry.create(engine, {
15439
15838
  attributes: {
@@ -15475,7 +15874,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15475
15874
  };
15476
15875
  _this.material = Material.create(engine, materialProps);
15477
15876
  _this.material.setColor("_Color", new Color(1, 1, 1, 1));
15478
- _this.material.depthMask = true;
15877
+ _this.material.depthMask = false;
15479
15878
  _this.material.depthTest = true;
15480
15879
  _this.material.blending = true;
15481
15880
  }
@@ -15540,16 +15939,18 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15540
15939
  };
15541
15940
  _proto.buildPath = function buildPath(data) {
15542
15941
  this.path.clear();
15543
- switch(data.type){
15544
- case 0:
15942
+ var shapeData = data;
15943
+ switch(shapeData.type){
15944
+ case ShapePrimitiveType.Custom:
15545
15945
  {
15546
- var customData = data;
15547
- var points = customData.param.points;
15548
- var easingIns = customData.param.easingIn;
15549
- var easingOuts = customData.param.easingOut;
15946
+ var customData = shapeData;
15947
+ var points = customData.points;
15948
+ var easingIns = customData.easingIns;
15949
+ var easingOuts = customData.easingOuts;
15550
15950
  this.curveValues = [];
15551
- for(var _iterator = _create_for_of_iterator_helper_loose(customData.param.shapes), _step; !(_step = _iterator()).done;){
15951
+ for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
15552
15952
  var shape = _step.value;
15953
+ this.setFillColor(shape.fill);
15553
15954
  var indices = shape.indexes;
15554
15955
  for(var i = 1; i < indices.length; i++){
15555
15956
  var pointIndex = indices[i];
@@ -15577,46 +15978,185 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15577
15978
  }
15578
15979
  break;
15579
15980
  }
15580
- case 2:
15981
+ case ShapePrimitiveType.Ellipse:
15982
+ {
15983
+ var ellipseData = shapeData;
15984
+ this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
15985
+ this.setFillColor(ellipseData.fill);
15986
+ break;
15987
+ }
15988
+ case ShapePrimitiveType.Rectangle:
15989
+ {
15990
+ var rectangleData = shapeData;
15991
+ this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
15992
+ this.setFillColor(rectangleData.fill);
15993
+ break;
15994
+ }
15995
+ case ShapePrimitiveType.Star:
15581
15996
  {
15582
- var ellipseData = data;
15583
- var ellipseParam = ellipseData.param;
15584
- this.path.ellipse(0, 0, ellipseParam.xRadius, ellipseParam.yRadius);
15997
+ var starData = shapeData;
15998
+ this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
15999
+ this.setFillColor(starData.fill);
15585
16000
  break;
15586
16001
  }
16002
+ case ShapePrimitiveType.Polygon:
16003
+ {
16004
+ var polygonData = shapeData;
16005
+ this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
16006
+ this.setFillColor(polygonData.fill);
16007
+ break;
16008
+ }
16009
+ }
16010
+ };
16011
+ _proto.setFillColor = function setFillColor(fill) {
16012
+ if (fill) {
16013
+ var color = fill.color;
16014
+ this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
15587
16015
  }
15588
16016
  };
15589
16017
  _proto.fromData = function fromData(data) {
15590
16018
  MeshComponent.prototype.fromData.call(this, data);
15591
16019
  this.data = data;
16020
+ var material = this.material;
16021
+ //@ts-expect-error // TODO 新版蒙版上线后重构
16022
+ material.stencilRef = data.renderer.mask !== undefined ? [
16023
+ data.renderer.mask,
16024
+ data.renderer.mask
16025
+ ] : undefined;
16026
+ //@ts-expect-error // TODO 新版蒙版上线后重构
16027
+ setMaskMode(material, data.renderer.maskMode);
15592
16028
  };
15593
16029
  return ShapeComponent;
15594
16030
  }(MeshComponent);
15595
16031
  ShapeComponent = __decorate([
15596
16032
  effectsClass("ShapeComponent")
15597
16033
  ], ShapeComponent);
15598
- var ComponentShapeType;
15599
- (function(ComponentShapeType) {
15600
- /**
15601
- * 自定义图形
15602
- */ ComponentShapeType[ComponentShapeType["CUSTOM"] = 0] = "CUSTOM";
15603
- /**
15604
- * 矩形
15605
- */ ComponentShapeType[ComponentShapeType["RECTANGLE"] = 1] = "RECTANGLE";
15606
- /**
15607
- * 椭圆
15608
- */ ComponentShapeType[ComponentShapeType["ELLIPSE"] = 2] = "ELLIPSE";
15609
- /**
15610
- * 多边形
15611
- */ ComponentShapeType[ComponentShapeType["POLYGON"] = 3] = "POLYGON";
15612
- /**
15613
- * 星形
15614
- */ ComponentShapeType[ComponentShapeType["STAR"] = 4] = "STAR";
15615
- })(ComponentShapeType || (ComponentShapeType = {}));
15616
- var ShapeConnectType;
15617
- (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
15618
- var ShapePointType;
15619
- (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
16034
+
16035
+ var Fake3DComponent = /*#__PURE__*/ function(Component) {
16036
+ _inherits(Fake3DComponent, Component);
16037
+ function Fake3DComponent() {
16038
+ var _this;
16039
+ _this = Component.apply(this, arguments) || this;
16040
+ _this.loop = false;
16041
+ _this.amountOfMotion = 1.0;
16042
+ _this.animationLength = 2.0;
16043
+ _this.mode = 1;
16044
+ _this.startPositionX = 0;
16045
+ _this.startPositionY = 0;
16046
+ _this.startPositionZ = 0;
16047
+ _this.endPositionX = 0;
16048
+ _this.endPositionY = 0;
16049
+ _this.endPositionZ = 0;
16050
+ _this.amplitudeX = 0;
16051
+ _this.amplitudeY = 0;
16052
+ _this.amplitudeZ = 0;
16053
+ _this.phaseX = 0;
16054
+ _this.phaseY = 0;
16055
+ _this.phaseZ = 0;
16056
+ return _this;
16057
+ }
16058
+ var _proto = Fake3DComponent.prototype;
16059
+ _proto.onStart = function onStart() {
16060
+ this.effectComponent = this.item.getComponent(EffectComponent);
16061
+ };
16062
+ _proto.onUpdate = function onUpdate(dt) {
16063
+ this.updateFake3D();
16064
+ };
16065
+ _proto.updateFake3D = function updateFake3D() {
16066
+ if (!this.effectComponent) {
16067
+ return;
16068
+ }
16069
+ var time = this.item.time % this.animationLength / this.animationLength;
16070
+ var _PosX = 0;
16071
+ var _PosY = 0;
16072
+ var _PosZ = 0;
16073
+ switch(this.mode){
16074
+ case 0:
16075
+ {
16076
+ var PI = Math.PI;
16077
+ _PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
16078
+ _PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
16079
+ _PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
16080
+ break;
16081
+ }
16082
+ case 1:
16083
+ {
16084
+ var localTime = time;
16085
+ if (this.loop) {
16086
+ if (localTime > 0.5) {
16087
+ localTime = 1 - localTime;
16088
+ }
16089
+ localTime *= 2;
16090
+ }
16091
+ _PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
16092
+ _PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
16093
+ _PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
16094
+ break;
16095
+ }
16096
+ }
16097
+ var material = this.effectComponent.material;
16098
+ material.setFloat("_PosX", _PosX * this.amountOfMotion);
16099
+ material.setFloat("_PosY", _PosY * this.amountOfMotion);
16100
+ material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
16101
+ };
16102
+ return Fake3DComponent;
16103
+ }(Component);
16104
+ __decorate([
16105
+ serialize()
16106
+ ], Fake3DComponent.prototype, "loop", void 0);
16107
+ __decorate([
16108
+ serialize()
16109
+ ], Fake3DComponent.prototype, "amountOfMotion", void 0);
16110
+ __decorate([
16111
+ serialize()
16112
+ ], Fake3DComponent.prototype, "animationLength", void 0);
16113
+ __decorate([
16114
+ serialize()
16115
+ ], Fake3DComponent.prototype, "mode", void 0);
16116
+ __decorate([
16117
+ serialize()
16118
+ ], Fake3DComponent.prototype, "startPositionX", void 0);
16119
+ __decorate([
16120
+ serialize()
16121
+ ], Fake3DComponent.prototype, "startPositionY", void 0);
16122
+ __decorate([
16123
+ serialize()
16124
+ ], Fake3DComponent.prototype, "startPositionZ", void 0);
16125
+ __decorate([
16126
+ serialize()
16127
+ ], Fake3DComponent.prototype, "endPositionX", void 0);
16128
+ __decorate([
16129
+ serialize()
16130
+ ], Fake3DComponent.prototype, "endPositionY", void 0);
16131
+ __decorate([
16132
+ serialize()
16133
+ ], Fake3DComponent.prototype, "endPositionZ", void 0);
16134
+ __decorate([
16135
+ serialize()
16136
+ ], Fake3DComponent.prototype, "amplitudeX", void 0);
16137
+ __decorate([
16138
+ serialize()
16139
+ ], Fake3DComponent.prototype, "amplitudeY", void 0);
16140
+ __decorate([
16141
+ serialize()
16142
+ ], Fake3DComponent.prototype, "amplitudeZ", void 0);
16143
+ __decorate([
16144
+ serialize()
16145
+ ], Fake3DComponent.prototype, "phaseX", void 0);
16146
+ __decorate([
16147
+ serialize()
16148
+ ], Fake3DComponent.prototype, "phaseY", void 0);
16149
+ __decorate([
16150
+ serialize()
16151
+ ], Fake3DComponent.prototype, "phaseZ", void 0);
16152
+ Fake3DComponent = __decorate([
16153
+ effectsClass("Fake3DComponent")
16154
+ ], Fake3DComponent);
16155
+ var Fake3DAnimationMode;
16156
+ (function(Fake3DAnimationMode) {
16157
+ Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
16158
+ Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
16159
+ })(Fake3DAnimationMode || (Fake3DAnimationMode = {}));
15620
16160
 
15621
16161
  var CameraController = /*#__PURE__*/ function(Behaviour) {
15622
16162
  _inherits(CameraController, Behaviour);
@@ -15988,8 +16528,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
15988
16528
  0
15989
16529
  ]
15990
16530
  };
16531
+ _this.duringPlay = false;
15991
16532
  /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
15992
- _this.hasBeenAddedToComposition = false;
15993
16533
  _this.getHitTestParams = function(force) {
15994
16534
  if (!_this.clickable) {
15995
16535
  return;
@@ -16026,7 +16566,6 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16026
16566
  ];
16027
16567
  };
16028
16568
  _proto.onStart = function onStart() {
16029
- var _this = this;
16030
16569
  var options = this.item.props.content.options;
16031
16570
  var env = this.item.engine.renderer.env;
16032
16571
  var composition = this.item.composition;
@@ -16050,32 +16589,37 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16050
16589
  this.materials = this.previewContent.mesh.materials;
16051
16590
  }
16052
16591
  this.item.getHitTestParams = this.getHitTestParams;
16053
- this.item.onEnd = function() {
16054
- if (_this.item && _this.item.composition) {
16055
- var _this_previewContent;
16056
- _this.item.composition.removeInteractiveItem(_this.item, _this.item.props.content.options.type);
16057
- _this.clickable = false;
16058
- _this.hasBeenAddedToComposition = false;
16059
- (_this_previewContent = _this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
16060
- _this.endDragTarget();
16592
+ };
16593
+ _proto.onDisable = function onDisable() {
16594
+ RendererComponent.prototype.onDisable.call(this);
16595
+ if (this.item && this.item.composition) {
16596
+ var _this_previewContent;
16597
+ if (this.duringPlay && !this.item.transform.getValid()) {
16598
+ this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
16599
+ this.duringPlay = false;
16061
16600
  }
16062
- };
16601
+ this.clickable = false;
16602
+ (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
16603
+ this.endDragTarget();
16604
+ }
16605
+ };
16606
+ _proto.onEnable = function onEnable() {
16607
+ RendererComponent.prototype.onEnable.call(this);
16608
+ var type = this.interactData.options.type;
16609
+ if (type === InteractType.CLICK) {
16610
+ this.clickable = true;
16611
+ }
16063
16612
  };
16064
16613
  _proto.onUpdate = function onUpdate(dt) {
16065
16614
  var _this_previewContent;
16066
- if (!this.isActiveAndEnabled) {
16067
- return;
16068
- }
16069
- (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
16070
- if (!this.hasBeenAddedToComposition && this.item.composition) {
16071
- var type = this.interactData.options.type;
16072
- if (type === InteractType.CLICK) {
16073
- this.clickable = true;
16074
- }
16615
+ this.duringPlay = true;
16616
+ // trigger messageBegin when item enter
16617
+ if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
16618
+ var _this_item_composition;
16075
16619
  var options = this.item.props.content.options;
16076
- this.item.composition.addInteractiveItem(this.item, options.type);
16077
- this.hasBeenAddedToComposition = true;
16620
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
16078
16621
  }
16622
+ (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
16079
16623
  if (!this.dragEvent || !this.bouncingArg) {
16080
16624
  return;
16081
16625
  }
@@ -16243,7 +16787,9 @@ function shouldIgnoreBouncing(arg, mul) {
16243
16787
  return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
16244
16788
  }
16245
16789
 
16246
- var MeshCollider = /*#__PURE__*/ function() {
16790
+ /**
16791
+ *
16792
+ */ var MeshCollider = /*#__PURE__*/ function() {
16247
16793
  function MeshCollider() {
16248
16794
  this.triangles = [];
16249
16795
  }
@@ -16251,6 +16797,38 @@ var MeshCollider = /*#__PURE__*/ function() {
16251
16797
  _proto.getBoundingBoxData = function getBoundingBoxData() {
16252
16798
  return this.boundingBoxData;
16253
16799
  };
16800
+ _proto.getBoundingBox = function getBoundingBox() {
16801
+ var maxX = -Number.MAX_VALUE;
16802
+ var maxY = -Number.MAX_VALUE;
16803
+ var minX = Number.MAX_VALUE;
16804
+ var minY = Number.MAX_VALUE;
16805
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
16806
+ var triangle = _step.value;
16807
+ maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
16808
+ maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
16809
+ minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
16810
+ minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
16811
+ }
16812
+ var area = [];
16813
+ var point0 = new Vector3(minX, maxY, 0);
16814
+ var point1 = new Vector3(maxX, maxY, 0);
16815
+ var point2 = new Vector3(maxX, minY, 0);
16816
+ var point3 = new Vector3(minX, minY, 0);
16817
+ area.push({
16818
+ p0: point0,
16819
+ p1: point1,
16820
+ p2: point2
16821
+ });
16822
+ area.push({
16823
+ p0: point0,
16824
+ p1: point2,
16825
+ p2: point3
16826
+ });
16827
+ return {
16828
+ type: HitTestType.triangle,
16829
+ area: area
16830
+ };
16831
+ };
16254
16832
  _proto.setGeometry = function setGeometry(geometry, worldMatrix) {
16255
16833
  if (this.geometry !== geometry) {
16256
16834
  this.triangles = this.geometryToTriangles(geometry);
@@ -16455,6 +17033,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
16455
17033
  if (inputCount === void 0) inputCount = 0;
16456
17034
  this.onPlayablePlayFlag = true;
16457
17035
  this.onPlayablePauseFlag = false;
17036
+ this.duration = 0;
16458
17037
  this.destroyed = false;
16459
17038
  this.inputs = [];
16460
17039
  this.inputOuputPorts = [];
@@ -16547,6 +17126,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
16547
17126
  _proto.getTime = function getTime() {
16548
17127
  return this.time;
16549
17128
  };
17129
+ _proto.setDuration = function setDuration(duration) {
17130
+ this.duration = duration;
17131
+ };
17132
+ _proto.getDuration = function getDuration() {
17133
+ return this.duration;
17134
+ };
16550
17135
  _proto.getPlayState = function getPlayState() {
16551
17136
  return this.playState;
16552
17137
  };
@@ -16698,7 +17283,9 @@ var PlayableTraversalMode;
16698
17283
  var tempQuat$1 = new Quaternion();
16699
17284
  var seed$3 = 1;
16700
17285
  // TODO 继承 Component
16701
- var Transform = /*#__PURE__*/ function() {
17286
+ /**
17287
+ *
17288
+ */ var Transform = /*#__PURE__*/ function() {
16702
17289
  function Transform(props, parent) {
16703
17290
  if (props === void 0) props = {};
16704
17291
  this.taggedProperties = {};
@@ -17163,7 +17750,11 @@ var Transform = /*#__PURE__*/ function() {
17163
17750
  return Transform;
17164
17751
  }();
17165
17752
 
17166
- var EventEmitter = function EventEmitter() {
17753
+ /**
17754
+ *
17755
+ */ /**
17756
+ * 事件监听器
17757
+ */ var EventEmitter = function EventEmitter() {
17167
17758
  var _this = this;
17168
17759
  var _this1 = this;
17169
17760
  this.listeners = {};
@@ -17257,17 +17848,15 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17257
17848
  /**
17258
17849
  * 元素动画结束时行为(如何处理元素)
17259
17850
  */ _this.endBehavior = EndBehavior.forward;
17260
- /**
17261
- * 元素是否可用
17262
- */ _this.ended = false;
17263
- _this.reusable = false;
17264
17851
  _this.type = ItemType.base;
17265
17852
  _this.isDuringPlay = false;
17266
17853
  _this.components = [];
17267
17854
  _this.rendererComponents = [];
17268
17855
  /**
17269
- * 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
17270
- * @protected
17856
+ * 元素是否激活
17857
+ */ _this.active = true;
17858
+ /**
17859
+ * 元素组件是否显示,用于批量开关元素组件
17271
17860
  */ _this.visible = true;
17272
17861
  /**
17273
17862
  * 元素动画的速度
@@ -17398,12 +17987,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17398
17987
  }
17399
17988
  };
17400
17989
  /**
17401
- * 元素动画结束播放时回调函数
17402
- * @override
17403
- */ _proto.onEnd = function onEnd() {
17404
- // OVERRIDE
17405
- };
17406
- /**
17407
17990
  * 通过指定 r、g、b、a 值设置元素的颜色
17408
17991
  * @param {number} r
17409
17992
  * @param {number} g
@@ -17416,17 +17999,27 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17416
17999
  * @param opacity - 透明度值,范围 [0,1]
17417
18000
  */ _proto.setOpacity = function setOpacity(opacity) {};
17418
18001
  /**
17419
- * 获取元素显隐属性
17420
- */ _proto.getVisible = function getVisible() {
17421
- return this.visible;
18002
+ * 激活或停用 VFXItem
18003
+ */ _proto.setActive = function setActive(value) {
18004
+ if (this.active !== value) {
18005
+ this.active = !!value;
18006
+ this.onActiveChanged();
18007
+ }
17422
18008
  };
17423
18009
  /**
17424
- * 设置元素显隐属性 会触发 `handleVisibleChanged` 回调
18010
+ * 设置元素的显隐,该设置会批量开关元素组件
17425
18011
  */ _proto.setVisible = function setVisible(visible) {
17426
- if (this.visible !== visible) {
17427
- this.visible = !!visible;
17428
- this.onActiveChanged();
18012
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
18013
+ var component = _step.value;
18014
+ component.enabled = visible;
17429
18015
  }
18016
+ this.visible = visible;
18017
+ };
18018
+ /**
18019
+ * 元素组件显隐状态
18020
+ * @deprecated use isVisible instead
18021
+ */ _proto.getVisible = function getVisible() {
18022
+ return this.visible;
17430
18023
  };
17431
18024
  /**
17432
18025
  * 获取元素变换包括位置、旋转、缩放
@@ -17508,14 +18101,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17508
18101
  this.transform.assignWorldTRS(pos);
17509
18102
  return pos;
17510
18103
  };
17511
- /**
17512
- * 是否到达元素的结束时间
17513
- * @param now
17514
- * @returns
17515
- */ _proto.isEnded = function isEnded(now) {
17516
- // at least 1 ms
17517
- return now - this.duration > 0.001;
17518
- };
17519
18104
  _proto.find = function find(name) {
17520
18105
  var _queue;
17521
18106
  if (this.name === name) {
@@ -17539,7 +18124,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17539
18124
  * @internal
17540
18125
  */ _proto.beginPlay = function beginPlay() {
17541
18126
  this.isDuringPlay = true;
17542
- if (this.composition && this.visible && !this.isEnabled) {
18127
+ if (this.composition && this.active && !this.isEnabled) {
17543
18128
  this.onEnable();
17544
18129
  }
17545
18130
  for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
@@ -17633,7 +18218,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17633
18218
  options: {}
17634
18219
  };
17635
18220
  }
17636
- if (duration <= 0) {
18221
+ if (duration < 0) {
17637
18222
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
17638
18223
  }
17639
18224
  this.rendererComponents.length = 0;
@@ -17723,25 +18308,54 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17723
18308
  // }
17724
18309
  // }
17725
18310
  };
17726
- VFXItem.isComposition = function isComposition(item) {
18311
+ /**
18312
+ *
18313
+ * @param item
18314
+ * @returns
18315
+ */ VFXItem.isComposition = function isComposition(item) {
17727
18316
  return item.type === ItemType.composition;
17728
18317
  };
17729
- VFXItem.isSprite = function isSprite(item) {
18318
+ /**
18319
+ *
18320
+ * @param item
18321
+ * @returns
18322
+ */ VFXItem.isSprite = function isSprite(item) {
17730
18323
  return item.type === ItemType.sprite;
17731
18324
  };
17732
- VFXItem.isParticle = function isParticle(item) {
18325
+ /**
18326
+ *
18327
+ * @param item
18328
+ * @returns
18329
+ */ VFXItem.isParticle = function isParticle(item) {
17733
18330
  return item.type === ItemType.particle;
17734
18331
  };
17735
- VFXItem.isNull = function isNull(item) {
18332
+ /**
18333
+ *
18334
+ * @param item
18335
+ * @returns
18336
+ */ VFXItem.isNull = function isNull(item) {
17736
18337
  return item.type === ItemType.null;
17737
18338
  };
17738
- VFXItem.isTree = function isTree(item) {
18339
+ /**
18340
+ *
18341
+ * @param item
18342
+ * @returns
18343
+ */ VFXItem.isTree = function isTree(item) {
17739
18344
  return item.type === ItemType.tree;
17740
18345
  };
17741
- VFXItem.isCamera = function isCamera(item) {
18346
+ /**
18347
+ *
18348
+ * @param item
18349
+ * @returns
18350
+ */ VFXItem.isCamera = function isCamera(item) {
17742
18351
  return item.type === ItemType.camera;
17743
18352
  };
17744
- VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
18353
+ /**
18354
+ *
18355
+ * @param ancestorCandidate
18356
+ * @param descendantCandidate
18357
+ * @returns
18358
+ */ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
17745
18359
  var current = descendantCandidate.parent;
17746
18360
  while(current){
17747
18361
  if (current === ancestorCandidate) {
@@ -17786,6 +18400,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
17786
18400
  }
17787
18401
  }
17788
18402
  }
18403
+ },
18404
+ {
18405
+ key: "isActive",
18406
+ get: /**
18407
+ * 当前 VFXItem 是否激活
18408
+ */ function get() {
18409
+ return this.active;
18410
+ }
18411
+ },
18412
+ {
18413
+ key: "isVisible",
18414
+ get: /**
18415
+ * 元素组件显隐状态
18416
+ */ function get() {
18417
+ return this.visible;
18418
+ }
17789
18419
  }
17790
18420
  ]);
17791
18421
  return VFXItem;
@@ -17949,6 +18579,16 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
17949
18579
  }
17950
18580
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
17951
18581
  var ta = this.textureSheetAnimation;
18582
+ var video = this.renderer.texture.source.video;
18583
+ if (video) {
18584
+ if (time === 0) {
18585
+ video.pause();
18586
+ } else {
18587
+ video.play().catch(function(e) {
18588
+ _this.engine.renderErrors.add(e);
18589
+ });
18590
+ }
18591
+ }
17952
18592
  if (ta) {
17953
18593
  var _this_material_getVector4;
17954
18594
  var total = ta.total || ta.row * ta.col;
@@ -18003,21 +18643,20 @@ var SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18003
18643
  dy
18004
18644
  ]);
18005
18645
  }
18006
- var video = this.renderer.texture.source.video;
18007
- if (video) {
18008
- if (time === 0 || time === this.item.duration) {
18009
- video.pause();
18010
- } else {
18011
- video.play().catch(function(e) {
18012
- _this.engine.renderErrors.add(e);
18013
- });
18014
- }
18015
- }
18016
18646
  };
18017
18647
  _proto.onDestroy = function onDestroy() {
18648
+ var textures = this.getTextures();
18018
18649
  if (this.item && this.item.composition) {
18019
- this.item.composition.destroyTextures(this.getTextures());
18650
+ this.item.composition.destroyTextures(textures);
18020
18651
  }
18652
+ textures.forEach(function(texture) {
18653
+ var source = texture.source;
18654
+ if (source.sourceType === TextureSourceType.video && (source == null ? void 0 : source.video)) {
18655
+ source.video.pause();
18656
+ source.video.src = "";
18657
+ source.video.load();
18658
+ }
18659
+ });
18021
18660
  };
18022
18661
  _proto.createGeometry = function createGeometry(mode) {
18023
18662
  var maxVertex = 12 * this.splits.length;
@@ -18456,7 +19095,7 @@ var ShapeNone = /*#__PURE__*/ function() {
18456
19095
  return ShapeNone;
18457
19096
  }();
18458
19097
  var _obj$2;
18459
- var map = (_obj$2 = {}, _obj$2[ShapeType.NONE] = ShapeNone, _obj$2[ShapeType.CONE] = Cone, _obj$2[ShapeType.SPHERE] = Sphere, _obj$2[ShapeType.HEMISPHERE] = Hemisphere, _obj$2[ShapeType.CIRCLE] = Circle, _obj$2[ShapeType.DONUT] = Donut, _obj$2[ShapeType.RECTANGLE] = Rectangle, _obj$2[ShapeType.EDGE] = Edge, _obj$2[ShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$2[ShapeType.TEXTURE] = TextureShape, _obj$2);
19098
+ 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);
18460
19099
  function createShape(shapeOptions) {
18461
19100
  if (!shapeOptions) {
18462
19101
  return new ShapeNone();
@@ -18473,7 +19112,7 @@ function createShape(shapeOptions) {
18473
19112
  throw new Error("Invalid shape: " + type + ".");
18474
19113
  }
18475
19114
  var ctrl = new Ctrl(options);
18476
- if (type !== ShapeType.NONE) {
19115
+ if (type !== ParticleEmitterShapeType.NONE) {
18477
19116
  var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
18478
19117
  0,
18479
19118
  0,
@@ -22550,6 +23189,7 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
22550
23189
  for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
22551
23190
  var timelineClip = _step.value;
22552
23191
  var clipPlayable = this.createClipPlayable(graph, timelineClip);
23192
+ clipPlayable.setDuration(timelineClip.duration);
22553
23193
  var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
22554
23194
  runtimeClips.push(clip);
22555
23195
  mixer.addInput(clipPlayable, 0);
@@ -22653,14 +23293,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
22653
23293
  this.playable.setTime(clipTime);
22654
23294
  // 判断动画是否结束
22655
23295
  if (ended) {
22656
- if (_instanceof1(boundObject, VFXItem) && !boundObject.ended) {
22657
- boundObject.ended = true;
22658
- boundObject.onEnd();
22659
- if (!boundObject.compositionReusable && !boundObject.reusable) {
22660
- boundObject.dispose();
22661
- this.playable.dispose();
22662
- }
22663
- }
22664
23296
  if (this.playable.getPlayState() === PlayState.Playing) {
22665
23297
  this.playable.pause();
22666
23298
  }
@@ -22703,26 +23335,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
22703
23335
  }
22704
23336
  if (hasInput) {
22705
23337
  boundItem.transform.setValid(true);
22706
- this.showRendererComponents(boundItem);
23338
+ boundItem.setActive(true);
22707
23339
  } else {
22708
23340
  boundItem.transform.setValid(false);
22709
- this.hideRendererComponents(boundItem);
22710
- }
22711
- };
22712
- _proto.hideRendererComponents = function hideRendererComponents(item) {
22713
- for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
22714
- var rendererComponent = _step.value;
22715
- if (rendererComponent.enabled) {
22716
- rendererComponent.enabled = false;
22717
- }
22718
- }
22719
- };
22720
- _proto.showRendererComponents = function showRendererComponents(item) {
22721
- for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
22722
- var rendererComponent = _step.value;
22723
- if (!rendererComponent.enabled) {
22724
- rendererComponent.enabled = true;
22725
- }
23341
+ boundItem.setActive(false);
22726
23342
  }
22727
23343
  };
22728
23344
  return ActivationMixerPlayable;
@@ -22750,7 +23366,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
22750
23366
  }
22751
23367
  var _proto = PropertyClipPlayable.prototype;
22752
23368
  _proto.processFrame = function processFrame(context) {
22753
- this.value = this.curve.getValue(this.time);
23369
+ this.value = this.curve.getValue(this.time / this.getDuration());
22754
23370
  };
22755
23371
  return PropertyClipPlayable;
22756
23372
  }(Playable);
@@ -23268,9 +23884,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
23268
23884
  var track = _step.value;
23269
23885
  var boundObject = track.boundObject;
23270
23886
  if (_instanceof1(boundObject, VFXItem)) {
23271
- if (_instanceof1(track, ObjectBindingTrack)) {
23272
- boundObject.reusable = value;
23273
- }
23274
23887
  var subCompositionComponent = boundObject.getComponent(CompositionComponent);
23275
23888
  if (subCompositionComponent) {
23276
23889
  subCompositionComponent.setReusable(value);
@@ -23315,16 +23928,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
23315
23928
  }
23316
23929
  }
23317
23930
  };
23318
- _proto.showItems = function showItems() {
23931
+ _proto.onEnable = function onEnable() {
23319
23932
  for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
23320
23933
  var item = _step.value;
23321
- item.setVisible(true);
23934
+ item.setActive(true);
23322
23935
  }
23323
23936
  };
23324
- _proto.hideItems = function hideItems() {
23937
+ _proto.onDisable = function onDisable() {
23325
23938
  for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
23326
23939
  var item = _step.value;
23327
- item.setVisible(false);
23940
+ item.setActive(false);
23328
23941
  }
23329
23942
  };
23330
23943
  _proto.onDestroy = function onDestroy() {
@@ -23340,7 +23953,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
23340
23953
  _proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
23341
23954
  var _this, _loop = function(i) {
23342
23955
  var item = _this.items[i];
23343
- if (item.getVisible() && item.transform.getValid() && !VFXItem.isComposition(item) && !skip(item)) {
23956
+ if (item.isActive && item.transform.getValid() && !VFXItem.isComposition(item) && !skip(item)) {
23344
23957
  var hitParams = item.getHitTestParams(force);
23345
23958
  if (hitParams) {
23346
23959
  var success = false;
@@ -23429,9 +24042,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
23429
24042
  var sceneBinding = _step.value;
23430
24043
  sceneBinding.key.boundObject = sceneBinding.value;
23431
24044
  }
23432
- // 未了通过帧对比,需要保证和原有的 update 时机一致。
24045
+ // 为了通过帧对比,需要保证和原有的 update 时机一致。
23433
24046
  // 因此这边更新一次对象绑定,后续 timeline playable 中 sort tracks 的排序才能和原先的版本对上。
23434
- // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline playable 中的 sortTracks 都能去掉。
24047
+ // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline asset 中的 sortTracks 都能去掉。
23435
24048
  for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
23436
24049
  var masterTrack = _step1.value;
23437
24050
  this.updateTrackAnimatedObject(masterTrack);
@@ -23482,9 +24095,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
23482
24095
  }
23483
24096
  }
23484
24097
  if (hasInput) {
23485
- compositionComponent.showItems();
24098
+ compositionComponent.item.setActive(true);
23486
24099
  } else {
23487
- compositionComponent.hideItems();
24100
+ compositionComponent.item.setActive(false);
23488
24101
  }
23489
24102
  };
23490
24103
  return SubCompositionMixerPlayable;
@@ -23535,6 +24148,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23535
24148
  return Vector4PropertyMixerPlayable;
23536
24149
  }(Playable);
23537
24150
 
24151
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24152
+ _inherits(ColorPropertyMixerPlayable, Playable);
24153
+ function ColorPropertyMixerPlayable() {
24154
+ var _this;
24155
+ _this = Playable.apply(this, arguments) || this;
24156
+ _this.propertyName = "";
24157
+ return _this;
24158
+ }
24159
+ var _proto = ColorPropertyMixerPlayable.prototype;
24160
+ _proto.processFrame = function processFrame(context) {
24161
+ var boundObject = context.output.getUserData();
24162
+ if (!boundObject) {
24163
+ return;
24164
+ }
24165
+ var hasInput = false;
24166
+ var value = boundObject[this.propertyName];
24167
+ if (!_instanceof1(value, Color)) {
24168
+ return;
24169
+ }
24170
+ value.setZero();
24171
+ // evaluate the curve
24172
+ for(var i = 0; i < this.getInputCount(); i++){
24173
+ var weight = this.getInputWeight(i);
24174
+ if (weight > 0) {
24175
+ var propertyClipPlayable = this.getInput(i);
24176
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24177
+ console.error("ColorPropertyMixerPlayable received incompatible input");
24178
+ continue;
24179
+ }
24180
+ var curveValue = propertyClipPlayable.value;
24181
+ value.r += curveValue.r * weight;
24182
+ value.g += curveValue.g * weight;
24183
+ value.b += curveValue.b * weight;
24184
+ value.a += curveValue.a * weight;
24185
+ hasInput = true;
24186
+ }
24187
+ }
24188
+ // set value
24189
+ if (hasInput) {
24190
+ boundObject[this.propertyName] = value;
24191
+ }
24192
+ };
24193
+ return ColorPropertyMixerPlayable;
24194
+ }(Playable);
24195
+
23538
24196
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
23539
24197
  _inherits(PropertyTrack, TrackAsset);
23540
24198
  function PropertyTrack() {
@@ -23694,7 +24352,7 @@ var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
23694
24352
  }
23695
24353
  var _proto = ColorPropertyTrack.prototype;
23696
24354
  _proto.createTrackMixer = function createTrackMixer(graph) {
23697
- var mixer = new FloatPropertyMixerPlayable(graph);
24355
+ var mixer = new ColorPropertyMixerPlayable(graph);
23698
24356
  var propertyNames = this.propertyNames;
23699
24357
  if (propertyNames.length > 0) {
23700
24358
  var propertyName = propertyNames[propertyNames.length - 1];
@@ -23708,6 +24366,27 @@ ColorPropertyTrack = __decorate([
23708
24366
  effectsClass(DataType.ColorPropertyTrack)
23709
24367
  ], ColorPropertyTrack);
23710
24368
 
24369
+ var ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24370
+ _inherits(ColorPropertyPlayableAsset, PlayableAsset);
24371
+ function ColorPropertyPlayableAsset() {
24372
+ return PlayableAsset.apply(this, arguments);
24373
+ }
24374
+ var _proto = ColorPropertyPlayableAsset.prototype;
24375
+ _proto.createPlayable = function createPlayable(graph) {
24376
+ var clipPlayable = new PropertyClipPlayable(graph);
24377
+ clipPlayable.curve = createValueGetter(this.curveData);
24378
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24379
+ return clipPlayable;
24380
+ };
24381
+ return ColorPropertyPlayableAsset;
24382
+ }(PlayableAsset);
24383
+ __decorate([
24384
+ serialize()
24385
+ ], ColorPropertyPlayableAsset.prototype, "curveData", void 0);
24386
+ ColorPropertyPlayableAsset = __decorate([
24387
+ effectsClass(DataType.ColorPropertyPlayableAsset)
24388
+ ], ColorPropertyPlayableAsset);
24389
+
23711
24390
  var FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
23712
24391
  _inherits(FloatPropertyPlayableAsset, PlayableAsset);
23713
24392
  function FloatPropertyPlayableAsset() {
@@ -23767,6 +24446,7 @@ var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
23767
24446
  var _this;
23768
24447
  _this = PlayableAsset.apply(this, arguments) || this;
23769
24448
  _this.tracks = [];
24449
+ _this.cacheFlattenedTracks = null;
23770
24450
  return _this;
23771
24451
  }
23772
24452
  var _proto = TimelineAsset.prototype;
@@ -23779,16 +24459,62 @@ var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
23779
24459
  track.create(this);
23780
24460
  }
23781
24461
  }
23782
- timelinePlayable.compileTracks(graph, this.tracks);
24462
+ this.sortTracks(this.tracks);
24463
+ timelinePlayable.compileTracks(graph, this.flattenedTracks);
23783
24464
  return timelinePlayable;
23784
24465
  };
23785
24466
  _proto.createTrack = function createTrack(classConstructor, parent, name) {
23786
24467
  var newTrack = new classConstructor(this.engine);
23787
24468
  newTrack.name = name ? name : classConstructor.name;
23788
24469
  parent.addChild(newTrack);
24470
+ this.invalidate();
23789
24471
  return newTrack;
23790
24472
  };
24473
+ /**
24474
+ * Invalidates the asset, called when tracks data changed
24475
+ */ _proto.invalidate = function invalidate() {
24476
+ this.cacheFlattenedTracks = null;
24477
+ };
24478
+ _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
24479
+ for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
24480
+ var subTrack = _step.value;
24481
+ allTracks.push(subTrack);
24482
+ }
24483
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
24484
+ var subTrack1 = _step1.value;
24485
+ this.addSubTracksRecursive(subTrack1, allTracks);
24486
+ }
24487
+ };
24488
+ _proto.sortTracks = function sortTracks(tracks) {
24489
+ var sortedTracks = [];
24490
+ for(var i = 0; i < tracks.length; i++){
24491
+ sortedTracks.push(new TrackSortWrapper(tracks[i], i));
24492
+ }
24493
+ sortedTracks.sort(compareTracks);
24494
+ tracks.length = 0;
24495
+ for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
24496
+ var trackWrapper = _step.value;
24497
+ tracks.push(trackWrapper.track);
24498
+ }
24499
+ };
23791
24500
  _proto.fromData = function fromData(data) {};
24501
+ _create_class(TimelineAsset, [
24502
+ {
24503
+ key: "flattenedTracks",
24504
+ get: function get() {
24505
+ if (!this.cacheFlattenedTracks) {
24506
+ this.cacheFlattenedTracks = [];
24507
+ // flatten track tree
24508
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24509
+ var masterTrack = _step.value;
24510
+ this.cacheFlattenedTracks.push(masterTrack);
24511
+ this.addSubTracksRecursive(masterTrack, this.cacheFlattenedTracks);
24512
+ }
24513
+ }
24514
+ return this.cacheFlattenedTracks;
24515
+ }
24516
+ }
24517
+ ]);
23792
24518
  return TimelineAsset;
23793
24519
  }(PlayableAsset);
23794
24520
  __decorate([
@@ -23821,18 +24547,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
23821
24547
  }
23822
24548
  };
23823
24549
  _proto.compileTracks = function compileTracks(graph, tracks) {
23824
- this.sortTracks(tracks);
23825
- var outputTrack = [];
23826
- // flatten track tree
23827
- for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
23828
- var masterTrack = _step.value;
23829
- outputTrack.push(masterTrack);
23830
- this.addSubTracksRecursive(masterTrack, outputTrack);
23831
- }
24550
+ var outputTrack = tracks;
23832
24551
  // map for searching track instance with track asset guid
23833
24552
  var trackInstanceMap = {};
23834
- for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
23835
- var track = _step1.value;
24553
+ for(var _iterator = _create_for_of_iterator_helper_loose(outputTrack), _step; !(_step = _iterator()).done;){
24554
+ var track = _step.value;
23836
24555
  // create track mixer and track output
23837
24556
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
23838
24557
  this.addInput(trackMixPlayable, 0);
@@ -23848,11 +24567,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
23848
24567
  }
23849
24568
  }
23850
24569
  // build trackInstance tree
23851
- for(var _iterator2 = _create_for_of_iterator_helper_loose(outputTrack), _step2; !(_step2 = _iterator2()).done;){
23852
- var track1 = _step2.value;
24570
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
24571
+ var track1 = _step1.value;
23853
24572
  var trackInstance1 = trackInstanceMap[track1.getInstanceId()];
23854
- for(var _iterator3 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step3; !(_step3 = _iterator3()).done;){
23855
- var child = _step3.value;
24573
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step2; !(_step2 = _iterator2()).done;){
24574
+ var child = _step2.value;
23856
24575
  var childTrackInstance = trackInstanceMap[child.getInstanceId()];
23857
24576
  trackInstance1.addChild(childTrackInstance);
23858
24577
  }
@@ -23869,28 +24588,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
23869
24588
  this.updateTrackAnimatedObject(trackInstance.children);
23870
24589
  }
23871
24590
  };
23872
- _proto.sortTracks = function sortTracks(tracks) {
23873
- var sortedTracks = [];
23874
- for(var i = 0; i < tracks.length; i++){
23875
- sortedTracks.push(new TrackSortWrapper(tracks[i], i));
23876
- }
23877
- sortedTracks.sort(compareTracks);
23878
- tracks.length = 0;
23879
- for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
23880
- var trackWrapper = _step.value;
23881
- tracks.push(trackWrapper.track);
23882
- }
23883
- };
23884
- _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
23885
- for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
23886
- var subTrack = _step.value;
23887
- allTracks.push(subTrack);
23888
- }
23889
- for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
23890
- var subTrack1 = _step1.value;
23891
- this.addSubTracksRecursive(subTrack1, allTracks);
23892
- }
23893
- };
23894
24591
  return TimelinePlayable;
23895
24592
  }(Playable);
23896
24593
  var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
@@ -23912,6 +24609,27 @@ function compareTracks(a, b) {
23912
24609
  }
23913
24610
  }
23914
24611
 
24612
+ var Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24613
+ _inherits(Vector4PropertyPlayableAsset, PlayableAsset);
24614
+ function Vector4PropertyPlayableAsset() {
24615
+ return PlayableAsset.apply(this, arguments);
24616
+ }
24617
+ var _proto = Vector4PropertyPlayableAsset.prototype;
24618
+ _proto.createPlayable = function createPlayable(graph) {
24619
+ var clipPlayable = new PropertyClipPlayable(graph);
24620
+ clipPlayable.curve = createValueGetter(this.curveData);
24621
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24622
+ return clipPlayable;
24623
+ };
24624
+ return Vector4PropertyPlayableAsset;
24625
+ }(PlayableAsset);
24626
+ __decorate([
24627
+ serialize()
24628
+ ], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
24629
+ Vector4PropertyPlayableAsset = __decorate([
24630
+ effectsClass("Vector4PropertyPlayableAsset")
24631
+ ], Vector4PropertyPlayableAsset);
24632
+
23915
24633
  var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
23916
24634
  _inherits(ObjectBindingTrack, TrackAsset1);
23917
24635
  function ObjectBindingTrack() {
@@ -23949,7 +24667,7 @@ var TextLayout = /*#__PURE__*/ function() {
23949
24667
  function TextLayout(options) {
23950
24668
  this.width = 0;
23951
24669
  this.height = 0;
23952
- 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, text = 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;
24670
+ 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;
23953
24671
  var tempWidth = fontSize + letterSpace;
23954
24672
  this.autoWidth = autoWidth;
23955
24673
  this.maxTextWidth = text.length * tempWidth;
@@ -24149,6 +24867,8 @@ var TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
24149
24867
  /**
24150
24868
  * 文本行数
24151
24869
  */ _this.lineCount = 0;
24870
+ _this.SCALE_FACTOR = 0.1;
24871
+ _this.ALPHA_FIX_VALUE = 1 / 255;
24152
24872
  _this.name = "MText" + seed$1++;
24153
24873
  _this.geometry = _this.createGeometry(glContext.TRIANGLES);
24154
24874
  if (props) {
@@ -24514,7 +25234,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
24514
25234
  }
24515
25235
  //与 toDataURL() 两种方式都需要像素读取操作
24516
25236
  var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
24517
- this.material.setTexture("uSampler0", Texture.createWithData(this.engine, {
25237
+ this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
24518
25238
  data: new Uint8Array(imageData.data),
24519
25239
  width: imageData.width,
24520
25240
  height: imageData.height
@@ -25842,13 +26562,13 @@ function getStandardParticleContent(particle) {
25842
26562
  var options = particle.options;
25843
26563
  var transform = particle.transform;
25844
26564
  var shape = {
25845
- type: ShapeType.NONE
26565
+ type: ParticleEmitterShapeType.NONE
25846
26566
  };
25847
26567
  if (particle.shape) {
25848
26568
  var _particle_shape_shape;
25849
26569
  var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
25850
26570
  shape = _extends({}, particle.shape, {
25851
- type: ShapeType[shapeType]
26571
+ type: ParticleEmitterShapeType[shapeType]
25852
26572
  });
25853
26573
  if (particle.shape.upDirection) {
25854
26574
  var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
@@ -27712,7 +28432,8 @@ var listOrder = 0;
27712
28432
  var itemProps = sourceItemData;
27713
28433
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
27714
28434
  itemProps.listIndex = listOrder++;
27715
- if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
28435
+ if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28436
+ itemProps.type === ItemType.shape) {
27716
28437
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
27717
28438
  var componentPath = _step2.value;
27718
28439
  var componentData = componentMap[componentPath.id];
@@ -27752,8 +28473,10 @@ var listOrder = 0;
27752
28473
  shapeData = shape;
27753
28474
  }
27754
28475
  if (shapeData !== undefined) {
27755
- // @ts-expect-error 类型转换问题
27756
- renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28476
+ if (!("aPoint" in shapeData && "index" in shapeData)) {
28477
+ // @ts-expect-error 类型转换问题
28478
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28479
+ }
27757
28480
  }
27758
28481
  }
27759
28482
  if ("trails" in renderContent && renderContent.trails !== undefined) {
@@ -27808,13 +28531,18 @@ var listOrder = 0;
27808
28531
  return CompositionSourceManager;
27809
28532
  }();
27810
28533
 
27811
- var SceneTicking = /*#__PURE__*/ function() {
28534
+ /**
28535
+ *
28536
+ */ var SceneTicking = /*#__PURE__*/ function() {
27812
28537
  function SceneTicking() {
27813
28538
  this.update = new UpdateTickData();
27814
28539
  this.lateUpdate = new LateUpdateTickData();
27815
28540
  }
27816
28541
  var _proto = SceneTicking.prototype;
27817
- _proto.addComponent = function addComponent(obj) {
28542
+ /**
28543
+ *
28544
+ * @param obj
28545
+ */ _proto.addComponent = function addComponent(obj) {
27818
28546
  if (obj.onUpdate !== Component.prototype.onUpdate) {
27819
28547
  this.update.addComponent(obj);
27820
28548
  }
@@ -27822,7 +28550,10 @@ var SceneTicking = /*#__PURE__*/ function() {
27822
28550
  this.lateUpdate.addComponent(obj);
27823
28551
  }
27824
28552
  };
27825
- _proto.removeComponent = function removeComponent(obj) {
28553
+ /**
28554
+ *
28555
+ * @param obj
28556
+ */ _proto.removeComponent = function removeComponent(obj) {
27826
28557
  if (obj.onUpdate !== Component.prototype.onUpdate) {
27827
28558
  this.update.removeComponent(obj);
27828
28559
  }
@@ -27830,7 +28561,9 @@ var SceneTicking = /*#__PURE__*/ function() {
27830
28561
  this.lateUpdate.removeComponent(obj);
27831
28562
  }
27832
28563
  };
27833
- _proto.clear = function clear() {
28564
+ /**
28565
+ *
28566
+ */ _proto.clear = function clear() {
27834
28567
  this.update.clear();
27835
28568
  this.lateUpdate.clear();
27836
28569
  };
@@ -27921,11 +28654,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
27921
28654
  var _this;
27922
28655
  var _scene_jsonScene_renderSettings;
27923
28656
  _this = EventEmitter.call(this) || this;
27924
- _this.sceneTicking = new SceneTicking();
28657
+ /**
28658
+ *
28659
+ */ _this.sceneTicking = new SceneTicking();
27925
28660
  /**
27926
28661
  * 动画播放速度
27927
28662
  */ _this.speed = 1;
27928
28663
  /**
28664
+ * 合成是否结束
28665
+ */ _this.isEnded = false;
28666
+ /**
27929
28667
  * 用于保存与当前合成相关的插件数据
27930
28668
  */ _this.loaderData = {};
27931
28669
  /**
@@ -27947,6 +28685,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
27947
28685
  * 合成暂停/播放 标识
27948
28686
  */ _this.paused = false;
27949
28687
  _this.lastVideoUpdateTime = 0;
28688
+ _this.isEndCalled = false;
27950
28689
  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;
27951
28690
  _this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
27952
28691
  if (reusable) {
@@ -28036,7 +28775,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28036
28775
  * @param visible - 是否可见
28037
28776
  */ _proto.setVisible = function setVisible(visible) {
28038
28777
  this.items.forEach(function(item) {
28039
- item.setVisible(visible);
28778
+ item.setActive(visible);
28040
28779
  });
28041
28780
  };
28042
28781
  /**
@@ -28046,7 +28785,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28046
28785
  return this.speed;
28047
28786
  };
28048
28787
  _proto.play = function play() {
28049
- if (this.rootItem.ended && this.reusable) {
28788
+ if (this.isEnded && this.reusable) {
28050
28789
  this.restart();
28051
28790
  }
28052
28791
  if (this.rootComposition.isStartCalled) {
@@ -28104,16 +28843,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28104
28843
  if (pause) {
28105
28844
  this.resume();
28106
28845
  }
28107
- if (!this.rootComposition.isStartCalled) {
28108
- this.rootComposition.onStart();
28109
- this.rootComposition.isStartCalled = true;
28110
- }
28111
28846
  this.setSpeed(1);
28112
28847
  this.forwardTime(time + this.startTime);
28113
28848
  this.setSpeed(speed);
28114
28849
  if (pause) {
28115
28850
  this.pause();
28116
28851
  }
28852
+ this.emit("goto", {
28853
+ time: time
28854
+ });
28117
28855
  };
28118
28856
  _proto.addItem = function addItem(item) {
28119
28857
  this.items.push(item);
@@ -28137,37 +28875,24 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28137
28875
  * 重置状态函数
28138
28876
  */ _proto.reset = function reset() {
28139
28877
  this.rendererOptions = null;
28140
- this.rootItem.ended = false;
28878
+ this.isEnded = false;
28879
+ this.isEndCalled = false;
28141
28880
  this.rootComposition.time = 0;
28142
28881
  this.pluginSystem.resetComposition(this, this.renderFrame);
28143
28882
  };
28144
28883
  _proto.prepareRender = function prepareRender() {
28145
28884
  var _this = this;
28146
28885
  var frame = this.renderFrame;
28147
- frame._renderPasses[0].meshes.length = 0;
28148
28886
  this.postLoaders.length = 0;
28149
28887
  this.pluginSystem.plugins.forEach(function(loader) {
28150
28888
  if (loader.prepareRenderFrame(_this, frame)) {
28151
28889
  _this.postLoaders.push(loader);
28152
28890
  }
28153
28891
  });
28154
- this.gatherRendererComponent(this.rootItem, frame);
28155
28892
  this.postLoaders.forEach(function(loader) {
28156
28893
  return loader.postProcessFrame(_this, frame);
28157
28894
  });
28158
28895
  };
28159
- _proto.gatherRendererComponent = function gatherRendererComponent(vfxItem, renderFrame) {
28160
- for(var _iterator = _create_for_of_iterator_helper_loose(vfxItem.rendererComponents), _step; !(_step = _iterator()).done;){
28161
- var rendererComponent = _step.value;
28162
- if (rendererComponent.isActiveAndEnabled) {
28163
- renderFrame.addMeshToDefaultRenderPass(rendererComponent);
28164
- }
28165
- }
28166
- for(var _iterator1 = _create_for_of_iterator_helper_loose(vfxItem.children), _step1; !(_step1 = _iterator1()).done;){
28167
- var item = _step1.value;
28168
- this.gatherRendererComponent(item, renderFrame);
28169
- }
28170
- };
28171
28896
  /**
28172
28897
  * 合成更新,针对所有 item 的更新
28173
28898
  * @param deltaTime - 更新的时间步长
@@ -28189,12 +28914,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28189
28914
  this.sceneTicking.lateUpdate.tick(dt);
28190
28915
  this.updateCamera();
28191
28916
  this.prepareRender();
28917
+ if (this.isEnded && !this.isEndCalled) {
28918
+ this.isEndCalled = true;
28919
+ this.emit("end", {
28920
+ composition: this
28921
+ });
28922
+ }
28192
28923
  if (this.shouldDispose()) {
28193
28924
  this.dispose();
28194
28925
  }
28195
28926
  };
28196
28927
  _proto.shouldDispose = function shouldDispose() {
28197
- return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
28928
+ return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
28198
28929
  };
28199
28930
  _proto.getUpdateTime = function getUpdateTime(t) {
28200
28931
  var startTimeInMs = this.startTime * 1000;
@@ -28285,11 +29016,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28285
29016
  */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
28286
29017
  if (this.rootComposition.isActiveAndEnabled) {
28287
29018
  var localTime = this.time + deltaTime - this.rootItem.start;
28288
- var ended = false;
29019
+ var isEnded = false;
28289
29020
  var duration = this.rootItem.duration;
28290
29021
  var endBehavior = this.rootItem.endBehavior;
28291
29022
  if (localTime - duration > 0.001) {
28292
- ended = true;
29023
+ isEnded = true;
28293
29024
  switch(endBehavior){
28294
29025
  case EndBehavior.restart:
28295
29026
  {
@@ -28313,11 +29044,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28313
29044
  }
28314
29045
  }
28315
29046
  this.rootComposition.time = localTime;
28316
- if (ended && !this.rootItem.ended) {
28317
- this.rootItem.ended = true;
28318
- this.emit("end", {
28319
- composition: this
28320
- });
29047
+ // end state changed, handle onEnd flags
29048
+ if (this.isEnded !== isEnded) {
29049
+ if (isEnded) {
29050
+ this.isEnded = true;
29051
+ } else {
29052
+ this.isEnded = false;
29053
+ this.isEndCalled = false;
29054
+ }
28321
29055
  }
28322
29056
  }
28323
29057
  };
@@ -30643,8 +31377,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
30643
31377
  registerPlugin("particle", ParticleLoader, VFXItem, true);
30644
31378
  registerPlugin("cal", CalculateLoader, VFXItem, true);
30645
31379
  registerPlugin("interact", InteractLoader, VFXItem, true);
30646
- var version = "2.1.0-alpha.9";
31380
+ var version = "2.1.0";
30647
31381
  logger.info("Core version: " + version + ".");
30648
31382
 
30649
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyTrack, Component, ComponentShapeType, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
31383
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
30650
31384
  //# sourceMappingURL=index.mjs.map