@galacean/effects-core 2.2.5 → 2.3.0-alpha.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/components/base-render-component.d.ts +10 -4
- package/dist/components/shape-component.d.ts +5 -2
- package/dist/composition.d.ts +62 -2
- package/dist/config.d.ts +11 -0
- package/dist/downloader.d.ts +15 -0
- package/dist/fallback/migration.d.ts +5 -0
- package/dist/index.js +1647 -1030
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1647 -1031
- package/dist/index.mjs.map +1 -1
- package/dist/math/keyframe-info.d.ts +8 -1
- package/dist/math/value-getters/index.d.ts +1 -1
- package/dist/math/value-getters/value-getter.d.ts +3 -1
- package/dist/math/value-getters/{vector4-curve.d.ts → vector-curves.d.ts} +8 -0
- package/dist/plugins/shape/build-line.d.ts +32 -0
- package/dist/plugins/shape/graphics-path.d.ts +0 -4
- package/dist/plugins/shape/polygon.d.ts +0 -4
- package/dist/plugins/shape/shape-path.d.ts +0 -4
- package/dist/plugins/timeline/playable-assets/index.d.ts +1 -1
- package/dist/plugins/timeline/playable-assets/{vector4-property-playable-asset.d.ts → vector-property-playable-assets.d.ts} +5 -1
- package/dist/plugins/timeline/playables/color-property-mixer-playable.d.ts +5 -5
- package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +4 -5
- package/dist/plugins/timeline/playables/index.d.ts +1 -1
- package/dist/plugins/timeline/playables/property-mixer-playable.d.ts +9 -0
- package/dist/plugins/timeline/playables/vector-property-mixer-playable.d.ts +11 -0
- package/dist/plugins/timeline/tracks/index.d.ts +1 -1
- package/dist/plugins/timeline/tracks/{vector4-property-track.d.ts → vector-property-track.d.ts} +3 -0
- package/package.json +2 -2
- package/dist/plugins/timeline/playables/vector4-property-mixer-playable.d.ts +0 -6
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.
|
|
6
|
+
* Version: v2.3.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -953,7 +953,7 @@ var pluginInfoMap = {
|
|
|
953
953
|
"video": "@galacean/effects-plugin-multimedia",
|
|
954
954
|
"audio": "@galacean/effects-plugin-multimedia",
|
|
955
955
|
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
956
|
-
"
|
|
956
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
957
957
|
"spine": "@galacean/effects-plugin-spine"
|
|
958
958
|
};
|
|
959
959
|
function getPluginUsageInfo(name) {
|
|
@@ -1018,6 +1018,26 @@ function _inherits(subClass, superClass) {
|
|
|
1018
1018
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
|
+
/**
|
|
1022
|
+
* JSON 版本
|
|
1023
|
+
*/ var JSONSceneVersion;
|
|
1024
|
+
(function(JSONSceneVersion) {
|
|
1025
|
+
JSONSceneVersion["1_0"] = "1.0";
|
|
1026
|
+
JSONSceneVersion["1_1"] = "1.1";
|
|
1027
|
+
JSONSceneVersion["1_2"] = "1.2";
|
|
1028
|
+
JSONSceneVersion["1_3"] = "1.3";
|
|
1029
|
+
JSONSceneVersion["1_5"] = "1.5";
|
|
1030
|
+
JSONSceneVersion["1_8"] = "1.8";
|
|
1031
|
+
JSONSceneVersion["2_0"] = "2.0";
|
|
1032
|
+
JSONSceneVersion["2_1"] = "2.1";
|
|
1033
|
+
JSONSceneVersion["2_2"] = "2.2";
|
|
1034
|
+
JSONSceneVersion["2_3"] = "2.3";
|
|
1035
|
+
JSONSceneVersion["2_4"] = "2.4";
|
|
1036
|
+
JSONSceneVersion["3_0"] = "3.0";
|
|
1037
|
+
JSONSceneVersion["3_1"] = "3.1";
|
|
1038
|
+
JSONSceneVersion["LATEST"] = "3.1";
|
|
1039
|
+
})(JSONSceneVersion || (JSONSceneVersion = {}));
|
|
1040
|
+
|
|
1021
1041
|
/*********************************************/ /* 元素属性参数类型 */ /*********************************************/ /**
|
|
1022
1042
|
* 渲染等级
|
|
1023
1043
|
*/ var RenderLevel;
|
|
@@ -1323,8 +1343,12 @@ var RenderFace;
|
|
|
1323
1343
|
*/ var END_BEHAVIOR_DESTROY_CHILDREN = 6;
|
|
1324
1344
|
var CAMERA_CLIP_MODE_VERTICAL = 1;
|
|
1325
1345
|
var CAMERA_CLIP_MODE_NORMAL = 0;
|
|
1326
|
-
|
|
1327
|
-
|
|
1346
|
+
/**
|
|
1347
|
+
* 消息开始
|
|
1348
|
+
*/ var MESSAGE_ITEM_PHRASE_BEGIN = 2;
|
|
1349
|
+
/**
|
|
1350
|
+
* 消息结束
|
|
1351
|
+
*/ var MESSAGE_ITEM_PHRASE_END = 1;
|
|
1328
1352
|
|
|
1329
1353
|
var CameraClipMode;
|
|
1330
1354
|
(function(CameraClipMode) {
|
|
@@ -1398,6 +1422,9 @@ var CameraClipMode;
|
|
|
1398
1422
|
/**
|
|
1399
1423
|
* Vector4 曲线
|
|
1400
1424
|
*/ ValueType[ValueType["VECTOR4_CURVE"] = 25] = "VECTOR4_CURVE";
|
|
1425
|
+
/**
|
|
1426
|
+
* Vector2 曲线
|
|
1427
|
+
*/ ValueType[ValueType["VECTOR2_CURVE"] = 26] = "VECTOR2_CURVE";
|
|
1401
1428
|
})(ValueType || (ValueType = {}));
|
|
1402
1429
|
/**
|
|
1403
1430
|
* 关键帧类型
|
|
@@ -1666,19 +1693,13 @@ var ShapePointType;
|
|
|
1666
1693
|
var DataType;
|
|
1667
1694
|
(function(DataType) {
|
|
1668
1695
|
DataType["VFXItemData"] = "VFXItemData";
|
|
1669
|
-
|
|
1696
|
+
// Assets
|
|
1670
1697
|
DataType["Material"] = "Material";
|
|
1671
1698
|
DataType["Shader"] = "Shader";
|
|
1672
|
-
DataType["SpriteComponent"] = "SpriteComponent";
|
|
1673
|
-
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1674
|
-
DataType["InteractComponent"] = "InteractComponent";
|
|
1675
|
-
DataType["CameraController"] = "CameraController";
|
|
1676
|
-
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1677
1699
|
DataType["Geometry"] = "Geometry";
|
|
1678
1700
|
DataType["Texture"] = "Texture";
|
|
1679
1701
|
DataType["Image"] = "Image";
|
|
1680
1702
|
DataType["AnimationClip"] = "AnimationClip";
|
|
1681
|
-
DataType["TextComponent"] = "TextComponent";
|
|
1682
1703
|
DataType["BinaryAsset"] = "BinaryAsset";
|
|
1683
1704
|
// Timeline
|
|
1684
1705
|
DataType["TrackAsset"] = "TrackAsset";
|
|
@@ -1690,6 +1711,7 @@ var DataType;
|
|
|
1690
1711
|
DataType["SubCompositionTrack"] = "SubCompositionTrack";
|
|
1691
1712
|
DataType["FloatPropertyTrack"] = "FloatPropertyTrack";
|
|
1692
1713
|
DataType["ColorPropertyTrack"] = "ColorPropertyTrack";
|
|
1714
|
+
DataType["Vector2PropertyTrack"] = "Vector2PropertyTrack";
|
|
1693
1715
|
DataType["Vector4PropertyTrack"] = "Vector4PropertyTrack";
|
|
1694
1716
|
DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
|
|
1695
1717
|
DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
|
|
@@ -1697,6 +1719,9 @@ var DataType;
|
|
|
1697
1719
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1698
1720
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1699
1721
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1722
|
+
DataType["Vector2PropertyPlayableAsset"] = "Vector2PropertyPlayableAsset";
|
|
1723
|
+
DataType["Vector4PropertyPlayableAsset"] = "Vector4PropertyPlayableAsset";
|
|
1724
|
+
// Components
|
|
1700
1725
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1701
1726
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1702
1727
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1710,6 +1735,13 @@ var DataType;
|
|
|
1710
1735
|
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1711
1736
|
DataType["OrientationComponent"] = "OrientationComponent";
|
|
1712
1737
|
DataType["ShapeComponent"] = "ShapeComponent";
|
|
1738
|
+
DataType["SpriteComponent"] = "SpriteComponent";
|
|
1739
|
+
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1740
|
+
DataType["InteractComponent"] = "InteractComponent";
|
|
1741
|
+
DataType["CameraController"] = "CameraController";
|
|
1742
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1743
|
+
DataType["EffectComponent"] = "EffectComponent";
|
|
1744
|
+
DataType["TextComponent"] = "TextComponent";
|
|
1713
1745
|
// Non-EffectObject
|
|
1714
1746
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1715
1747
|
})(DataType || (DataType = {}));
|
|
@@ -1798,8 +1830,11 @@ var VertexBufferSemantic;
|
|
|
1798
1830
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1799
1831
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1800
1832
|
|
|
1833
|
+
var LATEST_VERSION = JSONSceneVersion.LATEST;
|
|
1834
|
+
|
|
1801
1835
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1802
1836
|
__proto__: null,
|
|
1837
|
+
LATEST_VERSION: LATEST_VERSION,
|
|
1803
1838
|
get RenderLevel () { return RenderLevel; },
|
|
1804
1839
|
get BlendingMode () { return BlendingMode; },
|
|
1805
1840
|
get SideMode () { return SideMode; },
|
|
@@ -1827,6 +1862,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1827
1862
|
MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
|
|
1828
1863
|
get ValueType () { return ValueType; },
|
|
1829
1864
|
get BezierKeyframeType () { return BezierKeyframeType; },
|
|
1865
|
+
get JSONSceneVersion () { return JSONSceneVersion; },
|
|
1830
1866
|
get EndBehavior () { return EndBehavior; },
|
|
1831
1867
|
get ParentItemEndBehavior () { return ParentItemEndBehavior; },
|
|
1832
1868
|
get ParticleInteractionBehavior () { return ParticleInteractionBehavior; },
|
|
@@ -5274,988 +5310,719 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
5274
5310
|
Matrix4.tempVec2 = new Vector3();
|
|
5275
5311
|
Matrix4.tempMat0 = new Matrix4();
|
|
5276
5312
|
|
|
5277
|
-
function
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5287
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5288
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5289
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
5313
|
+
function _extends() {
|
|
5314
|
+
_extends = Object.assign || function assign(target) {
|
|
5315
|
+
for(var i = 1; i < arguments.length; i++){
|
|
5316
|
+
var source = arguments[i];
|
|
5317
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
5318
|
+
}
|
|
5319
|
+
return target;
|
|
5320
|
+
};
|
|
5321
|
+
return _extends.apply(this, arguments);
|
|
5290
5322
|
}
|
|
5291
5323
|
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
//
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
}
|
|
5324
|
+
var TextureLoadAction;
|
|
5325
|
+
(function(TextureLoadAction) {
|
|
5326
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
5327
|
+
//preserve previous attachment
|
|
5328
|
+
//load = 1,
|
|
5329
|
+
//clear attachment
|
|
5330
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
5331
|
+
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
5332
|
+
var TextureSourceType;
|
|
5333
|
+
(function(TextureSourceType) {
|
|
5334
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
5335
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
5336
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
5337
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
5338
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
5339
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
5340
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
5341
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
5342
|
+
})(TextureSourceType || (TextureSourceType = {}));
|
|
5311
5343
|
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
var GLSLVersion;
|
|
5320
|
-
(function(GLSLVersion) {
|
|
5321
|
-
GLSLVersion["GLSL1"] = "100";
|
|
5322
|
-
GLSLVersion["GLSL3"] = "300 es";
|
|
5323
|
-
})(GLSLVersion || (GLSLVersion = {}));
|
|
5324
|
-
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
5325
|
-
_inherits(ShaderVariant, EffectsObject);
|
|
5326
|
-
function ShaderVariant(engine, source) {
|
|
5327
|
-
var _this;
|
|
5328
|
-
_this = EffectsObject.call(this, engine) || this;
|
|
5329
|
-
_this.source = source;
|
|
5330
|
-
return _this;
|
|
5331
|
-
}
|
|
5332
|
-
return ShaderVariant;
|
|
5333
|
-
}(EffectsObject);
|
|
5334
|
-
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
5335
|
-
_inherits(Shader, EffectsObject);
|
|
5336
|
-
function Shader() {
|
|
5337
|
-
return EffectsObject.apply(this, arguments);
|
|
5344
|
+
/**
|
|
5345
|
+
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
5346
|
+
*/ var Downloader = /*#__PURE__*/ function() {
|
|
5347
|
+
function Downloader() {
|
|
5348
|
+
/**
|
|
5349
|
+
* 存储多个回调函数的对象
|
|
5350
|
+
*/ this.callbacks = {};
|
|
5338
5351
|
}
|
|
5339
|
-
var _proto =
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
macros[key]
|
|
5348
|
-
]);
|
|
5349
|
-
}
|
|
5350
|
-
}
|
|
5351
|
-
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
5352
|
-
shaderVariant.shader = this;
|
|
5353
|
-
return shaderVariant;
|
|
5352
|
+
var _proto = Downloader.prototype;
|
|
5353
|
+
/**
|
|
5354
|
+
* 下载一个 JSON 文件
|
|
5355
|
+
* @param url - 要下载的 JSON 文件的 URL
|
|
5356
|
+
* @param onSuccess - 下载成功后的回调函数
|
|
5357
|
+
* @param onError - 下载失败后的回调函数
|
|
5358
|
+
*/ _proto.downloadJSON = function downloadJSON(url, onSuccess, onError) {
|
|
5359
|
+
this.download(url, "json", onSuccess, onError);
|
|
5354
5360
|
};
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5361
|
+
/**
|
|
5362
|
+
* 下载一个二进制文件
|
|
5363
|
+
* @param url - 要下载的二进制文件的 URL
|
|
5364
|
+
* @param onSuccess - 下载成功后的回调函数
|
|
5365
|
+
* @param onError - 下载失败后的回调函数
|
|
5366
|
+
*/ _proto.downloadBinary = function downloadBinary(url, onSuccess, onError) {
|
|
5367
|
+
this.download(url, "arraybuffer", onSuccess, onError);
|
|
5358
5368
|
};
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
5367
|
-
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
5368
|
-
var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
5369
|
-
function createCopyShader(level, writeDepth) {
|
|
5370
|
-
var webgl2 = level === 2;
|
|
5371
|
-
return {
|
|
5372
|
-
name: EFFECTS_COPY_MESH_NAME,
|
|
5373
|
-
vertex: COPY_VERTEX_SHADER,
|
|
5374
|
-
fragment: COPY_FRAGMENT_SHADER,
|
|
5375
|
-
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
5376
|
-
macros: [
|
|
5377
|
-
[
|
|
5378
|
-
"DEPTH_TEXTURE",
|
|
5379
|
-
!!writeDepth
|
|
5380
|
-
]
|
|
5381
|
-
],
|
|
5382
|
-
// @ts-expect-error
|
|
5383
|
-
cacheId: COPY_MESH_SHADER_ID + +writeDepth
|
|
5369
|
+
/**
|
|
5370
|
+
* 下载一个 Blob 文件
|
|
5371
|
+
* @param url - 要下载的 Blob 文件的 URL
|
|
5372
|
+
* @param onSuccess - 下载成功后的回调函数
|
|
5373
|
+
* @param onError - 下载失败后的回调函数
|
|
5374
|
+
*/ _proto.downloadBlob = function downloadBlob(url, onSuccess, onError) {
|
|
5375
|
+
this.download(url, "blob", onSuccess, onError);
|
|
5384
5376
|
};
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
*
|
|
5390
|
-
* @param canvas
|
|
5391
|
-
* @param glType
|
|
5392
|
-
* @param options
|
|
5393
|
-
* @returns
|
|
5394
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
5395
|
-
if (glType === void 0) glType = "webgl";
|
|
5396
|
-
var context;
|
|
5397
|
-
if (glType === "webgl2") {
|
|
5398
|
-
context = canvas.getContext("webgl2", options);
|
|
5399
|
-
if (!context) {
|
|
5400
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5403
|
-
if (!context || glType === "webgl") {
|
|
5404
|
-
context = canvas.getContext("webgl", options);
|
|
5405
|
-
}
|
|
5406
|
-
if (!context) {
|
|
5407
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
5408
|
-
}
|
|
5409
|
-
return context;
|
|
5410
|
-
}
|
|
5411
|
-
|
|
5412
|
-
function gpuTimer(gl) {
|
|
5413
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
5414
|
-
if (ext) {
|
|
5415
|
-
var query = gl.createQuery();
|
|
5416
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
5417
|
-
return __generator(this, function(_state) {
|
|
5418
|
-
return [
|
|
5419
|
-
2,
|
|
5420
|
-
new Promise(function(resolve, reject) {
|
|
5421
|
-
if (query) {
|
|
5422
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
5423
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
5424
|
-
if (available && !disjoint) {
|
|
5425
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
5426
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
5427
|
-
// taken to use all significant bits of the result, not just the
|
|
5428
|
-
// least significant 32 bits.
|
|
5429
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
5430
|
-
}
|
|
5431
|
-
if (available || disjoint) {
|
|
5432
|
-
// Clean up the query object.
|
|
5433
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
5434
|
-
query = null;
|
|
5435
|
-
}
|
|
5436
|
-
available !== null && query && window.setTimeout(function() {
|
|
5437
|
-
getTime().then(resolve).catch;
|
|
5438
|
-
}, 1);
|
|
5439
|
-
}
|
|
5440
|
-
})
|
|
5441
|
-
];
|
|
5442
|
-
});
|
|
5443
|
-
});
|
|
5444
|
-
if (!query) {
|
|
5377
|
+
_proto.download = function download(url, responseType, onSuccess, onError) {
|
|
5378
|
+
var _this = this;
|
|
5379
|
+
if (responseType === void 0) responseType = "json";
|
|
5380
|
+
if (this.start(url, onSuccess, onError)) {
|
|
5445
5381
|
return;
|
|
5446
5382
|
}
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
},
|
|
5451
|
-
end: function() {
|
|
5452
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
5453
|
-
},
|
|
5454
|
-
getTime: getTime
|
|
5383
|
+
var xhr = new XMLHttpRequest();
|
|
5384
|
+
var handleError = function() {
|
|
5385
|
+
_this.finish(url, xhr.status, xhr.response);
|
|
5455
5386
|
};
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
}
|
|
5387
|
+
var handleLoad = function() {
|
|
5388
|
+
if (xhr.status == 200) {
|
|
5389
|
+
_this.finish(url, 200, xhr.response);
|
|
5390
|
+
} else {
|
|
5391
|
+
handleError();
|
|
5392
|
+
}
|
|
5393
|
+
};
|
|
5394
|
+
xhr.responseType = responseType;
|
|
5395
|
+
xhr.addEventListener("load", handleLoad);
|
|
5396
|
+
xhr.addEventListener("error", handleError);
|
|
5397
|
+
xhr.open("GET", url, true);
|
|
5398
|
+
xhr.send();
|
|
5399
|
+
};
|
|
5400
|
+
_proto.start = function start(url, onSuccess, onError) {
|
|
5401
|
+
var callbacks = this.callbacks[url];
|
|
5402
|
+
try {
|
|
5403
|
+
if (callbacks) {
|
|
5404
|
+
return true;
|
|
5405
|
+
}
|
|
5406
|
+
this.callbacks[url] = callbacks = [];
|
|
5407
|
+
} finally{
|
|
5408
|
+
callbacks.push(onSuccess, onError);
|
|
5409
|
+
}
|
|
5410
|
+
};
|
|
5411
|
+
_proto.finish = function finish(url, status, data) {
|
|
5412
|
+
var callbacks = this.callbacks[url];
|
|
5413
|
+
delete this.callbacks[url];
|
|
5414
|
+
var args = status == 200 ? [
|
|
5415
|
+
data
|
|
5416
|
+
] : [
|
|
5417
|
+
status,
|
|
5418
|
+
data
|
|
5419
|
+
];
|
|
5420
|
+
for(var i = args.length - 1, n = callbacks.length; i < n; i += 2){
|
|
5421
|
+
callbacks[i].apply(null, args);
|
|
5422
|
+
}
|
|
5423
|
+
};
|
|
5424
|
+
return Downloader;
|
|
5425
|
+
}();
|
|
5426
|
+
var webPFailed = false;
|
|
5427
|
+
var avifFailed = false;
|
|
5428
|
+
/**
|
|
5429
|
+
* 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
|
|
5430
|
+
* @param png - PNG 图片文件的 URL
|
|
5431
|
+
* @param webp - WebP 图片文件的 URL
|
|
5432
|
+
*/ function loadWebPOptional(png, webp) {
|
|
5433
|
+
return _loadWebPOptional.apply(this, arguments);
|
|
5480
5434
|
}
|
|
5481
|
-
function
|
|
5482
|
-
|
|
5435
|
+
function _loadWebPOptional() {
|
|
5436
|
+
_loadWebPOptional = _async_to_generator(function(png, webp) {
|
|
5437
|
+
var image, image1, image2;
|
|
5438
|
+
return __generator(this, function(_state) {
|
|
5439
|
+
switch(_state.label){
|
|
5440
|
+
case 0:
|
|
5441
|
+
if (!(webPFailed || !webp)) return [
|
|
5442
|
+
3,
|
|
5443
|
+
2
|
|
5444
|
+
];
|
|
5445
|
+
return [
|
|
5446
|
+
4,
|
|
5447
|
+
loadImage(png)
|
|
5448
|
+
];
|
|
5449
|
+
case 1:
|
|
5450
|
+
image = _state.sent();
|
|
5451
|
+
return [
|
|
5452
|
+
2,
|
|
5453
|
+
{
|
|
5454
|
+
image: image,
|
|
5455
|
+
url: png
|
|
5456
|
+
}
|
|
5457
|
+
];
|
|
5458
|
+
case 2:
|
|
5459
|
+
_state.trys.push([
|
|
5460
|
+
2,
|
|
5461
|
+
4,
|
|
5462
|
+
,
|
|
5463
|
+
6
|
|
5464
|
+
]);
|
|
5465
|
+
return [
|
|
5466
|
+
4,
|
|
5467
|
+
loadImage(webp)
|
|
5468
|
+
];
|
|
5469
|
+
case 3:
|
|
5470
|
+
image1 = _state.sent();
|
|
5471
|
+
return [
|
|
5472
|
+
2,
|
|
5473
|
+
{
|
|
5474
|
+
image: image1,
|
|
5475
|
+
url: webp
|
|
5476
|
+
}
|
|
5477
|
+
];
|
|
5478
|
+
case 4:
|
|
5479
|
+
_state.sent();
|
|
5480
|
+
webPFailed = true;
|
|
5481
|
+
return [
|
|
5482
|
+
4,
|
|
5483
|
+
loadImage(png)
|
|
5484
|
+
];
|
|
5485
|
+
case 5:
|
|
5486
|
+
image2 = _state.sent();
|
|
5487
|
+
return [
|
|
5488
|
+
2,
|
|
5489
|
+
{
|
|
5490
|
+
image: image2,
|
|
5491
|
+
url: png
|
|
5492
|
+
}
|
|
5493
|
+
];
|
|
5494
|
+
case 6:
|
|
5495
|
+
return [
|
|
5496
|
+
2
|
|
5497
|
+
];
|
|
5498
|
+
}
|
|
5499
|
+
});
|
|
5500
|
+
});
|
|
5501
|
+
return _loadWebPOptional.apply(this, arguments);
|
|
5483
5502
|
}
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
}
|
|
5503
|
+
/**
|
|
5504
|
+
* 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
|
|
5505
|
+
* @param png - PNG 图片文件的 URL
|
|
5506
|
+
* @param avif - AVIF 图片文件的 URL
|
|
5507
|
+
*/ function loadAVIFOptional(png, avif) {
|
|
5508
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
5491
5509
|
}
|
|
5492
|
-
function
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5510
|
+
function _loadAVIFOptional() {
|
|
5511
|
+
_loadAVIFOptional = _async_to_generator(function(png, avif) {
|
|
5512
|
+
var image, image1, image2;
|
|
5513
|
+
return __generator(this, function(_state) {
|
|
5514
|
+
switch(_state.label){
|
|
5515
|
+
case 0:
|
|
5516
|
+
if (!(avifFailed || !avif)) return [
|
|
5517
|
+
3,
|
|
5518
|
+
2
|
|
5519
|
+
];
|
|
5520
|
+
return [
|
|
5521
|
+
4,
|
|
5522
|
+
loadImage(png)
|
|
5523
|
+
];
|
|
5524
|
+
case 1:
|
|
5525
|
+
image = _state.sent();
|
|
5526
|
+
return [
|
|
5527
|
+
2,
|
|
5528
|
+
{
|
|
5529
|
+
image: image,
|
|
5530
|
+
url: png
|
|
5531
|
+
}
|
|
5532
|
+
];
|
|
5533
|
+
case 2:
|
|
5534
|
+
_state.trys.push([
|
|
5535
|
+
2,
|
|
5536
|
+
4,
|
|
5537
|
+
,
|
|
5538
|
+
6
|
|
5539
|
+
]);
|
|
5540
|
+
return [
|
|
5541
|
+
4,
|
|
5542
|
+
loadImage(avif)
|
|
5543
|
+
];
|
|
5544
|
+
case 3:
|
|
5545
|
+
image1 = _state.sent();
|
|
5546
|
+
return [
|
|
5547
|
+
2,
|
|
5548
|
+
{
|
|
5549
|
+
image: image1,
|
|
5550
|
+
url: avif
|
|
5551
|
+
}
|
|
5552
|
+
];
|
|
5553
|
+
case 4:
|
|
5554
|
+
_state.sent();
|
|
5555
|
+
avifFailed = true;
|
|
5556
|
+
return [
|
|
5557
|
+
4,
|
|
5558
|
+
loadImage(png)
|
|
5559
|
+
];
|
|
5560
|
+
case 5:
|
|
5561
|
+
image2 = _state.sent();
|
|
5562
|
+
return [
|
|
5563
|
+
2,
|
|
5564
|
+
{
|
|
5565
|
+
image: image2,
|
|
5566
|
+
url: png
|
|
5567
|
+
}
|
|
5568
|
+
];
|
|
5569
|
+
case 6:
|
|
5570
|
+
return [
|
|
5571
|
+
2
|
|
5572
|
+
];
|
|
5573
|
+
}
|
|
5574
|
+
});
|
|
5575
|
+
});
|
|
5576
|
+
return _loadAVIFOptional.apply(this, arguments);
|
|
5507
5577
|
}
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
return VertexFormatType.Int16;
|
|
5514
|
-
case WebGLRenderingContext["BYTE"]:
|
|
5515
|
-
return VertexFormatType.Int8;
|
|
5516
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
5517
|
-
return VertexFormatType.UInt16;
|
|
5518
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
5519
|
-
return VertexFormatType.UInt8;
|
|
5520
|
-
default:
|
|
5521
|
-
return VertexFormatType.Float32;
|
|
5522
|
-
}
|
|
5578
|
+
/**
|
|
5579
|
+
* 异步加载一个图片文件
|
|
5580
|
+
* @param source - 图片文件的 URL、Blob 或 HTMLImageElement 对象
|
|
5581
|
+
*/ function loadImage(source) {
|
|
5582
|
+
return _loadImage.apply(this, arguments);
|
|
5523
5583
|
}
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5584
|
+
function _loadImage() {
|
|
5585
|
+
_loadImage = _async_to_generator(function(source) {
|
|
5586
|
+
var url, revokeURL;
|
|
5587
|
+
return __generator(this, function(_state) {
|
|
5588
|
+
url = "";
|
|
5589
|
+
// 1. string | Blob | HTMLImageElement 处理逻辑
|
|
5590
|
+
if (_instanceof1(source, HTMLImageElement)) {
|
|
5591
|
+
if (source.complete) {
|
|
5592
|
+
return [
|
|
5593
|
+
2,
|
|
5594
|
+
source
|
|
5595
|
+
];
|
|
5596
|
+
}
|
|
5597
|
+
url = source.src;
|
|
5598
|
+
} else if (_instanceof1(source, Blob)) {
|
|
5599
|
+
url = URL.createObjectURL(source);
|
|
5600
|
+
revokeURL = true;
|
|
5601
|
+
} else if (typeof source === "string") {
|
|
5602
|
+
url = source;
|
|
5603
|
+
}
|
|
5604
|
+
// 2. 非法类型
|
|
5605
|
+
if (!url) {
|
|
5606
|
+
throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
|
|
5607
|
+
}
|
|
5608
|
+
return [
|
|
5609
|
+
2,
|
|
5610
|
+
new Promise(function(resolve, reject) {
|
|
5611
|
+
var img = new Image();
|
|
5612
|
+
if (!/^data:/.test(url)) {
|
|
5613
|
+
img.crossOrigin = "*";
|
|
5614
|
+
}
|
|
5615
|
+
img.onload = function() {
|
|
5616
|
+
img.onload = null;
|
|
5617
|
+
if (revokeURL) {
|
|
5618
|
+
URL.revokeObjectURL(url);
|
|
5619
|
+
}
|
|
5620
|
+
return resolve(img);
|
|
5621
|
+
};
|
|
5622
|
+
img.onerror = function(e) {
|
|
5623
|
+
img.onerror = null;
|
|
5624
|
+
if (revokeURL) {
|
|
5625
|
+
URL.revokeObjectURL(url);
|
|
5626
|
+
}
|
|
5627
|
+
return reject("Load image fail: " + url + ", reason: " + JSON.stringify(e));
|
|
5628
|
+
};
|
|
5629
|
+
img.src = url;
|
|
5630
|
+
})
|
|
5631
|
+
];
|
|
5632
|
+
});
|
|
5633
|
+
});
|
|
5634
|
+
return _loadImage.apply(this, arguments);
|
|
5536
5635
|
}
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
return 1;
|
|
5543
|
-
case BlendingMode.SUBTRACTION:
|
|
5544
|
-
return 1;
|
|
5545
|
-
case BlendingMode.STRONG_LIGHT:
|
|
5546
|
-
return 1;
|
|
5547
|
-
case BlendingMode.WEAK_LIGHT:
|
|
5548
|
-
return 1;
|
|
5549
|
-
case BlendingMode.SUPERPOSITION:
|
|
5550
|
-
return 2;
|
|
5551
|
-
case BlendingMode.BRIGHTNESS:
|
|
5552
|
-
return 3;
|
|
5553
|
-
case BlendingMode.MULTIPLY:
|
|
5554
|
-
return 0;
|
|
5555
|
-
default:
|
|
5556
|
-
// 处理undefined
|
|
5557
|
-
return 1;
|
|
5558
|
-
}
|
|
5636
|
+
/**
|
|
5637
|
+
* 异步加载一个二进制文件
|
|
5638
|
+
* @param url - 二进制文件的 URL
|
|
5639
|
+
*/ function loadBinary(url) {
|
|
5640
|
+
return _loadBinary.apply(this, arguments);
|
|
5559
5641
|
}
|
|
5560
|
-
function
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
case BlendingMode.ALPHA:
|
|
5571
|
-
material.blendFunction = [
|
|
5572
|
-
glContext.ONE,
|
|
5573
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5574
|
-
glContext.ONE,
|
|
5575
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5576
|
-
];
|
|
5577
|
-
break;
|
|
5578
|
-
case BlendingMode.ADD:
|
|
5579
|
-
material.blendFunction = [
|
|
5580
|
-
glContext.ONE,
|
|
5581
|
-
glContext.ONE,
|
|
5582
|
-
glContext.ONE,
|
|
5583
|
-
glContext.ONE
|
|
5584
|
-
];
|
|
5585
|
-
break;
|
|
5586
|
-
case BlendingMode.SUBTRACTION:
|
|
5587
|
-
material.blendFunction = [
|
|
5588
|
-
glContext.ONE,
|
|
5589
|
-
glContext.ONE,
|
|
5590
|
-
glContext.ZERO,
|
|
5591
|
-
glContext.ONE
|
|
5592
|
-
];
|
|
5593
|
-
material.blendEquation = [
|
|
5594
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
5595
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
5596
|
-
];
|
|
5597
|
-
break;
|
|
5598
|
-
case BlendingMode.SUPERPOSITION:
|
|
5599
|
-
material.blendFunction = [
|
|
5600
|
-
glContext.ONE,
|
|
5601
|
-
glContext.ONE,
|
|
5602
|
-
glContext.ONE,
|
|
5603
|
-
glContext.ONE
|
|
5604
|
-
];
|
|
5605
|
-
break;
|
|
5606
|
-
case BlendingMode.MULTIPLY:
|
|
5607
|
-
material.blendFunction = [
|
|
5608
|
-
glContext.DST_COLOR,
|
|
5609
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5610
|
-
glContext.DST_COLOR,
|
|
5611
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5612
|
-
];
|
|
5613
|
-
break;
|
|
5614
|
-
case BlendingMode.BRIGHTNESS:
|
|
5615
|
-
material.blendFunction = [
|
|
5616
|
-
glContext.ONE,
|
|
5617
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5618
|
-
glContext.ONE,
|
|
5619
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5620
|
-
];
|
|
5621
|
-
break;
|
|
5622
|
-
case BlendingMode.STRONG_LIGHT:
|
|
5623
|
-
material.blendFunction = [
|
|
5624
|
-
glContext.DST_COLOR,
|
|
5625
|
-
glContext.DST_ALPHA,
|
|
5626
|
-
glContext.ZERO,
|
|
5627
|
-
glContext.ONE
|
|
5628
|
-
];
|
|
5629
|
-
break;
|
|
5630
|
-
case BlendingMode.WEAK_LIGHT:
|
|
5631
|
-
material.blendFunction = [
|
|
5632
|
-
glContext.DST_COLOR,
|
|
5633
|
-
glContext.ZERO,
|
|
5634
|
-
glContext.ZERO,
|
|
5635
|
-
glContext.ONE
|
|
5642
|
+
function _loadBinary() {
|
|
5643
|
+
_loadBinary = _async_to_generator(function(url) {
|
|
5644
|
+
return __generator(this, function(_state) {
|
|
5645
|
+
return [
|
|
5646
|
+
2,
|
|
5647
|
+
new Promise(function(resolve, reject) {
|
|
5648
|
+
new Downloader().downloadBinary(url, resolve, function(status, responseText) {
|
|
5649
|
+
reject("Couldn't load bins " + url + ": status " + status + ", " + responseText);
|
|
5650
|
+
});
|
|
5651
|
+
})
|
|
5636
5652
|
];
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
}
|
|
5653
|
+
});
|
|
5654
|
+
});
|
|
5655
|
+
return _loadBinary.apply(this, arguments);
|
|
5641
5656
|
}
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
material.frontFace = glContext.CW;
|
|
5648
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
5649
|
-
}
|
|
5657
|
+
/**
|
|
5658
|
+
* 异步加载一个 Blob 文件
|
|
5659
|
+
* @param url - Blob 文件的 URL
|
|
5660
|
+
*/ function loadBlob(url) {
|
|
5661
|
+
return _loadBlob.apply(this, arguments);
|
|
5650
5662
|
}
|
|
5651
|
-
function
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
];
|
|
5662
|
-
material.stencilOpZPass = [
|
|
5663
|
-
glContext.REPLACE,
|
|
5664
|
-
glContext.REPLACE
|
|
5665
|
-
];
|
|
5666
|
-
break;
|
|
5667
|
-
case MaskMode.OBSCURED:
|
|
5668
|
-
material.stencilTest = true;
|
|
5669
|
-
material.stencilFunc = [
|
|
5670
|
-
glContext.EQUAL,
|
|
5671
|
-
glContext.EQUAL
|
|
5672
|
-
];
|
|
5673
|
-
break;
|
|
5674
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
5675
|
-
material.stencilTest = true;
|
|
5676
|
-
material.stencilFunc = [
|
|
5677
|
-
glContext.NOTEQUAL,
|
|
5678
|
-
glContext.NOTEQUAL
|
|
5663
|
+
function _loadBlob() {
|
|
5664
|
+
_loadBlob = _async_to_generator(function(url) {
|
|
5665
|
+
return __generator(this, function(_state) {
|
|
5666
|
+
return [
|
|
5667
|
+
2,
|
|
5668
|
+
new Promise(function(resolve, reject) {
|
|
5669
|
+
new Downloader().downloadBlob(url, resolve, function(status, responseText) {
|
|
5670
|
+
reject("Couldn't load blob " + url + ": status " + status + ", " + responseText);
|
|
5671
|
+
});
|
|
5672
|
+
})
|
|
5679
5673
|
];
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
break;
|
|
5684
|
-
default:
|
|
5685
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
5686
|
-
}
|
|
5674
|
+
});
|
|
5675
|
+
});
|
|
5676
|
+
return _loadBlob.apply(this, arguments);
|
|
5687
5677
|
}
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
5694
|
-
}
|
|
5695
|
-
return target;
|
|
5696
|
-
};
|
|
5697
|
-
return _extends.apply(this, arguments);
|
|
5678
|
+
/**
|
|
5679
|
+
* 异步加载一个视频文件
|
|
5680
|
+
* @param url - 视频文件的 URL 或 MediaProvider 对象
|
|
5681
|
+
*/ function loadVideo(url) {
|
|
5682
|
+
return _loadVideo.apply(this, arguments);
|
|
5698
5683
|
}
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
5707
|
-
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
5708
|
-
var TextureSourceType;
|
|
5709
|
-
(function(TextureSourceType) {
|
|
5710
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
5711
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
5712
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
5713
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
5714
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
5715
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
5716
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
5717
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
5718
|
-
})(TextureSourceType || (TextureSourceType = {}));
|
|
5719
|
-
|
|
5720
|
-
/**
|
|
5721
|
-
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
5722
|
-
*/ var Downloader = /*#__PURE__*/ function() {
|
|
5723
|
-
function Downloader() {
|
|
5724
|
-
/**
|
|
5725
|
-
* 存储多个回调函数的对象
|
|
5726
|
-
*/ this.callbacks = {};
|
|
5727
|
-
}
|
|
5728
|
-
var _proto = Downloader.prototype;
|
|
5729
|
-
/**
|
|
5730
|
-
* 下载一个 JSON 文件
|
|
5731
|
-
* @param url - 要下载的 JSON 文件的 URL
|
|
5732
|
-
* @param onSuccess - 下载成功后的回调函数
|
|
5733
|
-
* @param onError - 下载失败后的回调函数
|
|
5734
|
-
*/ _proto.downloadJSON = function downloadJSON(url, onSuccess, onError) {
|
|
5735
|
-
this.download(url, "json", onSuccess, onError);
|
|
5736
|
-
};
|
|
5737
|
-
/**
|
|
5738
|
-
* 下载一个二进制文件
|
|
5739
|
-
* @param url - 要下载的二进制文件的 URL
|
|
5740
|
-
* @param onSuccess - 下载成功后的回调函数
|
|
5741
|
-
* @param onError - 下载失败后的回调函数
|
|
5742
|
-
*/ _proto.downloadBinary = function downloadBinary(url, onSuccess, onError) {
|
|
5743
|
-
this.download(url, "arraybuffer", onSuccess, onError);
|
|
5744
|
-
};
|
|
5745
|
-
/**
|
|
5746
|
-
* 下载一个 Blob 文件
|
|
5747
|
-
* @param url - 要下载的 Blob 文件的 URL
|
|
5748
|
-
* @param onSuccess - 下载成功后的回调函数
|
|
5749
|
-
* @param onError - 下载失败后的回调函数
|
|
5750
|
-
*/ _proto.downloadBlob = function downloadBlob(url, onSuccess, onError) {
|
|
5751
|
-
this.download(url, "blob", onSuccess, onError);
|
|
5752
|
-
};
|
|
5753
|
-
_proto.download = function download(url, responseType, onSuccess, onError) {
|
|
5754
|
-
var _this = this;
|
|
5755
|
-
if (responseType === void 0) responseType = "json";
|
|
5756
|
-
if (this.start(url, onSuccess, onError)) {
|
|
5757
|
-
return;
|
|
5758
|
-
}
|
|
5759
|
-
var xhr = new XMLHttpRequest();
|
|
5760
|
-
var handleError = function() {
|
|
5761
|
-
_this.finish(url, xhr.status, xhr.response);
|
|
5762
|
-
};
|
|
5763
|
-
var handleLoad = function() {
|
|
5764
|
-
if (xhr.status == 200) {
|
|
5765
|
-
_this.finish(url, 200, xhr.response);
|
|
5684
|
+
function _loadVideo() {
|
|
5685
|
+
_loadVideo = _async_to_generator(function(url) {
|
|
5686
|
+
var video;
|
|
5687
|
+
return __generator(this, function(_state) {
|
|
5688
|
+
video = document.createElement("video");
|
|
5689
|
+
if (typeof url === "string") {
|
|
5690
|
+
video.src = url;
|
|
5766
5691
|
} else {
|
|
5767
|
-
|
|
5692
|
+
video.srcObject = url;
|
|
5768
5693
|
}
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
xhr.open("GET", url, true);
|
|
5774
|
-
xhr.send();
|
|
5775
|
-
};
|
|
5776
|
-
_proto.start = function start(url, onSuccess, onError) {
|
|
5777
|
-
var callbacks = this.callbacks[url];
|
|
5778
|
-
try {
|
|
5779
|
-
if (callbacks) {
|
|
5780
|
-
return true;
|
|
5694
|
+
video.crossOrigin = "anonymous";
|
|
5695
|
+
video.muted = true;
|
|
5696
|
+
if (isAndroid()) {
|
|
5697
|
+
video.setAttribute("renderer", "standard");
|
|
5781
5698
|
}
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5699
|
+
video.setAttribute("playsinline", "playsinline");
|
|
5700
|
+
return [
|
|
5701
|
+
2,
|
|
5702
|
+
new Promise(function(resolve, reject) {
|
|
5703
|
+
var pending = video.play();
|
|
5704
|
+
if (pending) {
|
|
5705
|
+
void pending.then(function() {
|
|
5706
|
+
return resolve(video);
|
|
5707
|
+
});
|
|
5708
|
+
} else {
|
|
5709
|
+
video.addEventListener("loadeddata", function listener() {
|
|
5710
|
+
resolve(video);
|
|
5711
|
+
video.removeEventListener("loadeddata", listener);
|
|
5712
|
+
}, true);
|
|
5713
|
+
}
|
|
5714
|
+
video.addEventListener("error", function(e) {
|
|
5715
|
+
reject("Load video fail.");
|
|
5716
|
+
});
|
|
5717
|
+
})
|
|
5718
|
+
];
|
|
5719
|
+
});
|
|
5720
|
+
});
|
|
5721
|
+
return _loadVideo.apply(this, arguments);
|
|
5722
|
+
}
|
|
5804
5723
|
/**
|
|
5805
|
-
*
|
|
5806
|
-
* @param
|
|
5807
|
-
* @param
|
|
5808
|
-
|
|
5809
|
-
|
|
5724
|
+
* 异步加载一个媒体文件
|
|
5725
|
+
* @param url
|
|
5726
|
+
* @param loadFn
|
|
5727
|
+
* @returns
|
|
5728
|
+
*/ function loadMedia(url, loadFn) {
|
|
5729
|
+
return _loadMedia.apply(this, arguments);
|
|
5810
5730
|
}
|
|
5811
|
-
function
|
|
5812
|
-
|
|
5813
|
-
var image, image1, image2;
|
|
5731
|
+
function _loadMedia() {
|
|
5732
|
+
_loadMedia = _async_to_generator(function(url, loadFn) {
|
|
5814
5733
|
return __generator(this, function(_state) {
|
|
5815
5734
|
switch(_state.label){
|
|
5816
5735
|
case 0:
|
|
5817
|
-
if (!(
|
|
5736
|
+
if (!Array.isArray(url)) return [
|
|
5818
5737
|
3,
|
|
5819
|
-
|
|
5820
|
-
];
|
|
5821
|
-
return [
|
|
5822
|
-
4,
|
|
5823
|
-
loadImage(png)
|
|
5738
|
+
5
|
|
5824
5739
|
];
|
|
5740
|
+
_state.label = 1;
|
|
5825
5741
|
case 1:
|
|
5826
|
-
image = _state.sent();
|
|
5827
|
-
return [
|
|
5828
|
-
2,
|
|
5829
|
-
{
|
|
5830
|
-
image: image,
|
|
5831
|
-
url: png
|
|
5832
|
-
}
|
|
5833
|
-
];
|
|
5834
|
-
case 2:
|
|
5835
5742
|
_state.trys.push([
|
|
5836
|
-
|
|
5837
|
-
|
|
5743
|
+
1,
|
|
5744
|
+
3,
|
|
5838
5745
|
,
|
|
5839
|
-
|
|
5746
|
+
5
|
|
5840
5747
|
]);
|
|
5841
5748
|
return [
|
|
5842
5749
|
4,
|
|
5843
|
-
|
|
5750
|
+
loadFn(url[0])
|
|
5844
5751
|
];
|
|
5845
|
-
case
|
|
5846
|
-
image1 = _state.sent();
|
|
5752
|
+
case 2:
|
|
5847
5753
|
return [
|
|
5848
5754
|
2,
|
|
5849
|
-
|
|
5850
|
-
image: image1,
|
|
5851
|
-
url: webp
|
|
5852
|
-
}
|
|
5755
|
+
_state.sent()
|
|
5853
5756
|
];
|
|
5854
|
-
case
|
|
5757
|
+
case 3:
|
|
5855
5758
|
_state.sent();
|
|
5856
|
-
webPFailed = true;
|
|
5857
5759
|
return [
|
|
5858
5760
|
4,
|
|
5859
|
-
|
|
5761
|
+
loadFn(url[1])
|
|
5860
5762
|
];
|
|
5861
|
-
case
|
|
5862
|
-
image2 = _state.sent();
|
|
5763
|
+
case 4:
|
|
5863
5764
|
return [
|
|
5864
5765
|
2,
|
|
5865
|
-
|
|
5866
|
-
image: image2,
|
|
5867
|
-
url: png
|
|
5868
|
-
}
|
|
5766
|
+
_state.sent()
|
|
5869
5767
|
];
|
|
5870
|
-
case
|
|
5768
|
+
case 5:
|
|
5871
5769
|
return [
|
|
5872
|
-
2
|
|
5770
|
+
2,
|
|
5771
|
+
loadFn(url)
|
|
5873
5772
|
];
|
|
5874
5773
|
}
|
|
5875
5774
|
});
|
|
5876
5775
|
});
|
|
5877
|
-
return
|
|
5776
|
+
return _loadMedia.apply(this, arguments);
|
|
5878
5777
|
}
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
* @param avif - AVIF 图片文件的 URL
|
|
5883
|
-
*/ function loadAVIFOptional(png, avif) {
|
|
5884
|
-
return _loadAVIFOptional.apply(this, arguments);
|
|
5778
|
+
|
|
5779
|
+
function deserializeMipmapTexture(textureOptions, bins, assets) {
|
|
5780
|
+
return _deserializeMipmapTexture.apply(this, arguments);
|
|
5885
5781
|
}
|
|
5886
|
-
function
|
|
5887
|
-
|
|
5888
|
-
var
|
|
5782
|
+
function _deserializeMipmapTexture() {
|
|
5783
|
+
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, assets, files) {
|
|
5784
|
+
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
5889
5785
|
return __generator(this, function(_state) {
|
|
5890
5786
|
switch(_state.label){
|
|
5891
5787
|
case 0:
|
|
5892
|
-
if (
|
|
5788
|
+
if (files === void 0) files = [];
|
|
5789
|
+
if (!(textureOptions.target === 34067)) return [
|
|
5893
5790
|
3,
|
|
5894
5791
|
2
|
|
5895
5792
|
];
|
|
5793
|
+
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
5794
|
+
jobs = mipmaps.map(function(mipmap) {
|
|
5795
|
+
return Promise.all(mipmap.map(function(pointer) {
|
|
5796
|
+
// @ts-expect-error
|
|
5797
|
+
if (pointer.id) {
|
|
5798
|
+
// @ts-expect-error
|
|
5799
|
+
var loadedImage = assets[pointer.id];
|
|
5800
|
+
return loadedImage;
|
|
5801
|
+
} else {
|
|
5802
|
+
return loadMipmapImage(pointer, bins);
|
|
5803
|
+
}
|
|
5804
|
+
}));
|
|
5805
|
+
});
|
|
5896
5806
|
return [
|
|
5897
5807
|
4,
|
|
5898
|
-
|
|
5808
|
+
Promise.all(jobs)
|
|
5899
5809
|
];
|
|
5900
5810
|
case 1:
|
|
5901
|
-
|
|
5811
|
+
loadedMipmaps = _state.sent();
|
|
5902
5812
|
return [
|
|
5903
5813
|
2,
|
|
5904
|
-
{
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5814
|
+
_extends({
|
|
5815
|
+
keepImageSource: false
|
|
5816
|
+
}, textureOptions, {
|
|
5817
|
+
mipmaps: loadedMipmaps,
|
|
5818
|
+
sourceFrom: {
|
|
5819
|
+
target: target,
|
|
5820
|
+
// bin,
|
|
5821
|
+
type: TextureSourceType.mipmaps
|
|
5822
|
+
}
|
|
5823
|
+
})
|
|
5908
5824
|
];
|
|
5909
5825
|
case 2:
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
,
|
|
5914
|
-
|
|
5915
|
-
]);
|
|
5826
|
+
// TODO: 补充测试用例
|
|
5827
|
+
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
5828
|
+
jobs1 = mipmaps1.map(function(pointer) {
|
|
5829
|
+
return loadMipmapImage(pointer, bins);
|
|
5830
|
+
});
|
|
5916
5831
|
return [
|
|
5917
5832
|
4,
|
|
5918
|
-
|
|
5833
|
+
Promise.all(jobs1)
|
|
5919
5834
|
];
|
|
5920
5835
|
case 3:
|
|
5921
|
-
|
|
5836
|
+
loadedMipmaps1 = _state.sent();
|
|
5837
|
+
bin = files[mipmaps1[0][1][0]].url;
|
|
5922
5838
|
return [
|
|
5923
5839
|
2,
|
|
5924
|
-
{
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5840
|
+
_extends({
|
|
5841
|
+
keepImageSource: false
|
|
5842
|
+
}, textureOptions, {
|
|
5843
|
+
mipmaps: loadedMipmaps1,
|
|
5844
|
+
sourceType: TextureSourceType.mipmaps,
|
|
5845
|
+
sourceFrom: {
|
|
5846
|
+
target: target1,
|
|
5847
|
+
bin: bin,
|
|
5848
|
+
type: TextureSourceType.mipmaps,
|
|
5849
|
+
mipmaps: mipmaps1.map(function(pointer) {
|
|
5850
|
+
return [
|
|
5851
|
+
pointer[1][1],
|
|
5852
|
+
pointer[1][2]
|
|
5853
|
+
];
|
|
5854
|
+
})
|
|
5855
|
+
}
|
|
5856
|
+
})
|
|
5928
5857
|
];
|
|
5929
5858
|
case 4:
|
|
5930
|
-
_state.sent();
|
|
5931
|
-
avifFailed = true;
|
|
5932
|
-
return [
|
|
5933
|
-
4,
|
|
5934
|
-
loadImage(png)
|
|
5935
|
-
];
|
|
5936
|
-
case 5:
|
|
5937
|
-
image2 = _state.sent();
|
|
5938
|
-
return [
|
|
5939
|
-
2,
|
|
5940
|
-
{
|
|
5941
|
-
image: image2,
|
|
5942
|
-
url: png
|
|
5943
|
-
}
|
|
5944
|
-
];
|
|
5945
|
-
case 6:
|
|
5946
5859
|
return [
|
|
5947
5860
|
2
|
|
5948
5861
|
];
|
|
5949
5862
|
}
|
|
5950
5863
|
});
|
|
5951
5864
|
});
|
|
5952
|
-
return
|
|
5865
|
+
return _deserializeMipmapTexture.apply(this, arguments);
|
|
5953
5866
|
}
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
* @param source - 图片文件的 URL、Blob 或 HTMLImageElement 对象
|
|
5957
|
-
*/ function loadImage(source) {
|
|
5958
|
-
return _loadImage.apply(this, arguments);
|
|
5867
|
+
function loadMipmapImage(pointer, bins) {
|
|
5868
|
+
return _loadMipmapImage.apply(this, arguments);
|
|
5959
5869
|
}
|
|
5960
|
-
function
|
|
5961
|
-
|
|
5962
|
-
var
|
|
5870
|
+
function _loadMipmapImage() {
|
|
5871
|
+
_loadMipmapImage = _async_to_generator(function(pointer, bins) {
|
|
5872
|
+
var _pointer_, index, start, length, bin;
|
|
5963
5873
|
return __generator(this, function(_state) {
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
if (
|
|
5967
|
-
|
|
5968
|
-
return [
|
|
5969
|
-
2,
|
|
5970
|
-
source
|
|
5971
|
-
];
|
|
5972
|
-
}
|
|
5973
|
-
url = source.src;
|
|
5974
|
-
} else if (_instanceof1(source, Blob)) {
|
|
5975
|
-
url = URL.createObjectURL(source);
|
|
5976
|
-
revokeURL = true;
|
|
5977
|
-
} else if (typeof source === "string") {
|
|
5978
|
-
url = source;
|
|
5979
|
-
}
|
|
5980
|
-
// 2. 非法类型
|
|
5981
|
-
if (!url) {
|
|
5982
|
-
throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
|
|
5874
|
+
_pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
|
|
5875
|
+
bin = bins[index];
|
|
5876
|
+
if (!bin) {
|
|
5877
|
+
throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
|
|
5983
5878
|
}
|
|
5984
5879
|
return [
|
|
5985
5880
|
2,
|
|
5986
|
-
new
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
img.crossOrigin = "*";
|
|
5990
|
-
}
|
|
5991
|
-
img.onload = function() {
|
|
5992
|
-
img.onload = null;
|
|
5993
|
-
if (revokeURL) {
|
|
5994
|
-
URL.revokeObjectURL(url);
|
|
5995
|
-
}
|
|
5996
|
-
return resolve(img);
|
|
5997
|
-
};
|
|
5998
|
-
img.onerror = function(e) {
|
|
5999
|
-
img.onerror = null;
|
|
6000
|
-
if (revokeURL) {
|
|
6001
|
-
URL.revokeObjectURL(url);
|
|
6002
|
-
}
|
|
6003
|
-
return reject("Load image fail: " + url + ", reason: " + JSON.stringify(e));
|
|
6004
|
-
};
|
|
6005
|
-
img.src = url;
|
|
6006
|
-
})
|
|
5881
|
+
loadImage(new Blob([
|
|
5882
|
+
new Uint8Array(bin, start, length)
|
|
5883
|
+
]))
|
|
6007
5884
|
];
|
|
6008
5885
|
});
|
|
6009
5886
|
});
|
|
6010
|
-
return
|
|
5887
|
+
return _loadMipmapImage.apply(this, arguments);
|
|
6011
5888
|
}
|
|
5889
|
+
|
|
6012
5890
|
/**
|
|
6013
|
-
*
|
|
6014
|
-
*
|
|
6015
|
-
|
|
6016
|
-
|
|
5891
|
+
* Helper class to create a WebGL Context
|
|
5892
|
+
*
|
|
5893
|
+
* @param canvas
|
|
5894
|
+
* @param glType
|
|
5895
|
+
* @param options
|
|
5896
|
+
* @returns
|
|
5897
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
5898
|
+
if (glType === void 0) glType = "webgl";
|
|
5899
|
+
var context;
|
|
5900
|
+
if (glType === "webgl2") {
|
|
5901
|
+
context = canvas.getContext("webgl2", options);
|
|
5902
|
+
if (!context) {
|
|
5903
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
5904
|
+
}
|
|
5905
|
+
}
|
|
5906
|
+
if (!context || glType === "webgl") {
|
|
5907
|
+
context = canvas.getContext("webgl", options);
|
|
5908
|
+
}
|
|
5909
|
+
if (!context) {
|
|
5910
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
5911
|
+
}
|
|
5912
|
+
return context;
|
|
6017
5913
|
}
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
5914
|
+
|
|
5915
|
+
function gpuTimer(gl) {
|
|
5916
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
5917
|
+
if (ext) {
|
|
5918
|
+
var query = gl.createQuery();
|
|
5919
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
5920
|
+
return __generator(this, function(_state) {
|
|
5921
|
+
return [
|
|
5922
|
+
2,
|
|
5923
|
+
new Promise(function(resolve, reject) {
|
|
5924
|
+
if (query) {
|
|
5925
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
5926
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
5927
|
+
if (available && !disjoint) {
|
|
5928
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
5929
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
5930
|
+
// taken to use all significant bits of the result, not just the
|
|
5931
|
+
// least significant 32 bits.
|
|
5932
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
5933
|
+
}
|
|
5934
|
+
if (available || disjoint) {
|
|
5935
|
+
// Clean up the query object.
|
|
5936
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
5937
|
+
query = null;
|
|
5938
|
+
}
|
|
5939
|
+
available !== null && query && window.setTimeout(function() {
|
|
5940
|
+
getTime().then(resolve).catch;
|
|
5941
|
+
}, 1);
|
|
5942
|
+
}
|
|
5943
|
+
})
|
|
5944
|
+
];
|
|
5945
|
+
});
|
|
6029
5946
|
});
|
|
6030
|
-
|
|
6031
|
-
|
|
5947
|
+
if (!query) {
|
|
5948
|
+
return;
|
|
5949
|
+
}
|
|
5950
|
+
return {
|
|
5951
|
+
begin: function() {
|
|
5952
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
5953
|
+
},
|
|
5954
|
+
end: function() {
|
|
5955
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
5956
|
+
},
|
|
5957
|
+
getTime: getTime
|
|
5958
|
+
};
|
|
5959
|
+
}
|
|
6032
5960
|
}
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
5961
|
+
|
|
5962
|
+
var initErrors = [];
|
|
5963
|
+
// @ts-expect-error
|
|
5964
|
+
var glContext = {};
|
|
5965
|
+
if (!initErrors.length) {
|
|
5966
|
+
initGLContext();
|
|
6038
5967
|
}
|
|
6039
|
-
function
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
5968
|
+
function initGLContext() {
|
|
5969
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
5970
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
5971
|
+
copy(WebGL2RenderingContext);
|
|
5972
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
5973
|
+
copy(WebGLRenderingContext);
|
|
5974
|
+
copy(WebGLRenderingContext.prototype);
|
|
5975
|
+
} else {
|
|
5976
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
5977
|
+
"iOS16 lockdown mode, WebGL Constants not in global");
|
|
5978
|
+
}
|
|
5979
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
5980
|
+
// @ts-expect-error set default value
|
|
5981
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
5982
|
+
}
|
|
6053
5983
|
}
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
* @param url - 视频文件的 URL 或 MediaProvider 对象
|
|
6057
|
-
*/ function loadVideo(url) {
|
|
6058
|
-
return _loadVideo.apply(this, arguments);
|
|
5984
|
+
function isWebGL2(gl) {
|
|
5985
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
6059
5986
|
}
|
|
6060
|
-
function
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
} else {
|
|
6068
|
-
video.srcObject = url;
|
|
6069
|
-
}
|
|
6070
|
-
video.crossOrigin = "anonymous";
|
|
6071
|
-
video.muted = true;
|
|
6072
|
-
if (isAndroid()) {
|
|
6073
|
-
video.setAttribute("renderer", "standard");
|
|
6074
|
-
}
|
|
6075
|
-
video.setAttribute("playsinline", "playsinline");
|
|
6076
|
-
return [
|
|
6077
|
-
2,
|
|
6078
|
-
new Promise(function(resolve, reject) {
|
|
6079
|
-
var pending = video.play();
|
|
6080
|
-
if (pending) {
|
|
6081
|
-
void pending.then(function() {
|
|
6082
|
-
return resolve(video);
|
|
6083
|
-
});
|
|
6084
|
-
} else {
|
|
6085
|
-
video.addEventListener("loadeddata", function listener() {
|
|
6086
|
-
resolve(video);
|
|
6087
|
-
video.removeEventListener("loadeddata", listener);
|
|
6088
|
-
}, true);
|
|
6089
|
-
}
|
|
6090
|
-
video.addEventListener("error", function(e) {
|
|
6091
|
-
reject("Load video fail.");
|
|
6092
|
-
});
|
|
6093
|
-
})
|
|
6094
|
-
];
|
|
6095
|
-
});
|
|
6096
|
-
});
|
|
6097
|
-
return _loadVideo.apply(this, arguments);
|
|
6098
|
-
}
|
|
6099
|
-
function loadMedia(url, loadFn) {
|
|
6100
|
-
return _loadMedia.apply(this, arguments);
|
|
6101
|
-
}
|
|
6102
|
-
function _loadMedia() {
|
|
6103
|
-
_loadMedia = _async_to_generator(function(url, loadFn) {
|
|
6104
|
-
return __generator(this, function(_state) {
|
|
6105
|
-
switch(_state.label){
|
|
6106
|
-
case 0:
|
|
6107
|
-
if (!Array.isArray(url)) return [
|
|
6108
|
-
3,
|
|
6109
|
-
5
|
|
6110
|
-
];
|
|
6111
|
-
_state.label = 1;
|
|
6112
|
-
case 1:
|
|
6113
|
-
_state.trys.push([
|
|
6114
|
-
1,
|
|
6115
|
-
3,
|
|
6116
|
-
,
|
|
6117
|
-
5
|
|
6118
|
-
]);
|
|
6119
|
-
return [
|
|
6120
|
-
4,
|
|
6121
|
-
loadFn(url[0])
|
|
6122
|
-
];
|
|
6123
|
-
case 2:
|
|
6124
|
-
return [
|
|
6125
|
-
2,
|
|
6126
|
-
_state.sent()
|
|
6127
|
-
];
|
|
6128
|
-
case 3:
|
|
6129
|
-
_state.sent();
|
|
6130
|
-
return [
|
|
6131
|
-
4,
|
|
6132
|
-
loadFn(url[1])
|
|
6133
|
-
];
|
|
6134
|
-
case 4:
|
|
6135
|
-
return [
|
|
6136
|
-
2,
|
|
6137
|
-
_state.sent()
|
|
6138
|
-
];
|
|
6139
|
-
case 5:
|
|
6140
|
-
return [
|
|
6141
|
-
2,
|
|
6142
|
-
loadFn(url)
|
|
6143
|
-
];
|
|
6144
|
-
}
|
|
6145
|
-
});
|
|
6146
|
-
});
|
|
6147
|
-
return _loadMedia.apply(this, arguments);
|
|
6148
|
-
}
|
|
6149
|
-
|
|
6150
|
-
function deserializeMipmapTexture(textureOptions, bins, assets) {
|
|
6151
|
-
return _deserializeMipmapTexture.apply(this, arguments);
|
|
6152
|
-
}
|
|
6153
|
-
function _deserializeMipmapTexture() {
|
|
6154
|
-
_deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, assets, files) {
|
|
6155
|
-
var mipmaps, target, jobs, loadedMipmaps, mipmaps1, target1, jobs1, loadedMipmaps1, bin;
|
|
6156
|
-
return __generator(this, function(_state) {
|
|
6157
|
-
switch(_state.label){
|
|
6158
|
-
case 0:
|
|
6159
|
-
if (files === void 0) files = [];
|
|
6160
|
-
if (!(textureOptions.target === 34067)) return [
|
|
6161
|
-
3,
|
|
6162
|
-
2
|
|
6163
|
-
];
|
|
6164
|
-
mipmaps = textureOptions.mipmaps, target = textureOptions.target;
|
|
6165
|
-
jobs = mipmaps.map(function(mipmap) {
|
|
6166
|
-
return Promise.all(mipmap.map(function(pointer) {
|
|
6167
|
-
// @ts-expect-error
|
|
6168
|
-
if (pointer.id) {
|
|
6169
|
-
// @ts-expect-error
|
|
6170
|
-
var loadedImage = assets[pointer.id];
|
|
6171
|
-
return loadedImage;
|
|
6172
|
-
} else {
|
|
6173
|
-
return loadMipmapImage(pointer, bins);
|
|
6174
|
-
}
|
|
6175
|
-
}));
|
|
6176
|
-
});
|
|
6177
|
-
return [
|
|
6178
|
-
4,
|
|
6179
|
-
Promise.all(jobs)
|
|
6180
|
-
];
|
|
6181
|
-
case 1:
|
|
6182
|
-
loadedMipmaps = _state.sent();
|
|
6183
|
-
return [
|
|
6184
|
-
2,
|
|
6185
|
-
_extends({
|
|
6186
|
-
keepImageSource: false
|
|
6187
|
-
}, textureOptions, {
|
|
6188
|
-
mipmaps: loadedMipmaps,
|
|
6189
|
-
sourceFrom: {
|
|
6190
|
-
target: target,
|
|
6191
|
-
// bin,
|
|
6192
|
-
type: TextureSourceType.mipmaps
|
|
6193
|
-
}
|
|
6194
|
-
})
|
|
6195
|
-
];
|
|
6196
|
-
case 2:
|
|
6197
|
-
// TODO: 补充测试用例
|
|
6198
|
-
mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
|
|
6199
|
-
jobs1 = mipmaps1.map(function(pointer) {
|
|
6200
|
-
return loadMipmapImage(pointer, bins);
|
|
6201
|
-
});
|
|
6202
|
-
return [
|
|
6203
|
-
4,
|
|
6204
|
-
Promise.all(jobs1)
|
|
6205
|
-
];
|
|
6206
|
-
case 3:
|
|
6207
|
-
loadedMipmaps1 = _state.sent();
|
|
6208
|
-
bin = files[mipmaps1[0][1][0]].url;
|
|
6209
|
-
return [
|
|
6210
|
-
2,
|
|
6211
|
-
_extends({
|
|
6212
|
-
keepImageSource: false
|
|
6213
|
-
}, textureOptions, {
|
|
6214
|
-
mipmaps: loadedMipmaps1,
|
|
6215
|
-
sourceType: TextureSourceType.mipmaps,
|
|
6216
|
-
sourceFrom: {
|
|
6217
|
-
target: target1,
|
|
6218
|
-
bin: bin,
|
|
6219
|
-
type: TextureSourceType.mipmaps,
|
|
6220
|
-
mipmaps: mipmaps1.map(function(pointer) {
|
|
6221
|
-
return [
|
|
6222
|
-
pointer[1][1],
|
|
6223
|
-
pointer[1][2]
|
|
6224
|
-
];
|
|
6225
|
-
})
|
|
6226
|
-
}
|
|
6227
|
-
})
|
|
6228
|
-
];
|
|
6229
|
-
case 4:
|
|
6230
|
-
return [
|
|
6231
|
-
2
|
|
6232
|
-
];
|
|
6233
|
-
}
|
|
6234
|
-
});
|
|
6235
|
-
});
|
|
6236
|
-
return _deserializeMipmapTexture.apply(this, arguments);
|
|
5987
|
+
function copy(target) {
|
|
5988
|
+
for(var name in target){
|
|
5989
|
+
if (/^[A-Z_]/.test(name)) {
|
|
5990
|
+
// @ts-expect-error safe to assign
|
|
5991
|
+
glContext[name] = target[name];
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
6237
5994
|
}
|
|
6238
|
-
function
|
|
6239
|
-
|
|
5995
|
+
function vertexFormatType2GLType(formatType) {
|
|
5996
|
+
switch(formatType){
|
|
5997
|
+
case VertexFormatType.Float32:
|
|
5998
|
+
return WebGLRenderingContext["FLOAT"];
|
|
5999
|
+
case VertexFormatType.Int16:
|
|
6000
|
+
return WebGLRenderingContext["SHORT"];
|
|
6001
|
+
case VertexFormatType.Int8:
|
|
6002
|
+
return WebGLRenderingContext["BYTE"];
|
|
6003
|
+
case VertexFormatType.UInt16:
|
|
6004
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
6005
|
+
case VertexFormatType.UInt8:
|
|
6006
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
6007
|
+
default:
|
|
6008
|
+
return WebGLRenderingContext["FLOAT"];
|
|
6009
|
+
}
|
|
6240
6010
|
}
|
|
6241
|
-
function
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
return
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
});
|
|
6257
|
-
});
|
|
6258
|
-
return _loadMipmapImage.apply(this, arguments);
|
|
6011
|
+
function glType2VertexFormatType(webglType) {
|
|
6012
|
+
switch(webglType){
|
|
6013
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
6014
|
+
return VertexFormatType.Float32;
|
|
6015
|
+
case WebGLRenderingContext["SHORT"]:
|
|
6016
|
+
return VertexFormatType.Int16;
|
|
6017
|
+
case WebGLRenderingContext["BYTE"]:
|
|
6018
|
+
return VertexFormatType.Int8;
|
|
6019
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
6020
|
+
return VertexFormatType.UInt16;
|
|
6021
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
6022
|
+
return VertexFormatType.UInt8;
|
|
6023
|
+
default:
|
|
6024
|
+
return VertexFormatType.Float32;
|
|
6025
|
+
}
|
|
6259
6026
|
}
|
|
6260
6027
|
|
|
6261
6028
|
var seed$9 = 1;
|
|
@@ -6886,10 +6653,284 @@ function getDefaultTextureFactory() {
|
|
|
6886
6653
|
if (!g) {
|
|
6887
6654
|
g = new TextureFactory();
|
|
6888
6655
|
}
|
|
6889
|
-
return g;
|
|
6890
|
-
}
|
|
6891
|
-
function setDefaultTextureFactory(factory) {
|
|
6892
|
-
g = factory;
|
|
6656
|
+
return g;
|
|
6657
|
+
}
|
|
6658
|
+
function setDefaultTextureFactory(factory) {
|
|
6659
|
+
g = factory;
|
|
6660
|
+
}
|
|
6661
|
+
|
|
6662
|
+
function _array_like_to_array(arr, len) {
|
|
6663
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
6664
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6665
|
+
return arr2;
|
|
6666
|
+
}
|
|
6667
|
+
|
|
6668
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
6669
|
+
if (!o) return;
|
|
6670
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
6671
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6672
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6673
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6674
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
6675
|
+
}
|
|
6676
|
+
|
|
6677
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
6678
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
6679
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
6680
|
+
// Fallback for engines without symbol support
|
|
6681
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
6682
|
+
if (it) o = it;
|
|
6683
|
+
var i = 0;
|
|
6684
|
+
return function() {
|
|
6685
|
+
if (i >= o.length) return {
|
|
6686
|
+
done: true
|
|
6687
|
+
};
|
|
6688
|
+
return {
|
|
6689
|
+
done: false,
|
|
6690
|
+
value: o[i++]
|
|
6691
|
+
};
|
|
6692
|
+
};
|
|
6693
|
+
}
|
|
6694
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6695
|
+
}
|
|
6696
|
+
|
|
6697
|
+
var ShaderCompileResultStatus;
|
|
6698
|
+
(function(ShaderCompileResultStatus) {
|
|
6699
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
|
|
6700
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
|
|
6701
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
|
|
6702
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
|
|
6703
|
+
})(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
|
|
6704
|
+
var GLSLVersion;
|
|
6705
|
+
(function(GLSLVersion) {
|
|
6706
|
+
GLSLVersion["GLSL1"] = "100";
|
|
6707
|
+
GLSLVersion["GLSL3"] = "300 es";
|
|
6708
|
+
})(GLSLVersion || (GLSLVersion = {}));
|
|
6709
|
+
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
6710
|
+
_inherits(ShaderVariant, EffectsObject);
|
|
6711
|
+
function ShaderVariant(engine, source) {
|
|
6712
|
+
var _this;
|
|
6713
|
+
_this = EffectsObject.call(this, engine) || this;
|
|
6714
|
+
_this.source = source;
|
|
6715
|
+
return _this;
|
|
6716
|
+
}
|
|
6717
|
+
return ShaderVariant;
|
|
6718
|
+
}(EffectsObject);
|
|
6719
|
+
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
6720
|
+
_inherits(Shader, EffectsObject);
|
|
6721
|
+
function Shader() {
|
|
6722
|
+
return EffectsObject.apply(this, arguments);
|
|
6723
|
+
}
|
|
6724
|
+
var _proto = Shader.prototype;
|
|
6725
|
+
_proto.createVariant = function createVariant(macros) {
|
|
6726
|
+
var shaderMacros = [];
|
|
6727
|
+
if (macros) {
|
|
6728
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
|
|
6729
|
+
var key = _step.value;
|
|
6730
|
+
shaderMacros.push([
|
|
6731
|
+
key,
|
|
6732
|
+
macros[key]
|
|
6733
|
+
]);
|
|
6734
|
+
}
|
|
6735
|
+
}
|
|
6736
|
+
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
6737
|
+
shaderVariant.shader = this;
|
|
6738
|
+
return shaderVariant;
|
|
6739
|
+
};
|
|
6740
|
+
_proto.fromData = function fromData(data) {
|
|
6741
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
6742
|
+
this.shaderData = data;
|
|
6743
|
+
};
|
|
6744
|
+
return Shader;
|
|
6745
|
+
}(EffectsObject);
|
|
6746
|
+
Shader = __decorate([
|
|
6747
|
+
effectsClass(DataType.Shader)
|
|
6748
|
+
], Shader);
|
|
6749
|
+
|
|
6750
|
+
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
6751
|
+
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
6752
|
+
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
6753
|
+
var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
6754
|
+
function createCopyShader(level, writeDepth) {
|
|
6755
|
+
var webgl2 = level === 2;
|
|
6756
|
+
return {
|
|
6757
|
+
name: EFFECTS_COPY_MESH_NAME,
|
|
6758
|
+
vertex: COPY_VERTEX_SHADER,
|
|
6759
|
+
fragment: COPY_FRAGMENT_SHADER,
|
|
6760
|
+
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
6761
|
+
macros: [
|
|
6762
|
+
[
|
|
6763
|
+
"DEPTH_TEXTURE",
|
|
6764
|
+
!!writeDepth
|
|
6765
|
+
]
|
|
6766
|
+
],
|
|
6767
|
+
// @ts-expect-error
|
|
6768
|
+
cacheId: COPY_MESH_SHADER_ID + +writeDepth
|
|
6769
|
+
};
|
|
6770
|
+
}
|
|
6771
|
+
|
|
6772
|
+
var ShaderType;
|
|
6773
|
+
(function(ShaderType) {
|
|
6774
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
6775
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
6776
|
+
})(ShaderType || (ShaderType = {}));
|
|
6777
|
+
|
|
6778
|
+
function valIfUndefined(val, def) {
|
|
6779
|
+
if (val === undefined || val === null) {
|
|
6780
|
+
return def;
|
|
6781
|
+
}
|
|
6782
|
+
return val;
|
|
6783
|
+
}
|
|
6784
|
+
function getPreMultiAlpha(blending) {
|
|
6785
|
+
switch(blending){
|
|
6786
|
+
case BlendingMode.ALPHA:
|
|
6787
|
+
return 1;
|
|
6788
|
+
case BlendingMode.ADD:
|
|
6789
|
+
return 1;
|
|
6790
|
+
case BlendingMode.SUBTRACTION:
|
|
6791
|
+
return 1;
|
|
6792
|
+
case BlendingMode.STRONG_LIGHT:
|
|
6793
|
+
return 1;
|
|
6794
|
+
case BlendingMode.WEAK_LIGHT:
|
|
6795
|
+
return 1;
|
|
6796
|
+
case BlendingMode.SUPERPOSITION:
|
|
6797
|
+
return 2;
|
|
6798
|
+
case BlendingMode.BRIGHTNESS:
|
|
6799
|
+
return 3;
|
|
6800
|
+
case BlendingMode.MULTIPLY:
|
|
6801
|
+
return 0;
|
|
6802
|
+
default:
|
|
6803
|
+
// 处理undefined
|
|
6804
|
+
return 1;
|
|
6805
|
+
}
|
|
6806
|
+
}
|
|
6807
|
+
function setBlendMode(material, blendMode) {
|
|
6808
|
+
switch(blendMode){
|
|
6809
|
+
case undefined:
|
|
6810
|
+
material.blendFunction = [
|
|
6811
|
+
glContext.ONE,
|
|
6812
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6813
|
+
glContext.ONE,
|
|
6814
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6815
|
+
];
|
|
6816
|
+
break;
|
|
6817
|
+
case BlendingMode.ALPHA:
|
|
6818
|
+
material.blendFunction = [
|
|
6819
|
+
glContext.ONE,
|
|
6820
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6821
|
+
glContext.ONE,
|
|
6822
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6823
|
+
];
|
|
6824
|
+
break;
|
|
6825
|
+
case BlendingMode.ADD:
|
|
6826
|
+
material.blendFunction = [
|
|
6827
|
+
glContext.ONE,
|
|
6828
|
+
glContext.ONE,
|
|
6829
|
+
glContext.ONE,
|
|
6830
|
+
glContext.ONE
|
|
6831
|
+
];
|
|
6832
|
+
break;
|
|
6833
|
+
case BlendingMode.SUBTRACTION:
|
|
6834
|
+
material.blendFunction = [
|
|
6835
|
+
glContext.ONE,
|
|
6836
|
+
glContext.ONE,
|
|
6837
|
+
glContext.ZERO,
|
|
6838
|
+
glContext.ONE
|
|
6839
|
+
];
|
|
6840
|
+
material.blendEquation = [
|
|
6841
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
6842
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
6843
|
+
];
|
|
6844
|
+
break;
|
|
6845
|
+
case BlendingMode.SUPERPOSITION:
|
|
6846
|
+
material.blendFunction = [
|
|
6847
|
+
glContext.ONE,
|
|
6848
|
+
glContext.ONE,
|
|
6849
|
+
glContext.ONE,
|
|
6850
|
+
glContext.ONE
|
|
6851
|
+
];
|
|
6852
|
+
break;
|
|
6853
|
+
case BlendingMode.MULTIPLY:
|
|
6854
|
+
material.blendFunction = [
|
|
6855
|
+
glContext.DST_COLOR,
|
|
6856
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6857
|
+
glContext.DST_COLOR,
|
|
6858
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6859
|
+
];
|
|
6860
|
+
break;
|
|
6861
|
+
case BlendingMode.BRIGHTNESS:
|
|
6862
|
+
material.blendFunction = [
|
|
6863
|
+
glContext.ONE,
|
|
6864
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6865
|
+
glContext.ONE,
|
|
6866
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6867
|
+
];
|
|
6868
|
+
break;
|
|
6869
|
+
case BlendingMode.STRONG_LIGHT:
|
|
6870
|
+
material.blendFunction = [
|
|
6871
|
+
glContext.DST_COLOR,
|
|
6872
|
+
glContext.DST_ALPHA,
|
|
6873
|
+
glContext.ZERO,
|
|
6874
|
+
glContext.ONE
|
|
6875
|
+
];
|
|
6876
|
+
break;
|
|
6877
|
+
case BlendingMode.WEAK_LIGHT:
|
|
6878
|
+
material.blendFunction = [
|
|
6879
|
+
glContext.DST_COLOR,
|
|
6880
|
+
glContext.ZERO,
|
|
6881
|
+
glContext.ZERO,
|
|
6882
|
+
glContext.ONE
|
|
6883
|
+
];
|
|
6884
|
+
break;
|
|
6885
|
+
default:
|
|
6886
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
6887
|
+
}
|
|
6888
|
+
}
|
|
6889
|
+
function setSideMode(material, side) {
|
|
6890
|
+
if (side === SideMode.DOUBLE) {
|
|
6891
|
+
material.culling = false;
|
|
6892
|
+
} else {
|
|
6893
|
+
material.culling = true;
|
|
6894
|
+
material.frontFace = glContext.CW;
|
|
6895
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
6896
|
+
}
|
|
6897
|
+
}
|
|
6898
|
+
function setMaskMode(material, maskMode) {
|
|
6899
|
+
switch(maskMode){
|
|
6900
|
+
case undefined:
|
|
6901
|
+
material.stencilTest = false;
|
|
6902
|
+
break;
|
|
6903
|
+
case MaskMode.MASK:
|
|
6904
|
+
material.stencilTest = true;
|
|
6905
|
+
material.stencilFunc = [
|
|
6906
|
+
glContext.ALWAYS,
|
|
6907
|
+
glContext.ALWAYS
|
|
6908
|
+
];
|
|
6909
|
+
material.stencilOpZPass = [
|
|
6910
|
+
glContext.REPLACE,
|
|
6911
|
+
glContext.REPLACE
|
|
6912
|
+
];
|
|
6913
|
+
break;
|
|
6914
|
+
case MaskMode.OBSCURED:
|
|
6915
|
+
material.stencilTest = true;
|
|
6916
|
+
material.stencilFunc = [
|
|
6917
|
+
glContext.EQUAL,
|
|
6918
|
+
glContext.EQUAL
|
|
6919
|
+
];
|
|
6920
|
+
break;
|
|
6921
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
6922
|
+
material.stencilTest = true;
|
|
6923
|
+
material.stencilFunc = [
|
|
6924
|
+
glContext.NOTEQUAL,
|
|
6925
|
+
glContext.NOTEQUAL
|
|
6926
|
+
];
|
|
6927
|
+
break;
|
|
6928
|
+
case MaskMode.NONE:
|
|
6929
|
+
material.stencilTest = false;
|
|
6930
|
+
break;
|
|
6931
|
+
default:
|
|
6932
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
6933
|
+
}
|
|
6893
6934
|
}
|
|
6894
6935
|
|
|
6895
6936
|
/**
|
|
@@ -11715,25 +11756,35 @@ function numberToFix(a, fixed) {
|
|
|
11715
11756
|
}
|
|
11716
11757
|
|
|
11717
11758
|
var keyframeInfo = {
|
|
11759
|
+
pointIndexCache: {
|
|
11760
|
+
xIndex: 0,
|
|
11761
|
+
yIndex: 0
|
|
11762
|
+
},
|
|
11718
11763
|
/**
|
|
11719
11764
|
* 根据不同关键帧类型,获取位于曲线上的点
|
|
11720
11765
|
*/ getPointInCurve: function getPointInCurve(keyframe) {
|
|
11721
11766
|
keyframe[0]; var data = keyframe[1];
|
|
11722
|
-
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11767
|
+
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe, this.pointIndexCache), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11723
11768
|
var time = data[xIndex];
|
|
11724
11769
|
var value = data[yIndex];
|
|
11725
11770
|
return new Vector2(time, value);
|
|
11726
11771
|
},
|
|
11727
11772
|
/**
|
|
11728
11773
|
* 根据不同关键帧类型,获取位于曲线上的点的索引
|
|
11729
|
-
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe) {
|
|
11774
|
+
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe, res) {
|
|
11730
11775
|
var type = keyframe[0], markType = keyframe[2];
|
|
11731
11776
|
// 不同类型,存放的时间不同
|
|
11732
11777
|
var index = type === BezierKeyframeType.LINE ? 0 : type === BezierKeyframeType.EASE_OUT ? 0 : type === BezierKeyframeType.EASE_IN ? 2 : type === BezierKeyframeType.EASE ? 2 : type === BezierKeyframeType.HOLD ? markType === BezierKeyframeType.EASE_IN ? 2 : 0 : 0;
|
|
11733
|
-
|
|
11734
|
-
xIndex
|
|
11735
|
-
yIndex
|
|
11736
|
-
|
|
11778
|
+
if (res) {
|
|
11779
|
+
res.xIndex = index;
|
|
11780
|
+
res.yIndex = index + 1;
|
|
11781
|
+
return res;
|
|
11782
|
+
} else {
|
|
11783
|
+
return {
|
|
11784
|
+
xIndex: index,
|
|
11785
|
+
yIndex: index + 1
|
|
11786
|
+
};
|
|
11787
|
+
}
|
|
11737
11788
|
},
|
|
11738
11789
|
/**
|
|
11739
11790
|
* 关键帧左侧是否为缓动类型(否则为线段)
|
|
@@ -12640,6 +12691,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12640
12691
|
timeEnd: Number(e.x)
|
|
12641
12692
|
};
|
|
12642
12693
|
}
|
|
12694
|
+
this.startKeyframe = keyframes[0];
|
|
12695
|
+
this.endKeyframe = keyframes[keyframes.length - 1];
|
|
12643
12696
|
this.keyTimeData = Object.keys(this.curveMap);
|
|
12644
12697
|
};
|
|
12645
12698
|
_proto.getValue = function getValue(time) {
|
|
@@ -12647,12 +12700,18 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12647
12700
|
var keyTimeData = this.keyTimeData;
|
|
12648
12701
|
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
12649
12702
|
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
12650
|
-
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
12651
|
-
// const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
|
|
12652
12703
|
if (time <= keyTimeStart) {
|
|
12704
|
+
if (this.startKeyframe[0] === BezierKeyframeType.LINE || this.startKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12705
|
+
keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
|
|
12706
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12707
|
+
}
|
|
12653
12708
|
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
12654
12709
|
}
|
|
12655
12710
|
if (time >= keyTimeEnd) {
|
|
12711
|
+
if (this.endKeyframe[0] === BezierKeyframeType.LINE || this.endKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12712
|
+
keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
|
|
12713
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12714
|
+
}
|
|
12656
12715
|
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
12657
12716
|
}
|
|
12658
12717
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
@@ -13084,6 +13143,27 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13084
13143
|
};
|
|
13085
13144
|
return Vector4Curve;
|
|
13086
13145
|
}(ValueGetter);
|
|
13146
|
+
var Vector2Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
13147
|
+
_inherits(Vector2Curve, ValueGetter);
|
|
13148
|
+
function Vector2Curve() {
|
|
13149
|
+
var _this;
|
|
13150
|
+
_this = ValueGetter.apply(this, arguments) || this;
|
|
13151
|
+
_this.value = new Vector2();
|
|
13152
|
+
return _this;
|
|
13153
|
+
}
|
|
13154
|
+
var _proto = Vector2Curve.prototype;
|
|
13155
|
+
_proto.onCreate = function onCreate(arg) {
|
|
13156
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13157
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13158
|
+
};
|
|
13159
|
+
_proto.getValue = function getValue(t) {
|
|
13160
|
+
var x = this.xCurve.getValue(t);
|
|
13161
|
+
var y = this.yCurve.getValue(t);
|
|
13162
|
+
this.value.set(x, y);
|
|
13163
|
+
return this.value;
|
|
13164
|
+
};
|
|
13165
|
+
return Vector2Curve;
|
|
13166
|
+
}(ValueGetter);
|
|
13087
13167
|
|
|
13088
13168
|
var SPRITE_VERTEX_STRIDE = 6;
|
|
13089
13169
|
var SEMANTIC_PRE_COLOR_ATTACHMENT_0 = "PRE_COLOR_0";
|
|
@@ -13147,6 +13227,8 @@ var map$1 = (_obj$3 = {}, _obj$3[ValueType.RANDOM] = function(props) {
|
|
|
13147
13227
|
return new ColorCurve(props);
|
|
13148
13228
|
}, _obj$3[ValueType.VECTOR4_CURVE] = function(props) {
|
|
13149
13229
|
return new Vector4Curve(props);
|
|
13230
|
+
}, _obj$3[ValueType.VECTOR2_CURVE] = function(props) {
|
|
13231
|
+
return new Vector2Curve(props);
|
|
13150
13232
|
}, _obj$3);
|
|
13151
13233
|
function createValueGetter(args) {
|
|
13152
13234
|
if (!args || !isNaN(+args)) {
|
|
@@ -13271,13 +13353,39 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13271
13353
|
this.color = color;
|
|
13272
13354
|
this.material.setVector4("_Color", new Vector4().setFromArray(color));
|
|
13273
13355
|
};
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13356
|
+
_proto.setTexture = function setTexture(input) {
|
|
13357
|
+
var _this = this;
|
|
13358
|
+
return _async_to_generator(function() {
|
|
13359
|
+
var texture;
|
|
13360
|
+
return __generator(this, function(_state) {
|
|
13361
|
+
switch(_state.label){
|
|
13362
|
+
case 0:
|
|
13363
|
+
if (!(typeof input === "string")) return [
|
|
13364
|
+
3,
|
|
13365
|
+
2
|
|
13366
|
+
];
|
|
13367
|
+
return [
|
|
13368
|
+
4,
|
|
13369
|
+
Texture.fromImage(input, _this.item.engine)
|
|
13370
|
+
];
|
|
13371
|
+
case 1:
|
|
13372
|
+
texture = _state.sent();
|
|
13373
|
+
return [
|
|
13374
|
+
3,
|
|
13375
|
+
3
|
|
13376
|
+
];
|
|
13377
|
+
case 2:
|
|
13378
|
+
texture = input;
|
|
13379
|
+
_state.label = 3;
|
|
13380
|
+
case 3:
|
|
13381
|
+
_this.renderer.texture = texture;
|
|
13382
|
+
_this.material.setTexture("_MainTex", texture);
|
|
13383
|
+
return [
|
|
13384
|
+
2
|
|
13385
|
+
];
|
|
13386
|
+
}
|
|
13387
|
+
});
|
|
13388
|
+
})();
|
|
13281
13389
|
};
|
|
13282
13390
|
/**
|
|
13283
13391
|
* @internal
|
|
@@ -13539,6 +13647,8 @@ function getImageItemRenderInfo(item) {
|
|
|
13539
13647
|
};
|
|
13540
13648
|
}
|
|
13541
13649
|
|
|
13650
|
+
// Based on:
|
|
13651
|
+
// https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/ShapePrimitive.ts
|
|
13542
13652
|
var ShapePrimitive = function ShapePrimitive() {
|
|
13543
13653
|
};
|
|
13544
13654
|
|
|
@@ -14644,6 +14754,7 @@ function triangulate(contours) {
|
|
|
14644
14754
|
return triangleVerts;
|
|
14645
14755
|
}
|
|
14646
14756
|
|
|
14757
|
+
// Based on:
|
|
14647
14758
|
/**
|
|
14648
14759
|
* A class to define a shape via user defined coordinates.
|
|
14649
14760
|
*/ var Polygon = /*#__PURE__*/ function(ShapePrimitive) {
|
|
@@ -14743,12 +14854,13 @@ function triangulate(contours) {
|
|
|
14743
14854
|
var triangles = triangulate([
|
|
14744
14855
|
points
|
|
14745
14856
|
]);
|
|
14857
|
+
var indexStart = vertices.length / 2;
|
|
14746
14858
|
for(var i = 0; i < triangles.length; i++){
|
|
14747
|
-
vertices[verticesOffset + i] = triangles[i];
|
|
14859
|
+
vertices[verticesOffset * 2 + i] = triangles[i];
|
|
14748
14860
|
}
|
|
14749
14861
|
var vertexCount = triangles.length / 2;
|
|
14750
14862
|
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
14751
|
-
indices[indicesOffset + i1] = i1;
|
|
14863
|
+
indices[indicesOffset + i1] = indexStart + i1;
|
|
14752
14864
|
}
|
|
14753
14865
|
};
|
|
14754
14866
|
_create_class(Polygon, [
|
|
@@ -14870,6 +14982,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
14870
14982
|
recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
|
|
14871
14983
|
}
|
|
14872
14984
|
|
|
14985
|
+
// Based on:
|
|
14873
14986
|
/**
|
|
14874
14987
|
* The Ellipse object is used to help draw graphics and can also be used to specify a hit area for containers.
|
|
14875
14988
|
*/ var Ellipse = /*#__PURE__*/ function(ShapePrimitive) {
|
|
@@ -15076,6 +15189,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15076
15189
|
return Ellipse;
|
|
15077
15190
|
}(ShapePrimitive);
|
|
15078
15191
|
|
|
15192
|
+
// Based on:
|
|
15079
15193
|
var StarType;
|
|
15080
15194
|
(function(StarType) {
|
|
15081
15195
|
StarType[StarType["Star"] = 0] = "Star";
|
|
@@ -15144,12 +15258,13 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15144
15258
|
var triangles = triangulate([
|
|
15145
15259
|
points
|
|
15146
15260
|
]);
|
|
15261
|
+
var indexStart = vertices.length / 2;
|
|
15147
15262
|
for(var i = 0; i < triangles.length; i++){
|
|
15148
|
-
vertices[verticesOffset + i] = triangles[i];
|
|
15263
|
+
vertices[verticesOffset * 2 + i] = triangles[i];
|
|
15149
15264
|
}
|
|
15150
15265
|
var vertexCount = triangles.length / 2;
|
|
15151
15266
|
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15152
|
-
indices[indicesOffset + i1] = i1;
|
|
15267
|
+
indices[indicesOffset + i1] = indexStart + i1;
|
|
15153
15268
|
}
|
|
15154
15269
|
};
|
|
15155
15270
|
_proto.buildStarPath = function buildStarPath() {
|
|
@@ -15220,6 +15335,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15220
15335
|
return PolyStar;
|
|
15221
15336
|
}(ShapePrimitive);
|
|
15222
15337
|
|
|
15338
|
+
// Based on:
|
|
15223
15339
|
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15224
15340
|
/**
|
|
15225
15341
|
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
@@ -15543,6 +15659,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15543
15659
|
return Rectangle;
|
|
15544
15660
|
}(ShapePrimitive);
|
|
15545
15661
|
|
|
15662
|
+
// Based on:
|
|
15546
15663
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15547
15664
|
function ShapePath(graphicsPath) {
|
|
15548
15665
|
this.graphicsPath = graphicsPath;
|
|
@@ -15701,6 +15818,7 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15701
15818
|
return ShapePath;
|
|
15702
15819
|
}();
|
|
15703
15820
|
|
|
15821
|
+
// Based on:
|
|
15704
15822
|
var GraphicsPath = /*#__PURE__*/ function() {
|
|
15705
15823
|
function GraphicsPath() {
|
|
15706
15824
|
this.instructions = [];
|
|
@@ -15838,14 +15956,433 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15838
15956
|
return GraphicsPath;
|
|
15839
15957
|
}();
|
|
15840
15958
|
|
|
15959
|
+
// Based on:
|
|
15960
|
+
/**
|
|
15961
|
+
* The Point object represents a location in a two-dimensional coordinate system, where `x` represents
|
|
15962
|
+
* the position on the horizontal axis and `y` represents the position on the vertical axis.
|
|
15963
|
+
*/ var Point = /*#__PURE__*/ function() {
|
|
15964
|
+
function Point(x, y) {
|
|
15965
|
+
if (x === void 0) x = 0;
|
|
15966
|
+
if (y === void 0) y = 0;
|
|
15967
|
+
/**
|
|
15968
|
+
* Position of the point on the x axis
|
|
15969
|
+
*/ this.x = 0;
|
|
15970
|
+
/**
|
|
15971
|
+
* Position of the point on the y axis
|
|
15972
|
+
*/ this.y = 0;
|
|
15973
|
+
this.x = x;
|
|
15974
|
+
this.y = y;
|
|
15975
|
+
}
|
|
15976
|
+
var _proto = Point.prototype;
|
|
15977
|
+
/**
|
|
15978
|
+
* Creates a clone of this point
|
|
15979
|
+
* @returns A clone of this point
|
|
15980
|
+
*/ _proto.clone = function clone() {
|
|
15981
|
+
return new Point(this.x, this.y);
|
|
15982
|
+
};
|
|
15983
|
+
/**
|
|
15984
|
+
* Copies `x` and `y` from the given point into this point
|
|
15985
|
+
* @param p - The point to copy from
|
|
15986
|
+
* @returns The point instance itself
|
|
15987
|
+
*/ _proto.copyFrom = function copyFrom(p) {
|
|
15988
|
+
this.set(p.x, p.y);
|
|
15989
|
+
return this;
|
|
15990
|
+
};
|
|
15991
|
+
/**
|
|
15992
|
+
* Copies this point's x and y into the given point (`p`).
|
|
15993
|
+
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
|
15994
|
+
* @returns The point (`p`) with values updated
|
|
15995
|
+
*/ _proto.copyTo = function copyTo(p) {
|
|
15996
|
+
p.set(this.x, this.y);
|
|
15997
|
+
return p;
|
|
15998
|
+
};
|
|
15999
|
+
/**
|
|
16000
|
+
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
|
16001
|
+
* @param p - The point to check
|
|
16002
|
+
* @returns Returns `true` if both `x` and `y` are equal
|
|
16003
|
+
*/ _proto.equals = function equals(p) {
|
|
16004
|
+
return p.x === this.x && p.y === this.y;
|
|
16005
|
+
};
|
|
16006
|
+
/**
|
|
16007
|
+
* Sets the point to a new `x` and `y` position.
|
|
16008
|
+
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
|
16009
|
+
* @param {number} [x=0] - position of the point on the `x` axis
|
|
16010
|
+
* @param {number} [y=x] - position of the point on the `y` axis
|
|
16011
|
+
* @returns The point instance itself
|
|
16012
|
+
*/ _proto.set = function set(x, y) {
|
|
16013
|
+
if (x === void 0) x = 0;
|
|
16014
|
+
if (y === void 0) y = x;
|
|
16015
|
+
this.x = x;
|
|
16016
|
+
this.y = y;
|
|
16017
|
+
return this;
|
|
16018
|
+
};
|
|
16019
|
+
_create_class(Point, null, [
|
|
16020
|
+
{
|
|
16021
|
+
key: "shared",
|
|
16022
|
+
get: /**
|
|
16023
|
+
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
|
16024
|
+
* @readonly
|
|
16025
|
+
*/ function get() {
|
|
16026
|
+
tempPoint.x = 0;
|
|
16027
|
+
tempPoint.y = 0;
|
|
16028
|
+
return tempPoint;
|
|
16029
|
+
}
|
|
16030
|
+
}
|
|
16031
|
+
]);
|
|
16032
|
+
return Point;
|
|
16033
|
+
}();
|
|
16034
|
+
var tempPoint = new Point();
|
|
16035
|
+
|
|
16036
|
+
// Based on:
|
|
16037
|
+
var closePointEps = 1e-4;
|
|
16038
|
+
var curveEps = 0.0001;
|
|
16039
|
+
/**
|
|
16040
|
+
* Buffers vertices to draw a square cap.
|
|
16041
|
+
*
|
|
16042
|
+
* @internal
|
|
16043
|
+
* @private
|
|
16044
|
+
* @param x - X-coord of end point
|
|
16045
|
+
* @param y - Y-coord of end point
|
|
16046
|
+
* @param nx - X-coord of line normal pointing inside
|
|
16047
|
+
* @param ny - Y-coord of line normal pointing inside
|
|
16048
|
+
* @param innerWeight - Weight of inner points
|
|
16049
|
+
* @param outerWeight - Weight of outer points
|
|
16050
|
+
* @param clockwise - Whether the cap is drawn clockwise
|
|
16051
|
+
* @param verts - vertex buffer
|
|
16052
|
+
* @returns - no. of vertices pushed
|
|
16053
|
+
*/ function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) {
|
|
16054
|
+
var ix = x - nx * innerWeight;
|
|
16055
|
+
var iy = y - ny * innerWeight;
|
|
16056
|
+
var ox = x + nx * outerWeight;
|
|
16057
|
+
var oy = y + ny * outerWeight;
|
|
16058
|
+
/* Rotate nx,ny for extension vector */ var exx;
|
|
16059
|
+
var eyy;
|
|
16060
|
+
if (clockwise) {
|
|
16061
|
+
exx = ny;
|
|
16062
|
+
eyy = -nx;
|
|
16063
|
+
} else {
|
|
16064
|
+
exx = -ny;
|
|
16065
|
+
eyy = nx;
|
|
16066
|
+
}
|
|
16067
|
+
/* [i|0]x,y extended at cap */ var eix = ix + exx;
|
|
16068
|
+
var eiy = iy + eyy;
|
|
16069
|
+
var eox = ox + exx;
|
|
16070
|
+
var eoy = oy + eyy;
|
|
16071
|
+
/* Square itself must be inserted clockwise*/ verts.push(eix, eiy);
|
|
16072
|
+
verts.push(eox, eoy);
|
|
16073
|
+
return 2;
|
|
16074
|
+
}
|
|
16075
|
+
/**
|
|
16076
|
+
* Buffers vertices to draw an arc at the line joint or cap.
|
|
16077
|
+
*
|
|
16078
|
+
* @internal
|
|
16079
|
+
* @private
|
|
16080
|
+
* @param cx - X-coord of center
|
|
16081
|
+
* @param cy - Y-coord of center
|
|
16082
|
+
* @param sx - X-coord of arc start
|
|
16083
|
+
* @param sy - Y-coord of arc start
|
|
16084
|
+
* @param ex - X-coord of arc end
|
|
16085
|
+
* @param ey - Y-coord of arc end
|
|
16086
|
+
* @param verts - buffer of vertices
|
|
16087
|
+
* @param clockwise - orientation of vertices
|
|
16088
|
+
* @returns - no. of vertices pushed
|
|
16089
|
+
*/ function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
|
16090
|
+
var cx2p0x = sx - cx;
|
|
16091
|
+
var cy2p0y = sy - cy;
|
|
16092
|
+
var angle0 = Math.atan2(cx2p0x, cy2p0y);
|
|
16093
|
+
var angle1 = Math.atan2(ex - cx, ey - cy);
|
|
16094
|
+
if (clockwise && angle0 < angle1) {
|
|
16095
|
+
angle0 += Math.PI * 2;
|
|
16096
|
+
} else if (!clockwise && angle0 > angle1) {
|
|
16097
|
+
angle1 += Math.PI * 2;
|
|
16098
|
+
}
|
|
16099
|
+
var startAngle = angle0;
|
|
16100
|
+
var angleDiff = angle1 - angle0;
|
|
16101
|
+
var absAngleDiff = Math.abs(angleDiff);
|
|
16102
|
+
var radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);
|
|
16103
|
+
var segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;
|
|
16104
|
+
var angleInc = angleDiff / segCount;
|
|
16105
|
+
startAngle += angleInc;
|
|
16106
|
+
if (clockwise) {
|
|
16107
|
+
verts.push(cx, cy);
|
|
16108
|
+
verts.push(sx, sy);
|
|
16109
|
+
for(var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc){
|
|
16110
|
+
verts.push(cx, cy);
|
|
16111
|
+
verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
|
|
16112
|
+
}
|
|
16113
|
+
verts.push(cx, cy);
|
|
16114
|
+
verts.push(ex, ey);
|
|
16115
|
+
} else {
|
|
16116
|
+
verts.push(sx, sy);
|
|
16117
|
+
verts.push(cx, cy);
|
|
16118
|
+
for(var i1 = 1, angle2 = startAngle; i1 < segCount; i1++, angle2 += angleInc){
|
|
16119
|
+
verts.push(cx + Math.sin(angle2) * radius, cy + Math.cos(angle2) * radius);
|
|
16120
|
+
verts.push(cx, cy);
|
|
16121
|
+
}
|
|
16122
|
+
verts.push(ex, ey);
|
|
16123
|
+
verts.push(cx, cy);
|
|
16124
|
+
}
|
|
16125
|
+
return segCount * 2;
|
|
16126
|
+
}
|
|
16127
|
+
function getOrientationOfPoints(points) {
|
|
16128
|
+
var m = points.length;
|
|
16129
|
+
if (m < 6) {
|
|
16130
|
+
return 1;
|
|
16131
|
+
}
|
|
16132
|
+
var area = 0;
|
|
16133
|
+
for(var i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2){
|
|
16134
|
+
var x2 = points[i];
|
|
16135
|
+
var y2 = points[i + 1];
|
|
16136
|
+
area += (x2 - x1) * (y2 + y1);
|
|
16137
|
+
x1 = x2;
|
|
16138
|
+
y1 = y2;
|
|
16139
|
+
}
|
|
16140
|
+
if (area < 0) {
|
|
16141
|
+
return -1;
|
|
16142
|
+
}
|
|
16143
|
+
return 1;
|
|
16144
|
+
}
|
|
16145
|
+
/**
|
|
16146
|
+
* Builds a line to draw using the polygon method.
|
|
16147
|
+
* @param points
|
|
16148
|
+
* @param lineStyle
|
|
16149
|
+
* @param flipAlignment
|
|
16150
|
+
* @param closed
|
|
16151
|
+
* @param vertices
|
|
16152
|
+
* @param _verticesStride
|
|
16153
|
+
* @param _verticesOffset
|
|
16154
|
+
* @param indices
|
|
16155
|
+
* @param _indicesOffset
|
|
16156
|
+
*/ function buildLine(points, lineStyle, flipAlignment, closed, // alignment:number,
|
|
16157
|
+
vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
16158
|
+
// const shape = graphicsData.shape as Polygon;
|
|
16159
|
+
// let points = graphicsData.points || shape.points.slice();
|
|
16160
|
+
var eps = closePointEps;
|
|
16161
|
+
if (points.length === 0) {
|
|
16162
|
+
return;
|
|
16163
|
+
}
|
|
16164
|
+
var style = lineStyle;
|
|
16165
|
+
var alignment = style.alignment;
|
|
16166
|
+
if (lineStyle.alignment !== 0.5) {
|
|
16167
|
+
// rotate the points!
|
|
16168
|
+
var orientation = getOrientationOfPoints(points);
|
|
16169
|
+
if (flipAlignment) {
|
|
16170
|
+
orientation *= -1;
|
|
16171
|
+
}
|
|
16172
|
+
alignment = (alignment - 0.5) * orientation + 0.5;
|
|
16173
|
+
}
|
|
16174
|
+
// get first and last point.. figure out the middle!
|
|
16175
|
+
var firstPoint = new Point(points[0], points[1]);
|
|
16176
|
+
var lastPoint = new Point(points[points.length - 2], points[points.length - 1]);
|
|
16177
|
+
var closedShape = closed;
|
|
16178
|
+
var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
|
|
16179
|
+
// if the first point is the last point - gonna have issues :)
|
|
16180
|
+
if (closedShape) {
|
|
16181
|
+
// need to clone as we are going to slightly modify the shape..
|
|
16182
|
+
points = points.slice();
|
|
16183
|
+
if (closedPath) {
|
|
16184
|
+
points.pop();
|
|
16185
|
+
points.pop();
|
|
16186
|
+
lastPoint.set(points[points.length - 2], points[points.length - 1]);
|
|
16187
|
+
}
|
|
16188
|
+
var midPointX = (firstPoint.x + lastPoint.x) * 0.5;
|
|
16189
|
+
var midPointY = (lastPoint.y + firstPoint.y) * 0.5;
|
|
16190
|
+
points.unshift(midPointX, midPointY);
|
|
16191
|
+
points.push(midPointX, midPointY);
|
|
16192
|
+
}
|
|
16193
|
+
var verts = vertices;
|
|
16194
|
+
var length = points.length / 2;
|
|
16195
|
+
var indexCount = points.length;
|
|
16196
|
+
var indexStart = verts.length / 2;
|
|
16197
|
+
// Max. inner and outer width
|
|
16198
|
+
var width = style.width / 2;
|
|
16199
|
+
var widthSquared = width * width;
|
|
16200
|
+
var miterLimitSquared = style.miterLimit * style.miterLimit;
|
|
16201
|
+
/* Line segments of interest where (x1,y1) forms the corner. */ var x0 = points[0];
|
|
16202
|
+
var y0 = points[1];
|
|
16203
|
+
var x1 = points[2];
|
|
16204
|
+
var y1 = points[3];
|
|
16205
|
+
var x2 = 0;
|
|
16206
|
+
var y2 = 0;
|
|
16207
|
+
/* perp[?](x|y) = the line normal with magnitude lineWidth. */ var perpX = -(y0 - y1);
|
|
16208
|
+
var perpY = x0 - x1;
|
|
16209
|
+
var perp1x = 0;
|
|
16210
|
+
var perp1y = 0;
|
|
16211
|
+
var dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16212
|
+
perpX /= dist;
|
|
16213
|
+
perpY /= dist;
|
|
16214
|
+
perpX *= width;
|
|
16215
|
+
perpY *= width;
|
|
16216
|
+
var ratio = alignment; // 0.5;
|
|
16217
|
+
var innerWeight = (1 - ratio) * 2;
|
|
16218
|
+
var outerWeight = ratio * 2;
|
|
16219
|
+
if (!closedShape) {
|
|
16220
|
+
if (style.cap === "round") {
|
|
16221
|
+
indexCount += round(x0 - perpX * (innerWeight - outerWeight) * 0.5, y0 - perpY * (innerWeight - outerWeight) * 0.5, x0 - perpX * innerWeight, y0 - perpY * innerWeight, x0 + perpX * outerWeight, y0 + perpY * outerWeight, verts, true) + 2;
|
|
16222
|
+
} else if (style.cap === "square") {
|
|
16223
|
+
indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);
|
|
16224
|
+
}
|
|
16225
|
+
}
|
|
16226
|
+
// Push first point (below & above vertices)
|
|
16227
|
+
verts.push(x0 - perpX * innerWeight, y0 - perpY * innerWeight);
|
|
16228
|
+
verts.push(x0 + perpX * outerWeight, y0 + perpY * outerWeight);
|
|
16229
|
+
for(var i = 1; i < length - 1; ++i){
|
|
16230
|
+
x0 = points[(i - 1) * 2];
|
|
16231
|
+
y0 = points[(i - 1) * 2 + 1];
|
|
16232
|
+
x1 = points[i * 2];
|
|
16233
|
+
y1 = points[i * 2 + 1];
|
|
16234
|
+
x2 = points[(i + 1) * 2];
|
|
16235
|
+
y2 = points[(i + 1) * 2 + 1];
|
|
16236
|
+
perpX = -(y0 - y1);
|
|
16237
|
+
perpY = x0 - x1;
|
|
16238
|
+
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16239
|
+
perpX /= dist;
|
|
16240
|
+
perpY /= dist;
|
|
16241
|
+
perpX *= width;
|
|
16242
|
+
perpY *= width;
|
|
16243
|
+
perp1x = -(y1 - y2);
|
|
16244
|
+
perp1y = x1 - x2;
|
|
16245
|
+
dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
|
|
16246
|
+
perp1x /= dist;
|
|
16247
|
+
perp1y /= dist;
|
|
16248
|
+
perp1x *= width;
|
|
16249
|
+
perp1y *= width;
|
|
16250
|
+
/* d[x|y](0|1) = the component displacement between points p(0,1|1,2) */ var dx0 = x1 - x0;
|
|
16251
|
+
var dy0 = y0 - y1;
|
|
16252
|
+
var dx1 = x1 - x2;
|
|
16253
|
+
var dy1 = y2 - y1;
|
|
16254
|
+
/* +ve if internal angle < 90 degree, -ve if internal angle > 90 degree. */ var dot = dx0 * dx1 + dy0 * dy1;
|
|
16255
|
+
/* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ var cross = dy0 * dx1 - dy1 * dx0;
|
|
16256
|
+
var clockwise = cross < 0;
|
|
16257
|
+
/* Going nearly parallel? */ /* atan(0.001) ~= 0.001 rad ~= 0.057 degree */ if (Math.abs(cross) < 0.001 * Math.abs(dot)) {
|
|
16258
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16259
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16260
|
+
/* 180 degree corner? */ if (dot >= 0) {
|
|
16261
|
+
if (style.join === "round") {
|
|
16262
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
|
|
16263
|
+
} else {
|
|
16264
|
+
indexCount += 2;
|
|
16265
|
+
}
|
|
16266
|
+
verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
|
|
16267
|
+
verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
|
|
16268
|
+
}
|
|
16269
|
+
continue;
|
|
16270
|
+
}
|
|
16271
|
+
/* p[x|y] is the miter point. pDist is the distance between miter point and p1. */ var c1 = (-perpX + x0) * (-perpY + y1) - (-perpX + x1) * (-perpY + y0);
|
|
16272
|
+
var c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);
|
|
16273
|
+
var px = (dx0 * c2 - dx1 * c1) / cross;
|
|
16274
|
+
var py = (dy1 * c1 - dy0 * c2) / cross;
|
|
16275
|
+
var pDist = (px - x1) * (px - x1) + (py - y1) * (py - y1);
|
|
16276
|
+
/* Inner miter point */ var imx = x1 + (px - x1) * innerWeight;
|
|
16277
|
+
var imy = y1 + (py - y1) * innerWeight;
|
|
16278
|
+
/* Outer miter point */ var omx = x1 - (px - x1) * outerWeight;
|
|
16279
|
+
var omy = y1 - (py - y1) * outerWeight;
|
|
16280
|
+
/* Is the inside miter point too far away, creating a spike? */ var smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);
|
|
16281
|
+
var insideWeight = clockwise ? innerWeight : outerWeight;
|
|
16282
|
+
var smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
|
|
16283
|
+
var insideMiterOk = pDist <= smallerInsideDiagonalSq;
|
|
16284
|
+
if (insideMiterOk) {
|
|
16285
|
+
if (style.join === "bevel" || pDist / widthSquared > miterLimitSquared) {
|
|
16286
|
+
if (clockwise) /* rotating at inner angle */ {
|
|
16287
|
+
verts.push(imx, imy); // inner miter point
|
|
16288
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
16289
|
+
verts.push(imx, imy); // inner miter point
|
|
16290
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); // second segment's outer vertex
|
|
16291
|
+
} else /* rotating at outer angle */ {
|
|
16292
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight); // first segment's inner vertex
|
|
16293
|
+
verts.push(omx, omy); // outer miter point
|
|
16294
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); // second segment's outer vertex
|
|
16295
|
+
verts.push(omx, omy); // outer miter point
|
|
16296
|
+
}
|
|
16297
|
+
indexCount += 2;
|
|
16298
|
+
} else if (style.join === "round") {
|
|
16299
|
+
if (clockwise) /* arc is outside */ {
|
|
16300
|
+
verts.push(imx, imy);
|
|
16301
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16302
|
+
indexCount += round(x1, y1, x1 + perpX * outerWeight, y1 + perpY * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
|
|
16303
|
+
verts.push(imx, imy);
|
|
16304
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
|
16305
|
+
} else /* arc is inside */ {
|
|
16306
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16307
|
+
verts.push(omx, omy);
|
|
16308
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
|
|
16309
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
|
16310
|
+
verts.push(omx, omy);
|
|
16311
|
+
}
|
|
16312
|
+
} else {
|
|
16313
|
+
verts.push(imx, imy);
|
|
16314
|
+
verts.push(omx, omy);
|
|
16315
|
+
}
|
|
16316
|
+
} else {
|
|
16317
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight); // first segment's inner vertex
|
|
16318
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
16319
|
+
if (style.join === "round") {
|
|
16320
|
+
if (clockwise) /* arc is outside */ {
|
|
16321
|
+
indexCount += round(x1, y1, x1 + perpX * outerWeight, y1 + perpY * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
|
|
16322
|
+
} else /* arc is inside */ {
|
|
16323
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
|
|
16324
|
+
}
|
|
16325
|
+
} else if (style.join === "miter" && pDist / widthSquared <= miterLimitSquared) {
|
|
16326
|
+
if (clockwise) {
|
|
16327
|
+
verts.push(omx, omy); // inner miter point
|
|
16328
|
+
verts.push(omx, omy); // inner miter point
|
|
16329
|
+
} else {
|
|
16330
|
+
verts.push(imx, imy); // outer miter point
|
|
16331
|
+
verts.push(imx, imy); // outer miter point
|
|
16332
|
+
}
|
|
16333
|
+
indexCount += 2;
|
|
16334
|
+
}
|
|
16335
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); // second segment's inner vertex
|
|
16336
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); // second segment's outer vertex
|
|
16337
|
+
indexCount += 2;
|
|
16338
|
+
}
|
|
16339
|
+
}
|
|
16340
|
+
x0 = points[(length - 2) * 2];
|
|
16341
|
+
y0 = points[(length - 2) * 2 + 1];
|
|
16342
|
+
x1 = points[(length - 1) * 2];
|
|
16343
|
+
y1 = points[(length - 1) * 2 + 1];
|
|
16344
|
+
perpX = -(y0 - y1);
|
|
16345
|
+
perpY = x0 - x1;
|
|
16346
|
+
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16347
|
+
perpX /= dist;
|
|
16348
|
+
perpY /= dist;
|
|
16349
|
+
perpX *= width;
|
|
16350
|
+
perpY *= width;
|
|
16351
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16352
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16353
|
+
if (!closedShape) {
|
|
16354
|
+
if (style.cap === "round") {
|
|
16355
|
+
indexCount += round(x1 - perpX * (innerWeight - outerWeight) * 0.5, y1 - perpY * (innerWeight - outerWeight) * 0.5, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 + perpX * outerWeight, y1 + perpY * outerWeight, verts, false) + 2;
|
|
16356
|
+
} else if (style.cap === "square") {
|
|
16357
|
+
indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);
|
|
16358
|
+
}
|
|
16359
|
+
}
|
|
16360
|
+
// const indices = graphicsGeometry.indices;
|
|
16361
|
+
var eps2 = curveEps * curveEps;
|
|
16362
|
+
// indices.push(indexStart);
|
|
16363
|
+
for(var i1 = indexStart; i1 < indexCount + indexStart - 2; ++i1){
|
|
16364
|
+
x0 = verts[i1 * 2];
|
|
16365
|
+
y0 = verts[i1 * 2 + 1];
|
|
16366
|
+
x1 = verts[(i1 + 1) * 2];
|
|
16367
|
+
y1 = verts[(i1 + 1) * 2 + 1];
|
|
16368
|
+
x2 = verts[(i1 + 2) * 2];
|
|
16369
|
+
y2 = verts[(i1 + 2) * 2 + 1];
|
|
16370
|
+
/* Skip zero area triangles */ if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {
|
|
16371
|
+
continue;
|
|
16372
|
+
}
|
|
16373
|
+
indices.push(i1, i1 + 1, i1 + 2);
|
|
16374
|
+
}
|
|
16375
|
+
}
|
|
16376
|
+
|
|
15841
16377
|
var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
15842
16378
|
_inherits(ShapeComponent, MeshComponent);
|
|
15843
16379
|
function ShapeComponent(engine) {
|
|
15844
16380
|
var _this;
|
|
15845
16381
|
_this = MeshComponent.call(this, engine) || this;
|
|
15846
|
-
_this.
|
|
16382
|
+
_this.isStroke = false;
|
|
16383
|
+
_this.graphicsPath = new GraphicsPath();
|
|
15847
16384
|
_this.curveValues = [];
|
|
15848
|
-
_this.
|
|
16385
|
+
_this.shapeDirty = true;
|
|
15849
16386
|
_this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
|
|
15850
16387
|
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
|
|
15851
16388
|
if (!_this.geometry) {
|
|
@@ -15893,6 +16430,13 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15893
16430
|
_this.material.depthTest = true;
|
|
15894
16431
|
_this.material.blending = true;
|
|
15895
16432
|
}
|
|
16433
|
+
_this.strokeAttributes = {
|
|
16434
|
+
width: 1,
|
|
16435
|
+
alignment: 0.5,
|
|
16436
|
+
cap: "butt",
|
|
16437
|
+
join: "miter",
|
|
16438
|
+
miterLimit: 10
|
|
16439
|
+
};
|
|
15896
16440
|
return _this;
|
|
15897
16441
|
}
|
|
15898
16442
|
var _proto = ShapeComponent.prototype;
|
|
@@ -15900,10 +16444,10 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15900
16444
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
15901
16445
|
};
|
|
15902
16446
|
_proto.onUpdate = function onUpdate(dt) {
|
|
15903
|
-
if (this.
|
|
16447
|
+
if (this.shapeDirty) {
|
|
15904
16448
|
this.buildPath(this.data);
|
|
15905
|
-
this.buildGeometryFromPath(this.
|
|
15906
|
-
this.
|
|
16449
|
+
this.buildGeometryFromPath(this.graphicsPath.shapePath);
|
|
16450
|
+
this.shapeDirty = false;
|
|
15907
16451
|
}
|
|
15908
16452
|
};
|
|
15909
16453
|
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
|
|
@@ -15918,7 +16462,13 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15918
16462
|
var indexOffset = indices.length;
|
|
15919
16463
|
var vertOffset = vertices.length / 2;
|
|
15920
16464
|
shape.build(points);
|
|
15921
|
-
|
|
16465
|
+
if (!this.isStroke) {
|
|
16466
|
+
shape.triangulate(points, vertices, vertOffset, indices, indexOffset);
|
|
16467
|
+
} else {
|
|
16468
|
+
var close = true;
|
|
16469
|
+
var lineStyle = this.strokeAttributes;
|
|
16470
|
+
buildLine(points, lineStyle, false, close, vertices, 2, vertOffset, indices);
|
|
16471
|
+
}
|
|
15922
16472
|
}
|
|
15923
16473
|
var vertexCount = vertices.length / 2;
|
|
15924
16474
|
// get the current attribute and index arrays from the geometry, avoiding re-creation
|
|
@@ -15931,7 +16481,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15931
16481
|
if (!uvArray || uvArray.length < vertexCount * 2) {
|
|
15932
16482
|
uvArray = new Float32Array(vertexCount * 2);
|
|
15933
16483
|
}
|
|
15934
|
-
if (!indexArray) {
|
|
16484
|
+
if (!indexArray || indexArray.length < indices.length) {
|
|
15935
16485
|
indexArray = new Uint16Array(indices.length);
|
|
15936
16486
|
}
|
|
15937
16487
|
// set position and uv attribute array
|
|
@@ -15954,7 +16504,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15954
16504
|
this.geometry.setDrawCount(indices.length);
|
|
15955
16505
|
};
|
|
15956
16506
|
_proto.buildPath = function buildPath(data) {
|
|
15957
|
-
this.
|
|
16507
|
+
this.graphicsPath.clear();
|
|
15958
16508
|
var shapeData = data;
|
|
15959
16509
|
switch(shapeData.type){
|
|
15960
16510
|
case ShapePrimitiveType.Custom:
|
|
@@ -15963,9 +16513,9 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15963
16513
|
var points = customData.points;
|
|
15964
16514
|
var easingIns = customData.easingIns;
|
|
15965
16515
|
var easingOuts = customData.easingOuts;
|
|
15966
|
-
this.curveValues = [];
|
|
15967
16516
|
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
15968
16517
|
var shape = _step.value;
|
|
16518
|
+
this.curveValues = [];
|
|
15969
16519
|
this.setFillColor(shape.fill);
|
|
15970
16520
|
var indices = shape.indexes;
|
|
15971
16521
|
for(var i = 1; i < indices.length; i++){
|
|
@@ -15983,42 +16533,42 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15983
16533
|
controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
|
|
15984
16534
|
controlPoint2: easingIns[indices[0].easingIn]
|
|
15985
16535
|
});
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
|
|
15989
|
-
|
|
15990
|
-
|
|
15991
|
-
|
|
15992
|
-
|
|
15993
|
-
|
|
16536
|
+
this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
|
|
16537
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
|
|
16538
|
+
var curveValue = _step1.value;
|
|
16539
|
+
var point = curveValue.point;
|
|
16540
|
+
var control1 = curveValue.controlPoint1;
|
|
16541
|
+
var control2 = curveValue.controlPoint2;
|
|
16542
|
+
this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
|
|
16543
|
+
}
|
|
15994
16544
|
}
|
|
15995
16545
|
break;
|
|
15996
16546
|
}
|
|
15997
16547
|
case ShapePrimitiveType.Ellipse:
|
|
15998
16548
|
{
|
|
15999
16549
|
var ellipseData = shapeData;
|
|
16000
|
-
this.
|
|
16550
|
+
this.graphicsPath.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16001
16551
|
this.setFillColor(ellipseData.fill);
|
|
16002
16552
|
break;
|
|
16003
16553
|
}
|
|
16004
16554
|
case ShapePrimitiveType.Rectangle:
|
|
16005
16555
|
{
|
|
16006
16556
|
var rectangleData = shapeData;
|
|
16007
|
-
this.
|
|
16557
|
+
this.graphicsPath.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16008
16558
|
this.setFillColor(rectangleData.fill);
|
|
16009
16559
|
break;
|
|
16010
16560
|
}
|
|
16011
16561
|
case ShapePrimitiveType.Star:
|
|
16012
16562
|
{
|
|
16013
16563
|
var starData = shapeData;
|
|
16014
|
-
this.
|
|
16564
|
+
this.graphicsPath.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16015
16565
|
this.setFillColor(starData.fill);
|
|
16016
16566
|
break;
|
|
16017
16567
|
}
|
|
16018
16568
|
case ShapePrimitiveType.Polygon:
|
|
16019
16569
|
{
|
|
16020
16570
|
var polygonData = shapeData;
|
|
16021
|
-
this.
|
|
16571
|
+
this.graphicsPath.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16022
16572
|
this.setFillColor(polygonData.fill);
|
|
16023
16573
|
break;
|
|
16024
16574
|
}
|
|
@@ -16033,6 +16583,12 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16033
16583
|
_proto.fromData = function fromData(data) {
|
|
16034
16584
|
MeshComponent.prototype.fromData.call(this, data);
|
|
16035
16585
|
this.data = data;
|
|
16586
|
+
this.shapeDirty = true;
|
|
16587
|
+
var strokeParam = data.stroke;
|
|
16588
|
+
if (strokeParam) {
|
|
16589
|
+
this.isStroke = true;
|
|
16590
|
+
this.strokeAttributes.width = strokeParam.width;
|
|
16591
|
+
}
|
|
16036
16592
|
var material = this.material;
|
|
16037
16593
|
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16038
16594
|
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
@@ -16042,6 +16598,15 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16042
16598
|
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16043
16599
|
setMaskMode(material, data.renderer.maskMode);
|
|
16044
16600
|
};
|
|
16601
|
+
_create_class(ShapeComponent, [
|
|
16602
|
+
{
|
|
16603
|
+
key: "path",
|
|
16604
|
+
get: function get() {
|
|
16605
|
+
this.shapeDirty = true;
|
|
16606
|
+
return this.data;
|
|
16607
|
+
}
|
|
16608
|
+
}
|
|
16609
|
+
]);
|
|
16045
16610
|
return ShapeComponent;
|
|
16046
16611
|
}(MeshComponent);
|
|
16047
16612
|
ShapeComponent = __decorate([
|
|
@@ -16256,7 +16821,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
16256
16821
|
var vy = 0;
|
|
16257
16822
|
var ts = performance.now();
|
|
16258
16823
|
if (!_this.target) {
|
|
16259
|
-
logger.
|
|
16824
|
+
logger.warn("Trigger TouchEvent after EventSystem is disposed.");
|
|
16260
16825
|
return {
|
|
16261
16826
|
x: x,
|
|
16262
16827
|
y: y,
|
|
@@ -18729,10 +19294,19 @@ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
|
|
|
18729
19294
|
// 后处理配置相关
|
|
18730
19295
|
var POST_PROCESS_SETTINGS = "post_process_settings";
|
|
18731
19296
|
var config = {};
|
|
18732
|
-
|
|
19297
|
+
/**
|
|
19298
|
+
* 获取全局配置项
|
|
19299
|
+
* @param name
|
|
19300
|
+
* @returns
|
|
19301
|
+
*/ function getConfig(name) {
|
|
18733
19302
|
return config[name];
|
|
18734
19303
|
}
|
|
18735
|
-
|
|
19304
|
+
/**
|
|
19305
|
+
* 设置全局配置项
|
|
19306
|
+
* @param name
|
|
19307
|
+
* @param value
|
|
19308
|
+
* @returns
|
|
19309
|
+
*/ function setConfig(name, value) {
|
|
18736
19310
|
return config[name] = value;
|
|
18737
19311
|
}
|
|
18738
19312
|
|
|
@@ -23079,88 +23653,81 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23079
23653
|
return PropertyClipPlayable;
|
|
23080
23654
|
}(Playable);
|
|
23081
23655
|
|
|
23082
|
-
var
|
|
23083
|
-
_inherits(
|
|
23084
|
-
function
|
|
23656
|
+
var PropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
23657
|
+
_inherits(PropertyMixerPlayable, TrackMixerPlayable);
|
|
23658
|
+
function PropertyMixerPlayable() {
|
|
23085
23659
|
var _this;
|
|
23086
23660
|
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23087
23661
|
_this.propertyName = "";
|
|
23088
23662
|
return _this;
|
|
23089
23663
|
}
|
|
23090
|
-
var _proto =
|
|
23664
|
+
var _proto = PropertyMixerPlayable.prototype;
|
|
23091
23665
|
_proto.evaluate = function evaluate(context) {
|
|
23092
23666
|
var boundObject = context.output.getUserData();
|
|
23093
23667
|
if (!boundObject) {
|
|
23094
23668
|
return;
|
|
23095
23669
|
}
|
|
23096
23670
|
var hasInput = false;
|
|
23097
|
-
|
|
23098
|
-
if (
|
|
23671
|
+
this.propertyValue = boundObject[this.propertyName];
|
|
23672
|
+
if (this.propertyValue === undefined || this.propertyValue === null) {
|
|
23099
23673
|
return;
|
|
23100
23674
|
}
|
|
23101
|
-
|
|
23675
|
+
this.resetPropertyValue();
|
|
23102
23676
|
// evaluate the curve
|
|
23103
23677
|
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23104
23678
|
var weight = this.getClipWeight(i);
|
|
23105
23679
|
if (weight > 0) {
|
|
23106
23680
|
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23107
23681
|
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23108
|
-
console.error("
|
|
23682
|
+
console.error("PropertyTrack added non-PropertyPlayableAsset");
|
|
23109
23683
|
continue;
|
|
23110
23684
|
}
|
|
23111
23685
|
var curveValue = propertyClipPlayable.value;
|
|
23112
|
-
|
|
23113
|
-
value.g += curveValue.g * weight;
|
|
23114
|
-
value.b += curveValue.b * weight;
|
|
23115
|
-
value.a += curveValue.a * weight;
|
|
23686
|
+
this.addWeightedValue(curveValue, weight);
|
|
23116
23687
|
hasInput = true;
|
|
23117
23688
|
}
|
|
23118
23689
|
}
|
|
23119
23690
|
// set value
|
|
23120
23691
|
if (hasInput) {
|
|
23121
|
-
boundObject[this.propertyName] =
|
|
23692
|
+
boundObject[this.propertyName] = this.propertyValue;
|
|
23122
23693
|
}
|
|
23123
23694
|
};
|
|
23124
|
-
return
|
|
23695
|
+
return PropertyMixerPlayable;
|
|
23125
23696
|
}(TrackMixerPlayable);
|
|
23126
23697
|
|
|
23127
|
-
var
|
|
23128
|
-
_inherits(
|
|
23698
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
23699
|
+
_inherits(ColorPropertyMixerPlayable, PropertyMixerPlayable);
|
|
23700
|
+
function ColorPropertyMixerPlayable() {
|
|
23701
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23702
|
+
}
|
|
23703
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
23704
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
23705
|
+
this.propertyValue.setZero();
|
|
23706
|
+
};
|
|
23707
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
23708
|
+
var result = this.propertyValue;
|
|
23709
|
+
result.r += curveValue.r * weight;
|
|
23710
|
+
result.g += curveValue.g * weight;
|
|
23711
|
+
result.b += curveValue.b * weight;
|
|
23712
|
+
result.a += curveValue.a * weight;
|
|
23713
|
+
};
|
|
23714
|
+
return ColorPropertyMixerPlayable;
|
|
23715
|
+
}(PropertyMixerPlayable);
|
|
23716
|
+
|
|
23717
|
+
var FloatPropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
23718
|
+
_inherits(FloatPropertyMixerPlayable, PropertyMixerPlayable);
|
|
23129
23719
|
function FloatPropertyMixerPlayable() {
|
|
23130
|
-
|
|
23131
|
-
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23132
|
-
_this.propertyName = "";
|
|
23133
|
-
return _this;
|
|
23720
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23134
23721
|
}
|
|
23135
23722
|
var _proto = FloatPropertyMixerPlayable.prototype;
|
|
23136
|
-
_proto.
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
var hasInput = false;
|
|
23142
|
-
var value = 0;
|
|
23143
|
-
// evaluate the curve
|
|
23144
|
-
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23145
|
-
var weight = this.getClipWeight(i);
|
|
23146
|
-
if (weight > 0) {
|
|
23147
|
-
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23148
|
-
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23149
|
-
console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
|
|
23150
|
-
continue;
|
|
23151
|
-
}
|
|
23152
|
-
var curveValue = propertyClipPlayable.value;
|
|
23153
|
-
value += curveValue * weight;
|
|
23154
|
-
hasInput = true;
|
|
23155
|
-
}
|
|
23156
|
-
}
|
|
23157
|
-
// set value
|
|
23158
|
-
if (hasInput) {
|
|
23159
|
-
boundObject[this.propertyName] = value;
|
|
23160
|
-
}
|
|
23723
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
23724
|
+
this.propertyValue = 0;
|
|
23725
|
+
};
|
|
23726
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
23727
|
+
this.propertyValue += curveValue * weight;
|
|
23161
23728
|
};
|
|
23162
23729
|
return FloatPropertyMixerPlayable;
|
|
23163
|
-
}(
|
|
23730
|
+
}(PropertyMixerPlayable);
|
|
23164
23731
|
|
|
23165
23732
|
var ParticleMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
23166
23733
|
_inherits(ParticleMixerPlayable, TrackMixerPlayable);
|
|
@@ -23904,50 +24471,40 @@ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
23904
24471
|
return TransformMixerPlayable;
|
|
23905
24472
|
}(TrackMixerPlayable);
|
|
23906
24473
|
|
|
23907
|
-
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(
|
|
23908
|
-
_inherits(Vector4PropertyMixerPlayable,
|
|
24474
|
+
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
24475
|
+
_inherits(Vector4PropertyMixerPlayable, PropertyMixerPlayable);
|
|
23909
24476
|
function Vector4PropertyMixerPlayable() {
|
|
23910
|
-
|
|
23911
|
-
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23912
|
-
_this.propertyName = "";
|
|
23913
|
-
return _this;
|
|
24477
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23914
24478
|
}
|
|
23915
24479
|
var _proto = Vector4PropertyMixerPlayable.prototype;
|
|
23916
|
-
_proto.
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
}
|
|
23926
|
-
value.setZero();
|
|
23927
|
-
// evaluate the curve
|
|
23928
|
-
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23929
|
-
var weight = this.getClipWeight(i);
|
|
23930
|
-
if (weight > 0) {
|
|
23931
|
-
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23932
|
-
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23933
|
-
console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
|
|
23934
|
-
continue;
|
|
23935
|
-
}
|
|
23936
|
-
var curveValue = propertyClipPlayable.value;
|
|
23937
|
-
value.x += curveValue.x * weight;
|
|
23938
|
-
value.y += curveValue.y * weight;
|
|
23939
|
-
value.z += curveValue.z * weight;
|
|
23940
|
-
value.w += curveValue.w * weight;
|
|
23941
|
-
hasInput = true;
|
|
23942
|
-
}
|
|
23943
|
-
}
|
|
23944
|
-
// set value
|
|
23945
|
-
if (hasInput) {
|
|
23946
|
-
boundObject[this.propertyName] = value;
|
|
23947
|
-
}
|
|
24480
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24481
|
+
this.propertyValue.setZero();
|
|
24482
|
+
};
|
|
24483
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24484
|
+
var result = this.propertyValue;
|
|
24485
|
+
result.x += curveValue.x * weight;
|
|
24486
|
+
result.y += curveValue.y * weight;
|
|
24487
|
+
result.z += curveValue.z * weight;
|
|
24488
|
+
result.w += curveValue.w * weight;
|
|
23948
24489
|
};
|
|
23949
24490
|
return Vector4PropertyMixerPlayable;
|
|
23950
|
-
}(
|
|
24491
|
+
}(PropertyMixerPlayable);
|
|
24492
|
+
var Vector2PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
24493
|
+
_inherits(Vector2PropertyMixerPlayable, PropertyMixerPlayable);
|
|
24494
|
+
function Vector2PropertyMixerPlayable() {
|
|
24495
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
24496
|
+
}
|
|
24497
|
+
var _proto = Vector2PropertyMixerPlayable.prototype;
|
|
24498
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24499
|
+
this.propertyValue.setZero();
|
|
24500
|
+
};
|
|
24501
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24502
|
+
var result = this.propertyValue;
|
|
24503
|
+
result.x += curveValue.x * weight;
|
|
24504
|
+
result.y += curveValue.y * weight;
|
|
24505
|
+
};
|
|
24506
|
+
return Vector2PropertyMixerPlayable;
|
|
24507
|
+
}(PropertyMixerPlayable);
|
|
23951
24508
|
|
|
23952
24509
|
/**
|
|
23953
24510
|
* @since 2.0.0
|
|
@@ -24328,6 +24885,26 @@ var Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
24328
24885
|
Vector4PropertyTrack = __decorate([
|
|
24329
24886
|
effectsClass(DataType.Vector4PropertyTrack)
|
|
24330
24887
|
], Vector4PropertyTrack);
|
|
24888
|
+
var Vector2PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
24889
|
+
_inherits(Vector2PropertyTrack, PropertyTrack);
|
|
24890
|
+
function Vector2PropertyTrack() {
|
|
24891
|
+
return PropertyTrack.apply(this, arguments);
|
|
24892
|
+
}
|
|
24893
|
+
var _proto = Vector2PropertyTrack.prototype;
|
|
24894
|
+
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
24895
|
+
var mixer = new Vector2PropertyMixerPlayable(graph);
|
|
24896
|
+
var propertyNames = this.propertyNames;
|
|
24897
|
+
if (propertyNames.length > 0) {
|
|
24898
|
+
var propertyName = propertyNames[propertyNames.length - 1];
|
|
24899
|
+
mixer.propertyName = propertyName;
|
|
24900
|
+
}
|
|
24901
|
+
return mixer;
|
|
24902
|
+
};
|
|
24903
|
+
return Vector2PropertyTrack;
|
|
24904
|
+
}(PropertyTrack);
|
|
24905
|
+
Vector2PropertyTrack = __decorate([
|
|
24906
|
+
effectsClass("Vector2PropertyTrack")
|
|
24907
|
+
], Vector2PropertyTrack);
|
|
24331
24908
|
|
|
24332
24909
|
var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
24333
24910
|
_inherits(ColorPropertyTrack, PropertyTrack);
|
|
@@ -24594,8 +25171,28 @@ __decorate([
|
|
|
24594
25171
|
serialize()
|
|
24595
25172
|
], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24596
25173
|
Vector4PropertyPlayableAsset = __decorate([
|
|
24597
|
-
effectsClass(
|
|
25174
|
+
effectsClass(DataType.Vector4PropertyPlayableAsset)
|
|
24598
25175
|
], Vector4PropertyPlayableAsset);
|
|
25176
|
+
var Vector2PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
25177
|
+
_inherits(Vector2PropertyPlayableAsset, PlayableAsset);
|
|
25178
|
+
function Vector2PropertyPlayableAsset() {
|
|
25179
|
+
return PlayableAsset.apply(this, arguments);
|
|
25180
|
+
}
|
|
25181
|
+
var _proto = Vector2PropertyPlayableAsset.prototype;
|
|
25182
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
25183
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
25184
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
25185
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
25186
|
+
return clipPlayable;
|
|
25187
|
+
};
|
|
25188
|
+
return Vector2PropertyPlayableAsset;
|
|
25189
|
+
}(PlayableAsset);
|
|
25190
|
+
__decorate([
|
|
25191
|
+
serialize()
|
|
25192
|
+
], Vector2PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
25193
|
+
Vector2PropertyPlayableAsset = __decorate([
|
|
25194
|
+
effectsClass(DataType.Vector2PropertyPlayableAsset)
|
|
25195
|
+
], Vector2PropertyPlayableAsset);
|
|
24599
25196
|
|
|
24600
25197
|
var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
24601
25198
|
_inherits(ObjectBindingTrack, TrackAsset);
|
|
@@ -25978,7 +26575,7 @@ function getStandardInteractContent(ui) {
|
|
|
25978
26575
|
}
|
|
25979
26576
|
});
|
|
25980
26577
|
});
|
|
25981
|
-
json.version = "
|
|
26578
|
+
json.version = JSONSceneVersion["2_1"];
|
|
25982
26579
|
return json;
|
|
25983
26580
|
}
|
|
25984
26581
|
/**
|
|
@@ -25998,6 +26595,18 @@ function getStandardInteractContent(ui) {
|
|
|
25998
26595
|
});
|
|
25999
26596
|
return json;
|
|
26000
26597
|
}
|
|
26598
|
+
/**
|
|
26599
|
+
* 3.1 版本数据适配
|
|
26600
|
+
* - 富文本插件名称的适配
|
|
26601
|
+
*/ function version31Migration(json) {
|
|
26602
|
+
var _json_plugins;
|
|
26603
|
+
(_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
|
|
26604
|
+
if (plugin === "richtext") {
|
|
26605
|
+
json.plugins[index] = "rich-text";
|
|
26606
|
+
}
|
|
26607
|
+
});
|
|
26608
|
+
return json;
|
|
26609
|
+
}
|
|
26001
26610
|
/**
|
|
26002
26611
|
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
26003
26612
|
*/ function version30Migration(json) {
|
|
@@ -26305,7 +26914,7 @@ function getStandardInteractContent(ui) {
|
|
|
26305
26914
|
break;
|
|
26306
26915
|
}
|
|
26307
26916
|
}
|
|
26308
|
-
result.version = "
|
|
26917
|
+
result.version = JSONSceneVersion["3_0"];
|
|
26309
26918
|
return result;
|
|
26310
26919
|
}
|
|
26311
26920
|
/**
|
|
@@ -26825,6 +27434,8 @@ function getStandardJSON(json) {
|
|
|
26825
27434
|
}
|
|
26826
27435
|
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
26827
27436
|
version22Migration(json);
|
|
27437
|
+
// 修正老版本数据中,富文本插件名称的问题
|
|
27438
|
+
version31Migration(json);
|
|
26828
27439
|
if (v0.test(json.version)) {
|
|
26829
27440
|
var _exec;
|
|
26830
27441
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
@@ -26845,13 +27456,13 @@ function getStandardJSON(json) {
|
|
|
26845
27456
|
}
|
|
26846
27457
|
throw new Error("Invalid JSON version: " + json.version + ".");
|
|
26847
27458
|
}
|
|
26848
|
-
var currentVersion = "
|
|
27459
|
+
var currentVersion = JSONSceneVersion["1_0"];
|
|
26849
27460
|
function getStandardJSONFromV0(json) {
|
|
26850
27461
|
var _json_bins;
|
|
26851
|
-
currentVersion = "
|
|
27462
|
+
currentVersion = JSONSceneVersion["1_0"];
|
|
26852
27463
|
var plugins = json.plugins || [];
|
|
26853
27464
|
if ((_json_bins = json.bins) == null ? void 0 : _json_bins.length) {
|
|
26854
|
-
currentVersion = "
|
|
27465
|
+
currentVersion = JSONSceneVersion["1_3"];
|
|
26855
27466
|
}
|
|
26856
27467
|
var requires = (json.requires || []).slice();
|
|
26857
27468
|
var images = json.images.map(function(img, index) {
|
|
@@ -28774,7 +29385,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28774
29385
|
*/ _proto.getSpeed = function getSpeed() {
|
|
28775
29386
|
return this.speed;
|
|
28776
29387
|
};
|
|
28777
|
-
|
|
29388
|
+
/**
|
|
29389
|
+
*
|
|
29390
|
+
*/ _proto.play = function play() {
|
|
28778
29391
|
if (this.isEnded && this.reusable) {
|
|
28779
29392
|
this.restart();
|
|
28780
29393
|
}
|
|
@@ -28789,7 +29402,10 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28789
29402
|
*/ _proto.pause = function pause() {
|
|
28790
29403
|
this.paused = true;
|
|
28791
29404
|
};
|
|
28792
|
-
|
|
29405
|
+
/**
|
|
29406
|
+
*
|
|
29407
|
+
* @returns
|
|
29408
|
+
*/ _proto.getPaused = function getPaused() {
|
|
28793
29409
|
return this.paused;
|
|
28794
29410
|
};
|
|
28795
29411
|
/**
|
|
@@ -31367,8 +31983,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
31367
31983
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
31368
31984
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
31369
31985
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
31370
|
-
var version = "2.
|
|
31986
|
+
var version = "2.3.0-alpha.0";
|
|
31371
31987
|
logger.info("Core version: " + version + ".");
|
|
31372
31988
|
|
|
31373
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
31989
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
31374
31990
|
//# sourceMappingURL=index.mjs.map
|