@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.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.1.0-
|
|
6
|
+
* Version: v2.1.0-beta.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -1222,6 +1222,12 @@ function _inherits(subClass, superClass) {
|
|
|
1222
1222
|
/**
|
|
1223
1223
|
* 特效元素
|
|
1224
1224
|
*/ ItemType["effect"] = "effect";
|
|
1225
|
+
/**
|
|
1226
|
+
* 形状元素
|
|
1227
|
+
*/ ItemType["shape"] = "shape";
|
|
1228
|
+
/**
|
|
1229
|
+
* 后处理元素
|
|
1230
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
1225
1231
|
/**
|
|
1226
1232
|
* 节点元素
|
|
1227
1233
|
*/ ItemType["node"] = "node";
|
|
@@ -1231,6 +1237,9 @@ function _inherits(subClass, superClass) {
|
|
|
1231
1237
|
/**
|
|
1232
1238
|
* 音频元素
|
|
1233
1239
|
*/ ItemType["audio"] = "audio";
|
|
1240
|
+
/**
|
|
1241
|
+
* 富文本元素
|
|
1242
|
+
*/ ItemType["richtext"] = "richtext";
|
|
1234
1243
|
})(ItemType || (ItemType = {}));
|
|
1235
1244
|
/**
|
|
1236
1245
|
* 渲染模式
|
|
@@ -1606,6 +1615,30 @@ var TextAlignment;
|
|
|
1606
1615
|
*/ FontStyle["oblique"] = "oblique";
|
|
1607
1616
|
})(FontStyle || (FontStyle = {}));
|
|
1608
1617
|
|
|
1618
|
+
var BuiltinObjectGUID = {
|
|
1619
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
1620
|
+
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1621
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
1622
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* 动态换图类型
|
|
1627
|
+
* @since 1.1.0
|
|
1628
|
+
*/ var BackgroundType;
|
|
1629
|
+
(function(BackgroundType) {
|
|
1630
|
+
BackgroundType["video"] = "video";
|
|
1631
|
+
BackgroundType["image"] = "image";
|
|
1632
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1633
|
+
/**
|
|
1634
|
+
* 多媒体资源类型
|
|
1635
|
+
* @since 2.1.0
|
|
1636
|
+
*/ var MultimediaType;
|
|
1637
|
+
(function(MultimediaType) {
|
|
1638
|
+
MultimediaType["video"] = "video";
|
|
1639
|
+
MultimediaType["audio"] = "audio";
|
|
1640
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1641
|
+
|
|
1609
1642
|
var DataType;
|
|
1610
1643
|
(function(DataType) {
|
|
1611
1644
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1616,6 +1649,7 @@ var DataType;
|
|
|
1616
1649
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1617
1650
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1618
1651
|
DataType["CameraController"] = "CameraController";
|
|
1652
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1619
1653
|
DataType["Geometry"] = "Geometry";
|
|
1620
1654
|
DataType["Texture"] = "Texture";
|
|
1621
1655
|
DataType["AnimationClip"] = "AnimationClip";
|
|
@@ -1638,7 +1672,6 @@ var DataType;
|
|
|
1638
1672
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1639
1673
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1640
1674
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1641
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1642
1675
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1643
1676
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1644
1677
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1649,9 +1682,11 @@ var DataType;
|
|
|
1649
1682
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1650
1683
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1651
1684
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1685
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1652
1686
|
// Non-EffectObject
|
|
1653
1687
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1654
1688
|
})(DataType || (DataType = {}));
|
|
1689
|
+
|
|
1655
1690
|
var GeometryType;
|
|
1656
1691
|
(function(GeometryType) {
|
|
1657
1692
|
/**
|
|
@@ -1736,30 +1771,6 @@ var VertexBufferSemantic;
|
|
|
1736
1771
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1737
1772
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1738
1773
|
|
|
1739
|
-
var BuiltinObjectGUID = {
|
|
1740
|
-
WhiteTexture: "whitetexture00000000000000000000",
|
|
1741
|
-
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1742
|
-
PBRShader: "pbr00000000000000000000000000000",
|
|
1743
|
-
UnlitShader: "unlit000000000000000000000000000"
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
/**
|
|
1747
|
-
* 动态换图类型
|
|
1748
|
-
* @since 1.1.0
|
|
1749
|
-
*/ var BackgroundType;
|
|
1750
|
-
(function(BackgroundType) {
|
|
1751
|
-
BackgroundType["video"] = "video";
|
|
1752
|
-
BackgroundType["image"] = "image";
|
|
1753
|
-
})(BackgroundType || (BackgroundType = {}));
|
|
1754
|
-
/**
|
|
1755
|
-
* 多媒体资源类型
|
|
1756
|
-
* @since 2.1.0
|
|
1757
|
-
*/ var MultimediaType;
|
|
1758
|
-
(function(MultimediaType) {
|
|
1759
|
-
MultimediaType["video"] = "video";
|
|
1760
|
-
MultimediaType["audio"] = "audio";
|
|
1761
|
-
})(MultimediaType || (MultimediaType = {}));
|
|
1762
|
-
|
|
1763
1774
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1764
1775
|
__proto__: null,
|
|
1765
1776
|
get RenderLevel () { return RenderLevel; },
|
|
@@ -1804,14 +1815,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1804
1815
|
get TextAlignment () { return TextAlignment; },
|
|
1805
1816
|
get TextWeight () { return TextWeight; },
|
|
1806
1817
|
get FontStyle () { return FontStyle; },
|
|
1818
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1819
|
+
get BackgroundType () { return BackgroundType; },
|
|
1820
|
+
get MultimediaType () { return MultimediaType; },
|
|
1807
1821
|
get DataType () { return DataType; },
|
|
1808
1822
|
get GeometryType () { return GeometryType; },
|
|
1809
1823
|
get VertexFormatType () { return VertexFormatType; },
|
|
1810
1824
|
get IndexFormatType () { return IndexFormatType; },
|
|
1811
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1812
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1813
|
-
get BackgroundType () { return BackgroundType; },
|
|
1814
|
-
get MultimediaType () { return MultimediaType; }
|
|
1825
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1815
1826
|
});
|
|
1816
1827
|
|
|
1817
1828
|
function _defineProperties(target, props) {
|
|
@@ -1899,15 +1910,23 @@ function getDirectStore(target) {
|
|
|
1899
1910
|
this.engine.addInstance(this);
|
|
1900
1911
|
}
|
|
1901
1912
|
var _proto = EffectsObject.prototype;
|
|
1902
|
-
|
|
1913
|
+
/**
|
|
1914
|
+
*
|
|
1915
|
+
* @returns
|
|
1916
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1903
1917
|
return this.guid;
|
|
1904
1918
|
};
|
|
1905
|
-
|
|
1919
|
+
/**
|
|
1920
|
+
*
|
|
1921
|
+
* @param guid
|
|
1922
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1906
1923
|
this.engine.removeInstance(this.guid);
|
|
1907
1924
|
this.guid = guid;
|
|
1908
1925
|
this.engine.addInstance(this);
|
|
1909
1926
|
};
|
|
1910
|
-
|
|
1927
|
+
/**
|
|
1928
|
+
*
|
|
1929
|
+
*/ _proto.toData = function toData() {};
|
|
1911
1930
|
/**
|
|
1912
1931
|
* 反序列化函数
|
|
1913
1932
|
*
|
|
@@ -1917,8 +1936,14 @@ function getDirectStore(target) {
|
|
|
1917
1936
|
this.setInstanceId(data.id);
|
|
1918
1937
|
}
|
|
1919
1938
|
};
|
|
1920
|
-
|
|
1921
|
-
|
|
1939
|
+
/**
|
|
1940
|
+
*
|
|
1941
|
+
*/ _proto.dispose = function dispose() {};
|
|
1942
|
+
/**
|
|
1943
|
+
*
|
|
1944
|
+
* @param obj
|
|
1945
|
+
* @returns
|
|
1946
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1922
1947
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1923
1948
|
};
|
|
1924
1949
|
return EffectsObject;
|
|
@@ -1998,7 +2023,7 @@ function getDirectStore(target) {
|
|
|
1998
2023
|
this.onAwake();
|
|
1999
2024
|
this.isAwakeCalled = true;
|
|
2000
2025
|
}
|
|
2001
|
-
if (item.
|
|
2026
|
+
if (item.isActive && this.enabled) {
|
|
2002
2027
|
this.start();
|
|
2003
2028
|
this.enable();
|
|
2004
2029
|
}
|
|
@@ -2043,7 +2068,7 @@ function getDirectStore(target) {
|
|
|
2043
2068
|
get: /**
|
|
2044
2069
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2045
2070
|
*/ function get() {
|
|
2046
|
-
return this.item.
|
|
2071
|
+
return this.item.isActive && this.enabled;
|
|
2047
2072
|
}
|
|
2048
2073
|
},
|
|
2049
2074
|
{
|
|
@@ -3672,7 +3697,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3672
3697
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3673
3698
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3674
3699
|
|
|
3675
|
-
|
|
3700
|
+
/**
|
|
3701
|
+
* Mesh 组件
|
|
3702
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3676
3703
|
_inherits(MeshComponent, RendererComponent);
|
|
3677
3704
|
function MeshComponent() {
|
|
3678
3705
|
var _this;
|
|
@@ -3682,7 +3709,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3682
3709
|
*/ _this.meshCollider = new MeshCollider();
|
|
3683
3710
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3684
3711
|
_this.getHitTestParams = function(force) {
|
|
3685
|
-
var
|
|
3712
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3713
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3714
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3686
3715
|
if (area) {
|
|
3687
3716
|
return {
|
|
3688
3717
|
type: area.type,
|
|
@@ -3702,8 +3731,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3702
3731
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3703
3732
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3704
3733
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3705
|
-
var
|
|
3706
|
-
return
|
|
3734
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3735
|
+
return boundingBox;
|
|
3707
3736
|
};
|
|
3708
3737
|
return MeshComponent;
|
|
3709
3738
|
}(RendererComponent);
|
|
@@ -3741,24 +3770,29 @@ exports.EffectComponent = __decorate([
|
|
|
3741
3770
|
|
|
3742
3771
|
exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3743
3772
|
_inherits(PostProcessVolume, Behaviour);
|
|
3744
|
-
function PostProcessVolume() {
|
|
3773
|
+
function PostProcessVolume(engine) {
|
|
3745
3774
|
var _this;
|
|
3746
|
-
_this = Behaviour.
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
_this.
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
_this.
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3775
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3776
|
+
_this.bloom = {
|
|
3777
|
+
threshold: 0,
|
|
3778
|
+
intensity: 0,
|
|
3779
|
+
active: false
|
|
3780
|
+
};
|
|
3781
|
+
_this.vignette = {
|
|
3782
|
+
intensity: 0,
|
|
3783
|
+
smoothness: 0,
|
|
3784
|
+
roundness: 0,
|
|
3785
|
+
active: false
|
|
3786
|
+
};
|
|
3787
|
+
_this.tonemapping = {
|
|
3788
|
+
active: false
|
|
3789
|
+
};
|
|
3790
|
+
_this.colorAdjustments = {
|
|
3791
|
+
brightness: 0,
|
|
3792
|
+
saturation: 0,
|
|
3793
|
+
contrast: 0,
|
|
3794
|
+
active: false
|
|
3795
|
+
};
|
|
3762
3796
|
return _this;
|
|
3763
3797
|
}
|
|
3764
3798
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3772,36 +3806,18 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3772
3806
|
}(Behaviour);
|
|
3773
3807
|
__decorate([
|
|
3774
3808
|
serialize()
|
|
3775
|
-
], exports.PostProcessVolume.prototype, "
|
|
3776
|
-
__decorate([
|
|
3777
|
-
serialize()
|
|
3778
|
-
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
3809
|
+
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
3779
3810
|
__decorate([
|
|
3780
3811
|
serialize()
|
|
3781
|
-
], exports.PostProcessVolume.prototype, "
|
|
3812
|
+
], exports.PostProcessVolume.prototype, "vignette", void 0);
|
|
3782
3813
|
__decorate([
|
|
3783
3814
|
serialize()
|
|
3784
|
-
], exports.PostProcessVolume.prototype, "
|
|
3815
|
+
], exports.PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3785
3816
|
__decorate([
|
|
3786
3817
|
serialize()
|
|
3787
|
-
], exports.PostProcessVolume.prototype, "
|
|
3788
|
-
__decorate([
|
|
3789
|
-
serialize()
|
|
3790
|
-
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
3791
|
-
__decorate([
|
|
3792
|
-
serialize()
|
|
3793
|
-
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
3794
|
-
__decorate([
|
|
3795
|
-
serialize()
|
|
3796
|
-
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
3797
|
-
__decorate([
|
|
3798
|
-
serialize()
|
|
3799
|
-
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
3800
|
-
__decorate([
|
|
3801
|
-
serialize()
|
|
3802
|
-
], exports.PostProcessVolume.prototype, "toneMappingEnabled", void 0);
|
|
3818
|
+
], exports.PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3803
3819
|
exports.PostProcessVolume = __decorate([
|
|
3804
|
-
effectsClass(
|
|
3820
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3805
3821
|
], exports.PostProcessVolume);
|
|
3806
3822
|
|
|
3807
3823
|
function _assert_this_initialized(self) {
|
|
@@ -6888,6 +6904,7 @@ exports.MaterialRenderType = void 0;
|
|
|
6888
6904
|
_this.enabledMacros = {};
|
|
6889
6905
|
_this.destroyed = false;
|
|
6890
6906
|
_this.initialized = false;
|
|
6907
|
+
_this.shaderDirty = true;
|
|
6891
6908
|
if (props) {
|
|
6892
6909
|
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$8++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
6893
6910
|
_this.name = name;
|
|
@@ -6915,6 +6932,41 @@ exports.MaterialRenderType = void 0;
|
|
|
6915
6932
|
// OVERRIDE
|
|
6916
6933
|
};
|
|
6917
6934
|
_create_class(Material, [
|
|
6935
|
+
{
|
|
6936
|
+
key: "shader",
|
|
6937
|
+
get: function get() {
|
|
6938
|
+
return this._shader;
|
|
6939
|
+
},
|
|
6940
|
+
set: function set(value) {
|
|
6941
|
+
if (this._shader === value) {
|
|
6942
|
+
return;
|
|
6943
|
+
}
|
|
6944
|
+
this._shader = value;
|
|
6945
|
+
this.shaderDirty = true;
|
|
6946
|
+
}
|
|
6947
|
+
},
|
|
6948
|
+
{
|
|
6949
|
+
key: "mainTexture",
|
|
6950
|
+
get: /**
|
|
6951
|
+
* 材质的主纹理
|
|
6952
|
+
*/ function get() {
|
|
6953
|
+
return this.getTexture("_MainTex");
|
|
6954
|
+
},
|
|
6955
|
+
set: function set(value) {
|
|
6956
|
+
this.setTexture("_MainTex", value);
|
|
6957
|
+
}
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
key: "color",
|
|
6961
|
+
get: /**
|
|
6962
|
+
* 材质的主颜色
|
|
6963
|
+
*/ function get() {
|
|
6964
|
+
return this.getColor("_Color");
|
|
6965
|
+
},
|
|
6966
|
+
set: function set(value) {
|
|
6967
|
+
this.setColor("_Color", value);
|
|
6968
|
+
}
|
|
6969
|
+
},
|
|
6918
6970
|
{
|
|
6919
6971
|
key: "blending",
|
|
6920
6972
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10051,7 +10103,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10051
10103
|
|
|
10052
10104
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10053
10105
|
|
|
10054
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10106
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10055
10107
|
|
|
10056
10108
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
10057
10109
|
|
|
@@ -10282,15 +10334,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10282
10334
|
renderer.setFramebuffer(this.framebuffer);
|
|
10283
10335
|
};
|
|
10284
10336
|
_proto.execute = function execute(renderer) {
|
|
10285
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10337
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10286
10338
|
renderer.clear({
|
|
10287
10339
|
colorAction: exports.TextureStoreAction.clear,
|
|
10288
10340
|
depthAction: exports.TextureStoreAction.clear,
|
|
10289
10341
|
stencilAction: exports.TextureStoreAction.clear
|
|
10290
10342
|
});
|
|
10291
10343
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10292
|
-
var
|
|
10293
|
-
var threshold = (
|
|
10344
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10345
|
+
var threshold = (_renderer_renderingData_currentFrame_globalVolume_bloom_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : (_renderer_renderingData_currentFrame_globalVolume_bloom = _renderer_renderingData_currentFrame_globalVolume.bloom) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume_bloom.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_bloom_threshold : 1.0;
|
|
10294
10346
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10295
10347
|
renderer.renderMeshes([
|
|
10296
10348
|
this.screenMesh
|
|
@@ -10503,25 +10555,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10503
10555
|
depthAction: exports.TextureStoreAction.clear,
|
|
10504
10556
|
stencilAction: exports.TextureStoreAction.clear
|
|
10505
10557
|
});
|
|
10506
|
-
var
|
|
10507
|
-
var
|
|
10558
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10559
|
+
var bloom = _extends({
|
|
10560
|
+
threshold: 0,
|
|
10561
|
+
intensity: 0,
|
|
10562
|
+
active: false
|
|
10563
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10564
|
+
var vignette = _extends({
|
|
10565
|
+
intensity: 0,
|
|
10566
|
+
smoothness: 0,
|
|
10567
|
+
roundness: 0,
|
|
10568
|
+
active: false
|
|
10569
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10570
|
+
var colorAdjustments = _extends({
|
|
10571
|
+
brightness: 0,
|
|
10572
|
+
saturation: 0,
|
|
10573
|
+
contrast: 0,
|
|
10574
|
+
active: false
|
|
10575
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10576
|
+
var tonemapping = _extends({
|
|
10577
|
+
active: false
|
|
10578
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10508
10579
|
this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
|
|
10509
|
-
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
10510
|
-
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
10511
|
-
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
10512
|
-
this.screenMesh.material.setInt("_UseBloom", Number(
|
|
10513
|
-
if (
|
|
10580
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10581
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10582
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10583
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10584
|
+
if (bloom.active) {
|
|
10514
10585
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10515
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10586
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10516
10587
|
}
|
|
10517
|
-
if (
|
|
10518
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10519
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10520
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10588
|
+
if (vignette.intensity > 0) {
|
|
10589
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10590
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10591
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10521
10592
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10522
10593
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10523
10594
|
}
|
|
10524
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10595
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10525
10596
|
renderer.renderMeshes([
|
|
10526
10597
|
this.screenMesh
|
|
10527
10598
|
]);
|
|
@@ -10561,6 +10632,9 @@ var seed$5 = 1;
|
|
|
10561
10632
|
this.renderer = renderer;
|
|
10562
10633
|
if (postProcessingEnabled) {
|
|
10563
10634
|
var enableHDR = true;
|
|
10635
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10636
|
+
throw new Error("Half float texture is not supported.");
|
|
10637
|
+
}
|
|
10564
10638
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10565
10639
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10566
10640
|
attachments = [
|
|
@@ -13306,7 +13380,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13306
13380
|
return ColorCurve;
|
|
13307
13381
|
}(ValueGetter);
|
|
13308
13382
|
|
|
13309
|
-
|
|
13383
|
+
/**
|
|
13384
|
+
* @since 2.1.0
|
|
13385
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13310
13386
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13311
13387
|
function BaseRenderComponent(engine) {
|
|
13312
13388
|
var _this;
|
|
@@ -13393,7 +13469,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13393
13469
|
* @param texture - 纹理对象
|
|
13394
13470
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13395
13471
|
this.renderer.texture = texture;
|
|
13396
|
-
this.material.setTexture("
|
|
13472
|
+
this.material.setTexture("_MainTex", texture);
|
|
13397
13473
|
};
|
|
13398
13474
|
/**
|
|
13399
13475
|
* @internal
|
|
@@ -13472,51 +13548,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13472
13548
|
geometry.setIndexData(indexData);
|
|
13473
13549
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13474
13550
|
geometry.setDrawCount(data.index.length);
|
|
13475
|
-
|
|
13476
|
-
var texture1 = textures[i];
|
|
13477
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13478
|
-
}
|
|
13479
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13480
|
-
var emptyTexture = this.emptyTexture;
|
|
13481
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13482
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13483
|
-
}
|
|
13551
|
+
material.setTexture("_MainTex", texture);
|
|
13484
13552
|
};
|
|
13485
13553
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13486
|
-
this.
|
|
13487
|
-
|
|
13488
|
-
0.
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
0
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
2,
|
|
13506
|
-
1,
|
|
13507
|
-
3
|
|
13508
|
-
],
|
|
13509
|
-
atlasOffset: [
|
|
13554
|
+
var renderer = this.renderer;
|
|
13555
|
+
if (renderer.shape) {
|
|
13556
|
+
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;
|
|
13557
|
+
var point = new Float32Array(aPoint);
|
|
13558
|
+
var position = [];
|
|
13559
|
+
var atlasOffset = [];
|
|
13560
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13561
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13562
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13563
|
+
}
|
|
13564
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13565
|
+
return {
|
|
13566
|
+
index: index,
|
|
13567
|
+
atlasOffset: atlasOffset
|
|
13568
|
+
};
|
|
13569
|
+
} else {
|
|
13570
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13571
|
+
-0.5,
|
|
13572
|
+
0.5,
|
|
13510
13573
|
0,
|
|
13511
|
-
|
|
13574
|
+
-0.5,
|
|
13575
|
+
-0.5,
|
|
13512
13576
|
0,
|
|
13577
|
+
0.5,
|
|
13578
|
+
0.5,
|
|
13513
13579
|
0,
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
1,
|
|
13580
|
+
0.5,
|
|
13581
|
+
-0.5,
|
|
13517
13582
|
0
|
|
13518
|
-
]
|
|
13519
|
-
|
|
13583
|
+
]));
|
|
13584
|
+
return {
|
|
13585
|
+
index: [
|
|
13586
|
+
0,
|
|
13587
|
+
1,
|
|
13588
|
+
2,
|
|
13589
|
+
2,
|
|
13590
|
+
1,
|
|
13591
|
+
3
|
|
13592
|
+
],
|
|
13593
|
+
atlasOffset: [
|
|
13594
|
+
0,
|
|
13595
|
+
1,
|
|
13596
|
+
0,
|
|
13597
|
+
0,
|
|
13598
|
+
1,
|
|
13599
|
+
1,
|
|
13600
|
+
1,
|
|
13601
|
+
0
|
|
13602
|
+
]
|
|
13603
|
+
};
|
|
13604
|
+
}
|
|
13520
13605
|
};
|
|
13521
13606
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13522
13607
|
return Geometry.create(this.engine, {
|
|
@@ -13581,7 +13666,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13581
13666
|
setBlendMode(material, states.blendMode);
|
|
13582
13667
|
setMaskMode(material, states.maskMode);
|
|
13583
13668
|
setSideMode(material, states.side);
|
|
13584
|
-
material.shader.shaderData.properties = '
|
|
13669
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13585
13670
|
if (!material.hasUniform("_Color")) {
|
|
13586
13671
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13587
13672
|
}
|
|
@@ -15175,76 +15260,569 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15175
15260
|
return Ellipse;
|
|
15176
15261
|
}(ShapePrimitive);
|
|
15177
15262
|
|
|
15178
|
-
var
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15263
|
+
var StarType;
|
|
15264
|
+
(function(StarType) {
|
|
15265
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15266
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15267
|
+
})(StarType || (StarType = {}));
|
|
15268
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15269
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15270
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15271
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15272
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15273
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15274
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15275
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15276
|
+
if (starType === void 0) starType = 0;
|
|
15277
|
+
var _this;
|
|
15278
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15279
|
+
_this.pointCount = pointCount;
|
|
15280
|
+
_this.outerRadius = outerRadius;
|
|
15281
|
+
_this.innerRadius = innerRadius;
|
|
15282
|
+
_this.outerRoundness = outerRoundness;
|
|
15283
|
+
_this.innerRoundness = innerRoundness;
|
|
15284
|
+
_this.starType = starType;
|
|
15285
|
+
_this.v = [];
|
|
15286
|
+
_this.in = [];
|
|
15287
|
+
_this.out = [];
|
|
15288
|
+
return _this;
|
|
15183
15289
|
}
|
|
15184
|
-
var _proto =
|
|
15185
|
-
|
|
15186
|
-
this.
|
|
15187
|
-
|
|
15188
|
-
var path = this.graphicsPath;
|
|
15189
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
|
|
15190
|
-
var instruction = _step.value;
|
|
15191
|
-
var action = instruction.action;
|
|
15192
|
-
var data = instruction.data;
|
|
15193
|
-
switch(action){
|
|
15194
|
-
case "bezierCurveTo":
|
|
15195
|
-
{
|
|
15196
|
-
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15197
|
-
break;
|
|
15198
|
-
}
|
|
15199
|
-
case "moveTo":
|
|
15200
|
-
{
|
|
15201
|
-
this.moveTo(data[0], data[1]);
|
|
15202
|
-
break;
|
|
15203
|
-
}
|
|
15204
|
-
case "ellipse":
|
|
15205
|
-
{
|
|
15206
|
-
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15207
|
-
break;
|
|
15208
|
-
}
|
|
15209
|
-
}
|
|
15210
|
-
}
|
|
15211
|
-
this.endPoly();
|
|
15290
|
+
var _proto = PolyStar.prototype;
|
|
15291
|
+
_proto.clone = function clone() {
|
|
15292
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15293
|
+
return polyStar;
|
|
15212
15294
|
};
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
* @param cp2y - The y-coordinate of the second control point.
|
|
15221
|
-
* @param x - The x-coordinate of the end point.
|
|
15222
|
-
* @param y - The y-coordinate of the end point.
|
|
15223
|
-
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
15224
|
-
* @returns The instance of the current object for chaining.
|
|
15225
|
-
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
15226
|
-
this.ensurePoly();
|
|
15227
|
-
var currentPoly = this.currentPoly;
|
|
15228
|
-
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
15229
|
-
return this;
|
|
15295
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15296
|
+
this.pointCount = source.pointCount;
|
|
15297
|
+
this.outerRadius = source.outerRadius;
|
|
15298
|
+
this.innerRadius = source.innerRadius;
|
|
15299
|
+
this.outerRoundness = source.outerRoundness;
|
|
15300
|
+
this.innerRoundness = source.innerRoundness;
|
|
15301
|
+
this.starType = source.starType;
|
|
15230
15302
|
};
|
|
15231
|
-
_proto.
|
|
15232
|
-
|
|
15233
|
-
return this;
|
|
15303
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15304
|
+
destination.copyFrom(this);
|
|
15234
15305
|
};
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15306
|
+
_proto.build = function build(points) {
|
|
15307
|
+
switch(this.starType){
|
|
15308
|
+
case 0:
|
|
15309
|
+
{
|
|
15310
|
+
this.buildStarPath();
|
|
15311
|
+
break;
|
|
15312
|
+
}
|
|
15313
|
+
case 1:
|
|
15314
|
+
{
|
|
15315
|
+
this.buildPolygonPath();
|
|
15316
|
+
break;
|
|
15317
|
+
}
|
|
15318
|
+
}
|
|
15319
|
+
var smoothness = 1;
|
|
15320
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15321
|
+
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);
|
|
15322
|
+
}
|
|
15323
|
+
// draw last curve
|
|
15324
|
+
var lastIndex = this.v.length - 1;
|
|
15325
|
+
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);
|
|
15326
|
+
};
|
|
15327
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15328
|
+
var triangles = triangulate([
|
|
15329
|
+
points
|
|
15330
|
+
]);
|
|
15331
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15332
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15333
|
+
}
|
|
15334
|
+
var vertexCount = triangles.length / 2;
|
|
15335
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15336
|
+
indices[indicesOffset + i1] = i1;
|
|
15337
|
+
}
|
|
15338
|
+
};
|
|
15339
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15340
|
+
this.v = [];
|
|
15341
|
+
this.in = [];
|
|
15342
|
+
this.out = [];
|
|
15343
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15344
|
+
var angle = Math.PI * 2 / numPts;
|
|
15345
|
+
var longFlag = true;
|
|
15346
|
+
var longRad = this.outerRadius;
|
|
15347
|
+
var shortRad = this.innerRadius;
|
|
15348
|
+
var longRound = this.outerRoundness / 100;
|
|
15349
|
+
var shortRound = this.innerRoundness / 100;
|
|
15350
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15351
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15352
|
+
var i;
|
|
15353
|
+
var rad;
|
|
15354
|
+
var roundness;
|
|
15355
|
+
var perimSegment;
|
|
15356
|
+
var currentAng = -Math.PI / 2;
|
|
15357
|
+
var dir = 1;
|
|
15358
|
+
for(i = 0; i < numPts; i++){
|
|
15359
|
+
rad = longFlag ? longRad : shortRad;
|
|
15360
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15361
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15362
|
+
var x = rad * Math.cos(currentAng);
|
|
15363
|
+
var y = rad * Math.sin(currentAng);
|
|
15364
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15365
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15366
|
+
var offset = i * 2;
|
|
15367
|
+
this.v[offset] = x;
|
|
15368
|
+
this.v[offset + 1] = y;
|
|
15369
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15370
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15371
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15372
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15373
|
+
longFlag = !longFlag;
|
|
15374
|
+
currentAng += angle * dir;
|
|
15375
|
+
}
|
|
15376
|
+
};
|
|
15377
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15378
|
+
this.v = [];
|
|
15379
|
+
this.in = [];
|
|
15380
|
+
this.out = [];
|
|
15381
|
+
var numPts = Math.floor(this.pointCount);
|
|
15382
|
+
var angle = Math.PI * 2 / numPts;
|
|
15383
|
+
var rad = this.outerRadius;
|
|
15384
|
+
var roundness = this.outerRoundness / 100;
|
|
15385
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15386
|
+
var i;
|
|
15387
|
+
var currentAng = -Math.PI * 0.5;
|
|
15388
|
+
var dir = 1;
|
|
15389
|
+
for(i = 0; i < numPts; i++){
|
|
15390
|
+
var x = rad * Math.cos(currentAng);
|
|
15391
|
+
var y = rad * Math.sin(currentAng);
|
|
15392
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15393
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15394
|
+
var offset = i * 2;
|
|
15395
|
+
this.v[offset] = x;
|
|
15396
|
+
this.v[offset + 1] = y;
|
|
15397
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15398
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15399
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15400
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15401
|
+
currentAng += angle * dir;
|
|
15402
|
+
}
|
|
15403
|
+
};
|
|
15404
|
+
return PolyStar;
|
|
15405
|
+
}(ShapePrimitive);
|
|
15406
|
+
|
|
15407
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15408
|
+
/**
|
|
15409
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
15410
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15411
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15412
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15413
|
+
function Rectangle(x, y, width, height) {
|
|
15414
|
+
if (x === void 0) x = 0;
|
|
15415
|
+
if (y === void 0) y = 0;
|
|
15416
|
+
if (width === void 0) width = 0;
|
|
15417
|
+
if (height === void 0) height = 0;
|
|
15418
|
+
var _this;
|
|
15419
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15420
|
+
_this.x = Number(x);
|
|
15421
|
+
_this.y = Number(y);
|
|
15422
|
+
_this.width = Number(width);
|
|
15423
|
+
_this.height = Number(height);
|
|
15424
|
+
return _this;
|
|
15425
|
+
}
|
|
15426
|
+
var _proto = Rectangle.prototype;
|
|
15427
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15428
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15429
|
+
};
|
|
15430
|
+
/**
|
|
15431
|
+
* Creates a clone of this Rectangle
|
|
15432
|
+
* @returns a copy of the rectangle
|
|
15433
|
+
*/ _proto.clone = function clone() {
|
|
15434
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15435
|
+
};
|
|
15436
|
+
/**
|
|
15437
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15438
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15439
|
+
* @returns Returns itself.
|
|
15440
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15441
|
+
// this.x = bounds.minX;
|
|
15442
|
+
// this.y = bounds.minY;
|
|
15443
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15444
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15445
|
+
// return this;
|
|
15446
|
+
// }
|
|
15447
|
+
/**
|
|
15448
|
+
* Copies another rectangle to this one.
|
|
15449
|
+
* @param rectangle - The rectangle to copy from.
|
|
15450
|
+
* @returns Returns itself.
|
|
15451
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15452
|
+
this.x = rectangle.x;
|
|
15453
|
+
this.y = rectangle.y;
|
|
15454
|
+
this.width = rectangle.width;
|
|
15455
|
+
this.height = rectangle.height;
|
|
15456
|
+
return this;
|
|
15457
|
+
};
|
|
15458
|
+
/**
|
|
15459
|
+
* Copies this rectangle to another one.
|
|
15460
|
+
* @param rectangle - The rectangle to copy to.
|
|
15461
|
+
* @returns Returns given parameter.
|
|
15462
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15463
|
+
rectangle.copyFrom(this);
|
|
15464
|
+
return rectangle;
|
|
15465
|
+
};
|
|
15466
|
+
/**
|
|
15467
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15468
|
+
* @param x - The X coordinate of the point to test
|
|
15469
|
+
* @param y - The Y coordinate of the point to test
|
|
15470
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15471
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15472
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15473
|
+
return false;
|
|
15474
|
+
}
|
|
15475
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15476
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15477
|
+
return true;
|
|
15478
|
+
}
|
|
15479
|
+
}
|
|
15480
|
+
return false;
|
|
15481
|
+
};
|
|
15482
|
+
/**
|
|
15483
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15484
|
+
* @param x - The X coordinate of the point to test
|
|
15485
|
+
* @param y - The Y coordinate of the point to test
|
|
15486
|
+
* @param strokeWidth - The width of the line to check
|
|
15487
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15488
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15489
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15490
|
+
if (width <= 0 || height <= 0) {
|
|
15491
|
+
return false;
|
|
15492
|
+
}
|
|
15493
|
+
var _x = this.x;
|
|
15494
|
+
var _y = this.y;
|
|
15495
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15496
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15497
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15498
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15499
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15500
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15501
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15502
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15503
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15504
|
+
};
|
|
15505
|
+
/**
|
|
15506
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15507
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15508
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15509
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15510
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15511
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15512
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15513
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15514
|
+
// if (!transform) {
|
|
15515
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15516
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15517
|
+
// if (x1 <= x0) {
|
|
15518
|
+
// return false;
|
|
15519
|
+
// }
|
|
15520
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15521
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15522
|
+
// return y1 > y0;
|
|
15523
|
+
// }
|
|
15524
|
+
// const x0 = this.left;
|
|
15525
|
+
// const x1 = this.right;
|
|
15526
|
+
// const y0 = this.top;
|
|
15527
|
+
// const y1 = this.bottom;
|
|
15528
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15529
|
+
// return false;
|
|
15530
|
+
// }
|
|
15531
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15532
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15533
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15534
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15535
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15536
|
+
// return false;
|
|
15537
|
+
// }
|
|
15538
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15539
|
+
// if (s === 0) {
|
|
15540
|
+
// return false;
|
|
15541
|
+
// }
|
|
15542
|
+
// transform.apply(lt, lt);
|
|
15543
|
+
// transform.apply(lb, lb);
|
|
15544
|
+
// transform.apply(rt, rt);
|
|
15545
|
+
// transform.apply(rb, rb);
|
|
15546
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15547
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15548
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15549
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15550
|
+
// return false;
|
|
15551
|
+
// }
|
|
15552
|
+
// const nx = s * (lb.y - lt.y);
|
|
15553
|
+
// const ny = s * (lt.x - lb.x);
|
|
15554
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15555
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15556
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15557
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15558
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15559
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15560
|
+
// return false;
|
|
15561
|
+
// }
|
|
15562
|
+
// const mx = s * (lt.y - rt.y);
|
|
15563
|
+
// const my = s * (rt.x - lt.x);
|
|
15564
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15565
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15566
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15567
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15568
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15569
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15570
|
+
// return false;
|
|
15571
|
+
// }
|
|
15572
|
+
// return true;
|
|
15573
|
+
// }
|
|
15574
|
+
/**
|
|
15575
|
+
* Pads the rectangle making it grow in all directions.
|
|
15576
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15577
|
+
* @param paddingX - The horizontal padding amount.
|
|
15578
|
+
* @param paddingY - The vertical padding amount.
|
|
15579
|
+
* @returns Returns itself.
|
|
15580
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15581
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15582
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15583
|
+
this.x -= paddingX;
|
|
15584
|
+
this.y -= paddingY;
|
|
15585
|
+
this.width += paddingX * 2;
|
|
15586
|
+
this.height += paddingY * 2;
|
|
15587
|
+
return this;
|
|
15588
|
+
};
|
|
15589
|
+
/**
|
|
15590
|
+
* Fits this rectangle around the passed one.
|
|
15591
|
+
* @param rectangle - The rectangle to fit.
|
|
15592
|
+
* @returns Returns itself.
|
|
15593
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15594
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15595
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15596
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15597
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15598
|
+
this.x = x1;
|
|
15599
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15600
|
+
this.y = y1;
|
|
15601
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15602
|
+
return this;
|
|
15603
|
+
};
|
|
15604
|
+
/**
|
|
15605
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15606
|
+
* @param resolution - resolution
|
|
15607
|
+
* @param eps - precision
|
|
15608
|
+
* @returns Returns itself.
|
|
15609
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15610
|
+
if (resolution === void 0) resolution = 1;
|
|
15611
|
+
if (eps === void 0) eps = 0.001;
|
|
15612
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15613
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15614
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15615
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15616
|
+
this.width = x2 - this.x;
|
|
15617
|
+
this.height = y2 - this.y;
|
|
15618
|
+
return this;
|
|
15619
|
+
};
|
|
15620
|
+
/**
|
|
15621
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15622
|
+
* @param rectangle - The rectangle to include.
|
|
15623
|
+
* @returns Returns itself.
|
|
15624
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15625
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15626
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15627
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15628
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15629
|
+
this.x = x1;
|
|
15630
|
+
this.width = x2 - x1;
|
|
15631
|
+
this.y = y1;
|
|
15632
|
+
this.height = y2 - y1;
|
|
15633
|
+
return this;
|
|
15634
|
+
};
|
|
15635
|
+
/**
|
|
15636
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15637
|
+
* @param out - optional rectangle to store the result
|
|
15638
|
+
* @returns The framing rectangle
|
|
15639
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15640
|
+
out = out || new Rectangle();
|
|
15641
|
+
out.copyFrom(this);
|
|
15642
|
+
return out;
|
|
15643
|
+
};
|
|
15644
|
+
_proto.getX = function getX() {
|
|
15645
|
+
return this.x;
|
|
15646
|
+
};
|
|
15647
|
+
_proto.getY = function getY() {
|
|
15648
|
+
return this.y;
|
|
15649
|
+
};
|
|
15650
|
+
_proto.build = function build(points) {
|
|
15651
|
+
var x = this.x;
|
|
15652
|
+
var y = this.y;
|
|
15653
|
+
var width = this.width;
|
|
15654
|
+
var height = this.height;
|
|
15655
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15656
|
+
return points;
|
|
15657
|
+
}
|
|
15658
|
+
points[0] = x;
|
|
15659
|
+
points[1] = y;
|
|
15660
|
+
points[2] = x + width;
|
|
15661
|
+
points[3] = y;
|
|
15662
|
+
points[4] = x + width;
|
|
15663
|
+
points[5] = y + height;
|
|
15664
|
+
points[6] = x;
|
|
15665
|
+
points[7] = y + height;
|
|
15666
|
+
return points;
|
|
15667
|
+
};
|
|
15668
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15669
|
+
var count = 0;
|
|
15670
|
+
var verticesStride = 2;
|
|
15671
|
+
verticesOffset *= verticesStride;
|
|
15672
|
+
vertices[verticesOffset + count] = points[0];
|
|
15673
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15674
|
+
count += verticesStride;
|
|
15675
|
+
vertices[verticesOffset + count] = points[2];
|
|
15676
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15677
|
+
count += verticesStride;
|
|
15678
|
+
vertices[verticesOffset + count] = points[6];
|
|
15679
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15680
|
+
count += verticesStride;
|
|
15681
|
+
vertices[verticesOffset + count] = points[4];
|
|
15682
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15683
|
+
count += verticesStride;
|
|
15684
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15685
|
+
// triangle 1
|
|
15686
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15687
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15688
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15689
|
+
// triangle 2
|
|
15690
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15691
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15692
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15693
|
+
};
|
|
15694
|
+
_create_class(Rectangle, [
|
|
15695
|
+
{
|
|
15696
|
+
key: "left",
|
|
15697
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15698
|
+
return this.x;
|
|
15699
|
+
}
|
|
15700
|
+
},
|
|
15701
|
+
{
|
|
15702
|
+
key: "right",
|
|
15703
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15704
|
+
return this.x + this.width;
|
|
15705
|
+
}
|
|
15706
|
+
},
|
|
15707
|
+
{
|
|
15708
|
+
key: "top",
|
|
15709
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15710
|
+
return this.y;
|
|
15711
|
+
}
|
|
15712
|
+
},
|
|
15713
|
+
{
|
|
15714
|
+
key: "bottom",
|
|
15715
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15716
|
+
return this.y + this.height;
|
|
15717
|
+
}
|
|
15718
|
+
}
|
|
15719
|
+
], [
|
|
15720
|
+
{
|
|
15721
|
+
key: "EMPTY",
|
|
15722
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15723
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15724
|
+
}
|
|
15725
|
+
}
|
|
15726
|
+
]);
|
|
15727
|
+
return Rectangle;
|
|
15728
|
+
}(ShapePrimitive);
|
|
15729
|
+
|
|
15730
|
+
var ShapePath = /*#__PURE__*/ function() {
|
|
15731
|
+
function ShapePath(graphicsPath) {
|
|
15732
|
+
this.graphicsPath = graphicsPath;
|
|
15733
|
+
this.currentPoly = null;
|
|
15734
|
+
this.shapePrimitives = [];
|
|
15735
|
+
}
|
|
15736
|
+
var _proto = ShapePath.prototype;
|
|
15737
|
+
/** Builds the path. */ _proto.buildPath = function buildPath() {
|
|
15738
|
+
this.currentPoly = null;
|
|
15739
|
+
this.shapePrimitives.length = 0;
|
|
15740
|
+
var path = this.graphicsPath;
|
|
15741
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(path.instructions), _step; !(_step = _iterator()).done;){
|
|
15742
|
+
var instruction = _step.value;
|
|
15743
|
+
var action = instruction.action;
|
|
15744
|
+
var data = instruction.data;
|
|
15745
|
+
switch(action){
|
|
15746
|
+
case "bezierCurveTo":
|
|
15747
|
+
{
|
|
15748
|
+
this.bezierCurveTo(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15749
|
+
break;
|
|
15750
|
+
}
|
|
15751
|
+
case "moveTo":
|
|
15752
|
+
{
|
|
15753
|
+
this.moveTo(data[0], data[1]);
|
|
15754
|
+
break;
|
|
15755
|
+
}
|
|
15756
|
+
case "ellipse":
|
|
15757
|
+
{
|
|
15758
|
+
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15759
|
+
break;
|
|
15760
|
+
}
|
|
15761
|
+
case "polyStar":
|
|
15762
|
+
{
|
|
15763
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15764
|
+
break;
|
|
15765
|
+
}
|
|
15766
|
+
case "rect":
|
|
15767
|
+
{
|
|
15768
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15769
|
+
break;
|
|
15770
|
+
}
|
|
15771
|
+
}
|
|
15772
|
+
}
|
|
15773
|
+
this.endPoly();
|
|
15774
|
+
};
|
|
15775
|
+
/**
|
|
15776
|
+
* Adds a cubic Bezier curve to the path.
|
|
15777
|
+
* It requires three points: the first two are control points and the third one is the end point.
|
|
15778
|
+
* The starting point is the last point in the current path.
|
|
15779
|
+
* @param cp1x - The x-coordinate of the first control point.
|
|
15780
|
+
* @param cp1y - The y-coordinate of the first control point.
|
|
15781
|
+
* @param cp2x - The x-coordinate of the second control point.
|
|
15782
|
+
* @param cp2y - The y-coordinate of the second control point.
|
|
15783
|
+
* @param x - The x-coordinate of the end point.
|
|
15784
|
+
* @param y - The y-coordinate of the end point.
|
|
15785
|
+
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
15786
|
+
* @returns The instance of the current object for chaining.
|
|
15787
|
+
*/ _proto.bezierCurveTo = function bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, smoothness) {
|
|
15788
|
+
this.ensurePoly();
|
|
15789
|
+
var currentPoly = this.currentPoly;
|
|
15790
|
+
buildAdaptiveBezier(currentPoly.points, currentPoly.lastX, currentPoly.lastY, cp1x, cp1y, cp2x, cp2y, x, y, smoothness);
|
|
15791
|
+
return this;
|
|
15792
|
+
};
|
|
15793
|
+
_proto.moveTo = function moveTo(x, y) {
|
|
15794
|
+
this.startPoly(x, y);
|
|
15795
|
+
return this;
|
|
15796
|
+
};
|
|
15797
|
+
/**
|
|
15798
|
+
* Draws an ellipse at the specified location and with the given x and y radii.
|
|
15799
|
+
* An optional transformation can be applied, allowing for rotation, scaling, and translation.
|
|
15800
|
+
* @param x - The x-coordinate of the center of the ellipse.
|
|
15801
|
+
* @param y - The y-coordinate of the center of the ellipse.
|
|
15802
|
+
* @param radiusX - The horizontal radius of the ellipse.
|
|
15803
|
+
* @param radiusY - The vertical radius of the ellipse.
|
|
15804
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
|
|
15805
|
+
* @returns The instance of the current object for chaining.
|
|
15806
|
+
*/ _proto.ellipse = function ellipse(x, y, radiusX, radiusY, transform) {
|
|
15807
|
+
// TODO apply rotation to transform...
|
|
15808
|
+
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15809
|
+
return this;
|
|
15810
|
+
};
|
|
15811
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15812
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15813
|
+
return this;
|
|
15814
|
+
};
|
|
15815
|
+
/**
|
|
15816
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15817
|
+
* @param x - The x-coordinate of the top-left corner of the rectangle.
|
|
15818
|
+
* @param y - The y-coordinate of the top-left corner of the rectangle.
|
|
15819
|
+
* @param w - The width of the rectangle.
|
|
15820
|
+
* @param h - The height of the rectangle.
|
|
15821
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15822
|
+
* @returns The instance of the current object for chaining.
|
|
15823
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15824
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15825
|
+
return this;
|
|
15248
15826
|
};
|
|
15249
15827
|
/**
|
|
15250
15828
|
* Draws a given shape on the canvas.
|
|
@@ -15402,6 +15980,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15402
15980
|
this.dirty = true;
|
|
15403
15981
|
return this;
|
|
15404
15982
|
};
|
|
15983
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15984
|
+
this.instructions.push({
|
|
15985
|
+
action: "polyStar",
|
|
15986
|
+
data: [
|
|
15987
|
+
pointCount,
|
|
15988
|
+
outerRadius,
|
|
15989
|
+
innerRadius,
|
|
15990
|
+
outerRoundness,
|
|
15991
|
+
innerRoundness,
|
|
15992
|
+
starType,
|
|
15993
|
+
transform
|
|
15994
|
+
]
|
|
15995
|
+
});
|
|
15996
|
+
this.dirty = true;
|
|
15997
|
+
return this;
|
|
15998
|
+
};
|
|
15405
15999
|
_proto.clear = function clear() {
|
|
15406
16000
|
this.instructions.length = 0;
|
|
15407
16001
|
this.dirty = true;
|
|
@@ -15479,7 +16073,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15479
16073
|
};
|
|
15480
16074
|
_this.material = Material.create(engine, materialProps);
|
|
15481
16075
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15482
|
-
_this.material.depthMask =
|
|
16076
|
+
_this.material.depthMask = false;
|
|
15483
16077
|
_this.material.depthTest = true;
|
|
15484
16078
|
_this.material.blending = true;
|
|
15485
16079
|
}
|
|
@@ -15544,16 +16138,18 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15544
16138
|
};
|
|
15545
16139
|
_proto.buildPath = function buildPath(data) {
|
|
15546
16140
|
this.path.clear();
|
|
15547
|
-
|
|
16141
|
+
var shapeData = data;
|
|
16142
|
+
switch(shapeData.type){
|
|
15548
16143
|
case 0:
|
|
15549
16144
|
{
|
|
15550
|
-
var customData =
|
|
15551
|
-
var points = customData.
|
|
15552
|
-
var easingIns = customData.
|
|
15553
|
-
var easingOuts = customData.
|
|
16145
|
+
var customData = shapeData;
|
|
16146
|
+
var points = customData.points;
|
|
16147
|
+
var easingIns = customData.easingIns;
|
|
16148
|
+
var easingOuts = customData.easingOuts;
|
|
15554
16149
|
this.curveValues = [];
|
|
15555
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
16150
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15556
16151
|
var shape = _step.value;
|
|
16152
|
+
this.setFillColor(shape.fill);
|
|
15557
16153
|
var indices = shape.indexes;
|
|
15558
16154
|
for(var i = 1; i < indices.length; i++){
|
|
15559
16155
|
var pointIndex = indices[i];
|
|
@@ -15583,45 +16179,206 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15583
16179
|
}
|
|
15584
16180
|
case 2:
|
|
15585
16181
|
{
|
|
15586
|
-
var ellipseData =
|
|
15587
|
-
|
|
15588
|
-
this.
|
|
16182
|
+
var ellipseData = shapeData;
|
|
16183
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16184
|
+
this.setFillColor(ellipseData.fill);
|
|
16185
|
+
break;
|
|
16186
|
+
}
|
|
16187
|
+
case 1:
|
|
16188
|
+
{
|
|
16189
|
+
var rectangleData = shapeData;
|
|
16190
|
+
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16191
|
+
this.setFillColor(rectangleData.fill);
|
|
16192
|
+
break;
|
|
16193
|
+
}
|
|
16194
|
+
case 4:
|
|
16195
|
+
{
|
|
16196
|
+
var starData = shapeData;
|
|
16197
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16198
|
+
this.setFillColor(starData.fill);
|
|
16199
|
+
break;
|
|
16200
|
+
}
|
|
16201
|
+
case 3:
|
|
16202
|
+
{
|
|
16203
|
+
var polygonData = shapeData;
|
|
16204
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16205
|
+
this.setFillColor(polygonData.fill);
|
|
15589
16206
|
break;
|
|
15590
16207
|
}
|
|
15591
16208
|
}
|
|
15592
16209
|
};
|
|
16210
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16211
|
+
if (fill) {
|
|
16212
|
+
var color = fill.color;
|
|
16213
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
16214
|
+
}
|
|
16215
|
+
};
|
|
15593
16216
|
_proto.fromData = function fromData(data) {
|
|
15594
16217
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15595
16218
|
this.data = data;
|
|
16219
|
+
var material = this.material;
|
|
16220
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16221
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16222
|
+
data.renderer.mask,
|
|
16223
|
+
data.renderer.mask
|
|
16224
|
+
] : undefined;
|
|
16225
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16226
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15596
16227
|
};
|
|
15597
16228
|
return ShapeComponent;
|
|
15598
16229
|
}(MeshComponent);
|
|
15599
16230
|
exports.ShapeComponent = __decorate([
|
|
15600
16231
|
effectsClass("ShapeComponent")
|
|
15601
16232
|
], exports.ShapeComponent);
|
|
15602
|
-
exports.
|
|
15603
|
-
(function(
|
|
16233
|
+
exports.ShapePrimitiveType = void 0;
|
|
16234
|
+
(function(ShapePrimitiveType) {
|
|
15604
16235
|
/**
|
|
15605
16236
|
* 自定义图形
|
|
15606
|
-
*/
|
|
16237
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15607
16238
|
/**
|
|
15608
16239
|
* 矩形
|
|
15609
|
-
*/
|
|
16240
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15610
16241
|
/**
|
|
15611
16242
|
* 椭圆
|
|
15612
|
-
*/
|
|
16243
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15613
16244
|
/**
|
|
15614
16245
|
* 多边形
|
|
15615
|
-
*/
|
|
16246
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15616
16247
|
/**
|
|
15617
16248
|
* 星形
|
|
15618
|
-
*/
|
|
15619
|
-
})(exports.
|
|
16249
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
16250
|
+
})(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
|
|
15620
16251
|
exports.ShapeConnectType = void 0;
|
|
15621
16252
|
(function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
|
|
15622
16253
|
exports.ShapePointType = void 0;
|
|
15623
16254
|
(function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
|
|
15624
16255
|
|
|
16256
|
+
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16257
|
+
_inherits(Fake3DComponent, Component);
|
|
16258
|
+
function Fake3DComponent() {
|
|
16259
|
+
var _this;
|
|
16260
|
+
_this = Component.apply(this, arguments) || this;
|
|
16261
|
+
_this.loop = false;
|
|
16262
|
+
_this.amountOfMotion = 1.0;
|
|
16263
|
+
_this.animationLength = 2.0;
|
|
16264
|
+
_this.mode = 1;
|
|
16265
|
+
_this.startPositionX = 0;
|
|
16266
|
+
_this.startPositionY = 0;
|
|
16267
|
+
_this.startPositionZ = 0;
|
|
16268
|
+
_this.endPositionX = 0;
|
|
16269
|
+
_this.endPositionY = 0;
|
|
16270
|
+
_this.endPositionZ = 0;
|
|
16271
|
+
_this.amplitudeX = 0;
|
|
16272
|
+
_this.amplitudeY = 0;
|
|
16273
|
+
_this.amplitudeZ = 0;
|
|
16274
|
+
_this.phaseX = 0;
|
|
16275
|
+
_this.phaseY = 0;
|
|
16276
|
+
_this.phaseZ = 0;
|
|
16277
|
+
return _this;
|
|
16278
|
+
}
|
|
16279
|
+
var _proto = Fake3DComponent.prototype;
|
|
16280
|
+
_proto.onStart = function onStart() {
|
|
16281
|
+
this.effectComponent = this.item.getComponent(exports.EffectComponent);
|
|
16282
|
+
};
|
|
16283
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16284
|
+
this.updateFake3D();
|
|
16285
|
+
};
|
|
16286
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16287
|
+
if (!this.effectComponent) {
|
|
16288
|
+
return;
|
|
16289
|
+
}
|
|
16290
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16291
|
+
var _PosX = 0;
|
|
16292
|
+
var _PosY = 0;
|
|
16293
|
+
var _PosZ = 0;
|
|
16294
|
+
switch(this.mode){
|
|
16295
|
+
case 0:
|
|
16296
|
+
{
|
|
16297
|
+
var PI = Math.PI;
|
|
16298
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16299
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16300
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16301
|
+
break;
|
|
16302
|
+
}
|
|
16303
|
+
case 1:
|
|
16304
|
+
{
|
|
16305
|
+
var localTime = time;
|
|
16306
|
+
if (this.loop) {
|
|
16307
|
+
if (localTime > 0.5) {
|
|
16308
|
+
localTime = 1 - localTime;
|
|
16309
|
+
}
|
|
16310
|
+
localTime *= 2;
|
|
16311
|
+
}
|
|
16312
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16313
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16314
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16315
|
+
break;
|
|
16316
|
+
}
|
|
16317
|
+
}
|
|
16318
|
+
var material = this.effectComponent.material;
|
|
16319
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16320
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16321
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16322
|
+
};
|
|
16323
|
+
return Fake3DComponent;
|
|
16324
|
+
}(Component);
|
|
16325
|
+
__decorate([
|
|
16326
|
+
serialize()
|
|
16327
|
+
], exports.Fake3DComponent.prototype, "loop", void 0);
|
|
16328
|
+
__decorate([
|
|
16329
|
+
serialize()
|
|
16330
|
+
], exports.Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16331
|
+
__decorate([
|
|
16332
|
+
serialize()
|
|
16333
|
+
], exports.Fake3DComponent.prototype, "animationLength", void 0);
|
|
16334
|
+
__decorate([
|
|
16335
|
+
serialize()
|
|
16336
|
+
], exports.Fake3DComponent.prototype, "mode", void 0);
|
|
16337
|
+
__decorate([
|
|
16338
|
+
serialize()
|
|
16339
|
+
], exports.Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16340
|
+
__decorate([
|
|
16341
|
+
serialize()
|
|
16342
|
+
], exports.Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16343
|
+
__decorate([
|
|
16344
|
+
serialize()
|
|
16345
|
+
], exports.Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16346
|
+
__decorate([
|
|
16347
|
+
serialize()
|
|
16348
|
+
], exports.Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16349
|
+
__decorate([
|
|
16350
|
+
serialize()
|
|
16351
|
+
], exports.Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16352
|
+
__decorate([
|
|
16353
|
+
serialize()
|
|
16354
|
+
], exports.Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16355
|
+
__decorate([
|
|
16356
|
+
serialize()
|
|
16357
|
+
], exports.Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16358
|
+
__decorate([
|
|
16359
|
+
serialize()
|
|
16360
|
+
], exports.Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16361
|
+
__decorate([
|
|
16362
|
+
serialize()
|
|
16363
|
+
], exports.Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16364
|
+
__decorate([
|
|
16365
|
+
serialize()
|
|
16366
|
+
], exports.Fake3DComponent.prototype, "phaseX", void 0);
|
|
16367
|
+
__decorate([
|
|
16368
|
+
serialize()
|
|
16369
|
+
], exports.Fake3DComponent.prototype, "phaseY", void 0);
|
|
16370
|
+
__decorate([
|
|
16371
|
+
serialize()
|
|
16372
|
+
], exports.Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16373
|
+
exports.Fake3DComponent = __decorate([
|
|
16374
|
+
effectsClass("Fake3DComponent")
|
|
16375
|
+
], exports.Fake3DComponent);
|
|
16376
|
+
exports.Fake3DAnimationMode = void 0;
|
|
16377
|
+
(function(Fake3DAnimationMode) {
|
|
16378
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16379
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16380
|
+
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
16381
|
+
|
|
15625
16382
|
exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15626
16383
|
_inherits(CameraController, Behaviour);
|
|
15627
16384
|
function CameraController(engine, props) {
|
|
@@ -15992,8 +16749,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15992
16749
|
0
|
|
15993
16750
|
]
|
|
15994
16751
|
};
|
|
16752
|
+
_this.duringPlay = false;
|
|
15995
16753
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15996
|
-
_this.hasBeenAddedToComposition = false;
|
|
15997
16754
|
_this.getHitTestParams = function(force) {
|
|
15998
16755
|
if (!_this.clickable) {
|
|
15999
16756
|
return;
|
|
@@ -16030,7 +16787,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16030
16787
|
];
|
|
16031
16788
|
};
|
|
16032
16789
|
_proto.onStart = function onStart() {
|
|
16033
|
-
var _this = this;
|
|
16034
16790
|
var options = this.item.props.content.options;
|
|
16035
16791
|
var env = this.item.engine.renderer.env;
|
|
16036
16792
|
var composition = this.item.composition;
|
|
@@ -16054,32 +16810,35 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16054
16810
|
this.materials = this.previewContent.mesh.materials;
|
|
16055
16811
|
}
|
|
16056
16812
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
_this.endDragTarget();
|
|
16813
|
+
};
|
|
16814
|
+
_proto.onDisable = function onDisable() {
|
|
16815
|
+
if (this.item && this.item.composition) {
|
|
16816
|
+
var _this_previewContent;
|
|
16817
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16818
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16819
|
+
this.duringPlay = false;
|
|
16065
16820
|
}
|
|
16066
|
-
|
|
16821
|
+
this.clickable = false;
|
|
16822
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16823
|
+
this.endDragTarget();
|
|
16824
|
+
}
|
|
16825
|
+
};
|
|
16826
|
+
_proto.onEnable = function onEnable() {
|
|
16827
|
+
var type = this.interactData.options.type;
|
|
16828
|
+
if (type === InteractType.CLICK) {
|
|
16829
|
+
this.clickable = true;
|
|
16830
|
+
}
|
|
16067
16831
|
};
|
|
16068
16832
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16069
16833
|
var _this_previewContent;
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16075
|
-
var type = this.interactData.options.type;
|
|
16076
|
-
if (type === InteractType.CLICK) {
|
|
16077
|
-
this.clickable = true;
|
|
16078
|
-
}
|
|
16834
|
+
this.duringPlay = true;
|
|
16835
|
+
// trigger messageBegin when item enter
|
|
16836
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16837
|
+
var _this_item_composition;
|
|
16079
16838
|
var options = this.item.props.content.options;
|
|
16080
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16081
|
-
this.hasBeenAddedToComposition = true;
|
|
16839
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16082
16840
|
}
|
|
16841
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16083
16842
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16084
16843
|
return;
|
|
16085
16844
|
}
|
|
@@ -16247,7 +17006,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16247
17006
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16248
17007
|
}
|
|
16249
17008
|
|
|
16250
|
-
|
|
17009
|
+
/**
|
|
17010
|
+
*
|
|
17011
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16251
17012
|
function MeshCollider() {
|
|
16252
17013
|
this.triangles = [];
|
|
16253
17014
|
}
|
|
@@ -16255,6 +17016,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16255
17016
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16256
17017
|
return this.boundingBoxData;
|
|
16257
17018
|
};
|
|
17019
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
17020
|
+
var maxX = -Number.MAX_VALUE;
|
|
17021
|
+
var maxY = -Number.MAX_VALUE;
|
|
17022
|
+
var minX = Number.MAX_VALUE;
|
|
17023
|
+
var minY = Number.MAX_VALUE;
|
|
17024
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
17025
|
+
var triangle = _step.value;
|
|
17026
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
17027
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
17028
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
17029
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
17030
|
+
}
|
|
17031
|
+
var area = [];
|
|
17032
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
17033
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
17034
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
17035
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
17036
|
+
area.push({
|
|
17037
|
+
p0: point0,
|
|
17038
|
+
p1: point1,
|
|
17039
|
+
p2: point2
|
|
17040
|
+
});
|
|
17041
|
+
area.push({
|
|
17042
|
+
p0: point0,
|
|
17043
|
+
p1: point2,
|
|
17044
|
+
p2: point3
|
|
17045
|
+
});
|
|
17046
|
+
return {
|
|
17047
|
+
type: exports.HitTestType.triangle,
|
|
17048
|
+
area: area
|
|
17049
|
+
};
|
|
17050
|
+
};
|
|
16258
17051
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16259
17052
|
if (this.geometry !== geometry) {
|
|
16260
17053
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16459,6 +17252,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16459
17252
|
if (inputCount === void 0) inputCount = 0;
|
|
16460
17253
|
this.onPlayablePlayFlag = true;
|
|
16461
17254
|
this.onPlayablePauseFlag = false;
|
|
17255
|
+
this.duration = 0;
|
|
16462
17256
|
this.destroyed = false;
|
|
16463
17257
|
this.inputs = [];
|
|
16464
17258
|
this.inputOuputPorts = [];
|
|
@@ -16551,6 +17345,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16551
17345
|
_proto.getTime = function getTime() {
|
|
16552
17346
|
return this.time;
|
|
16553
17347
|
};
|
|
17348
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17349
|
+
this.duration = duration;
|
|
17350
|
+
};
|
|
17351
|
+
_proto.getDuration = function getDuration() {
|
|
17352
|
+
return this.duration;
|
|
17353
|
+
};
|
|
16554
17354
|
_proto.getPlayState = function getPlayState() {
|
|
16555
17355
|
return this.playState;
|
|
16556
17356
|
};
|
|
@@ -16702,7 +17502,9 @@ var PlayableTraversalMode;
|
|
|
16702
17502
|
var tempQuat$1 = new Quaternion();
|
|
16703
17503
|
var seed$3 = 1;
|
|
16704
17504
|
// TODO 继承 Component
|
|
16705
|
-
|
|
17505
|
+
/**
|
|
17506
|
+
*
|
|
17507
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16706
17508
|
function Transform(props, parent) {
|
|
16707
17509
|
if (props === void 0) props = {};
|
|
16708
17510
|
this.taggedProperties = {};
|
|
@@ -17167,7 +17969,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17167
17969
|
return Transform;
|
|
17168
17970
|
}();
|
|
17169
17971
|
|
|
17170
|
-
|
|
17972
|
+
/**
|
|
17973
|
+
*
|
|
17974
|
+
*/ /**
|
|
17975
|
+
* 事件监听器
|
|
17976
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17171
17977
|
var _this = this;
|
|
17172
17978
|
var _this1 = this;
|
|
17173
17979
|
this.listeners = {};
|
|
@@ -17261,17 +18067,15 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17261
18067
|
/**
|
|
17262
18068
|
* 元素动画结束时行为(如何处理元素)
|
|
17263
18069
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17264
|
-
/**
|
|
17265
|
-
* 元素是否可用
|
|
17266
|
-
*/ _this.ended = false;
|
|
17267
|
-
_this.reusable = false;
|
|
17268
18070
|
_this.type = ItemType.base;
|
|
17269
18071
|
_this.isDuringPlay = false;
|
|
17270
18072
|
_this.components = [];
|
|
17271
18073
|
_this.rendererComponents = [];
|
|
17272
18074
|
/**
|
|
17273
|
-
*
|
|
17274
|
-
|
|
18075
|
+
* 元素是否激活
|
|
18076
|
+
*/ _this.active = true;
|
|
18077
|
+
/**
|
|
18078
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17275
18079
|
*/ _this.visible = true;
|
|
17276
18080
|
/**
|
|
17277
18081
|
* 元素动画的速度
|
|
@@ -17402,12 +18206,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17402
18206
|
}
|
|
17403
18207
|
};
|
|
17404
18208
|
/**
|
|
17405
|
-
* 元素动画结束播放时回调函数
|
|
17406
|
-
* @override
|
|
17407
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17408
|
-
// OVERRIDE
|
|
17409
|
-
};
|
|
17410
|
-
/**
|
|
17411
18209
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17412
18210
|
* @param {number} r
|
|
17413
18211
|
* @param {number} g
|
|
@@ -17420,17 +18218,27 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17420
18218
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17421
18219
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17422
18220
|
/**
|
|
17423
|
-
*
|
|
17424
|
-
*/ _proto.
|
|
17425
|
-
|
|
18221
|
+
* 激活或停用 VFXItem
|
|
18222
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18223
|
+
if (this.active !== value) {
|
|
18224
|
+
this.active = !!value;
|
|
18225
|
+
this.onActiveChanged();
|
|
18226
|
+
}
|
|
17426
18227
|
};
|
|
17427
18228
|
/**
|
|
17428
|
-
*
|
|
18229
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17429
18230
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17430
|
-
|
|
17431
|
-
|
|
17432
|
-
|
|
18231
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18232
|
+
var component = _step.value;
|
|
18233
|
+
component.enabled = visible;
|
|
17433
18234
|
}
|
|
18235
|
+
this.visible = visible;
|
|
18236
|
+
};
|
|
18237
|
+
/**
|
|
18238
|
+
* 元素组件显隐状态
|
|
18239
|
+
* @deprecated use isVisible instead
|
|
18240
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18241
|
+
return this.visible;
|
|
17434
18242
|
};
|
|
17435
18243
|
/**
|
|
17436
18244
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17512,14 +18320,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17512
18320
|
this.transform.assignWorldTRS(pos);
|
|
17513
18321
|
return pos;
|
|
17514
18322
|
};
|
|
17515
|
-
/**
|
|
17516
|
-
* 是否到达元素的结束时间
|
|
17517
|
-
* @param now
|
|
17518
|
-
* @returns
|
|
17519
|
-
*/ _proto.isEnded = function isEnded(now) {
|
|
17520
|
-
// at least 1 ms
|
|
17521
|
-
return now - this.duration > 0.001;
|
|
17522
|
-
};
|
|
17523
18323
|
_proto.find = function find(name) {
|
|
17524
18324
|
var _queue;
|
|
17525
18325
|
if (this.name === name) {
|
|
@@ -17543,7 +18343,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17543
18343
|
* @internal
|
|
17544
18344
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17545
18345
|
this.isDuringPlay = true;
|
|
17546
|
-
if (this.composition && this.
|
|
18346
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17547
18347
|
this.onEnable();
|
|
17548
18348
|
}
|
|
17549
18349
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17727,25 +18527,54 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17727
18527
|
// }
|
|
17728
18528
|
// }
|
|
17729
18529
|
};
|
|
17730
|
-
|
|
18530
|
+
/**
|
|
18531
|
+
*
|
|
18532
|
+
* @param item
|
|
18533
|
+
* @returns
|
|
18534
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17731
18535
|
return item.type === ItemType.composition;
|
|
17732
18536
|
};
|
|
17733
|
-
|
|
18537
|
+
/**
|
|
18538
|
+
*
|
|
18539
|
+
* @param item
|
|
18540
|
+
* @returns
|
|
18541
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17734
18542
|
return item.type === ItemType.sprite;
|
|
17735
18543
|
};
|
|
17736
|
-
|
|
18544
|
+
/**
|
|
18545
|
+
*
|
|
18546
|
+
* @param item
|
|
18547
|
+
* @returns
|
|
18548
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17737
18549
|
return item.type === ItemType.particle;
|
|
17738
18550
|
};
|
|
17739
|
-
|
|
18551
|
+
/**
|
|
18552
|
+
*
|
|
18553
|
+
* @param item
|
|
18554
|
+
* @returns
|
|
18555
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17740
18556
|
return item.type === ItemType.null;
|
|
17741
18557
|
};
|
|
17742
|
-
|
|
18558
|
+
/**
|
|
18559
|
+
*
|
|
18560
|
+
* @param item
|
|
18561
|
+
* @returns
|
|
18562
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17743
18563
|
return item.type === ItemType.tree;
|
|
17744
18564
|
};
|
|
17745
|
-
|
|
18565
|
+
/**
|
|
18566
|
+
*
|
|
18567
|
+
* @param item
|
|
18568
|
+
* @returns
|
|
18569
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17746
18570
|
return item.type === ItemType.camera;
|
|
17747
18571
|
};
|
|
17748
|
-
|
|
18572
|
+
/**
|
|
18573
|
+
*
|
|
18574
|
+
* @param ancestorCandidate
|
|
18575
|
+
* @param descendantCandidate
|
|
18576
|
+
* @returns
|
|
18577
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17749
18578
|
var current = descendantCandidate.parent;
|
|
17750
18579
|
while(current){
|
|
17751
18580
|
if (current === ancestorCandidate) {
|
|
@@ -17790,6 +18619,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17790
18619
|
}
|
|
17791
18620
|
}
|
|
17792
18621
|
}
|
|
18622
|
+
},
|
|
18623
|
+
{
|
|
18624
|
+
key: "isActive",
|
|
18625
|
+
get: /**
|
|
18626
|
+
* 当前 VFXItem 是否激活
|
|
18627
|
+
*/ function get() {
|
|
18628
|
+
return this.active;
|
|
18629
|
+
}
|
|
18630
|
+
},
|
|
18631
|
+
{
|
|
18632
|
+
key: "isVisible",
|
|
18633
|
+
get: /**
|
|
18634
|
+
* 元素组件显隐状态
|
|
18635
|
+
*/ function get() {
|
|
18636
|
+
return this.visible;
|
|
18637
|
+
}
|
|
17793
18638
|
}
|
|
17794
18639
|
]);
|
|
17795
18640
|
return VFXItem;
|
|
@@ -22554,6 +23399,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22554
23399
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22555
23400
|
var timelineClip = _step.value;
|
|
22556
23401
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23402
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22557
23403
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22558
23404
|
runtimeClips.push(clip);
|
|
22559
23405
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22657,14 +23503,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22657
23503
|
this.playable.setTime(clipTime);
|
|
22658
23504
|
// 判断动画是否结束
|
|
22659
23505
|
if (ended) {
|
|
22660
|
-
if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
|
|
22661
|
-
boundObject.ended = true;
|
|
22662
|
-
boundObject.onEnd();
|
|
22663
|
-
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
22664
|
-
boundObject.dispose();
|
|
22665
|
-
this.playable.dispose();
|
|
22666
|
-
}
|
|
22667
|
-
}
|
|
22668
23506
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22669
23507
|
this.playable.pause();
|
|
22670
23508
|
}
|
|
@@ -22707,26 +23545,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22707
23545
|
}
|
|
22708
23546
|
if (hasInput) {
|
|
22709
23547
|
boundItem.transform.setValid(true);
|
|
22710
|
-
|
|
23548
|
+
boundItem.setActive(true);
|
|
22711
23549
|
} else {
|
|
22712
23550
|
boundItem.transform.setValid(false);
|
|
22713
|
-
|
|
22714
|
-
}
|
|
22715
|
-
};
|
|
22716
|
-
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
22717
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22718
|
-
var rendererComponent = _step.value;
|
|
22719
|
-
if (rendererComponent.enabled) {
|
|
22720
|
-
rendererComponent.enabled = false;
|
|
22721
|
-
}
|
|
22722
|
-
}
|
|
22723
|
-
};
|
|
22724
|
-
_proto.showRendererComponents = function showRendererComponents(item) {
|
|
22725
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22726
|
-
var rendererComponent = _step.value;
|
|
22727
|
-
if (!rendererComponent.enabled) {
|
|
22728
|
-
rendererComponent.enabled = true;
|
|
22729
|
-
}
|
|
23551
|
+
boundItem.setActive(false);
|
|
22730
23552
|
}
|
|
22731
23553
|
};
|
|
22732
23554
|
return ActivationMixerPlayable;
|
|
@@ -22754,7 +23576,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22754
23576
|
}
|
|
22755
23577
|
var _proto = PropertyClipPlayable.prototype;
|
|
22756
23578
|
_proto.processFrame = function processFrame(context) {
|
|
22757
|
-
this.value = this.curve.getValue(this.time);
|
|
23579
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22758
23580
|
};
|
|
22759
23581
|
return PropertyClipPlayable;
|
|
22760
23582
|
}(Playable);
|
|
@@ -23272,9 +24094,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23272
24094
|
var track = _step.value;
|
|
23273
24095
|
var boundObject = track.boundObject;
|
|
23274
24096
|
if (_instanceof1(boundObject, exports.VFXItem)) {
|
|
23275
|
-
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
23276
|
-
boundObject.reusable = value;
|
|
23277
|
-
}
|
|
23278
24097
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23279
24098
|
if (subCompositionComponent) {
|
|
23280
24099
|
subCompositionComponent.setReusable(value);
|
|
@@ -23319,16 +24138,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23319
24138
|
}
|
|
23320
24139
|
}
|
|
23321
24140
|
};
|
|
23322
|
-
_proto.
|
|
24141
|
+
_proto.onEnable = function onEnable() {
|
|
23323
24142
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23324
24143
|
var item = _step.value;
|
|
23325
|
-
item.
|
|
24144
|
+
item.setActive(true);
|
|
23326
24145
|
}
|
|
23327
24146
|
};
|
|
23328
|
-
_proto.
|
|
24147
|
+
_proto.onDisable = function onDisable() {
|
|
23329
24148
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23330
24149
|
var item = _step.value;
|
|
23331
|
-
item.
|
|
24150
|
+
item.setActive(false);
|
|
23332
24151
|
}
|
|
23333
24152
|
};
|
|
23334
24153
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23344,7 +24163,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23344
24163
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23345
24164
|
var _this, _loop = function(i) {
|
|
23346
24165
|
var item = _this.items[i];
|
|
23347
|
-
if (item.
|
|
24166
|
+
if (item.isActive && item.transform.getValid() && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
23348
24167
|
var hitParams = item.getHitTestParams(force);
|
|
23349
24168
|
if (hitParams) {
|
|
23350
24169
|
var success = false;
|
|
@@ -23486,9 +24305,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23486
24305
|
}
|
|
23487
24306
|
}
|
|
23488
24307
|
if (hasInput) {
|
|
23489
|
-
compositionComponent.
|
|
24308
|
+
compositionComponent.item.setActive(true);
|
|
23490
24309
|
} else {
|
|
23491
|
-
compositionComponent.
|
|
24310
|
+
compositionComponent.item.setActive(false);
|
|
23492
24311
|
}
|
|
23493
24312
|
};
|
|
23494
24313
|
return SubCompositionMixerPlayable;
|
|
@@ -24153,6 +24972,8 @@ exports.TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24153
24972
|
/**
|
|
24154
24973
|
* 文本行数
|
|
24155
24974
|
*/ _this.lineCount = 0;
|
|
24975
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24976
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24156
24977
|
_this.name = "MText" + seed$1++;
|
|
24157
24978
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24158
24979
|
if (props) {
|
|
@@ -24518,7 +25339,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24518
25339
|
}
|
|
24519
25340
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24520
25341
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24521
|
-
this.material.setTexture("
|
|
25342
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24522
25343
|
data: new Uint8Array(imageData.data),
|
|
24523
25344
|
width: imageData.width,
|
|
24524
25345
|
height: imageData.height
|
|
@@ -27716,7 +28537,7 @@ var listOrder = 0;
|
|
|
27716
28537
|
var itemProps = sourceItemData;
|
|
27717
28538
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27718
28539
|
itemProps.listIndex = listOrder++;
|
|
27719
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
28540
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
|
|
27720
28541
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27721
28542
|
var componentPath = _step2.value;
|
|
27722
28543
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27812,13 +28633,18 @@ var listOrder = 0;
|
|
|
27812
28633
|
return CompositionSourceManager;
|
|
27813
28634
|
}();
|
|
27814
28635
|
|
|
27815
|
-
|
|
28636
|
+
/**
|
|
28637
|
+
*
|
|
28638
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27816
28639
|
function SceneTicking() {
|
|
27817
28640
|
this.update = new UpdateTickData();
|
|
27818
28641
|
this.lateUpdate = new LateUpdateTickData();
|
|
27819
28642
|
}
|
|
27820
28643
|
var _proto = SceneTicking.prototype;
|
|
27821
|
-
|
|
28644
|
+
/**
|
|
28645
|
+
*
|
|
28646
|
+
* @param obj
|
|
28647
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27822
28648
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27823
28649
|
this.update.addComponent(obj);
|
|
27824
28650
|
}
|
|
@@ -27826,7 +28652,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27826
28652
|
this.lateUpdate.addComponent(obj);
|
|
27827
28653
|
}
|
|
27828
28654
|
};
|
|
27829
|
-
|
|
28655
|
+
/**
|
|
28656
|
+
*
|
|
28657
|
+
* @param obj
|
|
28658
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27830
28659
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27831
28660
|
this.update.removeComponent(obj);
|
|
27832
28661
|
}
|
|
@@ -27834,7 +28663,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27834
28663
|
this.lateUpdate.removeComponent(obj);
|
|
27835
28664
|
}
|
|
27836
28665
|
};
|
|
27837
|
-
|
|
28666
|
+
/**
|
|
28667
|
+
*
|
|
28668
|
+
*/ _proto.clear = function clear() {
|
|
27838
28669
|
this.update.clear();
|
|
27839
28670
|
this.lateUpdate.clear();
|
|
27840
28671
|
};
|
|
@@ -27925,11 +28756,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27925
28756
|
var _this;
|
|
27926
28757
|
var _scene_jsonScene_renderSettings;
|
|
27927
28758
|
_this = EventEmitter.call(this) || this;
|
|
27928
|
-
|
|
28759
|
+
/**
|
|
28760
|
+
*
|
|
28761
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27929
28762
|
/**
|
|
27930
28763
|
* 动画播放速度
|
|
27931
28764
|
*/ _this.speed = 1;
|
|
27932
28765
|
/**
|
|
28766
|
+
* 合成是否结束
|
|
28767
|
+
*/ _this.isEnded = false;
|
|
28768
|
+
/**
|
|
27933
28769
|
* 用于保存与当前合成相关的插件数据
|
|
27934
28770
|
*/ _this.loaderData = {};
|
|
27935
28771
|
/**
|
|
@@ -27951,6 +28787,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27951
28787
|
* 合成暂停/播放 标识
|
|
27952
28788
|
*/ _this.paused = false;
|
|
27953
28789
|
_this.lastVideoUpdateTime = 0;
|
|
28790
|
+
_this.isEndCalled = false;
|
|
27954
28791
|
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
27955
28792
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27956
28793
|
if (reusable) {
|
|
@@ -28040,7 +28877,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28040
28877
|
* @param visible - 是否可见
|
|
28041
28878
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28042
28879
|
this.items.forEach(function(item) {
|
|
28043
|
-
item.
|
|
28880
|
+
item.setActive(visible);
|
|
28044
28881
|
});
|
|
28045
28882
|
};
|
|
28046
28883
|
/**
|
|
@@ -28050,7 +28887,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28050
28887
|
return this.speed;
|
|
28051
28888
|
};
|
|
28052
28889
|
_proto.play = function play() {
|
|
28053
|
-
if (this.
|
|
28890
|
+
if (this.isEnded && this.reusable) {
|
|
28054
28891
|
this.restart();
|
|
28055
28892
|
}
|
|
28056
28893
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28141,7 +28978,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28141
28978
|
* 重置状态函数
|
|
28142
28979
|
*/ _proto.reset = function reset() {
|
|
28143
28980
|
this.rendererOptions = null;
|
|
28144
|
-
this.
|
|
28981
|
+
this.isEnded = false;
|
|
28982
|
+
this.isEndCalled = false;
|
|
28145
28983
|
this.rootComposition.time = 0;
|
|
28146
28984
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28147
28985
|
};
|
|
@@ -28193,12 +29031,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28193
29031
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28194
29032
|
this.updateCamera();
|
|
28195
29033
|
this.prepareRender();
|
|
29034
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
29035
|
+
this.isEndCalled = true;
|
|
29036
|
+
this.emit("end", {
|
|
29037
|
+
composition: this
|
|
29038
|
+
});
|
|
29039
|
+
}
|
|
28196
29040
|
if (this.shouldDispose()) {
|
|
28197
29041
|
this.dispose();
|
|
28198
29042
|
}
|
|
28199
29043
|
};
|
|
28200
29044
|
_proto.shouldDispose = function shouldDispose() {
|
|
28201
|
-
return this.
|
|
29045
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28202
29046
|
};
|
|
28203
29047
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28204
29048
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28289,11 +29133,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28289
29133
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28290
29134
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28291
29135
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28292
|
-
var
|
|
29136
|
+
var isEnded = false;
|
|
28293
29137
|
var duration = this.rootItem.duration;
|
|
28294
29138
|
var endBehavior = this.rootItem.endBehavior;
|
|
28295
29139
|
if (localTime - duration > 0.001) {
|
|
28296
|
-
|
|
29140
|
+
isEnded = true;
|
|
28297
29141
|
switch(endBehavior){
|
|
28298
29142
|
case EndBehavior.restart:
|
|
28299
29143
|
{
|
|
@@ -28317,11 +29161,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28317
29161
|
}
|
|
28318
29162
|
}
|
|
28319
29163
|
this.rootComposition.time = localTime;
|
|
28320
|
-
|
|
28321
|
-
|
|
28322
|
-
|
|
28323
|
-
|
|
28324
|
-
}
|
|
29164
|
+
// end state changed, handle onEnd flags
|
|
29165
|
+
if (this.isEnded !== isEnded) {
|
|
29166
|
+
if (isEnded) {
|
|
29167
|
+
this.isEnded = true;
|
|
29168
|
+
} else {
|
|
29169
|
+
this.isEnded = false;
|
|
29170
|
+
this.isEndCalled = false;
|
|
29171
|
+
}
|
|
28325
29172
|
}
|
|
28326
29173
|
}
|
|
28327
29174
|
};
|
|
@@ -30647,7 +31494,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
30647
31494
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
30648
31495
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
30649
31496
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
30650
|
-
var version = "2.1.0-
|
|
31497
|
+
var version = "2.1.0-beta.0";
|
|
30651
31498
|
logger.info("Core version: " + version + ".");
|
|
30652
31499
|
|
|
30653
31500
|
exports.AbstractPlugin = AbstractPlugin;
|