@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.js
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
|
'use strict';
|
|
@@ -1244,6 +1244,12 @@ function _inherits(subClass, superClass) {
|
|
|
1244
1244
|
/**
|
|
1245
1245
|
* 特效元素
|
|
1246
1246
|
*/ ItemType["effect"] = "effect";
|
|
1247
|
+
/**
|
|
1248
|
+
* 形状元素
|
|
1249
|
+
*/ ItemType["shape"] = "shape";
|
|
1250
|
+
/**
|
|
1251
|
+
* 后处理元素
|
|
1252
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
1247
1253
|
/**
|
|
1248
1254
|
* 节点元素
|
|
1249
1255
|
*/ ItemType["node"] = "node";
|
|
@@ -1253,6 +1259,9 @@ function _inherits(subClass, superClass) {
|
|
|
1253
1259
|
/**
|
|
1254
1260
|
* 音频元素
|
|
1255
1261
|
*/ ItemType["audio"] = "audio";
|
|
1262
|
+
/**
|
|
1263
|
+
* 富文本元素
|
|
1264
|
+
*/ ItemType["richtext"] = "richtext";
|
|
1256
1265
|
})(ItemType || (ItemType = {}));
|
|
1257
1266
|
/**
|
|
1258
1267
|
* 渲染模式
|
|
@@ -1628,6 +1637,30 @@ var TextAlignment;
|
|
|
1628
1637
|
*/ FontStyle["oblique"] = "oblique";
|
|
1629
1638
|
})(FontStyle || (FontStyle = {}));
|
|
1630
1639
|
|
|
1640
|
+
var BuiltinObjectGUID = {
|
|
1641
|
+
WhiteTexture: "whitetexture00000000000000000000",
|
|
1642
|
+
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1643
|
+
PBRShader: "pbr00000000000000000000000000000",
|
|
1644
|
+
UnlitShader: "unlit000000000000000000000000000"
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* 动态换图类型
|
|
1649
|
+
* @since 1.1.0
|
|
1650
|
+
*/ var BackgroundType;
|
|
1651
|
+
(function(BackgroundType) {
|
|
1652
|
+
BackgroundType["video"] = "video";
|
|
1653
|
+
BackgroundType["image"] = "image";
|
|
1654
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1655
|
+
/**
|
|
1656
|
+
* 多媒体资源类型
|
|
1657
|
+
* @since 2.1.0
|
|
1658
|
+
*/ var MultimediaType;
|
|
1659
|
+
(function(MultimediaType) {
|
|
1660
|
+
MultimediaType["video"] = "video";
|
|
1661
|
+
MultimediaType["audio"] = "audio";
|
|
1662
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1663
|
+
|
|
1631
1664
|
var DataType;
|
|
1632
1665
|
(function(DataType) {
|
|
1633
1666
|
DataType["VFXItemData"] = "VFXItemData";
|
|
@@ -1638,6 +1671,7 @@ var DataType;
|
|
|
1638
1671
|
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1639
1672
|
DataType["InteractComponent"] = "InteractComponent";
|
|
1640
1673
|
DataType["CameraController"] = "CameraController";
|
|
1674
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1641
1675
|
DataType["Geometry"] = "Geometry";
|
|
1642
1676
|
DataType["Texture"] = "Texture";
|
|
1643
1677
|
DataType["AnimationClip"] = "AnimationClip";
|
|
@@ -1660,7 +1694,6 @@ var DataType;
|
|
|
1660
1694
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1661
1695
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1662
1696
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1663
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
1664
1697
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1665
1698
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1666
1699
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1671,9 +1704,11 @@ var DataType;
|
|
|
1671
1704
|
DataType["SpineComponent"] = "SpineComponent";
|
|
1672
1705
|
DataType["VideoComponent"] = "VideoComponent";
|
|
1673
1706
|
DataType["AudioComponent"] = "AudioComponent";
|
|
1707
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1674
1708
|
// Non-EffectObject
|
|
1675
1709
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1676
1710
|
})(DataType || (DataType = {}));
|
|
1711
|
+
|
|
1677
1712
|
var GeometryType;
|
|
1678
1713
|
(function(GeometryType) {
|
|
1679
1714
|
/**
|
|
@@ -1758,30 +1793,6 @@ var VertexBufferSemantic;
|
|
|
1758
1793
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1759
1794
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1760
1795
|
|
|
1761
|
-
var BuiltinObjectGUID = {
|
|
1762
|
-
WhiteTexture: "whitetexture00000000000000000000",
|
|
1763
|
-
TransparentTexture: "transparenttexture00000000000000000000",
|
|
1764
|
-
PBRShader: "pbr00000000000000000000000000000",
|
|
1765
|
-
UnlitShader: "unlit000000000000000000000000000"
|
|
1766
|
-
};
|
|
1767
|
-
|
|
1768
|
-
/**
|
|
1769
|
-
* 动态换图类型
|
|
1770
|
-
* @since 1.1.0
|
|
1771
|
-
*/ var BackgroundType;
|
|
1772
|
-
(function(BackgroundType) {
|
|
1773
|
-
BackgroundType["video"] = "video";
|
|
1774
|
-
BackgroundType["image"] = "image";
|
|
1775
|
-
})(BackgroundType || (BackgroundType = {}));
|
|
1776
|
-
/**
|
|
1777
|
-
* 多媒体资源类型
|
|
1778
|
-
* @since 2.1.0
|
|
1779
|
-
*/ var MultimediaType;
|
|
1780
|
-
(function(MultimediaType) {
|
|
1781
|
-
MultimediaType["video"] = "video";
|
|
1782
|
-
MultimediaType["audio"] = "audio";
|
|
1783
|
-
})(MultimediaType || (MultimediaType = {}));
|
|
1784
|
-
|
|
1785
1796
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1786
1797
|
__proto__: null,
|
|
1787
1798
|
get RenderLevel () { return RenderLevel; },
|
|
@@ -1826,14 +1837,14 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1826
1837
|
get TextAlignment () { return TextAlignment; },
|
|
1827
1838
|
get TextWeight () { return TextWeight; },
|
|
1828
1839
|
get FontStyle () { return FontStyle; },
|
|
1840
|
+
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1841
|
+
get BackgroundType () { return BackgroundType; },
|
|
1842
|
+
get MultimediaType () { return MultimediaType; },
|
|
1829
1843
|
get DataType () { return DataType; },
|
|
1830
1844
|
get GeometryType () { return GeometryType; },
|
|
1831
1845
|
get VertexFormatType () { return VertexFormatType; },
|
|
1832
1846
|
get IndexFormatType () { return IndexFormatType; },
|
|
1833
|
-
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1834
|
-
BuiltinObjectGUID: BuiltinObjectGUID,
|
|
1835
|
-
get BackgroundType () { return BackgroundType; },
|
|
1836
|
-
get MultimediaType () { return MultimediaType; }
|
|
1847
|
+
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
1837
1848
|
});
|
|
1838
1849
|
|
|
1839
1850
|
function _defineProperties(target, props) {
|
|
@@ -1921,15 +1932,23 @@ function getDirectStore(target) {
|
|
|
1921
1932
|
this.engine.addInstance(this);
|
|
1922
1933
|
}
|
|
1923
1934
|
var _proto = EffectsObject.prototype;
|
|
1924
|
-
|
|
1935
|
+
/**
|
|
1936
|
+
*
|
|
1937
|
+
* @returns
|
|
1938
|
+
*/ _proto.getInstanceId = function getInstanceId() {
|
|
1925
1939
|
return this.guid;
|
|
1926
1940
|
};
|
|
1927
|
-
|
|
1941
|
+
/**
|
|
1942
|
+
*
|
|
1943
|
+
* @param guid
|
|
1944
|
+
*/ _proto.setInstanceId = function setInstanceId(guid) {
|
|
1928
1945
|
this.engine.removeInstance(this.guid);
|
|
1929
1946
|
this.guid = guid;
|
|
1930
1947
|
this.engine.addInstance(this);
|
|
1931
1948
|
};
|
|
1932
|
-
|
|
1949
|
+
/**
|
|
1950
|
+
*
|
|
1951
|
+
*/ _proto.toData = function toData() {};
|
|
1933
1952
|
/**
|
|
1934
1953
|
* 反序列化函数
|
|
1935
1954
|
*
|
|
@@ -1939,8 +1958,14 @@ function getDirectStore(target) {
|
|
|
1939
1958
|
this.setInstanceId(data.id);
|
|
1940
1959
|
}
|
|
1941
1960
|
};
|
|
1942
|
-
|
|
1943
|
-
|
|
1961
|
+
/**
|
|
1962
|
+
*
|
|
1963
|
+
*/ _proto.dispose = function dispose() {};
|
|
1964
|
+
/**
|
|
1965
|
+
*
|
|
1966
|
+
* @param obj
|
|
1967
|
+
* @returns
|
|
1968
|
+
*/ EffectsObject.is = function is(obj) {
|
|
1944
1969
|
return _instanceof1(obj, EffectsObject) && "guid" in obj;
|
|
1945
1970
|
};
|
|
1946
1971
|
return EffectsObject;
|
|
@@ -2020,7 +2045,7 @@ function getDirectStore(target) {
|
|
|
2020
2045
|
this.onAwake();
|
|
2021
2046
|
this.isAwakeCalled = true;
|
|
2022
2047
|
}
|
|
2023
|
-
if (item.
|
|
2048
|
+
if (item.isActive && this.enabled) {
|
|
2024
2049
|
this.start();
|
|
2025
2050
|
this.enable();
|
|
2026
2051
|
}
|
|
@@ -2065,7 +2090,7 @@ function getDirectStore(target) {
|
|
|
2065
2090
|
get: /**
|
|
2066
2091
|
* 组件是否可以更新,true 更新,false 不更新
|
|
2067
2092
|
*/ function get() {
|
|
2068
|
-
return this.item.
|
|
2093
|
+
return this.item.isActive && this.enabled;
|
|
2069
2094
|
}
|
|
2070
2095
|
},
|
|
2071
2096
|
{
|
|
@@ -3694,7 +3719,9 @@ Vector3.ZERO = new Vector3(0.0, 0.0, 0.0);
|
|
|
3694
3719
|
*/ Vector4.ONE = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
3695
3720
|
Vector4.ZERO = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
3696
3721
|
|
|
3697
|
-
|
|
3722
|
+
/**
|
|
3723
|
+
* Mesh 组件
|
|
3724
|
+
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
3698
3725
|
_inherits(MeshComponent, RendererComponent);
|
|
3699
3726
|
function MeshComponent() {
|
|
3700
3727
|
var _this;
|
|
@@ -3704,7 +3731,9 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3704
3731
|
*/ _this.meshCollider = new MeshCollider();
|
|
3705
3732
|
// TODO 点击测试后续抽象一个 Collider 组件
|
|
3706
3733
|
_this.getHitTestParams = function(force) {
|
|
3707
|
-
var
|
|
3734
|
+
var worldMatrix = _this.transform.getWorldMatrix();
|
|
3735
|
+
_this.meshCollider.setGeometry(_this.geometry, worldMatrix);
|
|
3736
|
+
var area = _this.meshCollider.getBoundingBoxData();
|
|
3708
3737
|
if (area) {
|
|
3709
3738
|
return {
|
|
3710
3739
|
type: area.type,
|
|
@@ -3724,8 +3753,8 @@ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
3724
3753
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
3725
3754
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
3726
3755
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
3727
|
-
var
|
|
3728
|
-
return
|
|
3756
|
+
var boundingBox = this.meshCollider.getBoundingBox();
|
|
3757
|
+
return boundingBox;
|
|
3729
3758
|
};
|
|
3730
3759
|
return MeshComponent;
|
|
3731
3760
|
}(RendererComponent);
|
|
@@ -3763,24 +3792,29 @@ exports.EffectComponent = __decorate([
|
|
|
3763
3792
|
|
|
3764
3793
|
exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
3765
3794
|
_inherits(PostProcessVolume, Behaviour);
|
|
3766
|
-
function PostProcessVolume() {
|
|
3795
|
+
function PostProcessVolume(engine) {
|
|
3767
3796
|
var _this;
|
|
3768
|
-
_this = Behaviour.
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
_this.
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
_this.
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3797
|
+
_this = Behaviour.call(this, engine) || this;
|
|
3798
|
+
_this.bloom = {
|
|
3799
|
+
threshold: 0,
|
|
3800
|
+
intensity: 0,
|
|
3801
|
+
active: false
|
|
3802
|
+
};
|
|
3803
|
+
_this.vignette = {
|
|
3804
|
+
intensity: 0,
|
|
3805
|
+
smoothness: 0,
|
|
3806
|
+
roundness: 0,
|
|
3807
|
+
active: false
|
|
3808
|
+
};
|
|
3809
|
+
_this.tonemapping = {
|
|
3810
|
+
active: false
|
|
3811
|
+
};
|
|
3812
|
+
_this.colorAdjustments = {
|
|
3813
|
+
brightness: 0,
|
|
3814
|
+
saturation: 0,
|
|
3815
|
+
contrast: 0,
|
|
3816
|
+
active: false
|
|
3817
|
+
};
|
|
3784
3818
|
return _this;
|
|
3785
3819
|
}
|
|
3786
3820
|
var _proto = PostProcessVolume.prototype;
|
|
@@ -3794,36 +3828,18 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3794
3828
|
}(Behaviour);
|
|
3795
3829
|
__decorate([
|
|
3796
3830
|
serialize()
|
|
3797
|
-
], exports.PostProcessVolume.prototype, "
|
|
3798
|
-
__decorate([
|
|
3799
|
-
serialize()
|
|
3800
|
-
], exports.PostProcessVolume.prototype, "threshold", void 0);
|
|
3831
|
+
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
3801
3832
|
__decorate([
|
|
3802
3833
|
serialize()
|
|
3803
|
-
], exports.PostProcessVolume.prototype, "
|
|
3834
|
+
], exports.PostProcessVolume.prototype, "vignette", void 0);
|
|
3804
3835
|
__decorate([
|
|
3805
3836
|
serialize()
|
|
3806
|
-
], exports.PostProcessVolume.prototype, "
|
|
3837
|
+
], exports.PostProcessVolume.prototype, "tonemapping", void 0);
|
|
3807
3838
|
__decorate([
|
|
3808
3839
|
serialize()
|
|
3809
|
-
], exports.PostProcessVolume.prototype, "
|
|
3810
|
-
__decorate([
|
|
3811
|
-
serialize()
|
|
3812
|
-
], exports.PostProcessVolume.prototype, "contrast", void 0);
|
|
3813
|
-
__decorate([
|
|
3814
|
-
serialize()
|
|
3815
|
-
], exports.PostProcessVolume.prototype, "vignetteIntensity", void 0);
|
|
3816
|
-
__decorate([
|
|
3817
|
-
serialize()
|
|
3818
|
-
], exports.PostProcessVolume.prototype, "vignetteSmoothness", void 0);
|
|
3819
|
-
__decorate([
|
|
3820
|
-
serialize()
|
|
3821
|
-
], exports.PostProcessVolume.prototype, "vignetteRoundness", void 0);
|
|
3822
|
-
__decorate([
|
|
3823
|
-
serialize()
|
|
3824
|
-
], exports.PostProcessVolume.prototype, "toneMappingEnabled", void 0);
|
|
3840
|
+
], exports.PostProcessVolume.prototype, "colorAdjustments", void 0);
|
|
3825
3841
|
exports.PostProcessVolume = __decorate([
|
|
3826
|
-
effectsClass(
|
|
3842
|
+
effectsClass(DataType.PostProcessVolume)
|
|
3827
3843
|
], exports.PostProcessVolume);
|
|
3828
3844
|
|
|
3829
3845
|
function _assert_this_initialized(self) {
|
|
@@ -6910,6 +6926,7 @@ exports.MaterialRenderType = void 0;
|
|
|
6910
6926
|
_this.enabledMacros = {};
|
|
6911
6927
|
_this.destroyed = false;
|
|
6912
6928
|
_this.initialized = false;
|
|
6929
|
+
_this.shaderDirty = true;
|
|
6913
6930
|
if (props) {
|
|
6914
6931
|
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;
|
|
6915
6932
|
_this.name = name;
|
|
@@ -6937,6 +6954,41 @@ exports.MaterialRenderType = void 0;
|
|
|
6937
6954
|
// OVERRIDE
|
|
6938
6955
|
};
|
|
6939
6956
|
_create_class(Material, [
|
|
6957
|
+
{
|
|
6958
|
+
key: "shader",
|
|
6959
|
+
get: function get() {
|
|
6960
|
+
return this._shader;
|
|
6961
|
+
},
|
|
6962
|
+
set: function set(value) {
|
|
6963
|
+
if (this._shader === value) {
|
|
6964
|
+
return;
|
|
6965
|
+
}
|
|
6966
|
+
this._shader = value;
|
|
6967
|
+
this.shaderDirty = true;
|
|
6968
|
+
}
|
|
6969
|
+
},
|
|
6970
|
+
{
|
|
6971
|
+
key: "mainTexture",
|
|
6972
|
+
get: /**
|
|
6973
|
+
* 材质的主纹理
|
|
6974
|
+
*/ function get() {
|
|
6975
|
+
return this.getTexture("_MainTex");
|
|
6976
|
+
},
|
|
6977
|
+
set: function set(value) {
|
|
6978
|
+
this.setTexture("_MainTex", value);
|
|
6979
|
+
}
|
|
6980
|
+
},
|
|
6981
|
+
{
|
|
6982
|
+
key: "color",
|
|
6983
|
+
get: /**
|
|
6984
|
+
* 材质的主颜色
|
|
6985
|
+
*/ function get() {
|
|
6986
|
+
return this.getColor("_Color");
|
|
6987
|
+
},
|
|
6988
|
+
set: function set(value) {
|
|
6989
|
+
this.setColor("_Color", value);
|
|
6990
|
+
}
|
|
6991
|
+
},
|
|
6940
6992
|
{
|
|
6941
6993
|
key: "blending",
|
|
6942
6994
|
set: /******** effects-core 中会调用 引擎必须实现 ***********************/ /**
|
|
@@ -10073,7 +10125,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10073
10125
|
|
|
10074
10126
|
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}";
|
|
10075
10127
|
|
|
10076
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D
|
|
10128
|
+
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;}";
|
|
10077
10129
|
|
|
10078
10130
|
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";
|
|
10079
10131
|
|
|
@@ -10304,15 +10356,15 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10304
10356
|
renderer.setFramebuffer(this.framebuffer);
|
|
10305
10357
|
};
|
|
10306
10358
|
_proto.execute = function execute(renderer) {
|
|
10307
|
-
var _renderer_renderingData_currentFrame_globalVolume;
|
|
10359
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
10308
10360
|
renderer.clear({
|
|
10309
10361
|
colorAction: exports.TextureStoreAction.clear,
|
|
10310
10362
|
depthAction: exports.TextureStoreAction.clear,
|
|
10311
10363
|
stencilAction: exports.TextureStoreAction.clear
|
|
10312
10364
|
});
|
|
10313
10365
|
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
10314
|
-
var
|
|
10315
|
-
var threshold = (
|
|
10366
|
+
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
10367
|
+
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;
|
|
10316
10368
|
this.screenMesh.material.setFloat("_Threshold", threshold);
|
|
10317
10369
|
renderer.renderMeshes([
|
|
10318
10370
|
this.screenMesh
|
|
@@ -10525,25 +10577,44 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10525
10577
|
depthAction: exports.TextureStoreAction.clear,
|
|
10526
10578
|
stencilAction: exports.TextureStoreAction.clear
|
|
10527
10579
|
});
|
|
10528
|
-
var
|
|
10529
|
-
var
|
|
10580
|
+
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
10581
|
+
var bloom = _extends({
|
|
10582
|
+
threshold: 0,
|
|
10583
|
+
intensity: 0,
|
|
10584
|
+
active: false
|
|
10585
|
+
}, globalVolume == null ? void 0 : globalVolume.bloom);
|
|
10586
|
+
var vignette = _extends({
|
|
10587
|
+
intensity: 0,
|
|
10588
|
+
smoothness: 0,
|
|
10589
|
+
roundness: 0,
|
|
10590
|
+
active: false
|
|
10591
|
+
}, globalVolume == null ? void 0 : globalVolume.vignette);
|
|
10592
|
+
var colorAdjustments = _extends({
|
|
10593
|
+
brightness: 0,
|
|
10594
|
+
saturation: 0,
|
|
10595
|
+
contrast: 0,
|
|
10596
|
+
active: false
|
|
10597
|
+
}, globalVolume == null ? void 0 : globalVolume.colorAdjustments);
|
|
10598
|
+
var tonemapping = _extends({
|
|
10599
|
+
active: false
|
|
10600
|
+
}, globalVolume == null ? void 0 : globalVolume.tonemapping);
|
|
10530
10601
|
this.screenMesh.material.setTexture("_SceneTex", this.sceneTextureHandle.texture);
|
|
10531
|
-
this.screenMesh.material.setFloat("_Brightness", brightness);
|
|
10532
|
-
this.screenMesh.material.setFloat("_Saturation", saturation);
|
|
10533
|
-
this.screenMesh.material.setFloat("_Contrast", contrast);
|
|
10534
|
-
this.screenMesh.material.setInt("_UseBloom", Number(
|
|
10535
|
-
if (
|
|
10602
|
+
this.screenMesh.material.setFloat("_Brightness", Math.pow(2, colorAdjustments.brightness));
|
|
10603
|
+
this.screenMesh.material.setFloat("_Saturation", colorAdjustments.saturation * 0.01 + 1);
|
|
10604
|
+
this.screenMesh.material.setFloat("_Contrast", colorAdjustments.contrast * 0.01 + 1);
|
|
10605
|
+
this.screenMesh.material.setInt("_UseBloom", Number(bloom.active));
|
|
10606
|
+
if (bloom.active) {
|
|
10536
10607
|
this.screenMesh.material.setTexture("_GaussianTex", this.mainTexture);
|
|
10537
|
-
this.screenMesh.material.setFloat("_BloomIntensity",
|
|
10608
|
+
this.screenMesh.material.setFloat("_BloomIntensity", bloom.intensity);
|
|
10538
10609
|
}
|
|
10539
|
-
if (
|
|
10540
|
-
this.screenMesh.material.setFloat("_VignetteIntensity",
|
|
10541
|
-
this.screenMesh.material.setFloat("_VignetteSmoothness",
|
|
10542
|
-
this.screenMesh.material.setFloat("_VignetteRoundness",
|
|
10610
|
+
if (vignette.intensity > 0) {
|
|
10611
|
+
this.screenMesh.material.setFloat("_VignetteIntensity", vignette.intensity);
|
|
10612
|
+
this.screenMesh.material.setFloat("_VignetteSmoothness", vignette.smoothness);
|
|
10613
|
+
this.screenMesh.material.setFloat("_VignetteRoundness", vignette.roundness);
|
|
10543
10614
|
this.screenMesh.material.setVector2("_VignetteCenter", new Vector2(0.5, 0.5));
|
|
10544
10615
|
this.screenMesh.material.setVector3("_VignetteColor", new Vector3(0.0, 0.0, 0.0));
|
|
10545
10616
|
}
|
|
10546
|
-
this.screenMesh.material.setInt("_UseToneMapping", Number(
|
|
10617
|
+
this.screenMesh.material.setInt("_UseToneMapping", Number(tonemapping.active));
|
|
10547
10618
|
renderer.renderMeshes([
|
|
10548
10619
|
this.screenMesh
|
|
10549
10620
|
]);
|
|
@@ -10583,6 +10654,9 @@ var seed$6 = 1;
|
|
|
10583
10654
|
this.renderer = renderer;
|
|
10584
10655
|
if (postProcessingEnabled) {
|
|
10585
10656
|
var enableHDR = true;
|
|
10657
|
+
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
10658
|
+
throw new Error("Half float texture is not supported.");
|
|
10659
|
+
}
|
|
10586
10660
|
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
10587
10661
|
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
10588
10662
|
attachments = [
|
|
@@ -13328,7 +13402,9 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13328
13402
|
return ColorCurve;
|
|
13329
13403
|
}(ValueGetter);
|
|
13330
13404
|
|
|
13331
|
-
|
|
13405
|
+
/**
|
|
13406
|
+
* @since 2.1.0
|
|
13407
|
+
*/ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
13332
13408
|
_inherits(BaseRenderComponent, RendererComponent);
|
|
13333
13409
|
function BaseRenderComponent(engine) {
|
|
13334
13410
|
var _this;
|
|
@@ -13415,7 +13491,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13415
13491
|
* @param texture - 纹理对象
|
|
13416
13492
|
*/ _proto.setTexture = function setTexture(texture) {
|
|
13417
13493
|
this.renderer.texture = texture;
|
|
13418
|
-
this.material.setTexture("
|
|
13494
|
+
this.material.setTexture("_MainTex", texture);
|
|
13419
13495
|
};
|
|
13420
13496
|
/**
|
|
13421
13497
|
* @internal
|
|
@@ -13494,51 +13570,60 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13494
13570
|
geometry.setIndexData(indexData);
|
|
13495
13571
|
geometry.setAttributeData("atlasOffset", attributes.atlasOffset);
|
|
13496
13572
|
geometry.setDrawCount(data.index.length);
|
|
13497
|
-
|
|
13498
|
-
var texture1 = textures[i];
|
|
13499
|
-
material.setTexture("uSampler" + i, texture1);
|
|
13500
|
-
}
|
|
13501
|
-
// FIXME: 内存泄漏的临时方案,后面再调整
|
|
13502
|
-
var emptyTexture = this.emptyTexture;
|
|
13503
|
-
for(var k = textures.length; k < exports.maxSpriteMeshItemCount; k++){
|
|
13504
|
-
material.setTexture("uSampler" + k, emptyTexture);
|
|
13505
|
-
}
|
|
13573
|
+
material.setTexture("_MainTex", texture);
|
|
13506
13574
|
};
|
|
13507
13575
|
_proto.getItemGeometryData = function getItemGeometryData() {
|
|
13508
|
-
this.
|
|
13509
|
-
|
|
13510
|
-
0.
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
0
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
2,
|
|
13528
|
-
1,
|
|
13529
|
-
3
|
|
13530
|
-
],
|
|
13531
|
-
atlasOffset: [
|
|
13576
|
+
var renderer = this.renderer;
|
|
13577
|
+
if (renderer.shape) {
|
|
13578
|
+
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;
|
|
13579
|
+
var point = new Float32Array(aPoint);
|
|
13580
|
+
var position = [];
|
|
13581
|
+
var atlasOffset = [];
|
|
13582
|
+
for(var i = 0; i < point.length; i += 6){
|
|
13583
|
+
atlasOffset.push(aPoint[i + 2], aPoint[i + 3]);
|
|
13584
|
+
position.push(point[i], point[i + 1], 0.0);
|
|
13585
|
+
}
|
|
13586
|
+
this.geometry.setAttributeData("aPos", new Float32Array(position));
|
|
13587
|
+
return {
|
|
13588
|
+
index: index,
|
|
13589
|
+
atlasOffset: atlasOffset
|
|
13590
|
+
};
|
|
13591
|
+
} else {
|
|
13592
|
+
this.geometry.setAttributeData("aPos", new Float32Array([
|
|
13593
|
+
-0.5,
|
|
13594
|
+
0.5,
|
|
13532
13595
|
0,
|
|
13533
|
-
|
|
13596
|
+
-0.5,
|
|
13597
|
+
-0.5,
|
|
13534
13598
|
0,
|
|
13599
|
+
0.5,
|
|
13600
|
+
0.5,
|
|
13535
13601
|
0,
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
1,
|
|
13602
|
+
0.5,
|
|
13603
|
+
-0.5,
|
|
13539
13604
|
0
|
|
13540
|
-
]
|
|
13541
|
-
|
|
13605
|
+
]));
|
|
13606
|
+
return {
|
|
13607
|
+
index: [
|
|
13608
|
+
0,
|
|
13609
|
+
1,
|
|
13610
|
+
2,
|
|
13611
|
+
2,
|
|
13612
|
+
1,
|
|
13613
|
+
3
|
|
13614
|
+
],
|
|
13615
|
+
atlasOffset: [
|
|
13616
|
+
0,
|
|
13617
|
+
1,
|
|
13618
|
+
0,
|
|
13619
|
+
0,
|
|
13620
|
+
1,
|
|
13621
|
+
1,
|
|
13622
|
+
1,
|
|
13623
|
+
0
|
|
13624
|
+
]
|
|
13625
|
+
};
|
|
13626
|
+
}
|
|
13542
13627
|
};
|
|
13543
13628
|
_proto.createGeometry = function createGeometry(mode) {
|
|
13544
13629
|
return Geometry.create(this.engine, {
|
|
@@ -13603,7 +13688,7 @@ var BaseRenderComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13603
13688
|
setBlendMode(material, states.blendMode);
|
|
13604
13689
|
setMaskMode(material, states.maskMode);
|
|
13605
13690
|
setSideMode(material, states.side);
|
|
13606
|
-
material.shader.shaderData.properties = '
|
|
13691
|
+
material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
|
|
13607
13692
|
if (!material.hasUniform("_Color")) {
|
|
13608
13693
|
material.setVector4("_Color", new Vector4(0, 0, 0, 1));
|
|
13609
13694
|
}
|
|
@@ -15171,30 +15256,497 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15171
15256
|
centerX += points[i];
|
|
15172
15257
|
centerY += points[i + 1];
|
|
15173
15258
|
}
|
|
15174
|
-
centerX /= points.length / 2;
|
|
15175
|
-
centerY /= points.length / 2;
|
|
15176
|
-
// Set center vertex
|
|
15177
|
-
var count = verticesOffset;
|
|
15178
|
-
vertices[count * 2] = centerX;
|
|
15179
|
-
vertices[count * 2 + 1] = centerY;
|
|
15180
|
-
var centerIndex = count++;
|
|
15181
|
-
// Set edge vertices and indices
|
|
15182
|
-
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
15183
|
-
vertices[count * 2] = points[i1];
|
|
15184
|
-
vertices[count * 2 + 1] = points[i1 + 1];
|
|
15185
|
-
if (i1 > 0) {
|
|
15186
|
-
indices[indicesOffset++] = count;
|
|
15187
|
-
indices[indicesOffset++] = centerIndex;
|
|
15188
|
-
indices[indicesOffset++] = count - 1;
|
|
15259
|
+
centerX /= points.length / 2;
|
|
15260
|
+
centerY /= points.length / 2;
|
|
15261
|
+
// Set center vertex
|
|
15262
|
+
var count = verticesOffset;
|
|
15263
|
+
vertices[count * 2] = centerX;
|
|
15264
|
+
vertices[count * 2 + 1] = centerY;
|
|
15265
|
+
var centerIndex = count++;
|
|
15266
|
+
// Set edge vertices and indices
|
|
15267
|
+
for(var i1 = 0; i1 < points.length; i1 += 2){
|
|
15268
|
+
vertices[count * 2] = points[i1];
|
|
15269
|
+
vertices[count * 2 + 1] = points[i1 + 1];
|
|
15270
|
+
if (i1 > 0) {
|
|
15271
|
+
indices[indicesOffset++] = count;
|
|
15272
|
+
indices[indicesOffset++] = centerIndex;
|
|
15273
|
+
indices[indicesOffset++] = count - 1;
|
|
15274
|
+
}
|
|
15275
|
+
count++;
|
|
15276
|
+
}
|
|
15277
|
+
// Connect last point to the first edge point
|
|
15278
|
+
indices[indicesOffset++] = centerIndex + 1;
|
|
15279
|
+
indices[indicesOffset++] = centerIndex;
|
|
15280
|
+
indices[indicesOffset++] = count - 1;
|
|
15281
|
+
};
|
|
15282
|
+
return Ellipse;
|
|
15283
|
+
}(ShapePrimitive);
|
|
15284
|
+
|
|
15285
|
+
var StarType;
|
|
15286
|
+
(function(StarType) {
|
|
15287
|
+
StarType[StarType["Star"] = 0] = "Star";
|
|
15288
|
+
StarType[StarType["Polygon"] = 1] = "Polygon";
|
|
15289
|
+
})(StarType || (StarType = {}));
|
|
15290
|
+
var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15291
|
+
_inherits(PolyStar, ShapePrimitive);
|
|
15292
|
+
function PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType) {
|
|
15293
|
+
if (pointCount === void 0) pointCount = 0;
|
|
15294
|
+
if (outerRadius === void 0) outerRadius = 0;
|
|
15295
|
+
if (innerRadius === void 0) innerRadius = 0;
|
|
15296
|
+
if (outerRoundness === void 0) outerRoundness = 0;
|
|
15297
|
+
if (innerRoundness === void 0) innerRoundness = 0;
|
|
15298
|
+
if (starType === void 0) starType = 0;
|
|
15299
|
+
var _this;
|
|
15300
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15301
|
+
_this.pointCount = pointCount;
|
|
15302
|
+
_this.outerRadius = outerRadius;
|
|
15303
|
+
_this.innerRadius = innerRadius;
|
|
15304
|
+
_this.outerRoundness = outerRoundness;
|
|
15305
|
+
_this.innerRoundness = innerRoundness;
|
|
15306
|
+
_this.starType = starType;
|
|
15307
|
+
_this.v = [];
|
|
15308
|
+
_this.in = [];
|
|
15309
|
+
_this.out = [];
|
|
15310
|
+
return _this;
|
|
15311
|
+
}
|
|
15312
|
+
var _proto = PolyStar.prototype;
|
|
15313
|
+
_proto.clone = function clone() {
|
|
15314
|
+
var polyStar = new PolyStar(this.pointCount, this.outerRadius, this.innerRadius, this.outerRoundness, this.innerRoundness, this.starType);
|
|
15315
|
+
return polyStar;
|
|
15316
|
+
};
|
|
15317
|
+
_proto.copyFrom = function copyFrom(source) {
|
|
15318
|
+
this.pointCount = source.pointCount;
|
|
15319
|
+
this.outerRadius = source.outerRadius;
|
|
15320
|
+
this.innerRadius = source.innerRadius;
|
|
15321
|
+
this.outerRoundness = source.outerRoundness;
|
|
15322
|
+
this.innerRoundness = source.innerRoundness;
|
|
15323
|
+
this.starType = source.starType;
|
|
15324
|
+
};
|
|
15325
|
+
_proto.copyTo = function copyTo(destination) {
|
|
15326
|
+
destination.copyFrom(this);
|
|
15327
|
+
};
|
|
15328
|
+
_proto.build = function build(points) {
|
|
15329
|
+
switch(this.starType){
|
|
15330
|
+
case 0:
|
|
15331
|
+
{
|
|
15332
|
+
this.buildStarPath();
|
|
15333
|
+
break;
|
|
15334
|
+
}
|
|
15335
|
+
case 1:
|
|
15336
|
+
{
|
|
15337
|
+
this.buildPolygonPath();
|
|
15338
|
+
break;
|
|
15339
|
+
}
|
|
15340
|
+
}
|
|
15341
|
+
var smoothness = 1;
|
|
15342
|
+
for(var i = 0; i < this.v.length - 2; i += 2){
|
|
15343
|
+
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);
|
|
15344
|
+
}
|
|
15345
|
+
// draw last curve
|
|
15346
|
+
var lastIndex = this.v.length - 1;
|
|
15347
|
+
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);
|
|
15348
|
+
};
|
|
15349
|
+
_proto.triangulate = function triangulate1(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15350
|
+
var triangles = triangulate([
|
|
15351
|
+
points
|
|
15352
|
+
]);
|
|
15353
|
+
for(var i = 0; i < triangles.length; i++){
|
|
15354
|
+
vertices[verticesOffset + i] = triangles[i];
|
|
15355
|
+
}
|
|
15356
|
+
var vertexCount = triangles.length / 2;
|
|
15357
|
+
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15358
|
+
indices[indicesOffset + i1] = i1;
|
|
15359
|
+
}
|
|
15360
|
+
};
|
|
15361
|
+
_proto.buildStarPath = function buildStarPath() {
|
|
15362
|
+
this.v = [];
|
|
15363
|
+
this.in = [];
|
|
15364
|
+
this.out = [];
|
|
15365
|
+
var numPts = Math.floor(this.pointCount) * 2;
|
|
15366
|
+
var angle = Math.PI * 2 / numPts;
|
|
15367
|
+
var longFlag = true;
|
|
15368
|
+
var longRad = this.outerRadius;
|
|
15369
|
+
var shortRad = this.innerRadius;
|
|
15370
|
+
var longRound = this.outerRoundness / 100;
|
|
15371
|
+
var shortRound = this.innerRoundness / 100;
|
|
15372
|
+
var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);
|
|
15373
|
+
var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);
|
|
15374
|
+
var i;
|
|
15375
|
+
var rad;
|
|
15376
|
+
var roundness;
|
|
15377
|
+
var perimSegment;
|
|
15378
|
+
var currentAng = -Math.PI / 2;
|
|
15379
|
+
var dir = 1;
|
|
15380
|
+
for(i = 0; i < numPts; i++){
|
|
15381
|
+
rad = longFlag ? longRad : shortRad;
|
|
15382
|
+
roundness = longFlag ? longRound : shortRound;
|
|
15383
|
+
perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
|
15384
|
+
var x = rad * Math.cos(currentAng);
|
|
15385
|
+
var y = rad * Math.sin(currentAng);
|
|
15386
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15387
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15388
|
+
var offset = i * 2;
|
|
15389
|
+
this.v[offset] = x;
|
|
15390
|
+
this.v[offset + 1] = y;
|
|
15391
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15392
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15393
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15394
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15395
|
+
longFlag = !longFlag;
|
|
15396
|
+
currentAng += angle * dir;
|
|
15397
|
+
}
|
|
15398
|
+
};
|
|
15399
|
+
_proto.buildPolygonPath = function buildPolygonPath() {
|
|
15400
|
+
this.v = [];
|
|
15401
|
+
this.in = [];
|
|
15402
|
+
this.out = [];
|
|
15403
|
+
var numPts = Math.floor(this.pointCount);
|
|
15404
|
+
var angle = Math.PI * 2 / numPts;
|
|
15405
|
+
var rad = this.outerRadius;
|
|
15406
|
+
var roundness = this.outerRoundness / 100;
|
|
15407
|
+
var perimSegment = 2 * Math.PI * rad / (numPts * 4);
|
|
15408
|
+
var i;
|
|
15409
|
+
var currentAng = -Math.PI * 0.5;
|
|
15410
|
+
var dir = 1;
|
|
15411
|
+
for(i = 0; i < numPts; i++){
|
|
15412
|
+
var x = rad * Math.cos(currentAng);
|
|
15413
|
+
var y = rad * Math.sin(currentAng);
|
|
15414
|
+
var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);
|
|
15415
|
+
var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);
|
|
15416
|
+
var offset = i * 2;
|
|
15417
|
+
this.v[offset] = x;
|
|
15418
|
+
this.v[offset + 1] = y;
|
|
15419
|
+
this.in[offset] = x + ox * perimSegment * roundness * dir;
|
|
15420
|
+
this.in[offset + 1] = y + oy * perimSegment * roundness * dir;
|
|
15421
|
+
this.out[offset] = x - ox * perimSegment * roundness * dir;
|
|
15422
|
+
this.out[offset + 1] = y - oy * perimSegment * roundness * dir;
|
|
15423
|
+
currentAng += angle * dir;
|
|
15424
|
+
}
|
|
15425
|
+
};
|
|
15426
|
+
return PolyStar;
|
|
15427
|
+
}(ShapePrimitive);
|
|
15428
|
+
|
|
15429
|
+
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15430
|
+
/**
|
|
15431
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
15432
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
15433
|
+
*/ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
|
|
15434
|
+
_inherits(Rectangle, ShapePrimitive);
|
|
15435
|
+
function Rectangle(x, y, width, height) {
|
|
15436
|
+
if (x === void 0) x = 0;
|
|
15437
|
+
if (y === void 0) y = 0;
|
|
15438
|
+
if (width === void 0) width = 0;
|
|
15439
|
+
if (height === void 0) height = 0;
|
|
15440
|
+
var _this;
|
|
15441
|
+
_this = ShapePrimitive.call(this) || this;
|
|
15442
|
+
_this.x = Number(x);
|
|
15443
|
+
_this.y = Number(y);
|
|
15444
|
+
_this.width = Number(width);
|
|
15445
|
+
_this.height = Number(height);
|
|
15446
|
+
return _this;
|
|
15447
|
+
}
|
|
15448
|
+
var _proto = Rectangle.prototype;
|
|
15449
|
+
/** Determines whether the Rectangle is empty. */ _proto.isEmpty = function isEmpty() {
|
|
15450
|
+
return this.left === this.right || this.top === this.bottom;
|
|
15451
|
+
};
|
|
15452
|
+
/**
|
|
15453
|
+
* Creates a clone of this Rectangle
|
|
15454
|
+
* @returns a copy of the rectangle
|
|
15455
|
+
*/ _proto.clone = function clone() {
|
|
15456
|
+
return new Rectangle(this.x, this.y, this.width, this.height);
|
|
15457
|
+
};
|
|
15458
|
+
/**
|
|
15459
|
+
* Converts a Bounds object to a Rectangle object.
|
|
15460
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
15461
|
+
* @returns Returns itself.
|
|
15462
|
+
*/ // copyFromBounds (bounds: Bounds): this {
|
|
15463
|
+
// this.x = bounds.minX;
|
|
15464
|
+
// this.y = bounds.minY;
|
|
15465
|
+
// this.width = bounds.maxX - bounds.minX;
|
|
15466
|
+
// this.height = bounds.maxY - bounds.minY;
|
|
15467
|
+
// return this;
|
|
15468
|
+
// }
|
|
15469
|
+
/**
|
|
15470
|
+
* Copies another rectangle to this one.
|
|
15471
|
+
* @param rectangle - The rectangle to copy from.
|
|
15472
|
+
* @returns Returns itself.
|
|
15473
|
+
*/ _proto.copyFrom = function copyFrom(rectangle) {
|
|
15474
|
+
this.x = rectangle.x;
|
|
15475
|
+
this.y = rectangle.y;
|
|
15476
|
+
this.width = rectangle.width;
|
|
15477
|
+
this.height = rectangle.height;
|
|
15478
|
+
return this;
|
|
15479
|
+
};
|
|
15480
|
+
/**
|
|
15481
|
+
* Copies this rectangle to another one.
|
|
15482
|
+
* @param rectangle - The rectangle to copy to.
|
|
15483
|
+
* @returns Returns given parameter.
|
|
15484
|
+
*/ _proto.copyTo = function copyTo(rectangle) {
|
|
15485
|
+
rectangle.copyFrom(this);
|
|
15486
|
+
return rectangle;
|
|
15487
|
+
};
|
|
15488
|
+
/**
|
|
15489
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
15490
|
+
* @param x - The X coordinate of the point to test
|
|
15491
|
+
* @param y - The Y coordinate of the point to test
|
|
15492
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
15493
|
+
*/ _proto.contains = function contains(x, y) {
|
|
15494
|
+
if (this.width <= 0 || this.height <= 0) {
|
|
15495
|
+
return false;
|
|
15496
|
+
}
|
|
15497
|
+
if (x >= this.x && x < this.x + this.width) {
|
|
15498
|
+
if (y >= this.y && y < this.y + this.height) {
|
|
15499
|
+
return true;
|
|
15500
|
+
}
|
|
15501
|
+
}
|
|
15502
|
+
return false;
|
|
15503
|
+
};
|
|
15504
|
+
/**
|
|
15505
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
15506
|
+
* @param x - The X coordinate of the point to test
|
|
15507
|
+
* @param y - The Y coordinate of the point to test
|
|
15508
|
+
* @param strokeWidth - The width of the line to check
|
|
15509
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
15510
|
+
*/ _proto.strokeContains = function strokeContains(x, y, strokeWidth) {
|
|
15511
|
+
var _this = this, width = _this.width, height = _this.height;
|
|
15512
|
+
if (width <= 0 || height <= 0) {
|
|
15513
|
+
return false;
|
|
15514
|
+
}
|
|
15515
|
+
var _x = this.x;
|
|
15516
|
+
var _y = this.y;
|
|
15517
|
+
var outerLeft = _x - strokeWidth / 2;
|
|
15518
|
+
var outerRight = _x + width + strokeWidth / 2;
|
|
15519
|
+
var outerTop = _y - strokeWidth / 2;
|
|
15520
|
+
var outerBottom = _y + height + strokeWidth / 2;
|
|
15521
|
+
var innerLeft = _x + strokeWidth / 2;
|
|
15522
|
+
var innerRight = _x + width - strokeWidth / 2;
|
|
15523
|
+
var innerTop = _y + strokeWidth / 2;
|
|
15524
|
+
var innerBottom = _y + height - strokeWidth / 2;
|
|
15525
|
+
return x >= outerLeft && x <= outerRight && y >= outerTop && y <= outerBottom && !(x > innerLeft && x < innerRight && y > innerTop && y < innerBottom);
|
|
15526
|
+
};
|
|
15527
|
+
/**
|
|
15528
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
15529
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
15530
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
15531
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
15532
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
15533
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
15534
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
15535
|
+
*/ // intersects (other: Rectangle, transform?: Matrix4): boolean {
|
|
15536
|
+
// if (!transform) {
|
|
15537
|
+
// const x0 = this.x < other.x ? other.x : this.x;
|
|
15538
|
+
// const x1 = this.right > other.right ? other.right : this.right;
|
|
15539
|
+
// if (x1 <= x0) {
|
|
15540
|
+
// return false;
|
|
15541
|
+
// }
|
|
15542
|
+
// const y0 = this.y < other.y ? other.y : this.y;
|
|
15543
|
+
// const y1 = this.bottom > other.bottom ? other.bottom : this.bottom;
|
|
15544
|
+
// return y1 > y0;
|
|
15545
|
+
// }
|
|
15546
|
+
// const x0 = this.left;
|
|
15547
|
+
// const x1 = this.right;
|
|
15548
|
+
// const y0 = this.top;
|
|
15549
|
+
// const y1 = this.bottom;
|
|
15550
|
+
// if (x1 <= x0 || y1 <= y0) {
|
|
15551
|
+
// return false;
|
|
15552
|
+
// }
|
|
15553
|
+
// const lt = tempPoints[0].set(other.left, other.top);
|
|
15554
|
+
// const lb = tempPoints[1].set(other.left, other.bottom);
|
|
15555
|
+
// const rt = tempPoints[2].set(other.right, other.top);
|
|
15556
|
+
// const rb = tempPoints[3].set(other.right, other.bottom);
|
|
15557
|
+
// if (rt.x <= lt.x || lb.y <= lt.y) {
|
|
15558
|
+
// return false;
|
|
15559
|
+
// }
|
|
15560
|
+
// const s = Math.sign((transform.a * transform.d) - (transform.b * transform.c));
|
|
15561
|
+
// if (s === 0) {
|
|
15562
|
+
// return false;
|
|
15563
|
+
// }
|
|
15564
|
+
// transform.apply(lt, lt);
|
|
15565
|
+
// transform.apply(lb, lb);
|
|
15566
|
+
// transform.apply(rt, rt);
|
|
15567
|
+
// transform.apply(rb, rb);
|
|
15568
|
+
// if (Math.max(lt.x, lb.x, rt.x, rb.x) <= x0
|
|
15569
|
+
// || Math.min(lt.x, lb.x, rt.x, rb.x) >= x1
|
|
15570
|
+
// || Math.max(lt.y, lb.y, rt.y, rb.y) <= y0
|
|
15571
|
+
// || Math.min(lt.y, lb.y, rt.y, rb.y) >= y1) {
|
|
15572
|
+
// return false;
|
|
15573
|
+
// }
|
|
15574
|
+
// const nx = s * (lb.y - lt.y);
|
|
15575
|
+
// const ny = s * (lt.x - lb.x);
|
|
15576
|
+
// const n00 = (nx * x0) + (ny * y0);
|
|
15577
|
+
// const n10 = (nx * x1) + (ny * y0);
|
|
15578
|
+
// const n01 = (nx * x0) + (ny * y1);
|
|
15579
|
+
// const n11 = (nx * x1) + (ny * y1);
|
|
15580
|
+
// if (Math.max(n00, n10, n01, n11) <= (nx * lt.x) + (ny * lt.y)
|
|
15581
|
+
// || Math.min(n00, n10, n01, n11) >= (nx * rb.x) + (ny * rb.y)) {
|
|
15582
|
+
// return false;
|
|
15583
|
+
// }
|
|
15584
|
+
// const mx = s * (lt.y - rt.y);
|
|
15585
|
+
// const my = s * (rt.x - lt.x);
|
|
15586
|
+
// const m00 = (mx * x0) + (my * y0);
|
|
15587
|
+
// const m10 = (mx * x1) + (my * y0);
|
|
15588
|
+
// const m01 = (mx * x0) + (my * y1);
|
|
15589
|
+
// const m11 = (mx * x1) + (my * y1);
|
|
15590
|
+
// if (Math.max(m00, m10, m01, m11) <= (mx * lt.x) + (my * lt.y)
|
|
15591
|
+
// || Math.min(m00, m10, m01, m11) >= (mx * rb.x) + (my * rb.y)) {
|
|
15592
|
+
// return false;
|
|
15593
|
+
// }
|
|
15594
|
+
// return true;
|
|
15595
|
+
// }
|
|
15596
|
+
/**
|
|
15597
|
+
* Pads the rectangle making it grow in all directions.
|
|
15598
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
15599
|
+
* @param paddingX - The horizontal padding amount.
|
|
15600
|
+
* @param paddingY - The vertical padding amount.
|
|
15601
|
+
* @returns Returns itself.
|
|
15602
|
+
*/ _proto.pad = function pad(paddingX, paddingY) {
|
|
15603
|
+
if (paddingX === void 0) paddingX = 0;
|
|
15604
|
+
if (paddingY === void 0) paddingY = paddingX;
|
|
15605
|
+
this.x -= paddingX;
|
|
15606
|
+
this.y -= paddingY;
|
|
15607
|
+
this.width += paddingX * 2;
|
|
15608
|
+
this.height += paddingY * 2;
|
|
15609
|
+
return this;
|
|
15610
|
+
};
|
|
15611
|
+
/**
|
|
15612
|
+
* Fits this rectangle around the passed one.
|
|
15613
|
+
* @param rectangle - The rectangle to fit.
|
|
15614
|
+
* @returns Returns itself.
|
|
15615
|
+
*/ _proto.fit = function fit(rectangle) {
|
|
15616
|
+
var x1 = Math.max(this.x, rectangle.x);
|
|
15617
|
+
var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
|
|
15618
|
+
var y1 = Math.max(this.y, rectangle.y);
|
|
15619
|
+
var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
|
|
15620
|
+
this.x = x1;
|
|
15621
|
+
this.width = Math.max(x2 - x1, 0);
|
|
15622
|
+
this.y = y1;
|
|
15623
|
+
this.height = Math.max(y2 - y1, 0);
|
|
15624
|
+
return this;
|
|
15625
|
+
};
|
|
15626
|
+
/**
|
|
15627
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
15628
|
+
* @param resolution - resolution
|
|
15629
|
+
* @param eps - precision
|
|
15630
|
+
* @returns Returns itself.
|
|
15631
|
+
*/ _proto.ceil = function ceil(resolution, eps) {
|
|
15632
|
+
if (resolution === void 0) resolution = 1;
|
|
15633
|
+
if (eps === void 0) eps = 0.001;
|
|
15634
|
+
var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
|
|
15635
|
+
var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
|
|
15636
|
+
this.x = Math.floor((this.x + eps) * resolution) / resolution;
|
|
15637
|
+
this.y = Math.floor((this.y + eps) * resolution) / resolution;
|
|
15638
|
+
this.width = x2 - this.x;
|
|
15639
|
+
this.height = y2 - this.y;
|
|
15640
|
+
return this;
|
|
15641
|
+
};
|
|
15642
|
+
/**
|
|
15643
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
15644
|
+
* @param rectangle - The rectangle to include.
|
|
15645
|
+
* @returns Returns itself.
|
|
15646
|
+
*/ _proto.enlarge = function enlarge(rectangle) {
|
|
15647
|
+
var x1 = Math.min(this.x, rectangle.x);
|
|
15648
|
+
var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
|
|
15649
|
+
var y1 = Math.min(this.y, rectangle.y);
|
|
15650
|
+
var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
|
|
15651
|
+
this.x = x1;
|
|
15652
|
+
this.width = x2 - x1;
|
|
15653
|
+
this.y = y1;
|
|
15654
|
+
this.height = y2 - y1;
|
|
15655
|
+
return this;
|
|
15656
|
+
};
|
|
15657
|
+
/**
|
|
15658
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
15659
|
+
* @param out - optional rectangle to store the result
|
|
15660
|
+
* @returns The framing rectangle
|
|
15661
|
+
*/ _proto.getBounds = function getBounds(out) {
|
|
15662
|
+
out = out || new Rectangle();
|
|
15663
|
+
out.copyFrom(this);
|
|
15664
|
+
return out;
|
|
15665
|
+
};
|
|
15666
|
+
_proto.getX = function getX() {
|
|
15667
|
+
return this.x;
|
|
15668
|
+
};
|
|
15669
|
+
_proto.getY = function getY() {
|
|
15670
|
+
return this.y;
|
|
15671
|
+
};
|
|
15672
|
+
_proto.build = function build(points) {
|
|
15673
|
+
var x = this.x;
|
|
15674
|
+
var y = this.y;
|
|
15675
|
+
var width = this.width;
|
|
15676
|
+
var height = this.height;
|
|
15677
|
+
if (!(width >= 0 && height >= 0)) {
|
|
15678
|
+
return points;
|
|
15679
|
+
}
|
|
15680
|
+
points[0] = x;
|
|
15681
|
+
points[1] = y;
|
|
15682
|
+
points[2] = x + width;
|
|
15683
|
+
points[3] = y;
|
|
15684
|
+
points[4] = x + width;
|
|
15685
|
+
points[5] = y + height;
|
|
15686
|
+
points[6] = x;
|
|
15687
|
+
points[7] = y + height;
|
|
15688
|
+
return points;
|
|
15689
|
+
};
|
|
15690
|
+
_proto.triangulate = function triangulate(points, vertices, verticesOffset, indices, indicesOffset) {
|
|
15691
|
+
var count = 0;
|
|
15692
|
+
var verticesStride = 2;
|
|
15693
|
+
verticesOffset *= verticesStride;
|
|
15694
|
+
vertices[verticesOffset + count] = points[0];
|
|
15695
|
+
vertices[verticesOffset + count + 1] = points[1];
|
|
15696
|
+
count += verticesStride;
|
|
15697
|
+
vertices[verticesOffset + count] = points[2];
|
|
15698
|
+
vertices[verticesOffset + count + 1] = points[3];
|
|
15699
|
+
count += verticesStride;
|
|
15700
|
+
vertices[verticesOffset + count] = points[6];
|
|
15701
|
+
vertices[verticesOffset + count + 1] = points[7];
|
|
15702
|
+
count += verticesStride;
|
|
15703
|
+
vertices[verticesOffset + count] = points[4];
|
|
15704
|
+
vertices[verticesOffset + count + 1] = points[5];
|
|
15705
|
+
count += verticesStride;
|
|
15706
|
+
var verticesIndex = verticesOffset / verticesStride;
|
|
15707
|
+
// triangle 1
|
|
15708
|
+
indices[indicesOffset++] = verticesIndex;
|
|
15709
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15710
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15711
|
+
// triangle 2
|
|
15712
|
+
indices[indicesOffset++] = verticesIndex + 1;
|
|
15713
|
+
indices[indicesOffset++] = verticesIndex + 3;
|
|
15714
|
+
indices[indicesOffset++] = verticesIndex + 2;
|
|
15715
|
+
};
|
|
15716
|
+
_create_class(Rectangle, [
|
|
15717
|
+
{
|
|
15718
|
+
key: "left",
|
|
15719
|
+
get: /** Returns the left edge of the rectangle. */ function get() {
|
|
15720
|
+
return this.x;
|
|
15721
|
+
}
|
|
15722
|
+
},
|
|
15723
|
+
{
|
|
15724
|
+
key: "right",
|
|
15725
|
+
get: /** Returns the right edge of the rectangle. */ function get() {
|
|
15726
|
+
return this.x + this.width;
|
|
15727
|
+
}
|
|
15728
|
+
},
|
|
15729
|
+
{
|
|
15730
|
+
key: "top",
|
|
15731
|
+
get: /** Returns the top edge of the rectangle. */ function get() {
|
|
15732
|
+
return this.y;
|
|
15733
|
+
}
|
|
15734
|
+
},
|
|
15735
|
+
{
|
|
15736
|
+
key: "bottom",
|
|
15737
|
+
get: /** Returns the bottom edge of the rectangle. */ function get() {
|
|
15738
|
+
return this.y + this.height;
|
|
15739
|
+
}
|
|
15740
|
+
}
|
|
15741
|
+
], [
|
|
15742
|
+
{
|
|
15743
|
+
key: "EMPTY",
|
|
15744
|
+
get: /** A constant empty rectangle. This is a new object every time the property is accessed */ function get() {
|
|
15745
|
+
return new Rectangle(0, 0, 0, 0);
|
|
15189
15746
|
}
|
|
15190
|
-
count++;
|
|
15191
15747
|
}
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
indices[indicesOffset++] = centerIndex;
|
|
15195
|
-
indices[indicesOffset++] = count - 1;
|
|
15196
|
-
};
|
|
15197
|
-
return Ellipse;
|
|
15748
|
+
]);
|
|
15749
|
+
return Rectangle;
|
|
15198
15750
|
}(ShapePrimitive);
|
|
15199
15751
|
|
|
15200
15752
|
var ShapePath = /*#__PURE__*/ function() {
|
|
@@ -15228,6 +15780,16 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15228
15780
|
this.ellipse(data[0], data[1], data[2], data[3], data[4]);
|
|
15229
15781
|
break;
|
|
15230
15782
|
}
|
|
15783
|
+
case "polyStar":
|
|
15784
|
+
{
|
|
15785
|
+
this.polyStar(data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
15786
|
+
break;
|
|
15787
|
+
}
|
|
15788
|
+
case "rect":
|
|
15789
|
+
{
|
|
15790
|
+
this.rect(data[0], data[1], data[2], data[3], data[4]);
|
|
15791
|
+
break;
|
|
15792
|
+
}
|
|
15231
15793
|
}
|
|
15232
15794
|
}
|
|
15233
15795
|
this.endPoly();
|
|
@@ -15268,6 +15830,22 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15268
15830
|
this.drawShape(new Ellipse(x, y, radiusX, radiusY), transform);
|
|
15269
15831
|
return this;
|
|
15270
15832
|
};
|
|
15833
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
15834
|
+
this.drawShape(new PolyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType), transform);
|
|
15835
|
+
return this;
|
|
15836
|
+
};
|
|
15837
|
+
/**
|
|
15838
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
15839
|
+
* @param x - The x-coordinate of the top-left corner of the rectangle.
|
|
15840
|
+
* @param y - The y-coordinate of the top-left corner of the rectangle.
|
|
15841
|
+
* @param w - The width of the rectangle.
|
|
15842
|
+
* @param h - The height of the rectangle.
|
|
15843
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
15844
|
+
* @returns The instance of the current object for chaining.
|
|
15845
|
+
*/ _proto.rect = function rect(x, y, w, h, transform) {
|
|
15846
|
+
this.drawShape(new Rectangle$1(x, y, w, h), transform);
|
|
15847
|
+
return this;
|
|
15848
|
+
};
|
|
15271
15849
|
/**
|
|
15272
15850
|
* Draws a given shape on the canvas.
|
|
15273
15851
|
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
@@ -15424,6 +16002,22 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15424
16002
|
this.dirty = true;
|
|
15425
16003
|
return this;
|
|
15426
16004
|
};
|
|
16005
|
+
_proto.polyStar = function polyStar(pointCount, outerRadius, innerRadius, outerRoundness, innerRoundness, starType, transform) {
|
|
16006
|
+
this.instructions.push({
|
|
16007
|
+
action: "polyStar",
|
|
16008
|
+
data: [
|
|
16009
|
+
pointCount,
|
|
16010
|
+
outerRadius,
|
|
16011
|
+
innerRadius,
|
|
16012
|
+
outerRoundness,
|
|
16013
|
+
innerRoundness,
|
|
16014
|
+
starType,
|
|
16015
|
+
transform
|
|
16016
|
+
]
|
|
16017
|
+
});
|
|
16018
|
+
this.dirty = true;
|
|
16019
|
+
return this;
|
|
16020
|
+
};
|
|
15427
16021
|
_proto.clear = function clear() {
|
|
15428
16022
|
this.instructions.length = 0;
|
|
15429
16023
|
this.dirty = true;
|
|
@@ -15501,7 +16095,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15501
16095
|
};
|
|
15502
16096
|
_this.material = Material.create(engine, materialProps);
|
|
15503
16097
|
_this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
15504
|
-
_this.material.depthMask =
|
|
16098
|
+
_this.material.depthMask = false;
|
|
15505
16099
|
_this.material.depthTest = true;
|
|
15506
16100
|
_this.material.blending = true;
|
|
15507
16101
|
}
|
|
@@ -15566,16 +16160,18 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15566
16160
|
};
|
|
15567
16161
|
_proto.buildPath = function buildPath(data) {
|
|
15568
16162
|
this.path.clear();
|
|
15569
|
-
|
|
16163
|
+
var shapeData = data;
|
|
16164
|
+
switch(shapeData.type){
|
|
15570
16165
|
case 0:
|
|
15571
16166
|
{
|
|
15572
|
-
var customData =
|
|
15573
|
-
var points = customData.
|
|
15574
|
-
var easingIns = customData.
|
|
15575
|
-
var easingOuts = customData.
|
|
16167
|
+
var customData = shapeData;
|
|
16168
|
+
var points = customData.points;
|
|
16169
|
+
var easingIns = customData.easingIns;
|
|
16170
|
+
var easingOuts = customData.easingOuts;
|
|
15576
16171
|
this.curveValues = [];
|
|
15577
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.
|
|
16172
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15578
16173
|
var shape = _step.value;
|
|
16174
|
+
this.setFillColor(shape.fill);
|
|
15579
16175
|
var indices = shape.indexes;
|
|
15580
16176
|
for(var i = 1; i < indices.length; i++){
|
|
15581
16177
|
var pointIndex = indices[i];
|
|
@@ -15605,45 +16201,206 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15605
16201
|
}
|
|
15606
16202
|
case 2:
|
|
15607
16203
|
{
|
|
15608
|
-
var ellipseData =
|
|
15609
|
-
|
|
15610
|
-
this.
|
|
16204
|
+
var ellipseData = shapeData;
|
|
16205
|
+
this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16206
|
+
this.setFillColor(ellipseData.fill);
|
|
16207
|
+
break;
|
|
16208
|
+
}
|
|
16209
|
+
case 1:
|
|
16210
|
+
{
|
|
16211
|
+
var rectangleData = shapeData;
|
|
16212
|
+
this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16213
|
+
this.setFillColor(rectangleData.fill);
|
|
16214
|
+
break;
|
|
16215
|
+
}
|
|
16216
|
+
case 4:
|
|
16217
|
+
{
|
|
16218
|
+
var starData = shapeData;
|
|
16219
|
+
this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16220
|
+
this.setFillColor(starData.fill);
|
|
16221
|
+
break;
|
|
16222
|
+
}
|
|
16223
|
+
case 3:
|
|
16224
|
+
{
|
|
16225
|
+
var polygonData = shapeData;
|
|
16226
|
+
this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16227
|
+
this.setFillColor(polygonData.fill);
|
|
15611
16228
|
break;
|
|
15612
16229
|
}
|
|
15613
16230
|
}
|
|
15614
16231
|
};
|
|
16232
|
+
_proto.setFillColor = function setFillColor(fill) {
|
|
16233
|
+
if (fill) {
|
|
16234
|
+
var color = fill.color;
|
|
16235
|
+
this.material.setColor("_Color", new Color(color.r, color.g, color.b, color.a));
|
|
16236
|
+
}
|
|
16237
|
+
};
|
|
15615
16238
|
_proto.fromData = function fromData(data) {
|
|
15616
16239
|
MeshComponent.prototype.fromData.call(this, data);
|
|
15617
16240
|
this.data = data;
|
|
16241
|
+
var material = this.material;
|
|
16242
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16243
|
+
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
16244
|
+
data.renderer.mask,
|
|
16245
|
+
data.renderer.mask
|
|
16246
|
+
] : undefined;
|
|
16247
|
+
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16248
|
+
setMaskMode(material, data.renderer.maskMode);
|
|
15618
16249
|
};
|
|
15619
16250
|
return ShapeComponent;
|
|
15620
16251
|
}(MeshComponent);
|
|
15621
16252
|
exports.ShapeComponent = __decorate([
|
|
15622
16253
|
effectsClass("ShapeComponent")
|
|
15623
16254
|
], exports.ShapeComponent);
|
|
15624
|
-
exports.
|
|
15625
|
-
(function(
|
|
16255
|
+
exports.ShapePrimitiveType = void 0;
|
|
16256
|
+
(function(ShapePrimitiveType) {
|
|
15626
16257
|
/**
|
|
15627
16258
|
* 自定义图形
|
|
15628
|
-
*/
|
|
16259
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
15629
16260
|
/**
|
|
15630
16261
|
* 矩形
|
|
15631
|
-
*/
|
|
16262
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
15632
16263
|
/**
|
|
15633
16264
|
* 椭圆
|
|
15634
|
-
*/
|
|
16265
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
15635
16266
|
/**
|
|
15636
16267
|
* 多边形
|
|
15637
|
-
*/
|
|
16268
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
15638
16269
|
/**
|
|
15639
16270
|
* 星形
|
|
15640
|
-
*/
|
|
15641
|
-
})(exports.
|
|
16271
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
16272
|
+
})(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
|
|
15642
16273
|
exports.ShapeConnectType = void 0;
|
|
15643
16274
|
(function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
|
|
15644
16275
|
exports.ShapePointType = void 0;
|
|
15645
16276
|
(function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
|
|
15646
16277
|
|
|
16278
|
+
exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
|
|
16279
|
+
_inherits(Fake3DComponent, Component);
|
|
16280
|
+
function Fake3DComponent() {
|
|
16281
|
+
var _this;
|
|
16282
|
+
_this = Component.apply(this, arguments) || this;
|
|
16283
|
+
_this.loop = false;
|
|
16284
|
+
_this.amountOfMotion = 1.0;
|
|
16285
|
+
_this.animationLength = 2.0;
|
|
16286
|
+
_this.mode = 1;
|
|
16287
|
+
_this.startPositionX = 0;
|
|
16288
|
+
_this.startPositionY = 0;
|
|
16289
|
+
_this.startPositionZ = 0;
|
|
16290
|
+
_this.endPositionX = 0;
|
|
16291
|
+
_this.endPositionY = 0;
|
|
16292
|
+
_this.endPositionZ = 0;
|
|
16293
|
+
_this.amplitudeX = 0;
|
|
16294
|
+
_this.amplitudeY = 0;
|
|
16295
|
+
_this.amplitudeZ = 0;
|
|
16296
|
+
_this.phaseX = 0;
|
|
16297
|
+
_this.phaseY = 0;
|
|
16298
|
+
_this.phaseZ = 0;
|
|
16299
|
+
return _this;
|
|
16300
|
+
}
|
|
16301
|
+
var _proto = Fake3DComponent.prototype;
|
|
16302
|
+
_proto.onStart = function onStart() {
|
|
16303
|
+
this.effectComponent = this.item.getComponent(exports.EffectComponent);
|
|
16304
|
+
};
|
|
16305
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16306
|
+
this.updateFake3D();
|
|
16307
|
+
};
|
|
16308
|
+
_proto.updateFake3D = function updateFake3D() {
|
|
16309
|
+
if (!this.effectComponent) {
|
|
16310
|
+
return;
|
|
16311
|
+
}
|
|
16312
|
+
var time = this.item.time % this.animationLength / this.animationLength;
|
|
16313
|
+
var _PosX = 0;
|
|
16314
|
+
var _PosY = 0;
|
|
16315
|
+
var _PosZ = 0;
|
|
16316
|
+
switch(this.mode){
|
|
16317
|
+
case 0:
|
|
16318
|
+
{
|
|
16319
|
+
var PI = Math.PI;
|
|
16320
|
+
_PosX = Math.sin(2.0 * PI * (time + this.phaseX)) * this.amplitudeX;
|
|
16321
|
+
_PosY = Math.sin(2.0 * PI * (time + this.phaseY)) * this.amplitudeY;
|
|
16322
|
+
_PosZ = Math.sin(2.0 * PI * (time + this.phaseZ)) * this.amplitudeZ;
|
|
16323
|
+
break;
|
|
16324
|
+
}
|
|
16325
|
+
case 1:
|
|
16326
|
+
{
|
|
16327
|
+
var localTime = time;
|
|
16328
|
+
if (this.loop) {
|
|
16329
|
+
if (localTime > 0.5) {
|
|
16330
|
+
localTime = 1 - localTime;
|
|
16331
|
+
}
|
|
16332
|
+
localTime *= 2;
|
|
16333
|
+
}
|
|
16334
|
+
_PosX = this.startPositionX * (1 - localTime) + localTime * this.endPositionX;
|
|
16335
|
+
_PosY = this.startPositionY * (1 - localTime) + localTime * this.endPositionY;
|
|
16336
|
+
_PosZ = this.startPositionZ * (1 - localTime) + localTime * this.endPositionZ;
|
|
16337
|
+
break;
|
|
16338
|
+
}
|
|
16339
|
+
}
|
|
16340
|
+
var material = this.effectComponent.material;
|
|
16341
|
+
material.setFloat("_PosX", _PosX * this.amountOfMotion);
|
|
16342
|
+
material.setFloat("_PosY", _PosY * this.amountOfMotion);
|
|
16343
|
+
material.setFloat("_PosZ", _PosZ * this.amountOfMotion);
|
|
16344
|
+
};
|
|
16345
|
+
return Fake3DComponent;
|
|
16346
|
+
}(Component);
|
|
16347
|
+
__decorate([
|
|
16348
|
+
serialize()
|
|
16349
|
+
], exports.Fake3DComponent.prototype, "loop", void 0);
|
|
16350
|
+
__decorate([
|
|
16351
|
+
serialize()
|
|
16352
|
+
], exports.Fake3DComponent.prototype, "amountOfMotion", void 0);
|
|
16353
|
+
__decorate([
|
|
16354
|
+
serialize()
|
|
16355
|
+
], exports.Fake3DComponent.prototype, "animationLength", void 0);
|
|
16356
|
+
__decorate([
|
|
16357
|
+
serialize()
|
|
16358
|
+
], exports.Fake3DComponent.prototype, "mode", void 0);
|
|
16359
|
+
__decorate([
|
|
16360
|
+
serialize()
|
|
16361
|
+
], exports.Fake3DComponent.prototype, "startPositionX", void 0);
|
|
16362
|
+
__decorate([
|
|
16363
|
+
serialize()
|
|
16364
|
+
], exports.Fake3DComponent.prototype, "startPositionY", void 0);
|
|
16365
|
+
__decorate([
|
|
16366
|
+
serialize()
|
|
16367
|
+
], exports.Fake3DComponent.prototype, "startPositionZ", void 0);
|
|
16368
|
+
__decorate([
|
|
16369
|
+
serialize()
|
|
16370
|
+
], exports.Fake3DComponent.prototype, "endPositionX", void 0);
|
|
16371
|
+
__decorate([
|
|
16372
|
+
serialize()
|
|
16373
|
+
], exports.Fake3DComponent.prototype, "endPositionY", void 0);
|
|
16374
|
+
__decorate([
|
|
16375
|
+
serialize()
|
|
16376
|
+
], exports.Fake3DComponent.prototype, "endPositionZ", void 0);
|
|
16377
|
+
__decorate([
|
|
16378
|
+
serialize()
|
|
16379
|
+
], exports.Fake3DComponent.prototype, "amplitudeX", void 0);
|
|
16380
|
+
__decorate([
|
|
16381
|
+
serialize()
|
|
16382
|
+
], exports.Fake3DComponent.prototype, "amplitudeY", void 0);
|
|
16383
|
+
__decorate([
|
|
16384
|
+
serialize()
|
|
16385
|
+
], exports.Fake3DComponent.prototype, "amplitudeZ", void 0);
|
|
16386
|
+
__decorate([
|
|
16387
|
+
serialize()
|
|
16388
|
+
], exports.Fake3DComponent.prototype, "phaseX", void 0);
|
|
16389
|
+
__decorate([
|
|
16390
|
+
serialize()
|
|
16391
|
+
], exports.Fake3DComponent.prototype, "phaseY", void 0);
|
|
16392
|
+
__decorate([
|
|
16393
|
+
serialize()
|
|
16394
|
+
], exports.Fake3DComponent.prototype, "phaseZ", void 0);
|
|
16395
|
+
exports.Fake3DComponent = __decorate([
|
|
16396
|
+
effectsClass("Fake3DComponent")
|
|
16397
|
+
], exports.Fake3DComponent);
|
|
16398
|
+
exports.Fake3DAnimationMode = void 0;
|
|
16399
|
+
(function(Fake3DAnimationMode) {
|
|
16400
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Circular"] = 0] = "Circular";
|
|
16401
|
+
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
16402
|
+
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
16403
|
+
|
|
15647
16404
|
exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
15648
16405
|
_inherits(CameraController, Behaviour);
|
|
15649
16406
|
function CameraController(engine, props) {
|
|
@@ -16014,8 +16771,8 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16014
16771
|
0
|
|
16015
16772
|
]
|
|
16016
16773
|
};
|
|
16774
|
+
_this.duringPlay = false;
|
|
16017
16775
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
16018
|
-
_this.hasBeenAddedToComposition = false;
|
|
16019
16776
|
_this.getHitTestParams = function(force) {
|
|
16020
16777
|
if (!_this.clickable) {
|
|
16021
16778
|
return;
|
|
@@ -16052,7 +16809,6 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16052
16809
|
];
|
|
16053
16810
|
};
|
|
16054
16811
|
_proto.onStart = function onStart() {
|
|
16055
|
-
var _this = this;
|
|
16056
16812
|
var options = this.item.props.content.options;
|
|
16057
16813
|
var env = this.item.engine.renderer.env;
|
|
16058
16814
|
var composition = this.item.composition;
|
|
@@ -16076,32 +16832,35 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16076
16832
|
this.materials = this.previewContent.mesh.materials;
|
|
16077
16833
|
}
|
|
16078
16834
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
_this.endDragTarget();
|
|
16835
|
+
};
|
|
16836
|
+
_proto.onDisable = function onDisable() {
|
|
16837
|
+
if (this.item && this.item.composition) {
|
|
16838
|
+
var _this_previewContent;
|
|
16839
|
+
if (this.duringPlay && !this.item.transform.getValid()) {
|
|
16840
|
+
this.item.composition.removeInteractiveItem(this.item, this.item.props.content.options.type);
|
|
16841
|
+
this.duringPlay = false;
|
|
16087
16842
|
}
|
|
16088
|
-
|
|
16843
|
+
this.clickable = false;
|
|
16844
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.mesh.dispose();
|
|
16845
|
+
this.endDragTarget();
|
|
16846
|
+
}
|
|
16847
|
+
};
|
|
16848
|
+
_proto.onEnable = function onEnable() {
|
|
16849
|
+
var type = this.interactData.options.type;
|
|
16850
|
+
if (type === InteractType.CLICK) {
|
|
16851
|
+
this.clickable = true;
|
|
16852
|
+
}
|
|
16089
16853
|
};
|
|
16090
16854
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16091
16855
|
var _this_previewContent;
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
16097
|
-
var type = this.interactData.options.type;
|
|
16098
|
-
if (type === InteractType.CLICK) {
|
|
16099
|
-
this.clickable = true;
|
|
16100
|
-
}
|
|
16856
|
+
this.duringPlay = true;
|
|
16857
|
+
// trigger messageBegin when item enter
|
|
16858
|
+
if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
|
|
16859
|
+
var _this_item_composition;
|
|
16101
16860
|
var options = this.item.props.content.options;
|
|
16102
|
-
this.item.composition.addInteractiveItem(this.item, options.type);
|
|
16103
|
-
this.hasBeenAddedToComposition = true;
|
|
16861
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16104
16862
|
}
|
|
16863
|
+
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16105
16864
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
16106
16865
|
return;
|
|
16107
16866
|
}
|
|
@@ -16269,7 +17028,9 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
16269
17028
|
return arg && Math.abs(arg.vx || 0) < threshold && Math.abs(arg.vy || 0) < threshold;
|
|
16270
17029
|
}
|
|
16271
17030
|
|
|
16272
|
-
|
|
17031
|
+
/**
|
|
17032
|
+
*
|
|
17033
|
+
*/ var MeshCollider = /*#__PURE__*/ function() {
|
|
16273
17034
|
function MeshCollider() {
|
|
16274
17035
|
this.triangles = [];
|
|
16275
17036
|
}
|
|
@@ -16277,6 +17038,38 @@ var MeshCollider = /*#__PURE__*/ function() {
|
|
|
16277
17038
|
_proto.getBoundingBoxData = function getBoundingBoxData() {
|
|
16278
17039
|
return this.boundingBoxData;
|
|
16279
17040
|
};
|
|
17041
|
+
_proto.getBoundingBox = function getBoundingBox() {
|
|
17042
|
+
var maxX = -Number.MAX_VALUE;
|
|
17043
|
+
var maxY = -Number.MAX_VALUE;
|
|
17044
|
+
var minX = Number.MAX_VALUE;
|
|
17045
|
+
var minY = Number.MAX_VALUE;
|
|
17046
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.boundingBoxData.area), _step; !(_step = _iterator()).done;){
|
|
17047
|
+
var triangle = _step.value;
|
|
17048
|
+
maxX = Math.max(triangle.p0.x, triangle.p1.x, triangle.p2.x, maxX);
|
|
17049
|
+
maxY = Math.max(triangle.p0.y, triangle.p1.y, triangle.p2.y, maxY);
|
|
17050
|
+
minX = Math.min(triangle.p0.x, triangle.p1.x, triangle.p2.x, minX);
|
|
17051
|
+
minY = Math.min(triangle.p0.y, triangle.p1.y, triangle.p2.y, minY);
|
|
17052
|
+
}
|
|
17053
|
+
var area = [];
|
|
17054
|
+
var point0 = new Vector3(minX, maxY, 0);
|
|
17055
|
+
var point1 = new Vector3(maxX, maxY, 0);
|
|
17056
|
+
var point2 = new Vector3(maxX, minY, 0);
|
|
17057
|
+
var point3 = new Vector3(minX, minY, 0);
|
|
17058
|
+
area.push({
|
|
17059
|
+
p0: point0,
|
|
17060
|
+
p1: point1,
|
|
17061
|
+
p2: point2
|
|
17062
|
+
});
|
|
17063
|
+
area.push({
|
|
17064
|
+
p0: point0,
|
|
17065
|
+
p1: point2,
|
|
17066
|
+
p2: point3
|
|
17067
|
+
});
|
|
17068
|
+
return {
|
|
17069
|
+
type: exports.HitTestType.triangle,
|
|
17070
|
+
area: area
|
|
17071
|
+
};
|
|
17072
|
+
};
|
|
16280
17073
|
_proto.setGeometry = function setGeometry(geometry, worldMatrix) {
|
|
16281
17074
|
if (this.geometry !== geometry) {
|
|
16282
17075
|
this.triangles = this.geometryToTriangles(geometry);
|
|
@@ -16481,6 +17274,7 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16481
17274
|
if (inputCount === void 0) inputCount = 0;
|
|
16482
17275
|
this.onPlayablePlayFlag = true;
|
|
16483
17276
|
this.onPlayablePauseFlag = false;
|
|
17277
|
+
this.duration = 0;
|
|
16484
17278
|
this.destroyed = false;
|
|
16485
17279
|
this.inputs = [];
|
|
16486
17280
|
this.inputOuputPorts = [];
|
|
@@ -16573,6 +17367,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
|
16573
17367
|
_proto.getTime = function getTime() {
|
|
16574
17368
|
return this.time;
|
|
16575
17369
|
};
|
|
17370
|
+
_proto.setDuration = function setDuration(duration) {
|
|
17371
|
+
this.duration = duration;
|
|
17372
|
+
};
|
|
17373
|
+
_proto.getDuration = function getDuration() {
|
|
17374
|
+
return this.duration;
|
|
17375
|
+
};
|
|
16576
17376
|
_proto.getPlayState = function getPlayState() {
|
|
16577
17377
|
return this.playState;
|
|
16578
17378
|
};
|
|
@@ -16724,7 +17524,9 @@ var PlayableTraversalMode;
|
|
|
16724
17524
|
var tempQuat$1 = new Quaternion();
|
|
16725
17525
|
var seed$4 = 1;
|
|
16726
17526
|
// TODO 继承 Component
|
|
16727
|
-
|
|
17527
|
+
/**
|
|
17528
|
+
*
|
|
17529
|
+
*/ var Transform = /*#__PURE__*/ function() {
|
|
16728
17530
|
function Transform(props, parent) {
|
|
16729
17531
|
if (props === void 0) props = {};
|
|
16730
17532
|
this.taggedProperties = {};
|
|
@@ -17189,7 +17991,11 @@ var Transform = /*#__PURE__*/ function() {
|
|
|
17189
17991
|
return Transform;
|
|
17190
17992
|
}();
|
|
17191
17993
|
|
|
17192
|
-
|
|
17994
|
+
/**
|
|
17995
|
+
*
|
|
17996
|
+
*/ /**
|
|
17997
|
+
* 事件监听器
|
|
17998
|
+
*/ var EventEmitter = function EventEmitter() {
|
|
17193
17999
|
var _this = this;
|
|
17194
18000
|
var _this1 = this;
|
|
17195
18001
|
this.listeners = {};
|
|
@@ -17283,17 +18089,15 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17283
18089
|
/**
|
|
17284
18090
|
* 元素动画结束时行为(如何处理元素)
|
|
17285
18091
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
17286
|
-
/**
|
|
17287
|
-
* 元素是否可用
|
|
17288
|
-
*/ _this.ended = false;
|
|
17289
|
-
_this.reusable = false;
|
|
17290
18092
|
_this.type = ItemType.base;
|
|
17291
18093
|
_this.isDuringPlay = false;
|
|
17292
18094
|
_this.components = [];
|
|
17293
18095
|
_this.rendererComponents = [];
|
|
17294
18096
|
/**
|
|
17295
|
-
*
|
|
17296
|
-
|
|
18097
|
+
* 元素是否激活
|
|
18098
|
+
*/ _this.active = true;
|
|
18099
|
+
/**
|
|
18100
|
+
* 元素组件是否显示,用于批量开关元素组件
|
|
17297
18101
|
*/ _this.visible = true;
|
|
17298
18102
|
/**
|
|
17299
18103
|
* 元素动画的速度
|
|
@@ -17424,12 +18228,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17424
18228
|
}
|
|
17425
18229
|
};
|
|
17426
18230
|
/**
|
|
17427
|
-
* 元素动画结束播放时回调函数
|
|
17428
|
-
* @override
|
|
17429
|
-
*/ _proto.onEnd = function onEnd() {
|
|
17430
|
-
// OVERRIDE
|
|
17431
|
-
};
|
|
17432
|
-
/**
|
|
17433
18231
|
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
17434
18232
|
* @param {number} r
|
|
17435
18233
|
* @param {number} g
|
|
@@ -17442,17 +18240,27 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17442
18240
|
* @param opacity - 透明度值,范围 [0,1]
|
|
17443
18241
|
*/ _proto.setOpacity = function setOpacity(opacity) {};
|
|
17444
18242
|
/**
|
|
17445
|
-
*
|
|
17446
|
-
*/ _proto.
|
|
17447
|
-
|
|
18243
|
+
* 激活或停用 VFXItem
|
|
18244
|
+
*/ _proto.setActive = function setActive(value) {
|
|
18245
|
+
if (this.active !== value) {
|
|
18246
|
+
this.active = !!value;
|
|
18247
|
+
this.onActiveChanged();
|
|
18248
|
+
}
|
|
17448
18249
|
};
|
|
17449
18250
|
/**
|
|
17450
|
-
*
|
|
18251
|
+
* 设置元素的显隐,该设置会批量开关元素组件
|
|
17451
18252
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
18253
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
18254
|
+
var component = _step.value;
|
|
18255
|
+
component.enabled = visible;
|
|
17455
18256
|
}
|
|
18257
|
+
this.visible = visible;
|
|
18258
|
+
};
|
|
18259
|
+
/**
|
|
18260
|
+
* 元素组件显隐状态
|
|
18261
|
+
* @deprecated use isVisible instead
|
|
18262
|
+
*/ _proto.getVisible = function getVisible() {
|
|
18263
|
+
return this.visible;
|
|
17456
18264
|
};
|
|
17457
18265
|
/**
|
|
17458
18266
|
* 获取元素变换包括位置、旋转、缩放
|
|
@@ -17534,14 +18342,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17534
18342
|
this.transform.assignWorldTRS(pos);
|
|
17535
18343
|
return pos;
|
|
17536
18344
|
};
|
|
17537
|
-
/**
|
|
17538
|
-
* 是否到达元素的结束时间
|
|
17539
|
-
* @param now
|
|
17540
|
-
* @returns
|
|
17541
|
-
*/ _proto.isEnded = function isEnded(now) {
|
|
17542
|
-
// at least 1 ms
|
|
17543
|
-
return now - this.duration > 0.001;
|
|
17544
|
-
};
|
|
17545
18345
|
_proto.find = function find(name) {
|
|
17546
18346
|
var _queue;
|
|
17547
18347
|
if (this.name === name) {
|
|
@@ -17565,7 +18365,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17565
18365
|
* @internal
|
|
17566
18366
|
*/ _proto.beginPlay = function beginPlay() {
|
|
17567
18367
|
this.isDuringPlay = true;
|
|
17568
|
-
if (this.composition && this.
|
|
18368
|
+
if (this.composition && this.active && !this.isEnabled) {
|
|
17569
18369
|
this.onEnable();
|
|
17570
18370
|
}
|
|
17571
18371
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
@@ -17749,25 +18549,54 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17749
18549
|
// }
|
|
17750
18550
|
// }
|
|
17751
18551
|
};
|
|
17752
|
-
|
|
18552
|
+
/**
|
|
18553
|
+
*
|
|
18554
|
+
* @param item
|
|
18555
|
+
* @returns
|
|
18556
|
+
*/ VFXItem.isComposition = function isComposition(item) {
|
|
17753
18557
|
return item.type === ItemType.composition;
|
|
17754
18558
|
};
|
|
17755
|
-
|
|
18559
|
+
/**
|
|
18560
|
+
*
|
|
18561
|
+
* @param item
|
|
18562
|
+
* @returns
|
|
18563
|
+
*/ VFXItem.isSprite = function isSprite(item) {
|
|
17756
18564
|
return item.type === ItemType.sprite;
|
|
17757
18565
|
};
|
|
17758
|
-
|
|
18566
|
+
/**
|
|
18567
|
+
*
|
|
18568
|
+
* @param item
|
|
18569
|
+
* @returns
|
|
18570
|
+
*/ VFXItem.isParticle = function isParticle(item) {
|
|
17759
18571
|
return item.type === ItemType.particle;
|
|
17760
18572
|
};
|
|
17761
|
-
|
|
18573
|
+
/**
|
|
18574
|
+
*
|
|
18575
|
+
* @param item
|
|
18576
|
+
* @returns
|
|
18577
|
+
*/ VFXItem.isNull = function isNull(item) {
|
|
17762
18578
|
return item.type === ItemType.null;
|
|
17763
18579
|
};
|
|
17764
|
-
|
|
18580
|
+
/**
|
|
18581
|
+
*
|
|
18582
|
+
* @param item
|
|
18583
|
+
* @returns
|
|
18584
|
+
*/ VFXItem.isTree = function isTree(item) {
|
|
17765
18585
|
return item.type === ItemType.tree;
|
|
17766
18586
|
};
|
|
17767
|
-
|
|
18587
|
+
/**
|
|
18588
|
+
*
|
|
18589
|
+
* @param item
|
|
18590
|
+
* @returns
|
|
18591
|
+
*/ VFXItem.isCamera = function isCamera(item) {
|
|
17768
18592
|
return item.type === ItemType.camera;
|
|
17769
18593
|
};
|
|
17770
|
-
|
|
18594
|
+
/**
|
|
18595
|
+
*
|
|
18596
|
+
* @param ancestorCandidate
|
|
18597
|
+
* @param descendantCandidate
|
|
18598
|
+
* @returns
|
|
18599
|
+
*/ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
17771
18600
|
var current = descendantCandidate.parent;
|
|
17772
18601
|
while(current){
|
|
17773
18602
|
if (current === ancestorCandidate) {
|
|
@@ -17812,6 +18641,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
17812
18641
|
}
|
|
17813
18642
|
}
|
|
17814
18643
|
}
|
|
18644
|
+
},
|
|
18645
|
+
{
|
|
18646
|
+
key: "isActive",
|
|
18647
|
+
get: /**
|
|
18648
|
+
* 当前 VFXItem 是否激活
|
|
18649
|
+
*/ function get() {
|
|
18650
|
+
return this.active;
|
|
18651
|
+
}
|
|
18652
|
+
},
|
|
18653
|
+
{
|
|
18654
|
+
key: "isVisible",
|
|
18655
|
+
get: /**
|
|
18656
|
+
* 元素组件显隐状态
|
|
18657
|
+
*/ function get() {
|
|
18658
|
+
return this.visible;
|
|
18659
|
+
}
|
|
17815
18660
|
}
|
|
17816
18661
|
]);
|
|
17817
18662
|
return VFXItem;
|
|
@@ -22576,6 +23421,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
22576
23421
|
for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
|
|
22577
23422
|
var timelineClip = _step.value;
|
|
22578
23423
|
var clipPlayable = this.createClipPlayable(graph, timelineClip);
|
|
23424
|
+
clipPlayable.setDuration(timelineClip.duration);
|
|
22579
23425
|
var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
|
|
22580
23426
|
runtimeClips.push(clip);
|
|
22581
23427
|
mixer.addInput(clipPlayable, 0);
|
|
@@ -22679,14 +23525,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
22679
23525
|
this.playable.setTime(clipTime);
|
|
22680
23526
|
// 判断动画是否结束
|
|
22681
23527
|
if (ended) {
|
|
22682
|
-
if (_instanceof1(boundObject, exports.VFXItem) && !boundObject.ended) {
|
|
22683
|
-
boundObject.ended = true;
|
|
22684
|
-
boundObject.onEnd();
|
|
22685
|
-
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
22686
|
-
boundObject.dispose();
|
|
22687
|
-
this.playable.dispose();
|
|
22688
|
-
}
|
|
22689
|
-
}
|
|
22690
23528
|
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
22691
23529
|
this.playable.pause();
|
|
22692
23530
|
}
|
|
@@ -22729,26 +23567,10 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22729
23567
|
}
|
|
22730
23568
|
if (hasInput) {
|
|
22731
23569
|
boundItem.transform.setValid(true);
|
|
22732
|
-
|
|
23570
|
+
boundItem.setActive(true);
|
|
22733
23571
|
} else {
|
|
22734
23572
|
boundItem.transform.setValid(false);
|
|
22735
|
-
|
|
22736
|
-
}
|
|
22737
|
-
};
|
|
22738
|
-
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
22739
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22740
|
-
var rendererComponent = _step.value;
|
|
22741
|
-
if (rendererComponent.enabled) {
|
|
22742
|
-
rendererComponent.enabled = false;
|
|
22743
|
-
}
|
|
22744
|
-
}
|
|
22745
|
-
};
|
|
22746
|
-
_proto.showRendererComponents = function showRendererComponents(item) {
|
|
22747
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
22748
|
-
var rendererComponent = _step.value;
|
|
22749
|
-
if (!rendererComponent.enabled) {
|
|
22750
|
-
rendererComponent.enabled = true;
|
|
22751
|
-
}
|
|
23573
|
+
boundItem.setActive(false);
|
|
22752
23574
|
}
|
|
22753
23575
|
};
|
|
22754
23576
|
return ActivationMixerPlayable;
|
|
@@ -22776,7 +23598,7 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
22776
23598
|
}
|
|
22777
23599
|
var _proto = PropertyClipPlayable.prototype;
|
|
22778
23600
|
_proto.processFrame = function processFrame(context) {
|
|
22779
|
-
this.value = this.curve.getValue(this.time);
|
|
23601
|
+
this.value = this.curve.getValue(this.time / this.getDuration());
|
|
22780
23602
|
};
|
|
22781
23603
|
return PropertyClipPlayable;
|
|
22782
23604
|
}(Playable);
|
|
@@ -23294,9 +24116,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23294
24116
|
var track = _step.value;
|
|
23295
24117
|
var boundObject = track.boundObject;
|
|
23296
24118
|
if (_instanceof1(boundObject, exports.VFXItem)) {
|
|
23297
|
-
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
23298
|
-
boundObject.reusable = value;
|
|
23299
|
-
}
|
|
23300
24119
|
var subCompositionComponent = boundObject.getComponent(CompositionComponent);
|
|
23301
24120
|
if (subCompositionComponent) {
|
|
23302
24121
|
subCompositionComponent.setReusable(value);
|
|
@@ -23341,16 +24160,16 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23341
24160
|
}
|
|
23342
24161
|
}
|
|
23343
24162
|
};
|
|
23344
|
-
_proto.
|
|
24163
|
+
_proto.onEnable = function onEnable() {
|
|
23345
24164
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23346
24165
|
var item = _step.value;
|
|
23347
|
-
item.
|
|
24166
|
+
item.setActive(true);
|
|
23348
24167
|
}
|
|
23349
24168
|
};
|
|
23350
|
-
_proto.
|
|
24169
|
+
_proto.onDisable = function onDisable() {
|
|
23351
24170
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
23352
24171
|
var item = _step.value;
|
|
23353
|
-
item.
|
|
24172
|
+
item.setActive(false);
|
|
23354
24173
|
}
|
|
23355
24174
|
};
|
|
23356
24175
|
_proto.onDestroy = function onDestroy() {
|
|
@@ -23366,7 +24185,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23366
24185
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
23367
24186
|
var _this, _loop = function(i) {
|
|
23368
24187
|
var item = _this.items[i];
|
|
23369
|
-
if (item.
|
|
24188
|
+
if (item.isActive && item.transform.getValid() && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
23370
24189
|
var hitParams = item.getHitTestParams(force);
|
|
23371
24190
|
if (hitParams) {
|
|
23372
24191
|
var success = false;
|
|
@@ -23508,9 +24327,9 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23508
24327
|
}
|
|
23509
24328
|
}
|
|
23510
24329
|
if (hasInput) {
|
|
23511
|
-
compositionComponent.
|
|
24330
|
+
compositionComponent.item.setActive(true);
|
|
23512
24331
|
} else {
|
|
23513
|
-
compositionComponent.
|
|
24332
|
+
compositionComponent.item.setActive(false);
|
|
23514
24333
|
}
|
|
23515
24334
|
};
|
|
23516
24335
|
return SubCompositionMixerPlayable;
|
|
@@ -24175,6 +24994,8 @@ exports.TextComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
24175
24994
|
/**
|
|
24176
24995
|
* 文本行数
|
|
24177
24996
|
*/ _this.lineCount = 0;
|
|
24997
|
+
_this.SCALE_FACTOR = 0.1;
|
|
24998
|
+
_this.ALPHA_FIX_VALUE = 1 / 255;
|
|
24178
24999
|
_this.name = "MText" + seed$2++;
|
|
24179
25000
|
_this.geometry = _this.createGeometry(glContext.TRIANGLES);
|
|
24180
25001
|
if (props) {
|
|
@@ -24540,7 +25361,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
24540
25361
|
}
|
|
24541
25362
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
24542
25363
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
24543
|
-
this.material.setTexture("
|
|
25364
|
+
this.material.setTexture("_MainTex", Texture.createWithData(this.engine, {
|
|
24544
25365
|
data: new Uint8Array(imageData.data),
|
|
24545
25366
|
width: imageData.width,
|
|
24546
25367
|
height: imageData.height
|
|
@@ -27738,7 +28559,7 @@ var listOrder = 0;
|
|
|
27738
28559
|
var itemProps = sourceItemData;
|
|
27739
28560
|
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
27740
28561
|
itemProps.listIndex = listOrder++;
|
|
27741
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
28562
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
|
|
27742
28563
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
27743
28564
|
var componentPath = _step2.value;
|
|
27744
28565
|
var componentData = componentMap[componentPath.id];
|
|
@@ -27834,13 +28655,18 @@ var listOrder = 0;
|
|
|
27834
28655
|
return CompositionSourceManager;
|
|
27835
28656
|
}();
|
|
27836
28657
|
|
|
27837
|
-
|
|
28658
|
+
/**
|
|
28659
|
+
*
|
|
28660
|
+
*/ var SceneTicking = /*#__PURE__*/ function() {
|
|
27838
28661
|
function SceneTicking() {
|
|
27839
28662
|
this.update = new UpdateTickData();
|
|
27840
28663
|
this.lateUpdate = new LateUpdateTickData();
|
|
27841
28664
|
}
|
|
27842
28665
|
var _proto = SceneTicking.prototype;
|
|
27843
|
-
|
|
28666
|
+
/**
|
|
28667
|
+
*
|
|
28668
|
+
* @param obj
|
|
28669
|
+
*/ _proto.addComponent = function addComponent(obj) {
|
|
27844
28670
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27845
28671
|
this.update.addComponent(obj);
|
|
27846
28672
|
}
|
|
@@ -27848,7 +28674,10 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27848
28674
|
this.lateUpdate.addComponent(obj);
|
|
27849
28675
|
}
|
|
27850
28676
|
};
|
|
27851
|
-
|
|
28677
|
+
/**
|
|
28678
|
+
*
|
|
28679
|
+
* @param obj
|
|
28680
|
+
*/ _proto.removeComponent = function removeComponent(obj) {
|
|
27852
28681
|
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
27853
28682
|
this.update.removeComponent(obj);
|
|
27854
28683
|
}
|
|
@@ -27856,7 +28685,9 @@ var SceneTicking = /*#__PURE__*/ function() {
|
|
|
27856
28685
|
this.lateUpdate.removeComponent(obj);
|
|
27857
28686
|
}
|
|
27858
28687
|
};
|
|
27859
|
-
|
|
28688
|
+
/**
|
|
28689
|
+
*
|
|
28690
|
+
*/ _proto.clear = function clear() {
|
|
27860
28691
|
this.update.clear();
|
|
27861
28692
|
this.lateUpdate.clear();
|
|
27862
28693
|
};
|
|
@@ -27947,11 +28778,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27947
28778
|
var _this;
|
|
27948
28779
|
var _scene_jsonScene_renderSettings;
|
|
27949
28780
|
_this = EventEmitter.call(this) || this;
|
|
27950
|
-
|
|
28781
|
+
/**
|
|
28782
|
+
*
|
|
28783
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
27951
28784
|
/**
|
|
27952
28785
|
* 动画播放速度
|
|
27953
28786
|
*/ _this.speed = 1;
|
|
27954
28787
|
/**
|
|
28788
|
+
* 合成是否结束
|
|
28789
|
+
*/ _this.isEnded = false;
|
|
28790
|
+
/**
|
|
27955
28791
|
* 用于保存与当前合成相关的插件数据
|
|
27956
28792
|
*/ _this.loaderData = {};
|
|
27957
28793
|
/**
|
|
@@ -27973,6 +28809,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
27973
28809
|
* 合成暂停/播放 标识
|
|
27974
28810
|
*/ _this.paused = false;
|
|
27975
28811
|
_this.lastVideoUpdateTime = 0;
|
|
28812
|
+
_this.isEndCalled = false;
|
|
27976
28813
|
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;
|
|
27977
28814
|
_this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
27978
28815
|
if (reusable) {
|
|
@@ -28062,7 +28899,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28062
28899
|
* @param visible - 是否可见
|
|
28063
28900
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
28064
28901
|
this.items.forEach(function(item) {
|
|
28065
|
-
item.
|
|
28902
|
+
item.setActive(visible);
|
|
28066
28903
|
});
|
|
28067
28904
|
};
|
|
28068
28905
|
/**
|
|
@@ -28072,7 +28909,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28072
28909
|
return this.speed;
|
|
28073
28910
|
};
|
|
28074
28911
|
_proto.play = function play() {
|
|
28075
|
-
if (this.
|
|
28912
|
+
if (this.isEnded && this.reusable) {
|
|
28076
28913
|
this.restart();
|
|
28077
28914
|
}
|
|
28078
28915
|
if (this.rootComposition.isStartCalled) {
|
|
@@ -28163,7 +29000,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28163
29000
|
* 重置状态函数
|
|
28164
29001
|
*/ _proto.reset = function reset() {
|
|
28165
29002
|
this.rendererOptions = null;
|
|
28166
|
-
this.
|
|
29003
|
+
this.isEnded = false;
|
|
29004
|
+
this.isEndCalled = false;
|
|
28167
29005
|
this.rootComposition.time = 0;
|
|
28168
29006
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
28169
29007
|
};
|
|
@@ -28215,12 +29053,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28215
29053
|
this.sceneTicking.lateUpdate.tick(dt);
|
|
28216
29054
|
this.updateCamera();
|
|
28217
29055
|
this.prepareRender();
|
|
29056
|
+
if (this.isEnded && !this.isEndCalled) {
|
|
29057
|
+
this.isEndCalled = true;
|
|
29058
|
+
this.emit("end", {
|
|
29059
|
+
composition: this
|
|
29060
|
+
});
|
|
29061
|
+
}
|
|
28218
29062
|
if (this.shouldDispose()) {
|
|
28219
29063
|
this.dispose();
|
|
28220
29064
|
}
|
|
28221
29065
|
};
|
|
28222
29066
|
_proto.shouldDispose = function shouldDispose() {
|
|
28223
|
-
return this.
|
|
29067
|
+
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
28224
29068
|
};
|
|
28225
29069
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
28226
29070
|
var startTimeInMs = this.startTime * 1000;
|
|
@@ -28311,11 +29155,11 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28311
29155
|
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
28312
29156
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
28313
29157
|
var localTime = this.time + deltaTime - this.rootItem.start;
|
|
28314
|
-
var
|
|
29158
|
+
var isEnded = false;
|
|
28315
29159
|
var duration = this.rootItem.duration;
|
|
28316
29160
|
var endBehavior = this.rootItem.endBehavior;
|
|
28317
29161
|
if (localTime - duration > 0.001) {
|
|
28318
|
-
|
|
29162
|
+
isEnded = true;
|
|
28319
29163
|
switch(endBehavior){
|
|
28320
29164
|
case EndBehavior.restart:
|
|
28321
29165
|
{
|
|
@@ -28339,11 +29183,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28339
29183
|
}
|
|
28340
29184
|
}
|
|
28341
29185
|
this.rootComposition.time = localTime;
|
|
28342
|
-
|
|
28343
|
-
|
|
28344
|
-
|
|
28345
|
-
|
|
28346
|
-
}
|
|
29186
|
+
// end state changed, handle onEnd flags
|
|
29187
|
+
if (this.isEnded !== isEnded) {
|
|
29188
|
+
if (isEnded) {
|
|
29189
|
+
this.isEnded = true;
|
|
29190
|
+
} else {
|
|
29191
|
+
this.isEnded = false;
|
|
29192
|
+
this.isEndCalled = false;
|
|
29193
|
+
}
|
|
28347
29194
|
}
|
|
28348
29195
|
}
|
|
28349
29196
|
};
|
|
@@ -30669,7 +31516,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
30669
31516
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
30670
31517
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
30671
31518
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
30672
|
-
var version$1 = "2.1.0-
|
|
31519
|
+
var version$1 = "2.1.0-beta.0";
|
|
30673
31520
|
logger.info("Core version: " + version$1 + ".");
|
|
30674
31521
|
|
|
30675
31522
|
var _obj;
|
|
@@ -30705,22 +31552,7 @@ var _obj3;
|
|
|
30705
31552
|
* 必须初始化的 uniform 的 map 对象(THREE 必须在初始化的时候赋值)
|
|
30706
31553
|
*/ var TEXTURE_UNIFORM_MAP = [
|
|
30707
31554
|
"uMaskTex",
|
|
30708
|
-
"
|
|
30709
|
-
"uSampler1",
|
|
30710
|
-
"uSampler2",
|
|
30711
|
-
"uSampler3",
|
|
30712
|
-
"uSampler4",
|
|
30713
|
-
"uSampler5",
|
|
30714
|
-
"uSampler6",
|
|
30715
|
-
"uSampler7",
|
|
30716
|
-
"uSampler8",
|
|
30717
|
-
"uSampler9",
|
|
30718
|
-
"uSampler10",
|
|
30719
|
-
"uSampler11",
|
|
30720
|
-
"uSampler12",
|
|
30721
|
-
"uSampler13",
|
|
30722
|
-
"uSampler14",
|
|
30723
|
-
"uSampler15",
|
|
31555
|
+
"_MainTex",
|
|
30724
31556
|
"uColorOverLifetime",
|
|
30725
31557
|
"uColorOverTrail"
|
|
30726
31558
|
];
|
|
@@ -30751,9 +31583,7 @@ var _obj3;
|
|
|
30751
31583
|
vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
|
|
30752
31584
|
fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
|
|
30753
31585
|
});
|
|
30754
|
-
|
|
30755
|
-
_this.uniforms["uSampler" + i] = new THREE__namespace.Uniform(null);
|
|
30756
|
-
}
|
|
31586
|
+
_this.uniforms["_MainTex"] = new THREE__namespace.Uniform(null);
|
|
30757
31587
|
_this.uniforms["uEditorTransform"] = new THREE__namespace.Uniform([
|
|
30758
31588
|
1,
|
|
30759
31589
|
1,
|
|
@@ -32313,7 +33143,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
32313
33143
|
*/ Mesh.create = function(engine, props) {
|
|
32314
33144
|
return new ThreeMesh(engine, props);
|
|
32315
33145
|
};
|
|
32316
|
-
var version = "2.1.0-
|
|
33146
|
+
var version = "2.1.0-beta.0";
|
|
32317
33147
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
32318
33148
|
|
|
32319
33149
|
exports.AbstractPlugin = AbstractPlugin;
|