@galacean/effects-threejs 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/index.js +1146 -316
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1147 -317
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.1.0-
|
|
6
|
+
* Version: v2.1.0-beta.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -1220,6 +1220,12 @@ function _inherits(subClass, superClass) {
|
|
|
1220
1220
|
/**
|
|
1221
1221
|
* 特效元素
|
|
1222
1222
|
*/ ItemType["effect"] = "effect";
|
|
1223
|
+
/**
|
|
1224
|
+
* 形状元素
|
|
1225
|
+
*/ ItemType["shape"] = "shape";
|
|
1226
|
+
/**
|
|
1227
|
+
* 后处理元素
|
|
1228
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
1223
1229
|
/**
|
|
1224
1230
|
* 节点元素
|
|
1225
1231
|
*/ ItemType["node"] = "node";
|
|
@@ -1229,6 +1235,9 @@ function _inherits(subClass, superClass) {
|
|
|
1229
1235
|
/**
|
|
1230
1236
|
* 音频元素
|
|
1231
1237
|
*/ ItemType["audio"] = "audio";
|
|
1238
|
+
/**
|
|
1239
|
+
* 富文本元素
|
|
1240
|
+
*/ ItemType["richtext"] = "richtext";
|
|
1232
1241
|
})(ItemType || (ItemType = {}));
|
|
1233
1242
|
/**
|
|
1234
1243
|
* 渲染模式
|
|
@@ -1604,6 +1613,30 @@ var TextAlignment;
|
|
|
1604
1613
|
*/ FontStyle["oblique"] = "oblique";
|
|
1605
1614
|
})(FontStyle || (FontStyle = {}));
|
|
1606
1615
|
|
|
1616
|
+
var BuiltinObjectGUID = {
|
|
1617
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
1618
|
+
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1619
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
1620
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
/**
|
|
1624
|
+
* 动态换图类型
|
|
1625
|
+
* @since 1.1.0
|
|
1626
|
+
*/ var BackgroundType;
|
|
1627
|
+
(function(BackgroundType) {
|
|
1628
|
+
BackgroundType["video"] = "video";
|
|
1629
|
+
BackgroundType["image"] = "image";
|
|
1630
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1631
|
+
/**
|
|
1632
|
+
* 多媒体资源类型
|
|
1633
|
+
* @since 2.1.0
|
|
1634
|
+
*/ var MultimediaType;
|
|
1635
|
+
(function(MultimediaType) {
|
|
1636
|
+
MultimediaType["video"] = "video";
|
|
1637
|
+
MultimediaType["audio"] = "audio";
|
|
1638
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1639
|
+
|
|
1607
1640
|
var DataType;
|
|
1608
1641
|
(function(DataType) {
|
|
1609
1642
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1614,6 +1647,7 @@ var DataType;
|
|
|
1614
1647
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1615
1648
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1616
1649
|
DataType["CameraController"] = "CameraController";
|
|
1650
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1617
1651
|
DataType["Geometry"] = "Geometry";
|
|
1618
1652
|
DataType["Texture"] = "Texture";
|
|
1619
1653
|
DataType["AnimationClip"] = "AnimationClip";
|
|
@@ -1636,7 +1670,6 @@ var DataType;
|
|
|
1636
1670
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1637
1671
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1638
1672
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1639
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1640
1673
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1641
1674
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1642
1675
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1647,9 +1680,11 @@ var DataType;
|
|
|
1647
1680
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1648
1681
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1649
1682
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1683
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1650
1684
|
// Non-EffectObject
|
|
1651
1685
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1652
1686
|
})(DataType || (DataType = {}));
|
|
1687
|
+
|
|
1653
1688
|
var GeometryType;
|
|
1654
1689
|
(function(GeometryType) {
|
|
1655
1690
|
/**
|
|
@@ -1734,30 +1769,6 @@ var VertexBufferSemantic;
|
|
|
1734
1769
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1735
1770
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1736
1771
|
|
|
1737
|
-
var BuiltinObjectGUID = {
|
|
1738
|
-
WhiteTexture: "whitetexture00000000000000000000",
|
|
1739
|
-
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1740
|
-
PBRShader: "pbr00000000000000000000000000000",
|
|
1741
|
-
UnlitShader: "unlit000000000000000000000000000"
|
|
1742
|
-
};
|
|
1743
|
-
|
|
1744
|
-
/**
|
|
1745
|
-
* 动态换图类型
|
|
1746
|
-
* @since 1.1.0
|
|
1747
|
-
*/ var BackgroundType;
|
|
1748
|
-
(function(BackgroundType) {
|
|
1749
|
-
BackgroundType["video"] = "video";
|
|
1750
|
-
BackgroundType["image"] = "image";
|
|
1751
|
-
})(BackgroundType || (BackgroundType = {}));
|
|
1752
|
-
/**
|
|
1753
|
-
* 多媒体资源类型
|
|
1754
|
-
* @since 2.1.0
|
|
1755
|
-
*/ var MultimediaType;
|
|
1756
|
-
(function(MultimediaType) {
|
|
1757
|
-
MultimediaType["video"] = "video";
|
|
1758
|
-
MultimediaType["audio"] = "audio";
|
|
1759
|
-
})(MultimediaType || (MultimediaType = {}));
|
|
1760
|
-
|
|
1761
1772
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1762
1773
|
__proto__: null,
|
|
1763
1774
|
get RenderLevel () { return RenderLevel; },
|
|
@@ -1802,14 +1813,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1802
1813
|
get TextAlignment () { return TextAlignment; },
|
|
1803
1814
|
get TextWeight () { return TextWeight; },
|
|
1804
1815
|
get FontStyle () { return FontStyle; },
|
|
1816
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1817
|
+
get BackgroundType () { return BackgroundType; },
|
|
1818
|
+
get MultimediaType () { return MultimediaType; },
|
|
1805
1819
|
get DataType () { return DataType; },
|
|
1806
1820
|
get GeometryType () { return GeometryType; },
|
|
1807
1821
|
get VertexFormatType () { return VertexFormatType; },
|
|
1808
1822
|
get IndexFormatType () { return IndexFormatType; },
|
|
1809
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1810
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1811
|
-
get BackgroundType () { return BackgroundType; },
|
|
1812
|
-
get MultimediaType () { return MultimediaType; }
|
|
1823
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1813
1824
|
});
|
|
1814
1825
|
|
|
1815
1826
|
function _defineProperties(target, props) {
|
|
@@ -1897,15 +1908,23 @@ function getDirectStore(target) {
|
|
|
1897
1908
|
this.engine.addInstance(this);
|
|
1898
1909
|
}
|
|
1899
1910
|
var _proto = EffectsObject.prototype;
|
|
1900
|
-
|
|
1911
|
+
/**
|
|
1912
|
+
*
|
|
1913
|
+
* @returns
|
|
1914
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1901
1915
|
return this.guid;
|
|
1902
1916
|
};
|
|
1903
|
-
|
|
1917
|
+
/**
|
|
1918
|
+
*
|
|
1919
|
+
* @param guid
|
|
1920
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1904
1921
|
this.engine.removeInstance(this.guid);
|
|
1905
1922
|
this.guid = guid;
|
|
1906
1923
|
this.engine.addInstance(this);
|
|
1907
1924
|
};
|
|
1908
|
-
|
|
1925
|
+
/**
|
|
1926
|
+
*
|
|
1927
|
+
*/ _proto.toData = function toData() {};
|
|
1909
1928
|
/**
|
|
1910
1929
|
* 反序列化函数
|
|
1911
1930
|
*
|
|
@@ -1915,8 +1934,14 @@ function getDirectStore(target) {
|
|
|
1915
1934
|
this.setInstanceId(data.id);
|
|
1916
1935
|
}
|
|
1917
1936
|
};
|
|
1918
|
-
|
|
1919
|
-
|
|
1937
|
+
/**
|
|
1938
|
+
*
|
|
1939
|
+
*/ _proto.dispose = function dispose() {};
|
|
1940
|
+
/**
|
|
1941
|
+
*
|
|
1942
|
+
* @param obj
|
|
1943
|
+
* @returns
|
|
1944
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1920
1945
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1921
1946
|
};
|
|
1922
1947
|
return EffectsObject;
|
|
@@ -1996,7 +2021,7 @@ function getDirectStore(target) {
|
|
|
1996
2021
|
this.onAwake();
|
|
1997
2022
|
this.isAwakeCalled = true;
|
|
1998
2023
|
}
|
|
1999
|
-
if (item.
|
|
2024
|
+
if (item.isActive && this.enabled) {
|
|
2000
2025
|
this.start();
|
|
2001
2026
|
this.enable();
|
|
2002
2027
|
}
|
|
@@ -2041,7 +2066,7 @@ function getDirectStore(target) {
|
|
|
2041
2066
|
get: /**
|
|
2042
2067
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2043
2068
|
*/ function get() {
|
|
2044
|
-
return this.item.
|
|
2069
|
+
return this.item.isActive && this.enabled;
|
|
2045
2070
|
}
|
|
2046
2071
|
},
|
|
2047
2072
|
{
|
|
@@ -3670,7 +3695,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3670
3695
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3671
3696
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3672
3697
|
|
|
3673
|
-
|
|
3698
|
+
/**
|
|
3699
|
+
* Mesh 组件
|
|
3700
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3674
3701
|
_inherits(MeshComponent, RendererComponent);
|
|
3675
3702
|
function MeshComponent() {
|
|
3676
3703
|
var _this;
|
|
@@ -3680,7 +3707,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3680
3707
|
*/ _this.meshCollider = new MeshCollider();
|
|
3681
3708
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3682
3709
|
_this.getHitTestParams = function(force) {
|
|
3683
|
-
var
|
|
3710
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3711
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3712
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3684
3713
|
if (area) {
|
|
3685
3714
|
return {
|
|
3686
3715
|
type: area.type,
|
|
@@ -3700,8 +3729,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3700
3729
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3701
3730
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3702
3731
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3703
|
-
var
|
|
3704
|
-
return
|
|
3732
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3733
|
+
return boundingBox;
|
|
3705
3734
|
};
|
|
3706
3735
|
return MeshComponent;
|
|
3707
3736
|
}(RendererComponent);
|
|
@@ -3739,24 +3768,29 @@ EffectComponent = __decorate([
|
|
|
3739
3768
|
|
|
3740
3769
|
var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3741
3770
|
_inherits(PostProcessVolume, Behaviour);
|
|
3742
|
-
function PostProcessVolume() {
|
|
3771
|
+
function PostProcessVolume(engine) {
|
|
3743
3772
|
var _this;
|
|
3744
|
-
_this = Behaviour.
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
_this.
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
_this.
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3773
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3774
|
+
_this.bloom = {
|
|
3775
|
+
threshold: 0,
|
|
3776
|
+
intensity: 0,
|
|
3777
|
+
active: false
|
|
3778
|
+
};
|
|
3779
|
+
_this.vignette = {
|
|
3780
|
+
intensity: 0,
|
|
3781
|
+
smoothness: 0,
|
|
3782
|
+
roundness: 0,
|
|
3783
|
+
active: false
|
|
3784
|
+
};
|
|
3785
|
+
_this.tonemapping = {
|
|
3786
|
+
active: false
|
|
3787
|
+
};
|
|
3788
|
+
_this.colorAdjustments = {
|
|
3789
|
+
brightness: 0,
|
|
3790
|
+
saturation: 0,
|
|
3791
|
+
contrast: 0,
|
|
3792
|
+
active: false
|
|
3793
|
+
};
|
|
3760
3794
|
return _this;
|
|
3761
3795
|
}
|
|
3762
3796
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3770,36 +3804,18 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3770
3804
|
}(Behaviour);
|
|
3771
3805
|
__decorate([
|
|
3772
3806
|
serialize()
|
|
3773
|
-
], PostProcessVolume.prototype, "
|
|
3774
|
-
__decorate([
|
|
3775
|
-
serialize()
|
|
3776
|
-
], PostProcessVolume.prototype, "threshold", void 0);
|
|
3807
|
+
], PostProcessVolume.prototype, "bloom", void 0);
|
|
3777
3808
|
__decorate([
|
|
3778
3809
|
serialize()
|
|
3779
|
-
], PostProcessVolume.prototype, "
|
|
3810
|
+
], PostProcessVolume.prototype, "vignette", void 0);
|
|
3780
3811
|
__decorate([
|
|
3781
3812
|
serialize()
|
|
3782
|
-
], PostProcessVolume.prototype, "
|
|
3813
|
+
], PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3783
3814
|
__decorate([
|
|
3784
3815
|
serialize()
|
|
3785
|
-
], PostProcessVolume.prototype, "
|
|
3786
|
-
__decorate([
|
|
3787
|
-
serialize()
|
|
3788
|
-
], PostProcessVolume.prototype, "contrast", void 0);
|
|
3789
|
-
__decorate([
|
|
3790
|
-
serialize()
|
|
3791
|
-
], PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
3792
|
-
__decorate([
|
|
3793
|
-
serialize()
|
|
3794
|
-
], PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
3795
|
-
__decorate([
|
|
3796
|
-
serialize()
|
|
3797
|
-
], PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
3798
|
-
__decorate([
|
|
3799
|
-
serialize()
|
|
3800
|
-
], PostProcessVolume.prototype, "toneMappingEnabled", void 0);
|
|
3816
|
+
], PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3801
3817
|
PostProcessVolume = __decorate([
|
|
3802
|
-
effectsClass(
|
|
3818
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3803
3819
|
], PostProcessVolume);
|
|
3804
3820
|
|
|
3805
3821
|
function _assert_this_initialized(self) {
|
|
@@ -6886,6 +6902,7 @@ var MaterialRenderType;
|
|
|
6886
6902
|
_this.enabledMacros = {};
|
|
6887
6903
|
_this.destroyed = false;
|
|
6888
6904
|
_this.initialized = false;
|
|
6905
|
+
_this.shaderDirty = true;
|
|
6889
6906
|
if (props) {
|
|
6890
6907
|
var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$9++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
|
|
6891
6908
|
_this.name = name;
|
|
@@ -6913,6 +6930,41 @@ var MaterialRenderType;
|
|
|
6913
6930
|
// OVERRIDE
|
|
6914
6931
|
};
|
|
6915
6932
|
_create_class(Material, [
|
|
6933
|
+
{
|
|
6934
|
+
key: "shader",
|
|
6935
|
+
get: function get() {
|
|
6936
|
+
return this._shader;
|
|
6937
|
+
},
|
|
6938
|
+
set: function set(value) {
|
|
6939
|
+
if (this._shader === value) {
|
|
6940
|
+
return;
|
|
6941
|
+
}
|
|
6942
|
+
this._shader = value;
|
|
6943
|
+
this.shaderDirty = true;
|
|
6944
|
+
}
|
|
6945
|
+
},
|
|
6946
|
+
{
|
|
6947
|
+
key: "mainTexture",
|
|
6948
|
+
get: /**
|
|
6949
|
+
* 材质的主纹理
|
|
6950
|
+
*/ function get() {
|
|
6951
|
+
return this.getTexture("_MainTex");
|
|
6952
|
+
},
|
|
6953
|
+
set: function set(value) {
|
|
6954
|
+
this.setTexture("_MainTex", value);
|
|
6955
|
+
}
|
|
6956
|
+
},
|
|
6957
|
+
{
|
|
6958
|
+
key: "color",
|
|
6959
|
+
get: /**
|
|
6960
|
+
* 材质的主颜色
|
|
6961
|
+
*/ function get() {
|
|
6962
|
+
return this.getColor("_Color");
|
|
6963
|
+
},
|
|
6964
|
+
set: function set(value) {
|
|
6965
|
+
this.setColor("_Color", value);
|
|
6966
|
+
}
|
|
6967
|
+
},
|
|
6916
6968
|
{
|
|
6917
6969
|
key: "blending",
|
|
6918
6970
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10049,7 +10101,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10049
10101
|
|
|
10050
10102
|
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}";
|
|
10051
10103
|
|
|
10052
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10104
|
+
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;}";
|
|
10053
10105
|
|
|
10054
10106
|
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";
|
|
10055
10107
|
|
|
@@ -10280,15 +10332,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10280
10332
|
renderer.setFramebuffer(this.framebuffer);
|
|
10281
10333
|
};
|
|
10282
10334
|
_proto.execute = function execute(renderer) {
|
|
10283
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10335
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10284
10336
|
renderer.clear({
|
|
10285
10337
|
colorAction: TextureStoreAction.clear,
|
|
10286
10338
|
depthAction: TextureStoreAction.clear,
|
|
10287
10339
|
stencilAction: TextureStoreAction.clear
|
|
10288
10340
|
});
|
|
10289
10341
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10290
|
-
var
|
|
10291
|
-
var threshold = (
|
|
10342
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10343
|
+
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;
|
|
10292
10344
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10293
10345
|
renderer.renderMeshes([
|
|
10294
10346
|
this.screenMesh
|
|
@@ -10501,25 +10553,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10501
10553
|
depthAction: TextureStoreAction.clear,
|
|
10502
10554
|
stencilAction: TextureStoreAction.clear
|
|
10503
10555
|
});
|
|
10504
|
-
var
|
|
10505
|
-
var
|
|
10556
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10557
|
+
var bloom = _extends({
|
|
10558
|
+
threshold: 0,
|
|
10559
|
+
intensity: 0,
|
|
10560
|
+
active: false
|
|
10561
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10562
|
+
var vignette = _extends({
|
|
10563
|
+
intensity: 0,
|
|
10564
|
+
smoothness: 0,
|
|
10565
|
+
roundness: 0,
|
|
10566
|
+
active: false
|
|
10567
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10568
|
+
var colorAdjustments = _extends({
|
|
10569
|
+
brightness: 0,
|
|
10570
|
+
saturation: 0,
|
|
10571
|
+
contrast: 0,
|
|
10572
|
+
active: false
|
|
10573
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10574
|
+
var tonemapping = _extends({
|
|
10575
|
+
active: false
|
|
10576
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10506
10577
|
this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
|
|
10507
|
-
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
10508
|
-
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
10509
|
-
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
10510
|
-
this.screenMesh.material.setInt("_UseBloom", Number(
|
|
10511
|
-
if (
|
|
10578
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10579
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10580
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10581
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10582
|
+
if (bloom.active) {
|
|
10512
10583
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10513
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10584
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10514
10585
|
}
|
|
10515
|
-
if (
|
|
10516
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10517
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10518
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10586
|
+
if (vignette.intensity > 0) {
|
|
10587
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10588
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10589
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10519
10590
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10520
10591
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10521
10592
|
}
|
|
10522
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10593
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10523
10594
|
renderer.renderMeshes([
|
|
10524
10595
|
this.screenMesh
|
|
10525
10596
|
]);
|
|
@@ -10559,6 +10630,9 @@ var seed$6 = 1;
|
|
|
10559
10630
|
this.renderer = renderer;
|
|
10560
10631
|
if (postProcessingEnabled) {
|
|
10561
10632
|
var enableHDR = true;
|
|
10633
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10634
|
+
throw new Error("Half float texture is not supported.");
|
|
10635
|
+
}
|
|
10562
10636
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10563
10637
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10564
10638
|
attachments = [
|
|
@@ -13304,7 +13378,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13304
13378
|
return ColorCurve;
|
|
13305
13379
|
}(ValueGetter);
|
|
13306
13380
|
|
|
13307
|
-
|
|
13381
|
+
/**
|
|
13382
|
+
* @since 2.1.0
|
|
13383
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13308
13384
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13309
13385
|
function BaseRenderComponent(engine) {
|
|
13310
13386
|
var _this;
|
|
@@ -13391,7 +13467,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13391
13467
|
* @param texture - 纹理对象
|
|
13392
13468
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13393
13469
|
this.renderer.texture = texture;
|
|
13394
|
-
this.material.setTexture("
|
|
13470
|
+
this.material.setTexture("_MainTex", texture);
|
|
13395
13471
|
};
|
|
13396
13472
|
/**
|
|
13397
13473
|
* @internal
|
|
@@ -13470,51 +13546,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13470
13546
|
geometry.setIndexData(indexData);
|
|
13471
13547
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13472
13548
|
geometry.setDrawCount(data.index.length);
|
|
13473
|
-
|
|
13474
|
-
var texture1 = textures[i];
|
|
13475
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13476
|
-
}
|
|
13477
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13478
|
-
var emptyTexture = this.emptyTexture;
|
|
13479
|
-
for(var k = textures.length; k < maxSpriteMeshItemCount; k++){
|
|
13480
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13481
|
-
}
|
|
13549
|
+
material.setTexture("_MainTex", texture);
|
|
13482
13550
|
};
|
|
13483
13551
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13484
|
-
this.
|
|
13485
|
-
|
|
13486
|
-
0.
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
0
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
2,
|
|
13504
|
-
1,
|
|
13505
|
-
3
|
|
13506
|
-
],
|
|
13507
|
-
atlasOffset: [
|
|
13552
|
+
var renderer = this.renderer;
|
|
13553
|
+
if (renderer.shape) {
|
|
13554
|
+
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;
|
|
13555
|
+
var point = new Float32Array(aPoint);
|
|
13556
|
+
var position = [];
|
|
13557
|
+
var atlasOffset = [];
|
|
13558
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13559
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13560
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13561
|
+
}
|
|
13562
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13563
|
+
return {
|
|
13564
|
+
index: index,
|
|
13565
|
+
atlasOffset: atlasOffset
|
|
13566
|
+
};
|
|
13567
|
+
} else {
|
|
13568
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13569
|
+
-0.5,
|
|
13570
|
+
0.5,
|
|
13508
13571
|
0,
|
|
13509
|
-
|
|
13572
|
+
-0.5,
|
|
13573
|
+
-0.5,
|
|
13510
13574
|
0,
|
|
13575
|
+
0.5,
|
|
13576
|
+
0.5,
|
|
13511
13577
|
0,
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
1,
|
|
13578
|
+
0.5,
|
|
13579
|
+
-0.5,
|
|
13515
13580
|
0
|
|
13516
|
-
]
|
|
13517
|
-
|
|
13581
|
+
]));
|
|
13582
|
+
return {
|
|
13583
|
+
index: [
|
|
13584
|
+
0,
|
|
13585
|
+
1,
|
|
13586
|
+
2,
|
|
13587
|
+
2,
|
|
13588
|
+
1,
|
|
13589
|
+
3
|
|
13590
|
+
],
|
|
13591
|
+
atlasOffset: [
|
|
13592
|
+
0,
|
|
13593
|
+
1,
|
|
13594
|
+
0,
|
|
13595
|
+
0,
|
|
13596
|
+
1,
|
|
13597
|
+
1,
|
|
13598
|
+
1,
|
|
13599
|
+
0
|
|
13600
|
+
]
|
|
13601
|
+
};
|
|
13602
|
+
}
|
|
13518
13603
|
};
|
|
13519
13604
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13520
13605
|
return Geometry.create(this.engine, {
|
|
@@ -13579,7 +13664,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13579
13664
|
setBlendMode(material, states.blendMode);
|
|
13580
13665
|
setMaskMode(material, states.maskMode);
|
|
13581
13666
|
setSideMode(material, states.side);
|
|
13582
|
-
material.shader.shaderData.properties = '
|
|
13667
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13583
13668
|
if (!material.hasUniform("_Color")) {
|
|
13584
13669
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13585
13670
|
}
|
|
@@ -15147,30 +15232,497 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15147
15232
|
centerX += points[i];
|
|
15148
15233
|
centerY += points[i + 1];
|
|
15149
15234
|
}
|
|
15150
|
-
centerX /= points.length / 2;
|
|
15151
|
-
centerY /= points.length / 2;
|
|
15152
|
-
// Set center vertex
|
|
15153
|
-
var count = verticesOffset;
|
|
15154
|
-
vertices[count * 2] = centerX;
|
|
15155
|
-
vertices[count * 2 + 1] = centerY;
|
|
15156
|
-
var centerIndex = count++;
|
|
15157
|
-
// Set edge vertices and indices
|
|
15158
|
-
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
15159
|
-
vertices[count * 2] = points[i1];
|
|
15160
|
-
vertices[count * 2 + 1] = points[i1 + 1];
|
|
15161
|
-
if (i1 > 0) {
|
|
15162
|
-
indices[indicesOffset++] = count;
|
|
15163
|
-
indices[indicesOffset++] = centerIndex;
|
|
15164
|
-
indices[indicesOffset++] = count - 1;
|
|
15235
|
+
centerX /= points.length / 2;
|
|
15236
|
+
centerY /= points.length / 2;
|
|
15237
|
+
// Set center vertex
|
|
15238
|
+
var count = verticesOffset;
|
|
15239
|
+
vertices[count * 2] = centerX;
|
|
15240
|
+
vertices[count * 2 + 1] = centerY;
|
|
15241
|
+
var centerIndex = count++;
|
|
15242
|
+
// Set edge vertices and indices
|
|
15243
|
+
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
15244
|
+
vertices[count * 2] = points[i1];
|
|
15245
|
+
vertices[count * 2 + 1] = points[i1 + 1];
|
|
15246
|
+
if (i1 > 0) {
|
|
15247
|
+
indices[indicesOffset++] = count;
|
|
15248
|
+
indices[indicesOffset++] = centerIndex;
|
|
15249
|
+
indices[indicesOffset++] = count - 1;
|
|
15250
|
+
}
|
|
15251
|
+
count++;
|
|
15252
|
+
}
|
|
15253
|
+
// Connect last point to the first edge point
|
|
15254
|
+
indices[indicesOffset++] = centerIndex + 1;
|
|
15255
|
+
indices[indicesOffset++] = centerIndex;
|
|
15256
|
+
indices[indicesOffset++] = count - 1;
|
|
15257
|
+
};
|
|
15258
|
+
return Ellipse;
|
|
15259
|
+
}(ShapePrimitive);
|
|
15260
|
+
|
|
15261
|
+
var StarType;
|
|
15262
|
+
(function(StarType) {
|
|
15263
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15264
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15265
|
+
})(StarType || (StarType = {}));
|
|
15266
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15267
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15268
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15269
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15270
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15271
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15272
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15273
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15274
|
+
if (starType === void 0) starType = 0;
|
|
15275
|
+
var _this;
|
|
15276
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15277
|
+
_this.pointCount = pointCount;
|
|
15278
|
+
_this.outerRadius = outerRadius;
|
|
15279
|
+
_this.innerRadius = innerRadius;
|
|
15280
|
+
_this.outerRoundness = outerRoundness;
|
|
15281
|
+
_this.innerRoundness = innerRoundness;
|
|
15282
|
+
_this.starType = starType;
|
|
15283
|
+
_this.v = [];
|
|
15284
|
+
_this.in = [];
|
|
15285
|
+
_this.out = [];
|
|
15286
|
+
return _this;
|
|
15287
|
+
}
|
|
15288
|
+
var _proto = PolyStar.prototype;
|
|
15289
|
+
_proto.clone = function clone() {
|
|
15290
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15291
|
+
return polyStar;
|
|
15292
|
+
};
|
|
15293
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15294
|
+
this.pointCount = source.pointCount;
|
|
15295
|
+
this.outerRadius = source.outerRadius;
|
|
15296
|
+
this.innerRadius = source.innerRadius;
|
|
15297
|
+
this.outerRoundness = source.outerRoundness;
|
|
15298
|
+
this.innerRoundness = source.innerRoundness;
|
|
15299
|
+
this.starType = source.starType;
|
|
15300
|
+
};
|
|
15301
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15302
|
+
destination.copyFrom(this);
|
|
15303
|
+
};
|
|
15304
|
+
_proto.build = function build(points) {
|
|
15305
|
+
switch(this.starType){
|
|
15306
|
+
case 0:
|
|
15307
|
+
{
|
|
15308
|
+
this.buildStarPath();
|
|
15309
|
+
break;
|
|
15310
|
+
}
|
|
15311
|
+
case 1:
|
|
15312
|
+
{
|
|
15313
|
+
this.buildPolygonPath();
|
|
15314
|
+
break;
|
|
15315
|
+
}
|
|
15316
|
+
}
|
|
15317
|
+
var smoothness = 1;
|
|
15318
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15319
|
+
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);
|
|
15320
|
+
}
|
|
15321
|
+
// draw last curve
|
|
15322
|
+
var lastIndex = this.v.length - 1;
|
|
15323
|
+
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);
|
|
15324
|
+
};
|
|
15325
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15326
|
+
var triangles = triangulate([
|
|
15327
|
+
points
|
|
15328
|
+
]);
|
|
15329
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15330
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15331
|
+
}
|
|
15332
|
+
var vertexCount = triangles.length / 2;
|
|
15333
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15334
|
+
indices[indicesOffset + i1] = i1;
|
|
15335
|
+
}
|
|
15336
|
+
};
|
|
15337
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15338
|
+
this.v = [];
|
|
15339
|
+
this.in = [];
|
|
15340
|
+
this.out = [];
|
|
15341
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15342
|
+
var angle = Math.PI * 2 / numPts;
|
|
15343
|
+
var longFlag = true;
|
|
15344
|
+
var longRad = this.outerRadius;
|
|
15345
|
+
var shortRad = this.innerRadius;
|
|
15346
|
+
var longRound = this.outerRoundness / 100;
|
|
15347
|
+
var shortRound = this.innerRoundness / 100;
|
|
15348
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15349
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15350
|
+
var i;
|
|
15351
|
+
var rad;
|
|
15352
|
+
var roundness;
|
|
15353
|
+
var perimSegment;
|
|
15354
|
+
var currentAng = -Math.PI / 2;
|
|
15355
|
+
var dir = 1;
|
|
15356
|
+
for(i = 0; i < numPts; i++){
|
|
15357
|
+
rad = longFlag ? longRad : shortRad;
|
|
15358
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15359
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15360
|
+
var x = rad * Math.cos(currentAng);
|
|
15361
|
+
var y = rad * Math.sin(currentAng);
|
|
15362
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15363
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15364
|
+
var offset = i * 2;
|
|
15365
|
+
this.v[offset] = x;
|
|
15366
|
+
this.v[offset + 1] = y;
|
|
15367
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15368
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15369
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15370
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15371
|
+
longFlag = !longFlag;
|
|
15372
|
+
currentAng += angle * dir;
|
|
15373
|
+
}
|
|
15374
|
+
};
|
|
15375
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15376
|
+
this.v = [];
|
|
15377
|
+
this.in = [];
|
|
15378
|
+
this.out = [];
|
|
15379
|
+
var numPts = Math.floor(this.pointCount);
|
|
15380
|
+
var angle = Math.PI * 2 / numPts;
|
|
15381
|
+
var rad = this.outerRadius;
|
|
15382
|
+
var roundness = this.outerRoundness / 100;
|
|
15383
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15384
|
+
var i;
|
|
15385
|
+
var currentAng = -Math.PI * 0.5;
|
|
15386
|
+
var dir = 1;
|
|
15387
|
+
for(i = 0; i < numPts; i++){
|
|
15388
|
+
var x = rad * Math.cos(currentAng);
|
|
15389
|
+
var y = rad * Math.sin(currentAng);
|
|
15390
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15391
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15392
|
+
var offset = i * 2;
|
|
15393
|
+
this.v[offset] = x;
|
|
15394
|
+
this.v[offset + 1] = y;
|
|
15395
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15396
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15397
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15398
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15399
|
+
currentAng += angle * dir;
|
|
15400
|
+
}
|
|
15401
|
+
};
|
|
15402
|
+
return PolyStar;
|
|
15403
|
+
}(ShapePrimitive);
|
|
15404
|
+
|
|
15405
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15406
|
+
/**
|
|
15407
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
15408
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15409
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15410
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15411
|
+
function Rectangle(x, y, width, height) {
|
|
15412
|
+
if (x === void 0) x = 0;
|
|
15413
|
+
if (y === void 0) y = 0;
|
|
15414
|
+
if (width === void 0) width = 0;
|
|
15415
|
+
if (height === void 0) height = 0;
|
|
15416
|
+
var _this;
|
|
15417
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15418
|
+
_this.x = Number(x);
|
|
15419
|
+
_this.y = Number(y);
|
|
15420
|
+
_this.width = Number(width);
|
|
15421
|
+
_this.height = Number(height);
|
|
15422
|
+
return _this;
|
|
15423
|
+
}
|
|
15424
|
+
var _proto = Rectangle.prototype;
|
|
15425
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15426
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15427
|
+
};
|
|
15428
|
+
/**
|
|
15429
|
+
* Creates a clone of this Rectangle
|
|
15430
|
+
* @returns a copy of the rectangle
|
|
15431
|
+
*/ _proto.clone = function clone() {
|
|
15432
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15433
|
+
};
|
|
15434
|
+
/**
|
|
15435
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15436
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15437
|
+
* @returns Returns itself.
|
|
15438
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15439
|
+
// this.x = bounds.minX;
|
|
15440
|
+
// this.y = bounds.minY;
|
|
15441
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15442
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15443
|
+
// return this;
|
|
15444
|
+
// }
|
|
15445
|
+
/**
|
|
15446
|
+
* Copies another rectangle to this one.
|
|
15447
|
+
* @param rectangle - The rectangle to copy from.
|
|
15448
|
+
* @returns Returns itself.
|
|
15449
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15450
|
+
this.x = rectangle.x;
|
|
15451
|
+
this.y = rectangle.y;
|
|
15452
|
+
this.width = rectangle.width;
|
|
15453
|
+
this.height = rectangle.height;
|
|
15454
|
+
return this;
|
|
15455
|
+
};
|
|
15456
|
+
/**
|
|
15457
|
+
* Copies this rectangle to another one.
|
|
15458
|
+
* @param rectangle - The rectangle to copy to.
|
|
15459
|
+
* @returns Returns given parameter.
|
|
15460
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15461
|
+
rectangle.copyFrom(this);
|
|
15462
|
+
return rectangle;
|
|
15463
|
+
};
|
|
15464
|
+
/**
|
|
15465
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15466
|
+
* @param x - The X coordinate of the point to test
|
|
15467
|
+
* @param y - The Y coordinate of the point to test
|
|
15468
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15469
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15470
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15471
|
+
return false;
|
|
15472
|
+
}
|
|
15473
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15474
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15475
|
+
return true;
|
|
15476
|
+
}
|
|
15477
|
+
}
|
|
15478
|
+
return false;
|
|
15479
|
+
};
|
|
15480
|
+
/**
|
|
15481
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15482
|
+
* @param x - The X coordinate of the point to test
|
|
15483
|
+
* @param y - The Y coordinate of the point to test
|
|
15484
|
+
* @param strokeWidth - The width of the line to check
|
|
15485
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15486
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15487
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15488
|
+
if (width <= 0 || height <= 0) {
|
|
15489
|
+
return false;
|
|
15490
|
+
}
|
|
15491
|
+
var _x = this.x;
|
|
15492
|
+
var _y = this.y;
|
|
15493
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15494
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15495
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15496
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15497
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15498
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15499
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15500
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15501
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15502
|
+
};
|
|
15503
|
+
/**
|
|
15504
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15505
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15506
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15507
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15508
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15509
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15510
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15511
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15512
|
+
// if (!transform) {
|
|
15513
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15514
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15515
|
+
// if (x1 <= x0) {
|
|
15516
|
+
// return false;
|
|
15517
|
+
// }
|
|
15518
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15519
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15520
|
+
// return y1 > y0;
|
|
15521
|
+
// }
|
|
15522
|
+
// const x0 = this.left;
|
|
15523
|
+
// const x1 = this.right;
|
|
15524
|
+
// const y0 = this.top;
|
|
15525
|
+
// const y1 = this.bottom;
|
|
15526
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15527
|
+
// return false;
|
|
15528
|
+
// }
|
|
15529
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15530
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15531
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15532
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15533
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15534
|
+
// return false;
|
|
15535
|
+
// }
|
|
15536
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15537
|
+
// if (s === 0) {
|
|
15538
|
+
// return false;
|
|
15539
|
+
// }
|
|
15540
|
+
// transform.apply(lt, lt);
|
|
15541
|
+
// transform.apply(lb, lb);
|
|
15542
|
+
// transform.apply(rt, rt);
|
|
15543
|
+
// transform.apply(rb, rb);
|
|
15544
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15545
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15546
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15547
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15548
|
+
// return false;
|
|
15549
|
+
// }
|
|
15550
|
+
// const nx = s * (lb.y - lt.y);
|
|
15551
|
+
// const ny = s * (lt.x - lb.x);
|
|
15552
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15553
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15554
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15555
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15556
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15557
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15558
|
+
// return false;
|
|
15559
|
+
// }
|
|
15560
|
+
// const mx = s * (lt.y - rt.y);
|
|
15561
|
+
// const my = s * (rt.x - lt.x);
|
|
15562
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15563
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15564
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15565
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15566
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15567
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15568
|
+
// return false;
|
|
15569
|
+
// }
|
|
15570
|
+
// return true;
|
|
15571
|
+
// }
|
|
15572
|
+
/**
|
|
15573
|
+
* Pads the rectangle making it grow in all directions.
|
|
15574
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15575
|
+
* @param paddingX - The horizontal padding amount.
|
|
15576
|
+
* @param paddingY - The vertical padding amount.
|
|
15577
|
+
* @returns Returns itself.
|
|
15578
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15579
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15580
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15581
|
+
this.x -= paddingX;
|
|
15582
|
+
this.y -= paddingY;
|
|
15583
|
+
this.width += paddingX * 2;
|
|
15584
|
+
this.height += paddingY * 2;
|
|
15585
|
+
return this;
|
|
15586
|
+
};
|
|
15587
|
+
/**
|
|
15588
|
+
* Fits this rectangle around the passed one.
|
|
15589
|
+
* @param rectangle - The rectangle to fit.
|
|
15590
|
+
* @returns Returns itself.
|
|
15591
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15592
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15593
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15594
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15595
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15596
|
+
this.x = x1;
|
|
15597
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15598
|
+
this.y = y1;
|
|
15599
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15600
|
+
return this;
|
|
15601
|
+
};
|
|
15602
|
+
/**
|
|
15603
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15604
|
+
* @param resolution - resolution
|
|
15605
|
+
* @param eps - precision
|
|
15606
|
+
* @returns Returns itself.
|
|
15607
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15608
|
+
if (resolution === void 0) resolution = 1;
|
|
15609
|
+
if (eps === void 0) eps = 0.001;
|
|
15610
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15611
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15612
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15613
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15614
|
+
this.width = x2 - this.x;
|
|
15615
|
+
this.height = y2 - this.y;
|
|
15616
|
+
return this;
|
|
15617
|
+
};
|
|
15618
|
+
/**
|
|
15619
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15620
|
+
* @param rectangle - The rectangle to include.
|
|
15621
|
+
* @returns Returns itself.
|
|
15622
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15623
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15624
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15625
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15626
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15627
|
+
this.x = x1;
|
|
15628
|
+
this.width = x2 - x1;
|
|
15629
|
+
this.y = y1;
|
|
15630
|
+
this.height = y2 - y1;
|
|
15631
|
+
return this;
|
|
15632
|
+
};
|
|
15633
|
+
/**
|
|
15634
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15635
|
+
* @param out - optional rectangle to store the result
|
|
15636
|
+
* @returns The framing rectangle
|
|
15637
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15638
|
+
out = out || new Rectangle();
|
|
15639
|
+
out.copyFrom(this);
|
|
15640
|
+
return out;
|
|
15641
|
+
};
|
|
15642
|
+
_proto.getX = function getX() {
|
|
15643
|
+
return this.x;
|
|
15644
|
+
};
|
|
15645
|
+
_proto.getY = function getY() {
|
|
15646
|
+
return this.y;
|
|
15647
|
+
};
|
|
15648
|
+
_proto.build = function build(points) {
|
|
15649
|
+
var x = this.x;
|
|
15650
|
+
var y = this.y;
|
|
15651
|
+
var width = this.width;
|
|
15652
|
+
var height = this.height;
|
|
15653
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15654
|
+
return points;
|
|
15655
|
+
}
|
|
15656
|
+
points[0] = x;
|
|
15657
|
+
points[1] = y;
|
|
15658
|
+
points[2] = x + width;
|
|
15659
|
+
points[3] = y;
|
|
15660
|
+
points[4] = x + width;
|
|
15661
|
+
points[5] = y + height;
|
|
15662
|
+
points[6] = x;
|
|
15663
|
+
points[7] = y + height;
|
|
15664
|
+
return points;
|
|
15665
|
+
};
|
|
15666
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15667
|
+
var count = 0;
|
|
15668
|
+
var verticesStride = 2;
|
|
15669
|
+
verticesOffset *= verticesStride;
|
|
15670
|
+
vertices[verticesOffset + count] = points[0];
|
|
15671
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15672
|
+
count += verticesStride;
|
|
15673
|
+
vertices[verticesOffset + count] = points[2];
|
|
15674
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15675
|
+
count += verticesStride;
|
|
15676
|
+
vertices[verticesOffset + count] = points[6];
|
|
15677
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15678
|
+
count += verticesStride;
|
|
15679
|
+
vertices[verticesOffset + count] = points[4];
|
|
15680
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15681
|
+
count += verticesStride;
|
|
15682
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15683
|
+
// triangle 1
|
|
15684
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15685
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15686
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15687
|
+
// triangle 2
|
|
15688
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15689
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15690
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15691
|
+
};
|
|
15692
|
+
_create_class(Rectangle, [
|
|
15693
|
+
{
|
|
15694
|
+
key: "left",
|
|
15695
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15696
|
+
return this.x;
|
|
15697
|
+
}
|
|
15698
|
+
},
|
|
15699
|
+
{
|
|
15700
|
+
key: "right",
|
|
15701
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15702
|
+
return this.x + this.width;
|
|
15703
|
+
}
|
|
15704
|
+
},
|
|
15705
|
+
{
|
|
15706
|
+
key: "top",
|
|
15707
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15708
|
+
return this.y;
|
|
15709
|
+
}
|
|
15710
|
+
},
|
|
15711
|
+
{
|
|
15712
|
+
key: "bottom",
|
|
15713
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15714
|
+
return this.y + this.height;
|
|
15715
|
+
}
|
|
15716
|
+
}
|
|
15717
|
+
], [
|
|
15718
|
+
{
|
|
15719
|
+
key: "EMPTY",
|
|
15720
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15721
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15165
15722
|
}
|
|
15166
|
-
count++;
|
|
15167
15723
|
}
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
indices[indicesOffset++] = centerIndex;
|
|
15171
|
-
indices[indicesOffset++] = count - 1;
|
|
15172
|
-
};
|
|
15173
|
-
return Ellipse;
|
|
15724
|
+
]);
|
|
15725
|
+
return Rectangle;
|
|
15174
15726
|
}(ShapePrimitive);
|
|
15175
15727
|
|
|
15176
15728
|
var ShapePath = /*#__PURE__*/ function() {
|
|
@@ -15204,6 +15756,16 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15204
15756
|
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15205
15757
|
break;
|
|
15206
15758
|
}
|
|
15759
|
+
case "polyStar":
|
|
15760
|
+
{
|
|
15761
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15762
|
+
break;
|
|
15763
|
+
}
|
|
15764
|
+
case "rect":
|
|
15765
|
+
{
|
|
15766
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15767
|
+
break;
|
|
15768
|
+
}
|
|
15207
15769
|
}
|
|
15208
15770
|
}
|
|
15209
15771
|
this.endPoly();
|
|
@@ -15244,6 +15806,22 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15244
15806
|
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15245
15807
|
return this;
|
|
15246
15808
|
};
|
|
15809
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15810
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15811
|
+
return this;
|
|
15812
|
+
};
|
|
15813
|
+
/**
|
|
15814
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15815
|
+
* @param x - The x-coordinate of the top-left corner of the rectangle.
|
|
15816
|
+
* @param y - The y-coordinate of the top-left corner of the rectangle.
|
|
15817
|
+
* @param w - The width of the rectangle.
|
|
15818
|
+
* @param h - The height of the rectangle.
|
|
15819
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15820
|
+
* @returns The instance of the current object for chaining.
|
|
15821
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15822
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15823
|
+
return this;
|
|
15824
|
+
};
|
|
15247
15825
|
/**
|
|
15248
15826
|
* Draws a given shape on the canvas.
|
|
15249
15827
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
@@ -15400,6 +15978,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15400
15978
|
this.dirty = true;
|
|
15401
15979
|
return this;
|
|
15402
15980
|
};
|
|
15981
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15982
|
+
this.instructions.push({
|
|
15983
|
+
action: "polyStar",
|
|
15984
|
+
data: [
|
|
15985
|
+
pointCount,
|
|
15986
|
+
outerRadius,
|
|
15987
|
+
innerRadius,
|
|
15988
|
+
outerRoundness,
|
|
15989
|
+
innerRoundness,
|
|
15990
|
+
starType,
|
|
15991
|
+
transform
|
|
15992
|
+
]
|
|
15993
|
+
});
|
|
15994
|
+
this.dirty = true;
|
|
15995
|
+
return this;
|
|
15996
|
+
};
|
|
15403
15997
|
_proto.clear = function clear() {
|
|
15404
15998
|
this.instructions.length = 0;
|
|
15405
15999
|
this.dirty = true;
|
|
@@ -15477,7 +16071,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15477
16071
|
};
|
|
15478
16072
|
_this.material = Material.create(engine, materialProps);
|
|
15479
16073
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15480
|
-
_this.material.depthMask =
|
|
16074
|
+
_this.material.depthMask = false;
|
|
15481
16075
|
_this.material.depthTest = true;
|
|
15482
16076
|
_this.material.blending = true;
|
|
15483
16077
|
}
|
|
@@ -15542,16 +16136,18 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15542
16136
|
};
|
|
15543
16137
|
_proto.buildPath = function buildPath(data) {
|
|
15544
16138
|
this.path.clear();
|
|
15545
|
-
|
|
16139
|
+
var shapeData = data;
|
|
16140
|
+
switch(shapeData.type){
|
|
15546
16141
|
case 0:
|
|
15547
16142
|
{
|
|
15548
|
-
var customData =
|
|
15549
|
-
var points = customData.
|
|
15550
|
-
var easingIns = customData.
|
|
15551
|
-
var easingOuts = customData.
|
|
16143
|
+
var customData = shapeData;
|
|
16144
|
+
var points = customData.points;
|
|
16145
|
+
var easingIns = customData.easingIns;
|
|
16146
|
+
var easingOuts = customData.easingOuts;
|
|
15552
16147
|
this.curveValues = [];
|
|
15553
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
16148
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15554
16149
|
var shape = _step.value;
|
|
16150
|
+
this.setFillColor(shape.fill);
|
|
15555
16151
|
var indices = shape.indexes;
|
|
15556
16152
|
for(var i = 1; i < indices.length; i++){
|
|
15557
16153
|
var pointIndex = indices[i];
|
|
@@ -15581,45 +16177,206 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15581
16177
|
}
|
|
15582
16178
|
case 2:
|
|
15583
16179
|
{
|
|
15584
|
-
var ellipseData =
|
|
15585
|
-
|
|
15586
|
-
this.
|
|
16180
|
+
var ellipseData = shapeData;
|
|
16181
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16182
|
+
this.setFillColor(ellipseData.fill);
|
|
16183
|
+
break;
|
|
16184
|
+
}
|
|
16185
|
+
case 1:
|
|
16186
|
+
{
|
|
16187
|
+
var rectangleData = shapeData;
|
|
16188
|
+
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16189
|
+
this.setFillColor(rectangleData.fill);
|
|
16190
|
+
break;
|
|
16191
|
+
}
|
|
16192
|
+
case 4:
|
|
16193
|
+
{
|
|
16194
|
+
var starData = shapeData;
|
|
16195
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16196
|
+
this.setFillColor(starData.fill);
|
|
16197
|
+
break;
|
|
16198
|
+
}
|
|
16199
|
+
case 3:
|
|
16200
|
+
{
|
|
16201
|
+
var polygonData = shapeData;
|
|
16202
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16203
|
+
this.setFillColor(polygonData.fill);
|
|
15587
16204
|
break;
|
|
15588
16205
|
}
|
|
15589
16206
|
}
|
|
15590
16207
|
};
|
|
16208
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16209
|
+
if (fill) {
|
|
16210
|
+
var color = fill.color;
|
|
16211
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
16212
|
+
}
|
|
16213
|
+
};
|
|
15591
16214
|
_proto.fromData = function fromData(data) {
|
|
15592
16215
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15593
16216
|
this.data = data;
|
|
16217
|
+
var material = this.material;
|
|
16218
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16219
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16220
|
+
data.renderer.mask,
|
|
16221
|
+
data.renderer.mask
|
|
16222
|
+
] : undefined;
|
|
16223
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16224
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15594
16225
|
};
|
|
15595
16226
|
return ShapeComponent;
|
|
15596
16227
|
}(MeshComponent);
|
|
15597
16228
|
ShapeComponent = __decorate([
|
|
15598
16229
|
effectsClass("ShapeComponent")
|
|
15599
16230
|
], ShapeComponent);
|
|
15600
|
-
var
|
|
15601
|
-
(function(
|
|
16231
|
+
var ShapePrimitiveType;
|
|
16232
|
+
(function(ShapePrimitiveType) {
|
|
15602
16233
|
/**
|
|
15603
16234
|
* 自定义图形
|
|
15604
|
-
*/
|
|
16235
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15605
16236
|
/**
|
|
15606
16237
|
* 矩形
|
|
15607
|
-
*/
|
|
16238
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15608
16239
|
/**
|
|
15609
16240
|
* 椭圆
|
|
15610
|
-
*/
|
|
16241
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15611
16242
|
/**
|
|
15612
16243
|
* 多边形
|
|
15613
|
-
*/
|
|
16244
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15614
16245
|
/**
|
|
15615
16246
|
* 星形
|
|
15616
|
-
*/
|
|
15617
|
-
})(
|
|
16247
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
16248
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
15618
16249
|
var ShapeConnectType;
|
|
15619
16250
|
(function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
|
|
15620
16251
|
var ShapePointType;
|
|
15621
16252
|
(function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
|
|
15622
16253
|
|
|
16254
|
+
var Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16255
|
+
_inherits(Fake3DComponent, Component);
|
|
16256
|
+
function Fake3DComponent() {
|
|
16257
|
+
var _this;
|
|
16258
|
+
_this = Component.apply(this, arguments) || this;
|
|
16259
|
+
_this.loop = false;
|
|
16260
|
+
_this.amountOfMotion = 1.0;
|
|
16261
|
+
_this.animationLength = 2.0;
|
|
16262
|
+
_this.mode = 1;
|
|
16263
|
+
_this.startPositionX = 0;
|
|
16264
|
+
_this.startPositionY = 0;
|
|
16265
|
+
_this.startPositionZ = 0;
|
|
16266
|
+
_this.endPositionX = 0;
|
|
16267
|
+
_this.endPositionY = 0;
|
|
16268
|
+
_this.endPositionZ = 0;
|
|
16269
|
+
_this.amplitudeX = 0;
|
|
16270
|
+
_this.amplitudeY = 0;
|
|
16271
|
+
_this.amplitudeZ = 0;
|
|
16272
|
+
_this.phaseX = 0;
|
|
16273
|
+
_this.phaseY = 0;
|
|
16274
|
+
_this.phaseZ = 0;
|
|
16275
|
+
return _this;
|
|
16276
|
+
}
|
|
16277
|
+
var _proto = Fake3DComponent.prototype;
|
|
16278
|
+
_proto.onStart = function onStart() {
|
|
16279
|
+
this.effectComponent = this.item.getComponent(EffectComponent);
|
|
16280
|
+
};
|
|
16281
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16282
|
+
this.updateFake3D();
|
|
16283
|
+
};
|
|
16284
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16285
|
+
if (!this.effectComponent) {
|
|
16286
|
+
return;
|
|
16287
|
+
}
|
|
16288
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16289
|
+
var _PosX = 0;
|
|
16290
|
+
var _PosY = 0;
|
|
16291
|
+
var _PosZ = 0;
|
|
16292
|
+
switch(this.mode){
|
|
16293
|
+
case 0:
|
|
16294
|
+
{
|
|
16295
|
+
var PI = Math.PI;
|
|
16296
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16297
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16298
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16299
|
+
break;
|
|
16300
|
+
}
|
|
16301
|
+
case 1:
|
|
16302
|
+
{
|
|
16303
|
+
var localTime = time;
|
|
16304
|
+
if (this.loop) {
|
|
16305
|
+
if (localTime > 0.5) {
|
|
16306
|
+
localTime = 1 - localTime;
|
|
16307
|
+
}
|
|
16308
|
+
localTime *= 2;
|
|
16309
|
+
}
|
|
16310
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16311
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16312
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16313
|
+
break;
|
|
16314
|
+
}
|
|
16315
|
+
}
|
|
16316
|
+
var material = this.effectComponent.material;
|
|
16317
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16318
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16319
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16320
|
+
};
|
|
16321
|
+
return Fake3DComponent;
|
|
16322
|
+
}(Component);
|
|
16323
|
+
__decorate([
|
|
16324
|
+
serialize()
|
|
16325
|
+
], Fake3DComponent.prototype, "loop", void 0);
|
|
16326
|
+
__decorate([
|
|
16327
|
+
serialize()
|
|
16328
|
+
], Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16329
|
+
__decorate([
|
|
16330
|
+
serialize()
|
|
16331
|
+
], Fake3DComponent.prototype, "animationLength", void 0);
|
|
16332
|
+
__decorate([
|
|
16333
|
+
serialize()
|
|
16334
|
+
], Fake3DComponent.prototype, "mode", void 0);
|
|
16335
|
+
__decorate([
|
|
16336
|
+
serialize()
|
|
16337
|
+
], Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16338
|
+
__decorate([
|
|
16339
|
+
serialize()
|
|
16340
|
+
], Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16341
|
+
__decorate([
|
|
16342
|
+
serialize()
|
|
16343
|
+
], Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16344
|
+
__decorate([
|
|
16345
|
+
serialize()
|
|
16346
|
+
], Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16347
|
+
__decorate([
|
|
16348
|
+
serialize()
|
|
16349
|
+
], Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16350
|
+
__decorate([
|
|
16351
|
+
serialize()
|
|
16352
|
+
], Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16353
|
+
__decorate([
|
|
16354
|
+
serialize()
|
|
16355
|
+
], Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16356
|
+
__decorate([
|
|
16357
|
+
serialize()
|
|
16358
|
+
], Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16359
|
+
__decorate([
|
|
16360
|
+
serialize()
|
|
16361
|
+
], Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16362
|
+
__decorate([
|
|
16363
|
+
serialize()
|
|
16364
|
+
], Fake3DComponent.prototype, "phaseX", void 0);
|
|
16365
|
+
__decorate([
|
|
16366
|
+
serialize()
|
|
16367
|
+
], Fake3DComponent.prototype, "phaseY", void 0);
|
|
16368
|
+
__decorate([
|
|
16369
|
+
serialize()
|
|
16370
|
+
], Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16371
|
+
Fake3DComponent = __decorate([
|
|
16372
|
+
effectsClass("Fake3DComponent")
|
|
16373
|
+
], Fake3DComponent);
|
|
16374
|
+
var Fake3DAnimationMode;
|
|
16375
|
+
(function(Fake3DAnimationMode) {
|
|
16376
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16377
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16378
|
+
})(Fake3DAnimationMode || (Fake3DAnimationMode = {}));
|
|
16379
|
+
|
|
15623
16380
|
var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15624
16381
|
_inherits(CameraController, Behaviour);
|
|
15625
16382
|
function CameraController(engine, props) {
|
|
@@ -15990,8 +16747,8 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15990
16747
|
0
|
|
15991
16748
|
]
|
|
15992
16749
|
};
|
|
16750
|
+
_this.duringPlay = false;
|
|
15993
16751
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15994
|
-
_this.hasBeenAddedToComposition = false;
|
|
15995
16752
|
_this.getHitTestParams = function(force) {
|
|
15996
16753
|
if (!_this.clickable) {
|
|
15997
16754
|
return;
|
|
@@ -16028,7 +16785,6 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16028
16785
|
];
|
|
16029
16786
|
};
|
|
16030
16787
|
_proto.onStart = function onStart() {
|
|
16031
|
-
var _this = this;
|
|
16032
16788
|
var options = this.item.props.content.options;
|
|
16033
16789
|
var env = this.item.engine.renderer.env;
|
|
16034
16790
|
var composition = this.item.composition;
|
|
@@ -16052,32 +16808,35 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16052
16808
|
this.materials = this.previewContent.mesh.materials;
|
|
16053
16809
|
}
|
|
16054
16810
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
_this.endDragTarget();
|
|
16811
|
+
};
|
|
16812
|
+
_proto.onDisable = function onDisable() {
|
|
16813
|
+
if (this.item && this.item.composition) {
|
|
16814
|
+
var _this_previewContent;
|
|
16815
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16816
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16817
|
+
this.duringPlay = false;
|
|
16063
16818
|
}
|
|
16064
|
-
|
|
16819
|
+
this.clickable = false;
|
|
16820
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16821
|
+
this.endDragTarget();
|
|
16822
|
+
}
|
|
16823
|
+
};
|
|
16824
|
+
_proto.onEnable = function onEnable() {
|
|
16825
|
+
var type = this.interactData.options.type;
|
|
16826
|
+
if (type === InteractType.CLICK) {
|
|
16827
|
+
this.clickable = true;
|
|
16828
|
+
}
|
|
16065
16829
|
};
|
|
16066
16830
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16067
16831
|
var _this_previewContent;
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16073
|
-
var type = this.interactData.options.type;
|
|
16074
|
-
if (type === InteractType.CLICK) {
|
|
16075
|
-
this.clickable = true;
|
|
16076
|
-
}
|
|
16832
|
+
this.duringPlay = true;
|
|
16833
|
+
// trigger messageBegin when item enter
|
|
16834
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16835
|
+
var _this_item_composition;
|
|
16077
16836
|
var options = this.item.props.content.options;
|
|
16078
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16079
|
-
this.hasBeenAddedToComposition = true;
|
|
16837
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16080
16838
|
}
|
|
16839
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16081
16840
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16082
16841
|
return;
|
|
16083
16842
|
}
|
|
@@ -16245,7 +17004,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16245
17004
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16246
17005
|
}
|
|
16247
17006
|
|
|
16248
|
-
|
|
17007
|
+
/**
|
|
17008
|
+
*
|
|
17009
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16249
17010
|
function MeshCollider() {
|
|
16250
17011
|
this.triangles = [];
|
|
16251
17012
|
}
|
|
@@ -16253,6 +17014,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16253
17014
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16254
17015
|
return this.boundingBoxData;
|
|
16255
17016
|
};
|
|
17017
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
17018
|
+
var maxX = -Number.MAX_VALUE;
|
|
17019
|
+
var maxY = -Number.MAX_VALUE;
|
|
17020
|
+
var minX = Number.MAX_VALUE;
|
|
17021
|
+
var minY = Number.MAX_VALUE;
|
|
17022
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
17023
|
+
var triangle = _step.value;
|
|
17024
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
17025
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
17026
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
17027
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
17028
|
+
}
|
|
17029
|
+
var area = [];
|
|
17030
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
17031
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
17032
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
17033
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
17034
|
+
area.push({
|
|
17035
|
+
p0: point0,
|
|
17036
|
+
p1: point1,
|
|
17037
|
+
p2: point2
|
|
17038
|
+
});
|
|
17039
|
+
area.push({
|
|
17040
|
+
p0: point0,
|
|
17041
|
+
p1: point2,
|
|
17042
|
+
p2: point3
|
|
17043
|
+
});
|
|
17044
|
+
return {
|
|
17045
|
+
type: HitTestType.triangle,
|
|
17046
|
+
area: area
|
|
17047
|
+
};
|
|
17048
|
+
};
|
|
16256
17049
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16257
17050
|
if (this.geometry !== geometry) {
|
|
16258
17051
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16457,6 +17250,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16457
17250
|
if (inputCount === void 0) inputCount = 0;
|
|
16458
17251
|
this.onPlayablePlayFlag = true;
|
|
16459
17252
|
this.onPlayablePauseFlag = false;
|
|
17253
|
+
this.duration = 0;
|
|
16460
17254
|
this.destroyed = false;
|
|
16461
17255
|
this.inputs = [];
|
|
16462
17256
|
this.inputOuputPorts = [];
|
|
@@ -16549,6 +17343,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16549
17343
|
_proto.getTime = function getTime() {
|
|
16550
17344
|
return this.time;
|
|
16551
17345
|
};
|
|
17346
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17347
|
+
this.duration = duration;
|
|
17348
|
+
};
|
|
17349
|
+
_proto.getDuration = function getDuration() {
|
|
17350
|
+
return this.duration;
|
|
17351
|
+
};
|
|
16552
17352
|
_proto.getPlayState = function getPlayState() {
|
|
16553
17353
|
return this.playState;
|
|
16554
17354
|
};
|
|
@@ -16700,7 +17500,9 @@ var PlayableTraversalMode;
|
|
|
16700
17500
|
var tempQuat$1 = new Quaternion();
|
|
16701
17501
|
var seed$4 = 1;
|
|
16702
17502
|
// TODO 继承 Component
|
|
16703
|
-
|
|
17503
|
+
/**
|
|
17504
|
+
*
|
|
17505
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16704
17506
|
function Transform(props, parent) {
|
|
16705
17507
|
if (props === void 0) props = {};
|
|
16706
17508
|
this.taggedProperties = {};
|
|
@@ -17165,7 +17967,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17165
17967
|
return Transform;
|
|
17166
17968
|
}();
|
|
17167
17969
|
|
|
17168
|
-
|
|
17970
|
+
/**
|
|
17971
|
+
*
|
|
17972
|
+
*/ /**
|
|
17973
|
+
* 事件监听器
|
|
17974
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17169
17975
|
var _this = this;
|
|
17170
17976
|
var _this1 = this;
|
|
17171
17977
|
this.listeners = {};
|
|
@@ -17259,17 +18065,15 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17259
18065
|
/**
|
|
17260
18066
|
* 元素动画结束时行为(如何处理元素)
|
|
17261
18067
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17262
|
-
/**
|
|
17263
|
-
* 元素是否可用
|
|
17264
|
-
*/ _this.ended = false;
|
|
17265
|
-
_this.reusable = false;
|
|
17266
18068
|
_this.type = ItemType.base;
|
|
17267
18069
|
_this.isDuringPlay = false;
|
|
17268
18070
|
_this.components = [];
|
|
17269
18071
|
_this.rendererComponents = [];
|
|
17270
18072
|
/**
|
|
17271
|
-
*
|
|
17272
|
-
|
|
18073
|
+
* 元素是否激活
|
|
18074
|
+
*/ _this.active = true;
|
|
18075
|
+
/**
|
|
18076
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17273
18077
|
*/ _this.visible = true;
|
|
17274
18078
|
/**
|
|
17275
18079
|
* 元素动画的速度
|
|
@@ -17400,12 +18204,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17400
18204
|
}
|
|
17401
18205
|
};
|
|
17402
18206
|
/**
|
|
17403
|
-
* 元素动画结束播放时回调函数
|
|
17404
|
-
* @override
|
|
17405
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17406
|
-
// OVERRIDE
|
|
17407
|
-
};
|
|
17408
|
-
/**
|
|
17409
18207
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17410
18208
|
* @param {number} r
|
|
17411
18209
|
* @param {number} g
|
|
@@ -17418,17 +18216,27 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17418
18216
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17419
18217
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17420
18218
|
/**
|
|
17421
|
-
*
|
|
17422
|
-
*/ _proto.
|
|
17423
|
-
|
|
18219
|
+
* 激活或停用 VFXItem
|
|
18220
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18221
|
+
if (this.active !== value) {
|
|
18222
|
+
this.active = !!value;
|
|
18223
|
+
this.onActiveChanged();
|
|
18224
|
+
}
|
|
17424
18225
|
};
|
|
17425
18226
|
/**
|
|
17426
|
-
*
|
|
18227
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17427
18228
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
|
|
18229
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18230
|
+
var component = _step.value;
|
|
18231
|
+
component.enabled = visible;
|
|
17431
18232
|
}
|
|
18233
|
+
this.visible = visible;
|
|
18234
|
+
};
|
|
18235
|
+
/**
|
|
18236
|
+
* 元素组件显隐状态
|
|
18237
|
+
* @deprecated use isVisible instead
|
|
18238
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18239
|
+
return this.visible;
|
|
17432
18240
|
};
|
|
17433
18241
|
/**
|
|
17434
18242
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17510,14 +18318,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17510
18318
|
this.transform.assignWorldTRS(pos);
|
|
17511
18319
|
return pos;
|
|
17512
18320
|
};
|
|
17513
|
-
/**
|
|
17514
|
-
* 是否到达元素的结束时间
|
|
17515
|
-
* @param now
|
|
17516
|
-
* @returns
|
|
17517
|
-
*/ _proto.isEnded = function isEnded(now) {
|
|
17518
|
-
// at least 1 ms
|
|
17519
|
-
return now - this.duration > 0.001;
|
|
17520
|
-
};
|
|
17521
18321
|
_proto.find = function find(name) {
|
|
17522
18322
|
var _queue;
|
|
17523
18323
|
if (this.name === name) {
|
|
@@ -17541,7 +18341,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17541
18341
|
* @internal
|
|
17542
18342
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17543
18343
|
this.isDuringPlay = true;
|
|
17544
|
-
if (this.composition && this.
|
|
18344
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17545
18345
|
this.onEnable();
|
|
17546
18346
|
}
|
|
17547
18347
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17725,25 +18525,54 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17725
18525
|
// }
|
|
17726
18526
|
// }
|
|
17727
18527
|
};
|
|
17728
|
-
|
|
18528
|
+
/**
|
|
18529
|
+
*
|
|
18530
|
+
* @param item
|
|
18531
|
+
* @returns
|
|
18532
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17729
18533
|
return item.type === ItemType.composition;
|
|
17730
18534
|
};
|
|
17731
|
-
|
|
18535
|
+
/**
|
|
18536
|
+
*
|
|
18537
|
+
* @param item
|
|
18538
|
+
* @returns
|
|
18539
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17732
18540
|
return item.type === ItemType.sprite;
|
|
17733
18541
|
};
|
|
17734
|
-
|
|
18542
|
+
/**
|
|
18543
|
+
*
|
|
18544
|
+
* @param item
|
|
18545
|
+
* @returns
|
|
18546
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17735
18547
|
return item.type === ItemType.particle;
|
|
17736
18548
|
};
|
|
17737
|
-
|
|
18549
|
+
/**
|
|
18550
|
+
*
|
|
18551
|
+
* @param item
|
|
18552
|
+
* @returns
|
|
18553
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17738
18554
|
return item.type === ItemType.null;
|
|
17739
18555
|
};
|
|
17740
|
-
|
|
18556
|
+
/**
|
|
18557
|
+
*
|
|
18558
|
+
* @param item
|
|
18559
|
+
* @returns
|
|
18560
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17741
18561
|
return item.type === ItemType.tree;
|
|
17742
18562
|
};
|
|
17743
|
-
|
|
18563
|
+
/**
|
|
18564
|
+
*
|
|
18565
|
+
* @param item
|
|
18566
|
+
* @returns
|
|
18567
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17744
18568
|
return item.type === ItemType.camera;
|
|
17745
18569
|
};
|
|
17746
|
-
|
|
18570
|
+
/**
|
|
18571
|
+
*
|
|
18572
|
+
* @param ancestorCandidate
|
|
18573
|
+
* @param descendantCandidate
|
|
18574
|
+
* @returns
|
|
18575
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17747
18576
|
var current = descendantCandidate.parent;
|
|
17748
18577
|
while(current){
|
|
17749
18578
|
if (current === ancestorCandidate) {
|
|
@@ -17788,6 +18617,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17788
18617
|
}
|
|
17789
18618
|
}
|
|
17790
18619
|
}
|
|
18620
|
+
},
|
|
18621
|
+
{
|
|
18622
|
+
key: "isActive",
|
|
18623
|
+
get: /**
|
|
18624
|
+
* 当前 VFXItem 是否激活
|
|
18625
|
+
*/ function get() {
|
|
18626
|
+
return this.active;
|
|
18627
|
+
}
|
|
18628
|
+
},
|
|
18629
|
+
{
|
|
18630
|
+
key: "isVisible",
|
|
18631
|
+
get: /**
|
|
18632
|
+
* 元素组件显隐状态
|
|
18633
|
+
*/ function get() {
|
|
18634
|
+
return this.visible;
|
|
18635
|
+
}
|
|
17791
18636
|
}
|
|
17792
18637
|
]);
|
|
17793
18638
|
return VFXItem;
|
|
@@ -22552,6 +23397,7 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22552
23397
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22553
23398
|
var timelineClip = _step.value;
|
|
22554
23399
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23400
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22555
23401
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22556
23402
|
runtimeClips.push(clip);
|
|
22557
23403
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22655,14 +23501,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22655
23501
|
this.playable.setTime(clipTime);
|
|
22656
23502
|
// 判断动画是否结束
|
|
22657
23503
|
if (ended) {
|
|
22658
|
-
if (_instanceof1(boundObject, VFXItem) && !boundObject.ended) {
|
|
22659
|
-
boundObject.ended = true;
|
|
22660
|
-
boundObject.onEnd();
|
|
22661
|
-
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
22662
|
-
boundObject.dispose();
|
|
22663
|
-
this.playable.dispose();
|
|
22664
|
-
}
|
|
22665
|
-
}
|
|
22666
23504
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22667
23505
|
this.playable.pause();
|
|
22668
23506
|
}
|
|
@@ -22705,26 +23543,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22705
23543
|
}
|
|
22706
23544
|
if (hasInput) {
|
|
22707
23545
|
boundItem.transform.setValid(true);
|
|
22708
|
-
|
|
23546
|
+
boundItem.setActive(true);
|
|
22709
23547
|
} else {
|
|
22710
23548
|
boundItem.transform.setValid(false);
|
|
22711
|
-
|
|
22712
|
-
}
|
|
22713
|
-
};
|
|
22714
|
-
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
22715
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22716
|
-
var rendererComponent = _step.value;
|
|
22717
|
-
if (rendererComponent.enabled) {
|
|
22718
|
-
rendererComponent.enabled = false;
|
|
22719
|
-
}
|
|
22720
|
-
}
|
|
22721
|
-
};
|
|
22722
|
-
_proto.showRendererComponents = function showRendererComponents(item) {
|
|
22723
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22724
|
-
var rendererComponent = _step.value;
|
|
22725
|
-
if (!rendererComponent.enabled) {
|
|
22726
|
-
rendererComponent.enabled = true;
|
|
22727
|
-
}
|
|
23549
|
+
boundItem.setActive(false);
|
|
22728
23550
|
}
|
|
22729
23551
|
};
|
|
22730
23552
|
return ActivationMixerPlayable;
|
|
@@ -22752,7 +23574,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22752
23574
|
}
|
|
22753
23575
|
var _proto = PropertyClipPlayable.prototype;
|
|
22754
23576
|
_proto.processFrame = function processFrame(context) {
|
|
22755
|
-
this.value = this.curve.getValue(this.time);
|
|
23577
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22756
23578
|
};
|
|
22757
23579
|
return PropertyClipPlayable;
|
|
22758
23580
|
}(Playable);
|
|
@@ -23270,9 +24092,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23270
24092
|
var track = _step.value;
|
|
23271
24093
|
var boundObject = track.boundObject;
|
|
23272
24094
|
if (_instanceof1(boundObject, VFXItem)) {
|
|
23273
|
-
if (_instanceof1(track, ObjectBindingTrack)) {
|
|
23274
|
-
boundObject.reusable = value;
|
|
23275
|
-
}
|
|
23276
24095
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23277
24096
|
if (subCompositionComponent) {
|
|
23278
24097
|
subCompositionComponent.setReusable(value);
|
|
@@ -23317,16 +24136,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23317
24136
|
}
|
|
23318
24137
|
}
|
|
23319
24138
|
};
|
|
23320
|
-
_proto.
|
|
24139
|
+
_proto.onEnable = function onEnable() {
|
|
23321
24140
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23322
24141
|
var item = _step.value;
|
|
23323
|
-
item.
|
|
24142
|
+
item.setActive(true);
|
|
23324
24143
|
}
|
|
23325
24144
|
};
|
|
23326
|
-
_proto.
|
|
24145
|
+
_proto.onDisable = function onDisable() {
|
|
23327
24146
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23328
24147
|
var item = _step.value;
|
|
23329
|
-
item.
|
|
24148
|
+
item.setActive(false);
|
|
23330
24149
|
}
|
|
23331
24150
|
};
|
|
23332
24151
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23342,7 +24161,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23342
24161
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23343
24162
|
var _this, _loop = function(i) {
|
|
23344
24163
|
var item = _this.items[i];
|
|
23345
|
-
if (item.
|
|
24164
|
+
if (item.isActive && item.transform.getValid() && !VFXItem.isComposition(item) && !skip(item)) {
|
|
23346
24165
|
var hitParams = item.getHitTestParams(force);
|
|
23347
24166
|
if (hitParams) {
|
|
23348
24167
|
var success = false;
|
|
@@ -23484,9 +24303,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23484
24303
|
}
|
|
23485
24304
|
}
|
|
23486
24305
|
if (hasInput) {
|
|
23487
|
-
compositionComponent.
|
|
24306
|
+
compositionComponent.item.setActive(true);
|
|
23488
24307
|
} else {
|
|
23489
|
-
compositionComponent.
|
|
24308
|
+
compositionComponent.item.setActive(false);
|
|
23490
24309
|
}
|
|
23491
24310
|
};
|
|
23492
24311
|
return SubCompositionMixerPlayable;
|
|
@@ -24151,6 +24970,8 @@ var TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24151
24970
|
/**
|
|
24152
24971
|
* 文本行数
|
|
24153
24972
|
*/ _this.lineCount = 0;
|
|
24973
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24974
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24154
24975
|
_this.name = "MText" + seed$2++;
|
|
24155
24976
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24156
24977
|
if (props) {
|
|
@@ -24516,7 +25337,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24516
25337
|
}
|
|
24517
25338
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24518
25339
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24519
|
-
this.material.setTexture("
|
|
25340
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24520
25341
|
data: new Uint8Array(imageData.data),
|
|
24521
25342
|
width: imageData.width,
|
|
24522
25343
|
height: imageData.height
|
|
@@ -27714,7 +28535,7 @@ var listOrder = 0;
|
|
|
27714
28535
|
var itemProps = sourceItemData;
|
|
27715
28536
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27716
28537
|
itemProps.listIndex = listOrder++;
|
|
27717
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
28538
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
|
|
27718
28539
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27719
28540
|
var componentPath = _step2.value;
|
|
27720
28541
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27810,13 +28631,18 @@ var listOrder = 0;
|
|
|
27810
28631
|
return CompositionSourceManager;
|
|
27811
28632
|
}();
|
|
27812
28633
|
|
|
27813
|
-
|
|
28634
|
+
/**
|
|
28635
|
+
*
|
|
28636
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27814
28637
|
function SceneTicking() {
|
|
27815
28638
|
this.update = new UpdateTickData();
|
|
27816
28639
|
this.lateUpdate = new LateUpdateTickData();
|
|
27817
28640
|
}
|
|
27818
28641
|
var _proto = SceneTicking.prototype;
|
|
27819
|
-
|
|
28642
|
+
/**
|
|
28643
|
+
*
|
|
28644
|
+
* @param obj
|
|
28645
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27820
28646
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27821
28647
|
this.update.addComponent(obj);
|
|
27822
28648
|
}
|
|
@@ -27824,7 +28650,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27824
28650
|
this.lateUpdate.addComponent(obj);
|
|
27825
28651
|
}
|
|
27826
28652
|
};
|
|
27827
|
-
|
|
28653
|
+
/**
|
|
28654
|
+
*
|
|
28655
|
+
* @param obj
|
|
28656
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27828
28657
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27829
28658
|
this.update.removeComponent(obj);
|
|
27830
28659
|
}
|
|
@@ -27832,7 +28661,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27832
28661
|
this.lateUpdate.removeComponent(obj);
|
|
27833
28662
|
}
|
|
27834
28663
|
};
|
|
27835
|
-
|
|
28664
|
+
/**
|
|
28665
|
+
*
|
|
28666
|
+
*/ _proto.clear = function clear() {
|
|
27836
28667
|
this.update.clear();
|
|
27837
28668
|
this.lateUpdate.clear();
|
|
27838
28669
|
};
|
|
@@ -27923,11 +28754,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27923
28754
|
var _this;
|
|
27924
28755
|
var _scene_jsonScene_renderSettings;
|
|
27925
28756
|
_this = EventEmitter.call(this) || this;
|
|
27926
|
-
|
|
28757
|
+
/**
|
|
28758
|
+
*
|
|
28759
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27927
28760
|
/**
|
|
27928
28761
|
* 动画播放速度
|
|
27929
28762
|
*/ _this.speed = 1;
|
|
27930
28763
|
/**
|
|
28764
|
+
* 合成是否结束
|
|
28765
|
+
*/ _this.isEnded = false;
|
|
28766
|
+
/**
|
|
27931
28767
|
* 用于保存与当前合成相关的插件数据
|
|
27932
28768
|
*/ _this.loaderData = {};
|
|
27933
28769
|
/**
|
|
@@ -27949,6 +28785,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27949
28785
|
* 合成暂停/播放 标识
|
|
27950
28786
|
*/ _this.paused = false;
|
|
27951
28787
|
_this.lastVideoUpdateTime = 0;
|
|
28788
|
+
_this.isEndCalled = false;
|
|
27952
28789
|
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;
|
|
27953
28790
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27954
28791
|
if (reusable) {
|
|
@@ -28038,7 +28875,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28038
28875
|
* @param visible - 是否可见
|
|
28039
28876
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28040
28877
|
this.items.forEach(function(item) {
|
|
28041
|
-
item.
|
|
28878
|
+
item.setActive(visible);
|
|
28042
28879
|
});
|
|
28043
28880
|
};
|
|
28044
28881
|
/**
|
|
@@ -28048,7 +28885,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28048
28885
|
return this.speed;
|
|
28049
28886
|
};
|
|
28050
28887
|
_proto.play = function play() {
|
|
28051
|
-
if (this.
|
|
28888
|
+
if (this.isEnded && this.reusable) {
|
|
28052
28889
|
this.restart();
|
|
28053
28890
|
}
|
|
28054
28891
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28139,7 +28976,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28139
28976
|
* 重置状态函数
|
|
28140
28977
|
*/ _proto.reset = function reset() {
|
|
28141
28978
|
this.rendererOptions = null;
|
|
28142
|
-
this.
|
|
28979
|
+
this.isEnded = false;
|
|
28980
|
+
this.isEndCalled = false;
|
|
28143
28981
|
this.rootComposition.time = 0;
|
|
28144
28982
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28145
28983
|
};
|
|
@@ -28191,12 +29029,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28191
29029
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28192
29030
|
this.updateCamera();
|
|
28193
29031
|
this.prepareRender();
|
|
29032
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
29033
|
+
this.isEndCalled = true;
|
|
29034
|
+
this.emit("end", {
|
|
29035
|
+
composition: this
|
|
29036
|
+
});
|
|
29037
|
+
}
|
|
28194
29038
|
if (this.shouldDispose()) {
|
|
28195
29039
|
this.dispose();
|
|
28196
29040
|
}
|
|
28197
29041
|
};
|
|
28198
29042
|
_proto.shouldDispose = function shouldDispose() {
|
|
28199
|
-
return this.
|
|
29043
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28200
29044
|
};
|
|
28201
29045
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28202
29046
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28287,11 +29131,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28287
29131
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28288
29132
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28289
29133
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28290
|
-
var
|
|
29134
|
+
var isEnded = false;
|
|
28291
29135
|
var duration = this.rootItem.duration;
|
|
28292
29136
|
var endBehavior = this.rootItem.endBehavior;
|
|
28293
29137
|
if (localTime - duration > 0.001) {
|
|
28294
|
-
|
|
29138
|
+
isEnded = true;
|
|
28295
29139
|
switch(endBehavior){
|
|
28296
29140
|
case EndBehavior.restart:
|
|
28297
29141
|
{
|
|
@@ -28315,11 +29159,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28315
29159
|
}
|
|
28316
29160
|
}
|
|
28317
29161
|
this.rootComposition.time = localTime;
|
|
28318
|
-
|
|
28319
|
-
|
|
28320
|
-
|
|
28321
|
-
|
|
28322
|
-
}
|
|
29162
|
+
// end state changed, handle onEnd flags
|
|
29163
|
+
if (this.isEnded !== isEnded) {
|
|
29164
|
+
if (isEnded) {
|
|
29165
|
+
this.isEnded = true;
|
|
29166
|
+
} else {
|
|
29167
|
+
this.isEnded = false;
|
|
29168
|
+
this.isEndCalled = false;
|
|
29169
|
+
}
|
|
28323
29170
|
}
|
|
28324
29171
|
}
|
|
28325
29172
|
};
|
|
@@ -30645,7 +31492,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
30645
31492
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
30646
31493
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
30647
31494
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
30648
|
-
var version$1 = "2.1.0-
|
|
31495
|
+
var version$1 = "2.1.0-beta.0";
|
|
30649
31496
|
logger.info("Core version: " + version$1 + ".");
|
|
30650
31497
|
|
|
30651
31498
|
var _obj;
|
|
@@ -30681,22 +31528,7 @@ var _obj3;
|
|
|
30681
31528
|
* 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
|
|
30682
31529
|
*/ var TEXTURE_UNIFORM_MAP = [
|
|
30683
31530
|
"uMaskTex",
|
|
30684
|
-
"
|
|
30685
|
-
"uSampler1",
|
|
30686
|
-
"uSampler2",
|
|
30687
|
-
"uSampler3",
|
|
30688
|
-
"uSampler4",
|
|
30689
|
-
"uSampler5",
|
|
30690
|
-
"uSampler6",
|
|
30691
|
-
"uSampler7",
|
|
30692
|
-
"uSampler8",
|
|
30693
|
-
"uSampler9",
|
|
30694
|
-
"uSampler10",
|
|
30695
|
-
"uSampler11",
|
|
30696
|
-
"uSampler12",
|
|
30697
|
-
"uSampler13",
|
|
30698
|
-
"uSampler14",
|
|
30699
|
-
"uSampler15",
|
|
31531
|
+
"_MainTex",
|
|
30700
31532
|
"uColorOverLifetime",
|
|
30701
31533
|
"uColorOverTrail"
|
|
30702
31534
|
];
|
|
@@ -30727,9 +31559,7 @@ var _obj3;
|
|
|
30727
31559
|
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
30728
31560
|
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
30729
31561
|
});
|
|
30730
|
-
|
|
30731
|
-
_this.uniforms["uSampler" + i] = new THREE.Uniform(null);
|
|
30732
|
-
}
|
|
31562
|
+
_this.uniforms["_MainTex"] = new THREE.Uniform(null);
|
|
30733
31563
|
_this.uniforms["uEditorTransform"] = new THREE.Uniform([
|
|
30734
31564
|
1,
|
|
30735
31565
|
1,
|
|
@@ -32289,8 +33119,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
32289
33119
|
*/ Mesh.create = function(engine, props) {
|
|
32290
33120
|
return new ThreeMesh(engine, props);
|
|
32291
33121
|
};
|
|
32292
|
-
var version = "2.1.0-
|
|
33122
|
+
var version = "2.1.0-beta.0";
|
|
32293
33123
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
32294
33124
|
|
|
32295
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyTrack, Component,
|
|
33125
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapeConnectType, ShapePointType, ShapePrimitiveType, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
32296
33126
|
//# sourceMappingURL=index.mjs.map
|