@galacean/effects-core 2.1.0-alpha.9 → 2.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comp-vfx-item.d.ts +2 -2
- package/dist/components/base-render-component.d.ts +9 -0
- package/dist/components/fake-3d-component.d.ts +28 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/mesh-component.d.ts +3 -0
- package/dist/components/post-process-volume.d.ts +10 -10
- package/dist/components/shape-component.d.ts +119 -38
- package/dist/composition/scene-ticking.d.ts +14 -0
- package/dist/composition.d.ts +19 -9
- package/dist/effects-object.d.ts +23 -0
- package/dist/engine.d.ts +9 -0
- package/dist/events/event-emitter.d.ts +6 -0
- package/dist/events/types.d.ts +1 -1
- package/dist/index.js +1187 -340
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1188 -341
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +14 -1
- package/dist/plugins/cal/playable-graph.d.ts +3 -0
- package/dist/plugins/interact/interact-item.d.ts +4 -1
- package/dist/plugins/interact/mesh-collider.d.ts +4 -0
- package/dist/plugins/shape/graphics-path.d.ts +3 -1
- package/dist/plugins/shape/poly-star.d.ts +42 -0
- package/dist/plugins/shape/shape-path.d.ts +12 -0
- package/dist/plugins/shape/shape-primitive.d.ts +0 -3
- package/dist/plugins/sprite/sprite-item.d.ts +0 -7
- package/dist/plugins/text/text-item.d.ts +2 -0
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -2
- package/dist/shape/geometry.d.ts +2 -2
- package/dist/transform.d.ts +8 -0
- package/dist/vfx-item.d.ts +63 -22
- package/package.json +2 -2
package/dist/index.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-
|
|
6
|
+
* Version: v2.1.0-beta.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -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,30 @@ 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
|
+
* @since 1.1.0
|
|
1624
|
+
*/ var BackgroundType;
|
|
1625
|
+
(function(BackgroundType) {
|
|
1626
|
+
BackgroundType["video"] = "video";
|
|
1627
|
+
BackgroundType["image"] = "image";
|
|
1628
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1629
|
+
/**
|
|
1630
|
+
* 多媒体资源类型
|
|
1631
|
+
* @since 2.1.0
|
|
1632
|
+
*/ var MultimediaType;
|
|
1633
|
+
(function(MultimediaType) {
|
|
1634
|
+
MultimediaType["video"] = "video";
|
|
1635
|
+
MultimediaType["audio"] = "audio";
|
|
1636
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1637
|
+
|
|
1605
1638
|
var DataType;
|
|
1606
1639
|
(function(DataType) {
|
|
1607
1640
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1612,6 +1645,7 @@ var DataType;
|
|
|
1612
1645
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1613
1646
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1614
1647
|
DataType["CameraController"] = "CameraController";
|
|
1648
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1615
1649
|
DataType["Geometry"] = "Geometry";
|
|
1616
1650
|
DataType["Texture"] = "Texture";
|
|
1617
1651
|
DataType["AnimationClip"] = "AnimationClip";
|
|
@@ -1634,7 +1668,6 @@ var DataType;
|
|
|
1634
1668
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1635
1669
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1636
1670
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1637
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1638
1671
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1639
1672
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1640
1673
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1645,9 +1678,11 @@ var DataType;
|
|
|
1645
1678
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1646
1679
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1647
1680
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1681
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1648
1682
|
// Non-EffectObject
|
|
1649
1683
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1650
1684
|
})(DataType || (DataType = {}));
|
|
1685
|
+
|
|
1651
1686
|
var GeometryType;
|
|
1652
1687
|
(function(GeometryType) {
|
|
1653
1688
|
/**
|
|
@@ -1732,30 +1767,6 @@ var VertexBufferSemantic;
|
|
|
1732
1767
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1733
1768
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1734
1769
|
|
|
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
1770
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1760
1771
|
__proto__: null,
|
|
1761
1772
|
get RenderLevel () { return RenderLevel; },
|
|
@@ -1800,14 +1811,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1800
1811
|
get TextAlignment () { return TextAlignment; },
|
|
1801
1812
|
get TextWeight () { return TextWeight; },
|
|
1802
1813
|
get FontStyle () { return FontStyle; },
|
|
1814
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1815
|
+
get BackgroundType () { return BackgroundType; },
|
|
1816
|
+
get MultimediaType () { return MultimediaType; },
|
|
1803
1817
|
get DataType () { return DataType; },
|
|
1804
1818
|
get GeometryType () { return GeometryType; },
|
|
1805
1819
|
get VertexFormatType () { return VertexFormatType; },
|
|
1806
1820
|
get IndexFormatType () { return IndexFormatType; },
|
|
1807
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1808
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1809
|
-
get BackgroundType () { return BackgroundType; },
|
|
1810
|
-
get MultimediaType () { return MultimediaType; }
|
|
1821
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1811
1822
|
});
|
|
1812
1823
|
|
|
1813
1824
|
function _defineProperties(target, props) {
|
|
@@ -1895,15 +1906,23 @@ function getDirectStore(target) {
|
|
|
1895
1906
|
this.engine.addInstance(this);
|
|
1896
1907
|
}
|
|
1897
1908
|
var _proto = EffectsObject.prototype;
|
|
1898
|
-
|
|
1909
|
+
/**
|
|
1910
|
+
*
|
|
1911
|
+
* @returns
|
|
1912
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1899
1913
|
return this.guid;
|
|
1900
1914
|
};
|
|
1901
|
-
|
|
1915
|
+
/**
|
|
1916
|
+
*
|
|
1917
|
+
* @param guid
|
|
1918
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1902
1919
|
this.engine.removeInstance(this.guid);
|
|
1903
1920
|
this.guid = guid;
|
|
1904
1921
|
this.engine.addInstance(this);
|
|
1905
1922
|
};
|
|
1906
|
-
|
|
1923
|
+
/**
|
|
1924
|
+
*
|
|
1925
|
+
*/ _proto.toData = function toData() {};
|
|
1907
1926
|
/**
|
|
1908
1927
|
* 反序列化函数
|
|
1909
1928
|
*
|
|
@@ -1913,8 +1932,14 @@ function getDirectStore(target) {
|
|
|
1913
1932
|
this.setInstanceId(data.id);
|
|
1914
1933
|
}
|
|
1915
1934
|
};
|
|
1916
|
-
|
|
1917
|
-
|
|
1935
|
+
/**
|
|
1936
|
+
*
|
|
1937
|
+
*/ _proto.dispose = function dispose() {};
|
|
1938
|
+
/**
|
|
1939
|
+
*
|
|
1940
|
+
* @param obj
|
|
1941
|
+
* @returns
|
|
1942
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1918
1943
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1919
1944
|
};
|
|
1920
1945
|
return EffectsObject;
|
|
@@ -1994,7 +2019,7 @@ function getDirectStore(target) {
|
|
|
1994
2019
|
this.onAwake();
|
|
1995
2020
|
this.isAwakeCalled = true;
|
|
1996
2021
|
}
|
|
1997
|
-
if (item.
|
|
2022
|
+
if (item.isActive && this.enabled) {
|
|
1998
2023
|
this.start();
|
|
1999
2024
|
this.enable();
|
|
2000
2025
|
}
|
|
@@ -2039,7 +2064,7 @@ function getDirectStore(target) {
|
|
|
2039
2064
|
get: /**
|
|
2040
2065
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2041
2066
|
*/ function get() {
|
|
2042
|
-
return this.item.
|
|
2067
|
+
return this.item.isActive && this.enabled;
|
|
2043
2068
|
}
|
|
2044
2069
|
},
|
|
2045
2070
|
{
|
|
@@ -3668,7 +3693,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3668
3693
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3669
3694
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3670
3695
|
|
|
3671
|
-
|
|
3696
|
+
/**
|
|
3697
|
+
* Mesh 组件
|
|
3698
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3672
3699
|
_inherits(MeshComponent, RendererComponent);
|
|
3673
3700
|
function MeshComponent() {
|
|
3674
3701
|
var _this;
|
|
@@ -3678,7 +3705,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3678
3705
|
*/ _this.meshCollider = new MeshCollider();
|
|
3679
3706
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3680
3707
|
_this.getHitTestParams = function(force) {
|
|
3681
|
-
var
|
|
3708
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3709
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3710
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3682
3711
|
if (area) {
|
|
3683
3712
|
return {
|
|
3684
3713
|
type: area.type,
|
|
@@ -3698,8 +3727,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3698
3727
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3699
3728
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3700
3729
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3701
|
-
var
|
|
3702
|
-
return
|
|
3730
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3731
|
+
return boundingBox;
|
|
3703
3732
|
};
|
|
3704
3733
|
return MeshComponent;
|
|
3705
3734
|
}(RendererComponent);
|
|
@@ -3737,24 +3766,29 @@ EffectComponent = __decorate([
|
|
|
3737
3766
|
|
|
3738
3767
|
var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3739
3768
|
_inherits(PostProcessVolume, Behaviour);
|
|
3740
|
-
function PostProcessVolume() {
|
|
3769
|
+
function PostProcessVolume(engine) {
|
|
3741
3770
|
var _this;
|
|
3742
|
-
_this = Behaviour.
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
_this.
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
_this.
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3771
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3772
|
+
_this.bloom = {
|
|
3773
|
+
threshold: 0,
|
|
3774
|
+
intensity: 0,
|
|
3775
|
+
active: false
|
|
3776
|
+
};
|
|
3777
|
+
_this.vignette = {
|
|
3778
|
+
intensity: 0,
|
|
3779
|
+
smoothness: 0,
|
|
3780
|
+
roundness: 0,
|
|
3781
|
+
active: false
|
|
3782
|
+
};
|
|
3783
|
+
_this.tonemapping = {
|
|
3784
|
+
active: false
|
|
3785
|
+
};
|
|
3786
|
+
_this.colorAdjustments = {
|
|
3787
|
+
brightness: 0,
|
|
3788
|
+
saturation: 0,
|
|
3789
|
+
contrast: 0,
|
|
3790
|
+
active: false
|
|
3791
|
+
};
|
|
3758
3792
|
return _this;
|
|
3759
3793
|
}
|
|
3760
3794
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3768,36 +3802,18 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3768
3802
|
}(Behaviour);
|
|
3769
3803
|
__decorate([
|
|
3770
3804
|
serialize()
|
|
3771
|
-
], PostProcessVolume.prototype, "
|
|
3772
|
-
__decorate([
|
|
3773
|
-
serialize()
|
|
3774
|
-
], PostProcessVolume.prototype, "threshold", void 0);
|
|
3805
|
+
], PostProcessVolume.prototype, "bloom", void 0);
|
|
3775
3806
|
__decorate([
|
|
3776
3807
|
serialize()
|
|
3777
|
-
], PostProcessVolume.prototype, "
|
|
3808
|
+
], PostProcessVolume.prototype, "vignette", void 0);
|
|
3778
3809
|
__decorate([
|
|
3779
3810
|
serialize()
|
|
3780
|
-
], PostProcessVolume.prototype, "
|
|
3811
|
+
], PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3781
3812
|
__decorate([
|
|
3782
3813
|
serialize()
|
|
3783
|
-
], PostProcessVolume.prototype, "
|
|
3784
|
-
__decorate([
|
|
3785
|
-
serialize()
|
|
3786
|
-
], PostProcessVolume.prototype, "contrast", void 0);
|
|
3787
|
-
__decorate([
|
|
3788
|
-
serialize()
|
|
3789
|
-
], PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
3790
|
-
__decorate([
|
|
3791
|
-
serialize()
|
|
3792
|
-
], PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
3793
|
-
__decorate([
|
|
3794
|
-
serialize()
|
|
3795
|
-
], PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
3796
|
-
__decorate([
|
|
3797
|
-
serialize()
|
|
3798
|
-
], PostProcessVolume.prototype, "toneMappingEnabled", void 0);
|
|
3814
|
+
], PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3799
3815
|
PostProcessVolume = __decorate([
|
|
3800
|
-
effectsClass(
|
|
3816
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3801
3817
|
], PostProcessVolume);
|
|
3802
3818
|
|
|
3803
3819
|
function _assert_this_initialized(self) {
|
|
@@ -6884,6 +6900,7 @@ var MaterialRenderType;
|
|
|
6884
6900
|
_this.enabledMacros = {};
|
|
6885
6901
|
_this.destroyed = false;
|
|
6886
6902
|
_this.initialized = false;
|
|
6903
|
+
_this.shaderDirty = true;
|
|
6887
6904
|
if (props) {
|
|
6888
6905
|
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
6906
|
_this.name = name;
|
|
@@ -6911,6 +6928,41 @@ var MaterialRenderType;
|
|
|
6911
6928
|
// OVERRIDE
|
|
6912
6929
|
};
|
|
6913
6930
|
_create_class(Material, [
|
|
6931
|
+
{
|
|
6932
|
+
key: "shader",
|
|
6933
|
+
get: function get() {
|
|
6934
|
+
return this._shader;
|
|
6935
|
+
},
|
|
6936
|
+
set: function set(value) {
|
|
6937
|
+
if (this._shader === value) {
|
|
6938
|
+
return;
|
|
6939
|
+
}
|
|
6940
|
+
this._shader = value;
|
|
6941
|
+
this.shaderDirty = true;
|
|
6942
|
+
}
|
|
6943
|
+
},
|
|
6944
|
+
{
|
|
6945
|
+
key: "mainTexture",
|
|
6946
|
+
get: /**
|
|
6947
|
+
* 材质的主纹理
|
|
6948
|
+
*/ function get() {
|
|
6949
|
+
return this.getTexture("_MainTex");
|
|
6950
|
+
},
|
|
6951
|
+
set: function set(value) {
|
|
6952
|
+
this.setTexture("_MainTex", value);
|
|
6953
|
+
}
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
key: "color",
|
|
6957
|
+
get: /**
|
|
6958
|
+
* 材质的主颜色
|
|
6959
|
+
*/ function get() {
|
|
6960
|
+
return this.getColor("_Color");
|
|
6961
|
+
},
|
|
6962
|
+
set: function set(value) {
|
|
6963
|
+
this.setColor("_Color", value);
|
|
6964
|
+
}
|
|
6965
|
+
},
|
|
6914
6966
|
{
|
|
6915
6967
|
key: "blending",
|
|
6916
6968
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10047,7 +10099,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10047
10099
|
|
|
10048
10100
|
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
10101
|
|
|
10050
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10102
|
+
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
10103
|
|
|
10052
10104
|
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
10105
|
|
|
@@ -10278,15 +10330,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10278
10330
|
renderer.setFramebuffer(this.framebuffer);
|
|
10279
10331
|
};
|
|
10280
10332
|
_proto.execute = function execute(renderer) {
|
|
10281
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10333
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10282
10334
|
renderer.clear({
|
|
10283
10335
|
colorAction: TextureStoreAction.clear,
|
|
10284
10336
|
depthAction: TextureStoreAction.clear,
|
|
10285
10337
|
stencilAction: TextureStoreAction.clear
|
|
10286
10338
|
});
|
|
10287
10339
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10288
|
-
var
|
|
10289
|
-
var threshold = (
|
|
10340
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10341
|
+
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
10342
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10291
10343
|
renderer.renderMeshes([
|
|
10292
10344
|
this.screenMesh
|
|
@@ -10499,25 +10551,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10499
10551
|
depthAction: TextureStoreAction.clear,
|
|
10500
10552
|
stencilAction: TextureStoreAction.clear
|
|
10501
10553
|
});
|
|
10502
|
-
var
|
|
10503
|
-
var
|
|
10554
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10555
|
+
var bloom = _extends({
|
|
10556
|
+
threshold: 0,
|
|
10557
|
+
intensity: 0,
|
|
10558
|
+
active: false
|
|
10559
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10560
|
+
var vignette = _extends({
|
|
10561
|
+
intensity: 0,
|
|
10562
|
+
smoothness: 0,
|
|
10563
|
+
roundness: 0,
|
|
10564
|
+
active: false
|
|
10565
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10566
|
+
var colorAdjustments = _extends({
|
|
10567
|
+
brightness: 0,
|
|
10568
|
+
saturation: 0,
|
|
10569
|
+
contrast: 0,
|
|
10570
|
+
active: false
|
|
10571
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10572
|
+
var tonemapping = _extends({
|
|
10573
|
+
active: false
|
|
10574
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10504
10575
|
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(
|
|
10509
|
-
if (
|
|
10576
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10577
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10578
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10579
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10580
|
+
if (bloom.active) {
|
|
10510
10581
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10511
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10582
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10512
10583
|
}
|
|
10513
|
-
if (
|
|
10514
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10515
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10516
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10584
|
+
if (vignette.intensity > 0) {
|
|
10585
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10586
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10587
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10517
10588
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10518
10589
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10519
10590
|
}
|
|
10520
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10591
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10521
10592
|
renderer.renderMeshes([
|
|
10522
10593
|
this.screenMesh
|
|
10523
10594
|
]);
|
|
@@ -10557,6 +10628,9 @@ var seed$5 = 1;
|
|
|
10557
10628
|
this.renderer = renderer;
|
|
10558
10629
|
if (postProcessingEnabled) {
|
|
10559
10630
|
var enableHDR = true;
|
|
10631
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10632
|
+
throw new Error("Half float texture is not supported.");
|
|
10633
|
+
}
|
|
10560
10634
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10561
10635
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10562
10636
|
attachments = [
|
|
@@ -13302,7 +13376,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13302
13376
|
return ColorCurve;
|
|
13303
13377
|
}(ValueGetter);
|
|
13304
13378
|
|
|
13305
|
-
|
|
13379
|
+
/**
|
|
13380
|
+
* @since 2.1.0
|
|
13381
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13306
13382
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13307
13383
|
function BaseRenderComponent(engine) {
|
|
13308
13384
|
var _this;
|
|
@@ -13389,7 +13465,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13389
13465
|
* @param texture - 纹理对象
|
|
13390
13466
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13391
13467
|
this.renderer.texture = texture;
|
|
13392
|
-
this.material.setTexture("
|
|
13468
|
+
this.material.setTexture("_MainTex", texture);
|
|
13393
13469
|
};
|
|
13394
13470
|
/**
|
|
13395
13471
|
* @internal
|
|
@@ -13468,51 +13544,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13468
13544
|
geometry.setIndexData(indexData);
|
|
13469
13545
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13470
13546
|
geometry.setDrawCount(data.index.length);
|
|
13471
|
-
|
|
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
|
-
}
|
|
13547
|
+
material.setTexture("_MainTex", texture);
|
|
13480
13548
|
};
|
|
13481
13549
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13482
|
-
this.
|
|
13483
|
-
|
|
13484
|
-
0.
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
0
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
2,
|
|
13502
|
-
1,
|
|
13503
|
-
3
|
|
13504
|
-
],
|
|
13505
|
-
atlasOffset: [
|
|
13550
|
+
var renderer = this.renderer;
|
|
13551
|
+
if (renderer.shape) {
|
|
13552
|
+
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;
|
|
13553
|
+
var point = new Float32Array(aPoint);
|
|
13554
|
+
var position = [];
|
|
13555
|
+
var atlasOffset = [];
|
|
13556
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13557
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13558
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13559
|
+
}
|
|
13560
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13561
|
+
return {
|
|
13562
|
+
index: index,
|
|
13563
|
+
atlasOffset: atlasOffset
|
|
13564
|
+
};
|
|
13565
|
+
} else {
|
|
13566
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13567
|
+
-0.5,
|
|
13568
|
+
0.5,
|
|
13506
13569
|
0,
|
|
13507
|
-
|
|
13570
|
+
-0.5,
|
|
13571
|
+
-0.5,
|
|
13508
13572
|
0,
|
|
13573
|
+
0.5,
|
|
13574
|
+
0.5,
|
|
13509
13575
|
0,
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
1,
|
|
13576
|
+
0.5,
|
|
13577
|
+
-0.5,
|
|
13513
13578
|
0
|
|
13514
|
-
]
|
|
13515
|
-
|
|
13579
|
+
]));
|
|
13580
|
+
return {
|
|
13581
|
+
index: [
|
|
13582
|
+
0,
|
|
13583
|
+
1,
|
|
13584
|
+
2,
|
|
13585
|
+
2,
|
|
13586
|
+
1,
|
|
13587
|
+
3
|
|
13588
|
+
],
|
|
13589
|
+
atlasOffset: [
|
|
13590
|
+
0,
|
|
13591
|
+
1,
|
|
13592
|
+
0,
|
|
13593
|
+
0,
|
|
13594
|
+
1,
|
|
13595
|
+
1,
|
|
13596
|
+
1,
|
|
13597
|
+
0
|
|
13598
|
+
]
|
|
13599
|
+
};
|
|
13600
|
+
}
|
|
13516
13601
|
};
|
|
13517
13602
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13518
13603
|
return Geometry.create(this.engine, {
|
|
@@ -13577,7 +13662,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13577
13662
|
setBlendMode(material, states.blendMode);
|
|
13578
13663
|
setMaskMode(material, states.maskMode);
|
|
13579
13664
|
setSideMode(material, states.side);
|
|
13580
|
-
material.shader.shaderData.properties = '
|
|
13665
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13581
13666
|
if (!material.hasUniform("_Color")) {
|
|
13582
13667
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13583
13668
|
}
|
|
@@ -15171,76 +15256,569 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15171
15256
|
return Ellipse;
|
|
15172
15257
|
}(ShapePrimitive);
|
|
15173
15258
|
|
|
15174
|
-
var
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15259
|
+
var StarType;
|
|
15260
|
+
(function(StarType) {
|
|
15261
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15262
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15263
|
+
})(StarType || (StarType = {}));
|
|
15264
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15265
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15266
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15267
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15268
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15269
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15270
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15271
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15272
|
+
if (starType === void 0) starType = 0;
|
|
15273
|
+
var _this;
|
|
15274
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15275
|
+
_this.pointCount = pointCount;
|
|
15276
|
+
_this.outerRadius = outerRadius;
|
|
15277
|
+
_this.innerRadius = innerRadius;
|
|
15278
|
+
_this.outerRoundness = outerRoundness;
|
|
15279
|
+
_this.innerRoundness = innerRoundness;
|
|
15280
|
+
_this.starType = starType;
|
|
15281
|
+
_this.v = [];
|
|
15282
|
+
_this.in = [];
|
|
15283
|
+
_this.out = [];
|
|
15284
|
+
return _this;
|
|
15179
15285
|
}
|
|
15180
|
-
var _proto =
|
|
15181
|
-
|
|
15182
|
-
this.
|
|
15183
|
-
|
|
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
|
-
}
|
|
15200
|
-
case "ellipse":
|
|
15201
|
-
{
|
|
15202
|
-
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15203
|
-
break;
|
|
15204
|
-
}
|
|
15205
|
-
}
|
|
15206
|
-
}
|
|
15207
|
-
this.endPoly();
|
|
15286
|
+
var _proto = PolyStar.prototype;
|
|
15287
|
+
_proto.clone = function clone() {
|
|
15288
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15289
|
+
return polyStar;
|
|
15208
15290
|
};
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
* @param cp2y - The y-coordinate of the second control point.
|
|
15217
|
-
* @param x - The x-coordinate of the end point.
|
|
15218
|
-
* @param y - The y-coordinate of the end point.
|
|
15219
|
-
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
15220
|
-
* @returns The instance of the current object for chaining.
|
|
15221
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
15222
|
-
this.ensurePoly();
|
|
15223
|
-
var currentPoly = this.currentPoly;
|
|
15224
|
-
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
15225
|
-
return this;
|
|
15291
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15292
|
+
this.pointCount = source.pointCount;
|
|
15293
|
+
this.outerRadius = source.outerRadius;
|
|
15294
|
+
this.innerRadius = source.innerRadius;
|
|
15295
|
+
this.outerRoundness = source.outerRoundness;
|
|
15296
|
+
this.innerRoundness = source.innerRoundness;
|
|
15297
|
+
this.starType = source.starType;
|
|
15226
15298
|
};
|
|
15227
|
-
_proto.
|
|
15228
|
-
|
|
15229
|
-
return this;
|
|
15299
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15300
|
+
destination.copyFrom(this);
|
|
15230
15301
|
};
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15302
|
+
_proto.build = function build(points) {
|
|
15303
|
+
switch(this.starType){
|
|
15304
|
+
case 0:
|
|
15305
|
+
{
|
|
15306
|
+
this.buildStarPath();
|
|
15307
|
+
break;
|
|
15308
|
+
}
|
|
15309
|
+
case 1:
|
|
15310
|
+
{
|
|
15311
|
+
this.buildPolygonPath();
|
|
15312
|
+
break;
|
|
15313
|
+
}
|
|
15314
|
+
}
|
|
15315
|
+
var smoothness = 1;
|
|
15316
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15317
|
+
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);
|
|
15318
|
+
}
|
|
15319
|
+
// draw last curve
|
|
15320
|
+
var lastIndex = this.v.length - 1;
|
|
15321
|
+
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);
|
|
15322
|
+
};
|
|
15323
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15324
|
+
var triangles = triangulate([
|
|
15325
|
+
points
|
|
15326
|
+
]);
|
|
15327
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15328
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15329
|
+
}
|
|
15330
|
+
var vertexCount = triangles.length / 2;
|
|
15331
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15332
|
+
indices[indicesOffset + i1] = i1;
|
|
15333
|
+
}
|
|
15334
|
+
};
|
|
15335
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15336
|
+
this.v = [];
|
|
15337
|
+
this.in = [];
|
|
15338
|
+
this.out = [];
|
|
15339
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15340
|
+
var angle = Math.PI * 2 / numPts;
|
|
15341
|
+
var longFlag = true;
|
|
15342
|
+
var longRad = this.outerRadius;
|
|
15343
|
+
var shortRad = this.innerRadius;
|
|
15344
|
+
var longRound = this.outerRoundness / 100;
|
|
15345
|
+
var shortRound = this.innerRoundness / 100;
|
|
15346
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15347
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15348
|
+
var i;
|
|
15349
|
+
var rad;
|
|
15350
|
+
var roundness;
|
|
15351
|
+
var perimSegment;
|
|
15352
|
+
var currentAng = -Math.PI / 2;
|
|
15353
|
+
var dir = 1;
|
|
15354
|
+
for(i = 0; i < numPts; i++){
|
|
15355
|
+
rad = longFlag ? longRad : shortRad;
|
|
15356
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15357
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15358
|
+
var x = rad * Math.cos(currentAng);
|
|
15359
|
+
var y = rad * Math.sin(currentAng);
|
|
15360
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15361
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15362
|
+
var offset = i * 2;
|
|
15363
|
+
this.v[offset] = x;
|
|
15364
|
+
this.v[offset + 1] = y;
|
|
15365
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15366
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15367
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15368
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15369
|
+
longFlag = !longFlag;
|
|
15370
|
+
currentAng += angle * dir;
|
|
15371
|
+
}
|
|
15372
|
+
};
|
|
15373
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15374
|
+
this.v = [];
|
|
15375
|
+
this.in = [];
|
|
15376
|
+
this.out = [];
|
|
15377
|
+
var numPts = Math.floor(this.pointCount);
|
|
15378
|
+
var angle = Math.PI * 2 / numPts;
|
|
15379
|
+
var rad = this.outerRadius;
|
|
15380
|
+
var roundness = this.outerRoundness / 100;
|
|
15381
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15382
|
+
var i;
|
|
15383
|
+
var currentAng = -Math.PI * 0.5;
|
|
15384
|
+
var dir = 1;
|
|
15385
|
+
for(i = 0; i < numPts; i++){
|
|
15386
|
+
var x = rad * Math.cos(currentAng);
|
|
15387
|
+
var y = rad * Math.sin(currentAng);
|
|
15388
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15389
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15390
|
+
var offset = i * 2;
|
|
15391
|
+
this.v[offset] = x;
|
|
15392
|
+
this.v[offset + 1] = y;
|
|
15393
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15394
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15395
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15396
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15397
|
+
currentAng += angle * dir;
|
|
15398
|
+
}
|
|
15399
|
+
};
|
|
15400
|
+
return PolyStar;
|
|
15401
|
+
}(ShapePrimitive);
|
|
15402
|
+
|
|
15403
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15404
|
+
/**
|
|
15405
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
15406
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15407
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15408
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15409
|
+
function Rectangle(x, y, width, height) {
|
|
15410
|
+
if (x === void 0) x = 0;
|
|
15411
|
+
if (y === void 0) y = 0;
|
|
15412
|
+
if (width === void 0) width = 0;
|
|
15413
|
+
if (height === void 0) height = 0;
|
|
15414
|
+
var _this;
|
|
15415
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15416
|
+
_this.x = Number(x);
|
|
15417
|
+
_this.y = Number(y);
|
|
15418
|
+
_this.width = Number(width);
|
|
15419
|
+
_this.height = Number(height);
|
|
15420
|
+
return _this;
|
|
15421
|
+
}
|
|
15422
|
+
var _proto = Rectangle.prototype;
|
|
15423
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15424
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15425
|
+
};
|
|
15426
|
+
/**
|
|
15427
|
+
* Creates a clone of this Rectangle
|
|
15428
|
+
* @returns a copy of the rectangle
|
|
15429
|
+
*/ _proto.clone = function clone() {
|
|
15430
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15431
|
+
};
|
|
15432
|
+
/**
|
|
15433
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15434
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15435
|
+
* @returns Returns itself.
|
|
15436
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15437
|
+
// this.x = bounds.minX;
|
|
15438
|
+
// this.y = bounds.minY;
|
|
15439
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15440
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15441
|
+
// return this;
|
|
15442
|
+
// }
|
|
15443
|
+
/**
|
|
15444
|
+
* Copies another rectangle to this one.
|
|
15445
|
+
* @param rectangle - The rectangle to copy from.
|
|
15446
|
+
* @returns Returns itself.
|
|
15447
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15448
|
+
this.x = rectangle.x;
|
|
15449
|
+
this.y = rectangle.y;
|
|
15450
|
+
this.width = rectangle.width;
|
|
15451
|
+
this.height = rectangle.height;
|
|
15452
|
+
return this;
|
|
15453
|
+
};
|
|
15454
|
+
/**
|
|
15455
|
+
* Copies this rectangle to another one.
|
|
15456
|
+
* @param rectangle - The rectangle to copy to.
|
|
15457
|
+
* @returns Returns given parameter.
|
|
15458
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15459
|
+
rectangle.copyFrom(this);
|
|
15460
|
+
return rectangle;
|
|
15461
|
+
};
|
|
15462
|
+
/**
|
|
15463
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15464
|
+
* @param x - The X coordinate of the point to test
|
|
15465
|
+
* @param y - The Y coordinate of the point to test
|
|
15466
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15467
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15468
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15469
|
+
return false;
|
|
15470
|
+
}
|
|
15471
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15472
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15473
|
+
return true;
|
|
15474
|
+
}
|
|
15475
|
+
}
|
|
15476
|
+
return false;
|
|
15477
|
+
};
|
|
15478
|
+
/**
|
|
15479
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15480
|
+
* @param x - The X coordinate of the point to test
|
|
15481
|
+
* @param y - The Y coordinate of the point to test
|
|
15482
|
+
* @param strokeWidth - The width of the line to check
|
|
15483
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15484
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15485
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15486
|
+
if (width <= 0 || height <= 0) {
|
|
15487
|
+
return false;
|
|
15488
|
+
}
|
|
15489
|
+
var _x = this.x;
|
|
15490
|
+
var _y = this.y;
|
|
15491
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15492
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15493
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15494
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15495
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15496
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15497
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15498
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15499
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15500
|
+
};
|
|
15501
|
+
/**
|
|
15502
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15503
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15504
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15505
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15506
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15507
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15508
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15509
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15510
|
+
// if (!transform) {
|
|
15511
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15512
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15513
|
+
// if (x1 <= x0) {
|
|
15514
|
+
// return false;
|
|
15515
|
+
// }
|
|
15516
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15517
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15518
|
+
// return y1 > y0;
|
|
15519
|
+
// }
|
|
15520
|
+
// const x0 = this.left;
|
|
15521
|
+
// const x1 = this.right;
|
|
15522
|
+
// const y0 = this.top;
|
|
15523
|
+
// const y1 = this.bottom;
|
|
15524
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15525
|
+
// return false;
|
|
15526
|
+
// }
|
|
15527
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15528
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15529
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15530
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15531
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15532
|
+
// return false;
|
|
15533
|
+
// }
|
|
15534
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15535
|
+
// if (s === 0) {
|
|
15536
|
+
// return false;
|
|
15537
|
+
// }
|
|
15538
|
+
// transform.apply(lt, lt);
|
|
15539
|
+
// transform.apply(lb, lb);
|
|
15540
|
+
// transform.apply(rt, rt);
|
|
15541
|
+
// transform.apply(rb, rb);
|
|
15542
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15543
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15544
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15545
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15546
|
+
// return false;
|
|
15547
|
+
// }
|
|
15548
|
+
// const nx = s * (lb.y - lt.y);
|
|
15549
|
+
// const ny = s * (lt.x - lb.x);
|
|
15550
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15551
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15552
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15553
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15554
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15555
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15556
|
+
// return false;
|
|
15557
|
+
// }
|
|
15558
|
+
// const mx = s * (lt.y - rt.y);
|
|
15559
|
+
// const my = s * (rt.x - lt.x);
|
|
15560
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15561
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15562
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15563
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15564
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15565
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15566
|
+
// return false;
|
|
15567
|
+
// }
|
|
15568
|
+
// return true;
|
|
15569
|
+
// }
|
|
15570
|
+
/**
|
|
15571
|
+
* Pads the rectangle making it grow in all directions.
|
|
15572
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15573
|
+
* @param paddingX - The horizontal padding amount.
|
|
15574
|
+
* @param paddingY - The vertical padding amount.
|
|
15575
|
+
* @returns Returns itself.
|
|
15576
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15577
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15578
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15579
|
+
this.x -= paddingX;
|
|
15580
|
+
this.y -= paddingY;
|
|
15581
|
+
this.width += paddingX * 2;
|
|
15582
|
+
this.height += paddingY * 2;
|
|
15583
|
+
return this;
|
|
15584
|
+
};
|
|
15585
|
+
/**
|
|
15586
|
+
* Fits this rectangle around the passed one.
|
|
15587
|
+
* @param rectangle - The rectangle to fit.
|
|
15588
|
+
* @returns Returns itself.
|
|
15589
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15590
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15591
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15592
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15593
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15594
|
+
this.x = x1;
|
|
15595
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15596
|
+
this.y = y1;
|
|
15597
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15598
|
+
return this;
|
|
15599
|
+
};
|
|
15600
|
+
/**
|
|
15601
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15602
|
+
* @param resolution - resolution
|
|
15603
|
+
* @param eps - precision
|
|
15604
|
+
* @returns Returns itself.
|
|
15605
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15606
|
+
if (resolution === void 0) resolution = 1;
|
|
15607
|
+
if (eps === void 0) eps = 0.001;
|
|
15608
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15609
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15610
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15611
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15612
|
+
this.width = x2 - this.x;
|
|
15613
|
+
this.height = y2 - this.y;
|
|
15614
|
+
return this;
|
|
15615
|
+
};
|
|
15616
|
+
/**
|
|
15617
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15618
|
+
* @param rectangle - The rectangle to include.
|
|
15619
|
+
* @returns Returns itself.
|
|
15620
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15621
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15622
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15623
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15624
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15625
|
+
this.x = x1;
|
|
15626
|
+
this.width = x2 - x1;
|
|
15627
|
+
this.y = y1;
|
|
15628
|
+
this.height = y2 - y1;
|
|
15629
|
+
return this;
|
|
15630
|
+
};
|
|
15631
|
+
/**
|
|
15632
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15633
|
+
* @param out - optional rectangle to store the result
|
|
15634
|
+
* @returns The framing rectangle
|
|
15635
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15636
|
+
out = out || new Rectangle();
|
|
15637
|
+
out.copyFrom(this);
|
|
15638
|
+
return out;
|
|
15639
|
+
};
|
|
15640
|
+
_proto.getX = function getX() {
|
|
15641
|
+
return this.x;
|
|
15642
|
+
};
|
|
15643
|
+
_proto.getY = function getY() {
|
|
15644
|
+
return this.y;
|
|
15645
|
+
};
|
|
15646
|
+
_proto.build = function build(points) {
|
|
15647
|
+
var x = this.x;
|
|
15648
|
+
var y = this.y;
|
|
15649
|
+
var width = this.width;
|
|
15650
|
+
var height = this.height;
|
|
15651
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15652
|
+
return points;
|
|
15653
|
+
}
|
|
15654
|
+
points[0] = x;
|
|
15655
|
+
points[1] = y;
|
|
15656
|
+
points[2] = x + width;
|
|
15657
|
+
points[3] = y;
|
|
15658
|
+
points[4] = x + width;
|
|
15659
|
+
points[5] = y + height;
|
|
15660
|
+
points[6] = x;
|
|
15661
|
+
points[7] = y + height;
|
|
15662
|
+
return points;
|
|
15663
|
+
};
|
|
15664
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15665
|
+
var count = 0;
|
|
15666
|
+
var verticesStride = 2;
|
|
15667
|
+
verticesOffset *= verticesStride;
|
|
15668
|
+
vertices[verticesOffset + count] = points[0];
|
|
15669
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15670
|
+
count += verticesStride;
|
|
15671
|
+
vertices[verticesOffset + count] = points[2];
|
|
15672
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15673
|
+
count += verticesStride;
|
|
15674
|
+
vertices[verticesOffset + count] = points[6];
|
|
15675
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15676
|
+
count += verticesStride;
|
|
15677
|
+
vertices[verticesOffset + count] = points[4];
|
|
15678
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15679
|
+
count += verticesStride;
|
|
15680
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15681
|
+
// triangle 1
|
|
15682
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15683
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15684
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15685
|
+
// triangle 2
|
|
15686
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15687
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15688
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15689
|
+
};
|
|
15690
|
+
_create_class(Rectangle, [
|
|
15691
|
+
{
|
|
15692
|
+
key: "left",
|
|
15693
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15694
|
+
return this.x;
|
|
15695
|
+
}
|
|
15696
|
+
},
|
|
15697
|
+
{
|
|
15698
|
+
key: "right",
|
|
15699
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15700
|
+
return this.x + this.width;
|
|
15701
|
+
}
|
|
15702
|
+
},
|
|
15703
|
+
{
|
|
15704
|
+
key: "top",
|
|
15705
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15706
|
+
return this.y;
|
|
15707
|
+
}
|
|
15708
|
+
},
|
|
15709
|
+
{
|
|
15710
|
+
key: "bottom",
|
|
15711
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15712
|
+
return this.y + this.height;
|
|
15713
|
+
}
|
|
15714
|
+
}
|
|
15715
|
+
], [
|
|
15716
|
+
{
|
|
15717
|
+
key: "EMPTY",
|
|
15718
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15719
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15720
|
+
}
|
|
15721
|
+
}
|
|
15722
|
+
]);
|
|
15723
|
+
return Rectangle;
|
|
15724
|
+
}(ShapePrimitive);
|
|
15725
|
+
|
|
15726
|
+
var ShapePath = /*#__PURE__*/ function() {
|
|
15727
|
+
function ShapePath(graphicsPath) {
|
|
15728
|
+
this.graphicsPath = graphicsPath;
|
|
15729
|
+
this.currentPoly = null;
|
|
15730
|
+
this.shapePrimitives = [];
|
|
15731
|
+
}
|
|
15732
|
+
var _proto = ShapePath.prototype;
|
|
15733
|
+
/** Builds the path. */ _proto.buildPath = function buildPath() {
|
|
15734
|
+
this.currentPoly = null;
|
|
15735
|
+
this.shapePrimitives.length = 0;
|
|
15736
|
+
var path = this.graphicsPath;
|
|
15737
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
|
|
15738
|
+
var instruction = _step.value;
|
|
15739
|
+
var action = instruction.action;
|
|
15740
|
+
var data = instruction.data;
|
|
15741
|
+
switch(action){
|
|
15742
|
+
case "bezierCurveTo":
|
|
15743
|
+
{
|
|
15744
|
+
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15745
|
+
break;
|
|
15746
|
+
}
|
|
15747
|
+
case "moveTo":
|
|
15748
|
+
{
|
|
15749
|
+
this.moveTo(data[0], data[1]);
|
|
15750
|
+
break;
|
|
15751
|
+
}
|
|
15752
|
+
case "ellipse":
|
|
15753
|
+
{
|
|
15754
|
+
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15755
|
+
break;
|
|
15756
|
+
}
|
|
15757
|
+
case "polyStar":
|
|
15758
|
+
{
|
|
15759
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15760
|
+
break;
|
|
15761
|
+
}
|
|
15762
|
+
case "rect":
|
|
15763
|
+
{
|
|
15764
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15765
|
+
break;
|
|
15766
|
+
}
|
|
15767
|
+
}
|
|
15768
|
+
}
|
|
15769
|
+
this.endPoly();
|
|
15770
|
+
};
|
|
15771
|
+
/**
|
|
15772
|
+
* Adds a cubic Bezier curve to the path.
|
|
15773
|
+
* It requires three points: the first two are control points and the third one is the end point.
|
|
15774
|
+
* The starting point is the last point in the current path.
|
|
15775
|
+
* @param cp1x - The x-coordinate of the first control point.
|
|
15776
|
+
* @param cp1y - The y-coordinate of the first control point.
|
|
15777
|
+
* @param cp2x - The x-coordinate of the second control point.
|
|
15778
|
+
* @param cp2y - The y-coordinate of the second control point.
|
|
15779
|
+
* @param x - The x-coordinate of the end point.
|
|
15780
|
+
* @param y - The y-coordinate of the end point.
|
|
15781
|
+
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
15782
|
+
* @returns The instance of the current object for chaining.
|
|
15783
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
15784
|
+
this.ensurePoly();
|
|
15785
|
+
var currentPoly = this.currentPoly;
|
|
15786
|
+
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
15787
|
+
return this;
|
|
15788
|
+
};
|
|
15789
|
+
_proto.moveTo = function moveTo(x, y) {
|
|
15790
|
+
this.startPoly(x, y);
|
|
15791
|
+
return this;
|
|
15792
|
+
};
|
|
15793
|
+
/**
|
|
15794
|
+
* Draws an ellipse at the specified location and with the given x and y radii.
|
|
15795
|
+
* An optional transformation can be applied, allowing for rotation, scaling, and translation.
|
|
15796
|
+
* @param x - The x-coordinate of the center of the ellipse.
|
|
15797
|
+
* @param y - The y-coordinate of the center of the ellipse.
|
|
15798
|
+
* @param radiusX - The horizontal radius of the ellipse.
|
|
15799
|
+
* @param radiusY - The vertical radius of the ellipse.
|
|
15800
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
|
|
15801
|
+
* @returns The instance of the current object for chaining.
|
|
15802
|
+
*/ _proto.ellipse = function ellipse(x, y, radiusX, radiusY, transform) {
|
|
15803
|
+
// TODO apply rotation to transform...
|
|
15804
|
+
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15805
|
+
return this;
|
|
15806
|
+
};
|
|
15807
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15808
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15809
|
+
return this;
|
|
15810
|
+
};
|
|
15811
|
+
/**
|
|
15812
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15813
|
+
* @param x - The x-coordinate of the top-left corner of the rectangle.
|
|
15814
|
+
* @param y - The y-coordinate of the top-left corner of the rectangle.
|
|
15815
|
+
* @param w - The width of the rectangle.
|
|
15816
|
+
* @param h - The height of the rectangle.
|
|
15817
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15818
|
+
* @returns The instance of the current object for chaining.
|
|
15819
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15820
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15821
|
+
return this;
|
|
15244
15822
|
};
|
|
15245
15823
|
/**
|
|
15246
15824
|
* Draws a given shape on the canvas.
|
|
@@ -15398,6 +15976,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15398
15976
|
this.dirty = true;
|
|
15399
15977
|
return this;
|
|
15400
15978
|
};
|
|
15979
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15980
|
+
this.instructions.push({
|
|
15981
|
+
action: "polyStar",
|
|
15982
|
+
data: [
|
|
15983
|
+
pointCount,
|
|
15984
|
+
outerRadius,
|
|
15985
|
+
innerRadius,
|
|
15986
|
+
outerRoundness,
|
|
15987
|
+
innerRoundness,
|
|
15988
|
+
starType,
|
|
15989
|
+
transform
|
|
15990
|
+
]
|
|
15991
|
+
});
|
|
15992
|
+
this.dirty = true;
|
|
15993
|
+
return this;
|
|
15994
|
+
};
|
|
15401
15995
|
_proto.clear = function clear() {
|
|
15402
15996
|
this.instructions.length = 0;
|
|
15403
15997
|
this.dirty = true;
|
|
@@ -15475,7 +16069,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15475
16069
|
};
|
|
15476
16070
|
_this.material = Material.create(engine, materialProps);
|
|
15477
16071
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15478
|
-
_this.material.depthMask =
|
|
16072
|
+
_this.material.depthMask = false;
|
|
15479
16073
|
_this.material.depthTest = true;
|
|
15480
16074
|
_this.material.blending = true;
|
|
15481
16075
|
}
|
|
@@ -15540,16 +16134,18 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15540
16134
|
};
|
|
15541
16135
|
_proto.buildPath = function buildPath(data) {
|
|
15542
16136
|
this.path.clear();
|
|
15543
|
-
|
|
16137
|
+
var shapeData = data;
|
|
16138
|
+
switch(shapeData.type){
|
|
15544
16139
|
case 0:
|
|
15545
16140
|
{
|
|
15546
|
-
var customData =
|
|
15547
|
-
var points = customData.
|
|
15548
|
-
var easingIns = customData.
|
|
15549
|
-
var easingOuts = customData.
|
|
16141
|
+
var customData = shapeData;
|
|
16142
|
+
var points = customData.points;
|
|
16143
|
+
var easingIns = customData.easingIns;
|
|
16144
|
+
var easingOuts = customData.easingOuts;
|
|
15550
16145
|
this.curveValues = [];
|
|
15551
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
16146
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15552
16147
|
var shape = _step.value;
|
|
16148
|
+
this.setFillColor(shape.fill);
|
|
15553
16149
|
var indices = shape.indexes;
|
|
15554
16150
|
for(var i = 1; i < indices.length; i++){
|
|
15555
16151
|
var pointIndex = indices[i];
|
|
@@ -15579,45 +16175,206 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15579
16175
|
}
|
|
15580
16176
|
case 2:
|
|
15581
16177
|
{
|
|
15582
|
-
var ellipseData =
|
|
15583
|
-
|
|
15584
|
-
this.
|
|
16178
|
+
var ellipseData = shapeData;
|
|
16179
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16180
|
+
this.setFillColor(ellipseData.fill);
|
|
16181
|
+
break;
|
|
16182
|
+
}
|
|
16183
|
+
case 1:
|
|
16184
|
+
{
|
|
16185
|
+
var rectangleData = shapeData;
|
|
16186
|
+
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16187
|
+
this.setFillColor(rectangleData.fill);
|
|
16188
|
+
break;
|
|
16189
|
+
}
|
|
16190
|
+
case 4:
|
|
16191
|
+
{
|
|
16192
|
+
var starData = shapeData;
|
|
16193
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16194
|
+
this.setFillColor(starData.fill);
|
|
16195
|
+
break;
|
|
16196
|
+
}
|
|
16197
|
+
case 3:
|
|
16198
|
+
{
|
|
16199
|
+
var polygonData = shapeData;
|
|
16200
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16201
|
+
this.setFillColor(polygonData.fill);
|
|
15585
16202
|
break;
|
|
15586
16203
|
}
|
|
15587
16204
|
}
|
|
15588
16205
|
};
|
|
16206
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16207
|
+
if (fill) {
|
|
16208
|
+
var color = fill.color;
|
|
16209
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
16210
|
+
}
|
|
16211
|
+
};
|
|
15589
16212
|
_proto.fromData = function fromData(data) {
|
|
15590
16213
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15591
16214
|
this.data = data;
|
|
16215
|
+
var material = this.material;
|
|
16216
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16217
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16218
|
+
data.renderer.mask,
|
|
16219
|
+
data.renderer.mask
|
|
16220
|
+
] : undefined;
|
|
16221
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16222
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15592
16223
|
};
|
|
15593
16224
|
return ShapeComponent;
|
|
15594
16225
|
}(MeshComponent);
|
|
15595
16226
|
ShapeComponent = __decorate([
|
|
15596
16227
|
effectsClass("ShapeComponent")
|
|
15597
16228
|
], ShapeComponent);
|
|
15598
|
-
var
|
|
15599
|
-
(function(
|
|
16229
|
+
var ShapePrimitiveType;
|
|
16230
|
+
(function(ShapePrimitiveType) {
|
|
15600
16231
|
/**
|
|
15601
16232
|
* 自定义图形
|
|
15602
|
-
*/
|
|
16233
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15603
16234
|
/**
|
|
15604
16235
|
* 矩形
|
|
15605
|
-
*/
|
|
16236
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15606
16237
|
/**
|
|
15607
16238
|
* 椭圆
|
|
15608
|
-
*/
|
|
16239
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15609
16240
|
/**
|
|
15610
16241
|
* 多边形
|
|
15611
|
-
*/
|
|
16242
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15612
16243
|
/**
|
|
15613
16244
|
* 星形
|
|
15614
|
-
*/
|
|
15615
|
-
})(
|
|
16245
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
16246
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
15616
16247
|
var ShapeConnectType;
|
|
15617
16248
|
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
15618
16249
|
var ShapePointType;
|
|
15619
16250
|
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
15620
16251
|
|
|
16252
|
+
var Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16253
|
+
_inherits(Fake3DComponent, Component);
|
|
16254
|
+
function Fake3DComponent() {
|
|
16255
|
+
var _this;
|
|
16256
|
+
_this = Component.apply(this, arguments) || this;
|
|
16257
|
+
_this.loop = false;
|
|
16258
|
+
_this.amountOfMotion = 1.0;
|
|
16259
|
+
_this.animationLength = 2.0;
|
|
16260
|
+
_this.mode = 1;
|
|
16261
|
+
_this.startPositionX = 0;
|
|
16262
|
+
_this.startPositionY = 0;
|
|
16263
|
+
_this.startPositionZ = 0;
|
|
16264
|
+
_this.endPositionX = 0;
|
|
16265
|
+
_this.endPositionY = 0;
|
|
16266
|
+
_this.endPositionZ = 0;
|
|
16267
|
+
_this.amplitudeX = 0;
|
|
16268
|
+
_this.amplitudeY = 0;
|
|
16269
|
+
_this.amplitudeZ = 0;
|
|
16270
|
+
_this.phaseX = 0;
|
|
16271
|
+
_this.phaseY = 0;
|
|
16272
|
+
_this.phaseZ = 0;
|
|
16273
|
+
return _this;
|
|
16274
|
+
}
|
|
16275
|
+
var _proto = Fake3DComponent.prototype;
|
|
16276
|
+
_proto.onStart = function onStart() {
|
|
16277
|
+
this.effectComponent = this.item.getComponent(EffectComponent);
|
|
16278
|
+
};
|
|
16279
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16280
|
+
this.updateFake3D();
|
|
16281
|
+
};
|
|
16282
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16283
|
+
if (!this.effectComponent) {
|
|
16284
|
+
return;
|
|
16285
|
+
}
|
|
16286
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16287
|
+
var _PosX = 0;
|
|
16288
|
+
var _PosY = 0;
|
|
16289
|
+
var _PosZ = 0;
|
|
16290
|
+
switch(this.mode){
|
|
16291
|
+
case 0:
|
|
16292
|
+
{
|
|
16293
|
+
var PI = Math.PI;
|
|
16294
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16295
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16296
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16297
|
+
break;
|
|
16298
|
+
}
|
|
16299
|
+
case 1:
|
|
16300
|
+
{
|
|
16301
|
+
var localTime = time;
|
|
16302
|
+
if (this.loop) {
|
|
16303
|
+
if (localTime > 0.5) {
|
|
16304
|
+
localTime = 1 - localTime;
|
|
16305
|
+
}
|
|
16306
|
+
localTime *= 2;
|
|
16307
|
+
}
|
|
16308
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16309
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16310
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16311
|
+
break;
|
|
16312
|
+
}
|
|
16313
|
+
}
|
|
16314
|
+
var material = this.effectComponent.material;
|
|
16315
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16316
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16317
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16318
|
+
};
|
|
16319
|
+
return Fake3DComponent;
|
|
16320
|
+
}(Component);
|
|
16321
|
+
__decorate([
|
|
16322
|
+
serialize()
|
|
16323
|
+
], Fake3DComponent.prototype, "loop", void 0);
|
|
16324
|
+
__decorate([
|
|
16325
|
+
serialize()
|
|
16326
|
+
], Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16327
|
+
__decorate([
|
|
16328
|
+
serialize()
|
|
16329
|
+
], Fake3DComponent.prototype, "animationLength", void 0);
|
|
16330
|
+
__decorate([
|
|
16331
|
+
serialize()
|
|
16332
|
+
], Fake3DComponent.prototype, "mode", void 0);
|
|
16333
|
+
__decorate([
|
|
16334
|
+
serialize()
|
|
16335
|
+
], Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16336
|
+
__decorate([
|
|
16337
|
+
serialize()
|
|
16338
|
+
], Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16339
|
+
__decorate([
|
|
16340
|
+
serialize()
|
|
16341
|
+
], Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16342
|
+
__decorate([
|
|
16343
|
+
serialize()
|
|
16344
|
+
], Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16345
|
+
__decorate([
|
|
16346
|
+
serialize()
|
|
16347
|
+
], Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16348
|
+
__decorate([
|
|
16349
|
+
serialize()
|
|
16350
|
+
], Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16351
|
+
__decorate([
|
|
16352
|
+
serialize()
|
|
16353
|
+
], Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16354
|
+
__decorate([
|
|
16355
|
+
serialize()
|
|
16356
|
+
], Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16357
|
+
__decorate([
|
|
16358
|
+
serialize()
|
|
16359
|
+
], Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16360
|
+
__decorate([
|
|
16361
|
+
serialize()
|
|
16362
|
+
], Fake3DComponent.prototype, "phaseX", void 0);
|
|
16363
|
+
__decorate([
|
|
16364
|
+
serialize()
|
|
16365
|
+
], Fake3DComponent.prototype, "phaseY", void 0);
|
|
16366
|
+
__decorate([
|
|
16367
|
+
serialize()
|
|
16368
|
+
], Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16369
|
+
Fake3DComponent = __decorate([
|
|
16370
|
+
effectsClass("Fake3DComponent")
|
|
16371
|
+
], Fake3DComponent);
|
|
16372
|
+
var Fake3DAnimationMode;
|
|
16373
|
+
(function(Fake3DAnimationMode) {
|
|
16374
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16375
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16376
|
+
})(Fake3DAnimationMode || (Fake3DAnimationMode = {}));
|
|
16377
|
+
|
|
15621
16378
|
var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15622
16379
|
_inherits(CameraController, Behaviour);
|
|
15623
16380
|
function CameraController(engine, props) {
|
|
@@ -15988,8 +16745,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15988
16745
|
0
|
|
15989
16746
|
]
|
|
15990
16747
|
};
|
|
16748
|
+
_this.duringPlay = false;
|
|
15991
16749
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15992
|
-
_this.hasBeenAddedToComposition = false;
|
|
15993
16750
|
_this.getHitTestParams = function(force) {
|
|
15994
16751
|
if (!_this.clickable) {
|
|
15995
16752
|
return;
|
|
@@ -16026,7 +16783,6 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16026
16783
|
];
|
|
16027
16784
|
};
|
|
16028
16785
|
_proto.onStart = function onStart() {
|
|
16029
|
-
var _this = this;
|
|
16030
16786
|
var options = this.item.props.content.options;
|
|
16031
16787
|
var env = this.item.engine.renderer.env;
|
|
16032
16788
|
var composition = this.item.composition;
|
|
@@ -16050,32 +16806,35 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16050
16806
|
this.materials = this.previewContent.mesh.materials;
|
|
16051
16807
|
}
|
|
16052
16808
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
_this.endDragTarget();
|
|
16809
|
+
};
|
|
16810
|
+
_proto.onDisable = function onDisable() {
|
|
16811
|
+
if (this.item && this.item.composition) {
|
|
16812
|
+
var _this_previewContent;
|
|
16813
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16814
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16815
|
+
this.duringPlay = false;
|
|
16061
16816
|
}
|
|
16062
|
-
|
|
16817
|
+
this.clickable = false;
|
|
16818
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16819
|
+
this.endDragTarget();
|
|
16820
|
+
}
|
|
16821
|
+
};
|
|
16822
|
+
_proto.onEnable = function onEnable() {
|
|
16823
|
+
var type = this.interactData.options.type;
|
|
16824
|
+
if (type === InteractType.CLICK) {
|
|
16825
|
+
this.clickable = true;
|
|
16826
|
+
}
|
|
16063
16827
|
};
|
|
16064
16828
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16065
16829
|
var _this_previewContent;
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16071
|
-
var type = this.interactData.options.type;
|
|
16072
|
-
if (type === InteractType.CLICK) {
|
|
16073
|
-
this.clickable = true;
|
|
16074
|
-
}
|
|
16830
|
+
this.duringPlay = true;
|
|
16831
|
+
// trigger messageBegin when item enter
|
|
16832
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16833
|
+
var _this_item_composition;
|
|
16075
16834
|
var options = this.item.props.content.options;
|
|
16076
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16077
|
-
this.hasBeenAddedToComposition = true;
|
|
16835
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16078
16836
|
}
|
|
16837
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16079
16838
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16080
16839
|
return;
|
|
16081
16840
|
}
|
|
@@ -16243,7 +17002,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16243
17002
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16244
17003
|
}
|
|
16245
17004
|
|
|
16246
|
-
|
|
17005
|
+
/**
|
|
17006
|
+
*
|
|
17007
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16247
17008
|
function MeshCollider() {
|
|
16248
17009
|
this.triangles = [];
|
|
16249
17010
|
}
|
|
@@ -16251,6 +17012,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16251
17012
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16252
17013
|
return this.boundingBoxData;
|
|
16253
17014
|
};
|
|
17015
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
17016
|
+
var maxX = -Number.MAX_VALUE;
|
|
17017
|
+
var maxY = -Number.MAX_VALUE;
|
|
17018
|
+
var minX = Number.MAX_VALUE;
|
|
17019
|
+
var minY = Number.MAX_VALUE;
|
|
17020
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
17021
|
+
var triangle = _step.value;
|
|
17022
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
17023
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
17024
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
17025
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
17026
|
+
}
|
|
17027
|
+
var area = [];
|
|
17028
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
17029
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
17030
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
17031
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
17032
|
+
area.push({
|
|
17033
|
+
p0: point0,
|
|
17034
|
+
p1: point1,
|
|
17035
|
+
p2: point2
|
|
17036
|
+
});
|
|
17037
|
+
area.push({
|
|
17038
|
+
p0: point0,
|
|
17039
|
+
p1: point2,
|
|
17040
|
+
p2: point3
|
|
17041
|
+
});
|
|
17042
|
+
return {
|
|
17043
|
+
type: HitTestType.triangle,
|
|
17044
|
+
area: area
|
|
17045
|
+
};
|
|
17046
|
+
};
|
|
16254
17047
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16255
17048
|
if (this.geometry !== geometry) {
|
|
16256
17049
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16455,6 +17248,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16455
17248
|
if (inputCount === void 0) inputCount = 0;
|
|
16456
17249
|
this.onPlayablePlayFlag = true;
|
|
16457
17250
|
this.onPlayablePauseFlag = false;
|
|
17251
|
+
this.duration = 0;
|
|
16458
17252
|
this.destroyed = false;
|
|
16459
17253
|
this.inputs = [];
|
|
16460
17254
|
this.inputOuputPorts = [];
|
|
@@ -16547,6 +17341,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16547
17341
|
_proto.getTime = function getTime() {
|
|
16548
17342
|
return this.time;
|
|
16549
17343
|
};
|
|
17344
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17345
|
+
this.duration = duration;
|
|
17346
|
+
};
|
|
17347
|
+
_proto.getDuration = function getDuration() {
|
|
17348
|
+
return this.duration;
|
|
17349
|
+
};
|
|
16550
17350
|
_proto.getPlayState = function getPlayState() {
|
|
16551
17351
|
return this.playState;
|
|
16552
17352
|
};
|
|
@@ -16698,7 +17498,9 @@ var PlayableTraversalMode;
|
|
|
16698
17498
|
var tempQuat$1 = new Quaternion();
|
|
16699
17499
|
var seed$3 = 1;
|
|
16700
17500
|
// TODO 继承 Component
|
|
16701
|
-
|
|
17501
|
+
/**
|
|
17502
|
+
*
|
|
17503
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16702
17504
|
function Transform(props, parent) {
|
|
16703
17505
|
if (props === void 0) props = {};
|
|
16704
17506
|
this.taggedProperties = {};
|
|
@@ -17163,7 +17965,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17163
17965
|
return Transform;
|
|
17164
17966
|
}();
|
|
17165
17967
|
|
|
17166
|
-
|
|
17968
|
+
/**
|
|
17969
|
+
*
|
|
17970
|
+
*/ /**
|
|
17971
|
+
* 事件监听器
|
|
17972
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17167
17973
|
var _this = this;
|
|
17168
17974
|
var _this1 = this;
|
|
17169
17975
|
this.listeners = {};
|
|
@@ -17257,17 +18063,15 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17257
18063
|
/**
|
|
17258
18064
|
* 元素动画结束时行为(如何处理元素)
|
|
17259
18065
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17260
|
-
/**
|
|
17261
|
-
* 元素是否可用
|
|
17262
|
-
*/ _this.ended = false;
|
|
17263
|
-
_this.reusable = false;
|
|
17264
18066
|
_this.type = ItemType.base;
|
|
17265
18067
|
_this.isDuringPlay = false;
|
|
17266
18068
|
_this.components = [];
|
|
17267
18069
|
_this.rendererComponents = [];
|
|
17268
18070
|
/**
|
|
17269
|
-
*
|
|
17270
|
-
|
|
18071
|
+
* 元素是否激活
|
|
18072
|
+
*/ _this.active = true;
|
|
18073
|
+
/**
|
|
18074
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17271
18075
|
*/ _this.visible = true;
|
|
17272
18076
|
/**
|
|
17273
18077
|
* 元素动画的速度
|
|
@@ -17398,12 +18202,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17398
18202
|
}
|
|
17399
18203
|
};
|
|
17400
18204
|
/**
|
|
17401
|
-
* 元素动画结束播放时回调函数
|
|
17402
|
-
* @override
|
|
17403
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17404
|
-
// OVERRIDE
|
|
17405
|
-
};
|
|
17406
|
-
/**
|
|
17407
18205
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17408
18206
|
* @param {number} r
|
|
17409
18207
|
* @param {number} g
|
|
@@ -17416,17 +18214,27 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17416
18214
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17417
18215
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17418
18216
|
/**
|
|
17419
|
-
*
|
|
17420
|
-
*/ _proto.
|
|
17421
|
-
|
|
18217
|
+
* 激活或停用 VFXItem
|
|
18218
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18219
|
+
if (this.active !== value) {
|
|
18220
|
+
this.active = !!value;
|
|
18221
|
+
this.onActiveChanged();
|
|
18222
|
+
}
|
|
17422
18223
|
};
|
|
17423
18224
|
/**
|
|
17424
|
-
*
|
|
18225
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17425
18226
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
18227
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18228
|
+
var component = _step.value;
|
|
18229
|
+
component.enabled = visible;
|
|
17429
18230
|
}
|
|
18231
|
+
this.visible = visible;
|
|
18232
|
+
};
|
|
18233
|
+
/**
|
|
18234
|
+
* 元素组件显隐状态
|
|
18235
|
+
* @deprecated use isVisible instead
|
|
18236
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18237
|
+
return this.visible;
|
|
17430
18238
|
};
|
|
17431
18239
|
/**
|
|
17432
18240
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17508,14 +18316,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17508
18316
|
this.transform.assignWorldTRS(pos);
|
|
17509
18317
|
return pos;
|
|
17510
18318
|
};
|
|
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
18319
|
_proto.find = function find(name) {
|
|
17520
18320
|
var _queue;
|
|
17521
18321
|
if (this.name === name) {
|
|
@@ -17539,7 +18339,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17539
18339
|
* @internal
|
|
17540
18340
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17541
18341
|
this.isDuringPlay = true;
|
|
17542
|
-
if (this.composition && this.
|
|
18342
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17543
18343
|
this.onEnable();
|
|
17544
18344
|
}
|
|
17545
18345
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17723,25 +18523,54 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17723
18523
|
// }
|
|
17724
18524
|
// }
|
|
17725
18525
|
};
|
|
17726
|
-
|
|
18526
|
+
/**
|
|
18527
|
+
*
|
|
18528
|
+
* @param item
|
|
18529
|
+
* @returns
|
|
18530
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17727
18531
|
return item.type === ItemType.composition;
|
|
17728
18532
|
};
|
|
17729
|
-
|
|
18533
|
+
/**
|
|
18534
|
+
*
|
|
18535
|
+
* @param item
|
|
18536
|
+
* @returns
|
|
18537
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17730
18538
|
return item.type === ItemType.sprite;
|
|
17731
18539
|
};
|
|
17732
|
-
|
|
18540
|
+
/**
|
|
18541
|
+
*
|
|
18542
|
+
* @param item
|
|
18543
|
+
* @returns
|
|
18544
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17733
18545
|
return item.type === ItemType.particle;
|
|
17734
18546
|
};
|
|
17735
|
-
|
|
18547
|
+
/**
|
|
18548
|
+
*
|
|
18549
|
+
* @param item
|
|
18550
|
+
* @returns
|
|
18551
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17736
18552
|
return item.type === ItemType.null;
|
|
17737
18553
|
};
|
|
17738
|
-
|
|
18554
|
+
/**
|
|
18555
|
+
*
|
|
18556
|
+
* @param item
|
|
18557
|
+
* @returns
|
|
18558
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17739
18559
|
return item.type === ItemType.tree;
|
|
17740
18560
|
};
|
|
17741
|
-
|
|
18561
|
+
/**
|
|
18562
|
+
*
|
|
18563
|
+
* @param item
|
|
18564
|
+
* @returns
|
|
18565
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17742
18566
|
return item.type === ItemType.camera;
|
|
17743
18567
|
};
|
|
17744
|
-
|
|
18568
|
+
/**
|
|
18569
|
+
*
|
|
18570
|
+
* @param ancestorCandidate
|
|
18571
|
+
* @param descendantCandidate
|
|
18572
|
+
* @returns
|
|
18573
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17745
18574
|
var current = descendantCandidate.parent;
|
|
17746
18575
|
while(current){
|
|
17747
18576
|
if (current === ancestorCandidate) {
|
|
@@ -17786,6 +18615,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17786
18615
|
}
|
|
17787
18616
|
}
|
|
17788
18617
|
}
|
|
18618
|
+
},
|
|
18619
|
+
{
|
|
18620
|
+
key: "isActive",
|
|
18621
|
+
get: /**
|
|
18622
|
+
* 当前 VFXItem 是否激活
|
|
18623
|
+
*/ function get() {
|
|
18624
|
+
return this.active;
|
|
18625
|
+
}
|
|
18626
|
+
},
|
|
18627
|
+
{
|
|
18628
|
+
key: "isVisible",
|
|
18629
|
+
get: /**
|
|
18630
|
+
* 元素组件显隐状态
|
|
18631
|
+
*/ function get() {
|
|
18632
|
+
return this.visible;
|
|
18633
|
+
}
|
|
17789
18634
|
}
|
|
17790
18635
|
]);
|
|
17791
18636
|
return VFXItem;
|
|
@@ -22550,6 +23395,7 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22550
23395
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22551
23396
|
var timelineClip = _step.value;
|
|
22552
23397
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23398
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22553
23399
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22554
23400
|
runtimeClips.push(clip);
|
|
22555
23401
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22653,14 +23499,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22653
23499
|
this.playable.setTime(clipTime);
|
|
22654
23500
|
// 判断动画是否结束
|
|
22655
23501
|
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
23502
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22665
23503
|
this.playable.pause();
|
|
22666
23504
|
}
|
|
@@ -22703,26 +23541,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22703
23541
|
}
|
|
22704
23542
|
if (hasInput) {
|
|
22705
23543
|
boundItem.transform.setValid(true);
|
|
22706
|
-
|
|
23544
|
+
boundItem.setActive(true);
|
|
22707
23545
|
} else {
|
|
22708
23546
|
boundItem.transform.setValid(false);
|
|
22709
|
-
|
|
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
|
-
}
|
|
23547
|
+
boundItem.setActive(false);
|
|
22726
23548
|
}
|
|
22727
23549
|
};
|
|
22728
23550
|
return ActivationMixerPlayable;
|
|
@@ -22750,7 +23572,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22750
23572
|
}
|
|
22751
23573
|
var _proto = PropertyClipPlayable.prototype;
|
|
22752
23574
|
_proto.processFrame = function processFrame(context) {
|
|
22753
|
-
this.value = this.curve.getValue(this.time);
|
|
23575
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22754
23576
|
};
|
|
22755
23577
|
return PropertyClipPlayable;
|
|
22756
23578
|
}(Playable);
|
|
@@ -23268,9 +24090,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23268
24090
|
var track = _step.value;
|
|
23269
24091
|
var boundObject = track.boundObject;
|
|
23270
24092
|
if (_instanceof1(boundObject, VFXItem)) {
|
|
23271
|
-
if (_instanceof1(track, ObjectBindingTrack)) {
|
|
23272
|
-
boundObject.reusable = value;
|
|
23273
|
-
}
|
|
23274
24093
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23275
24094
|
if (subCompositionComponent) {
|
|
23276
24095
|
subCompositionComponent.setReusable(value);
|
|
@@ -23315,16 +24134,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23315
24134
|
}
|
|
23316
24135
|
}
|
|
23317
24136
|
};
|
|
23318
|
-
_proto.
|
|
24137
|
+
_proto.onEnable = function onEnable() {
|
|
23319
24138
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23320
24139
|
var item = _step.value;
|
|
23321
|
-
item.
|
|
24140
|
+
item.setActive(true);
|
|
23322
24141
|
}
|
|
23323
24142
|
};
|
|
23324
|
-
_proto.
|
|
24143
|
+
_proto.onDisable = function onDisable() {
|
|
23325
24144
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23326
24145
|
var item = _step.value;
|
|
23327
|
-
item.
|
|
24146
|
+
item.setActive(false);
|
|
23328
24147
|
}
|
|
23329
24148
|
};
|
|
23330
24149
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23340,7 +24159,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23340
24159
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23341
24160
|
var _this, _loop = function(i) {
|
|
23342
24161
|
var item = _this.items[i];
|
|
23343
|
-
if (item.
|
|
24162
|
+
if (item.isActive && item.transform.getValid() && !VFXItem.isComposition(item) && !skip(item)) {
|
|
23344
24163
|
var hitParams = item.getHitTestParams(force);
|
|
23345
24164
|
if (hitParams) {
|
|
23346
24165
|
var success = false;
|
|
@@ -23482,9 +24301,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23482
24301
|
}
|
|
23483
24302
|
}
|
|
23484
24303
|
if (hasInput) {
|
|
23485
|
-
compositionComponent.
|
|
24304
|
+
compositionComponent.item.setActive(true);
|
|
23486
24305
|
} else {
|
|
23487
|
-
compositionComponent.
|
|
24306
|
+
compositionComponent.item.setActive(false);
|
|
23488
24307
|
}
|
|
23489
24308
|
};
|
|
23490
24309
|
return SubCompositionMixerPlayable;
|
|
@@ -24149,6 +24968,8 @@ var TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24149
24968
|
/**
|
|
24150
24969
|
* 文本行数
|
|
24151
24970
|
*/ _this.lineCount = 0;
|
|
24971
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24972
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24152
24973
|
_this.name = "MText" + seed$1++;
|
|
24153
24974
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24154
24975
|
if (props) {
|
|
@@ -24514,7 +25335,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24514
25335
|
}
|
|
24515
25336
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24516
25337
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24517
|
-
this.material.setTexture("
|
|
25338
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24518
25339
|
data: new Uint8Array(imageData.data),
|
|
24519
25340
|
width: imageData.width,
|
|
24520
25341
|
height: imageData.height
|
|
@@ -27712,7 +28533,7 @@ var listOrder = 0;
|
|
|
27712
28533
|
var itemProps = sourceItemData;
|
|
27713
28534
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27714
28535
|
itemProps.listIndex = listOrder++;
|
|
27715
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
28536
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
|
|
27716
28537
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27717
28538
|
var componentPath = _step2.value;
|
|
27718
28539
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27808,13 +28629,18 @@ var listOrder = 0;
|
|
|
27808
28629
|
return CompositionSourceManager;
|
|
27809
28630
|
}();
|
|
27810
28631
|
|
|
27811
|
-
|
|
28632
|
+
/**
|
|
28633
|
+
*
|
|
28634
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27812
28635
|
function SceneTicking() {
|
|
27813
28636
|
this.update = new UpdateTickData();
|
|
27814
28637
|
this.lateUpdate = new LateUpdateTickData();
|
|
27815
28638
|
}
|
|
27816
28639
|
var _proto = SceneTicking.prototype;
|
|
27817
|
-
|
|
28640
|
+
/**
|
|
28641
|
+
*
|
|
28642
|
+
* @param obj
|
|
28643
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27818
28644
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27819
28645
|
this.update.addComponent(obj);
|
|
27820
28646
|
}
|
|
@@ -27822,7 +28648,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27822
28648
|
this.lateUpdate.addComponent(obj);
|
|
27823
28649
|
}
|
|
27824
28650
|
};
|
|
27825
|
-
|
|
28651
|
+
/**
|
|
28652
|
+
*
|
|
28653
|
+
* @param obj
|
|
28654
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27826
28655
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27827
28656
|
this.update.removeComponent(obj);
|
|
27828
28657
|
}
|
|
@@ -27830,7 +28659,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27830
28659
|
this.lateUpdate.removeComponent(obj);
|
|
27831
28660
|
}
|
|
27832
28661
|
};
|
|
27833
|
-
|
|
28662
|
+
/**
|
|
28663
|
+
*
|
|
28664
|
+
*/ _proto.clear = function clear() {
|
|
27834
28665
|
this.update.clear();
|
|
27835
28666
|
this.lateUpdate.clear();
|
|
27836
28667
|
};
|
|
@@ -27921,11 +28752,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27921
28752
|
var _this;
|
|
27922
28753
|
var _scene_jsonScene_renderSettings;
|
|
27923
28754
|
_this = EventEmitter.call(this) || this;
|
|
27924
|
-
|
|
28755
|
+
/**
|
|
28756
|
+
*
|
|
28757
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27925
28758
|
/**
|
|
27926
28759
|
* 动画播放速度
|
|
27927
28760
|
*/ _this.speed = 1;
|
|
27928
28761
|
/**
|
|
28762
|
+
* 合成是否结束
|
|
28763
|
+
*/ _this.isEnded = false;
|
|
28764
|
+
/**
|
|
27929
28765
|
* 用于保存与当前合成相关的插件数据
|
|
27930
28766
|
*/ _this.loaderData = {};
|
|
27931
28767
|
/**
|
|
@@ -27947,6 +28783,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27947
28783
|
* 合成暂停/播放 标识
|
|
27948
28784
|
*/ _this.paused = false;
|
|
27949
28785
|
_this.lastVideoUpdateTime = 0;
|
|
28786
|
+
_this.isEndCalled = false;
|
|
27950
28787
|
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
28788
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27952
28789
|
if (reusable) {
|
|
@@ -28036,7 +28873,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28036
28873
|
* @param visible - 是否可见
|
|
28037
28874
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28038
28875
|
this.items.forEach(function(item) {
|
|
28039
|
-
item.
|
|
28876
|
+
item.setActive(visible);
|
|
28040
28877
|
});
|
|
28041
28878
|
};
|
|
28042
28879
|
/**
|
|
@@ -28046,7 +28883,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28046
28883
|
return this.speed;
|
|
28047
28884
|
};
|
|
28048
28885
|
_proto.play = function play() {
|
|
28049
|
-
if (this.
|
|
28886
|
+
if (this.isEnded && this.reusable) {
|
|
28050
28887
|
this.restart();
|
|
28051
28888
|
}
|
|
28052
28889
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28137,7 +28974,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28137
28974
|
* 重置状态函数
|
|
28138
28975
|
*/ _proto.reset = function reset() {
|
|
28139
28976
|
this.rendererOptions = null;
|
|
28140
|
-
this.
|
|
28977
|
+
this.isEnded = false;
|
|
28978
|
+
this.isEndCalled = false;
|
|
28141
28979
|
this.rootComposition.time = 0;
|
|
28142
28980
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28143
28981
|
};
|
|
@@ -28189,12 +29027,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28189
29027
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28190
29028
|
this.updateCamera();
|
|
28191
29029
|
this.prepareRender();
|
|
29030
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
29031
|
+
this.isEndCalled = true;
|
|
29032
|
+
this.emit("end", {
|
|
29033
|
+
composition: this
|
|
29034
|
+
});
|
|
29035
|
+
}
|
|
28192
29036
|
if (this.shouldDispose()) {
|
|
28193
29037
|
this.dispose();
|
|
28194
29038
|
}
|
|
28195
29039
|
};
|
|
28196
29040
|
_proto.shouldDispose = function shouldDispose() {
|
|
28197
|
-
return this.
|
|
29041
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28198
29042
|
};
|
|
28199
29043
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28200
29044
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28285,11 +29129,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28285
29129
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28286
29130
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28287
29131
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28288
|
-
var
|
|
29132
|
+
var isEnded = false;
|
|
28289
29133
|
var duration = this.rootItem.duration;
|
|
28290
29134
|
var endBehavior = this.rootItem.endBehavior;
|
|
28291
29135
|
if (localTime - duration > 0.001) {
|
|
28292
|
-
|
|
29136
|
+
isEnded = true;
|
|
28293
29137
|
switch(endBehavior){
|
|
28294
29138
|
case EndBehavior.restart:
|
|
28295
29139
|
{
|
|
@@ -28313,11 +29157,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28313
29157
|
}
|
|
28314
29158
|
}
|
|
28315
29159
|
this.rootComposition.time = localTime;
|
|
28316
|
-
|
|
28317
|
-
|
|
28318
|
-
|
|
28319
|
-
|
|
28320
|
-
}
|
|
29160
|
+
// end state changed, handle onEnd flags
|
|
29161
|
+
if (this.isEnded !== isEnded) {
|
|
29162
|
+
if (isEnded) {
|
|
29163
|
+
this.isEnded = true;
|
|
29164
|
+
} else {
|
|
29165
|
+
this.isEnded = false;
|
|
29166
|
+
this.isEndCalled = false;
|
|
29167
|
+
}
|
|
28321
29168
|
}
|
|
28322
29169
|
}
|
|
28323
29170
|
};
|
|
@@ -30643,8 +31490,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
30643
31490
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
30644
31491
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
30645
31492
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
30646
|
-
var version = "2.1.0-
|
|
31493
|
+
var version = "2.1.0-beta.0";
|
|
30647
31494
|
logger.info("Core version: " + version + ".");
|
|
30648
31495
|
|
|
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,
|
|
31496
|
+
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, 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, ShapeConnectType, ShapePointType, ShapePrimitiveType, 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 };
|
|
30650
31497
|
//# sourceMappingURL=index.mjs.map
|