@galacean/effects-threejs 2.2.6 → 2.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1254 -578
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1254 -579
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.
|
|
6
|
+
* Version: v2.3.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -1020,6 +1020,26 @@ function _inherits(subClass, superClass) {
|
|
|
1020
1020
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
+
/**
|
|
1024
|
+
* JSON 版本
|
|
1025
|
+
*/ var JSONSceneVersion;
|
|
1026
|
+
(function(JSONSceneVersion) {
|
|
1027
|
+
JSONSceneVersion["1_0"] = "1.0";
|
|
1028
|
+
JSONSceneVersion["1_1"] = "1.1";
|
|
1029
|
+
JSONSceneVersion["1_2"] = "1.2";
|
|
1030
|
+
JSONSceneVersion["1_3"] = "1.3";
|
|
1031
|
+
JSONSceneVersion["1_5"] = "1.5";
|
|
1032
|
+
JSONSceneVersion["1_8"] = "1.8";
|
|
1033
|
+
JSONSceneVersion["2_0"] = "2.0";
|
|
1034
|
+
JSONSceneVersion["2_1"] = "2.1";
|
|
1035
|
+
JSONSceneVersion["2_2"] = "2.2";
|
|
1036
|
+
JSONSceneVersion["2_3"] = "2.3";
|
|
1037
|
+
JSONSceneVersion["2_4"] = "2.4";
|
|
1038
|
+
JSONSceneVersion["3_0"] = "3.0";
|
|
1039
|
+
JSONSceneVersion["3_1"] = "3.1";
|
|
1040
|
+
JSONSceneVersion["LATEST"] = "3.1";
|
|
1041
|
+
})(JSONSceneVersion || (JSONSceneVersion = {}));
|
|
1042
|
+
|
|
1023
1043
|
/*********************************************/ /* 元素属性参数类型 */ /*********************************************/ /**
|
|
1024
1044
|
* 渲染等级
|
|
1025
1045
|
*/ var RenderLevel;
|
|
@@ -1325,8 +1345,12 @@ var RenderFace;
|
|
|
1325
1345
|
*/ var END_BEHAVIOR_DESTROY_CHILDREN = 6;
|
|
1326
1346
|
var CAMERA_CLIP_MODE_VERTICAL = 1;
|
|
1327
1347
|
var CAMERA_CLIP_MODE_NORMAL = 0;
|
|
1328
|
-
|
|
1329
|
-
|
|
1348
|
+
/**
|
|
1349
|
+
* 消息开始
|
|
1350
|
+
*/ var MESSAGE_ITEM_PHRASE_BEGIN = 2;
|
|
1351
|
+
/**
|
|
1352
|
+
* 消息结束
|
|
1353
|
+
*/ var MESSAGE_ITEM_PHRASE_END = 1;
|
|
1330
1354
|
|
|
1331
1355
|
var CameraClipMode;
|
|
1332
1356
|
(function(CameraClipMode) {
|
|
@@ -1400,6 +1424,9 @@ var CameraClipMode;
|
|
|
1400
1424
|
/**
|
|
1401
1425
|
* Vector4 曲线
|
|
1402
1426
|
*/ ValueType[ValueType["VECTOR4_CURVE"] = 25] = "VECTOR4_CURVE";
|
|
1427
|
+
/**
|
|
1428
|
+
* Vector2 曲线
|
|
1429
|
+
*/ ValueType[ValueType["VECTOR2_CURVE"] = 26] = "VECTOR2_CURVE";
|
|
1403
1430
|
})(ValueType || (ValueType = {}));
|
|
1404
1431
|
/**
|
|
1405
1432
|
* 关键帧类型
|
|
@@ -1668,19 +1695,13 @@ var ShapePointType;
|
|
|
1668
1695
|
var DataType;
|
|
1669
1696
|
(function(DataType) {
|
|
1670
1697
|
DataType["VFXItemData"] = "VFXItemData";
|
|
1671
|
-
|
|
1698
|
+
// Assets
|
|
1672
1699
|
DataType["Material"] = "Material";
|
|
1673
1700
|
DataType["Shader"] = "Shader";
|
|
1674
|
-
DataType["SpriteComponent"] = "SpriteComponent";
|
|
1675
|
-
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1676
|
-
DataType["InteractComponent"] = "InteractComponent";
|
|
1677
|
-
DataType["CameraController"] = "CameraController";
|
|
1678
|
-
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1679
1701
|
DataType["Geometry"] = "Geometry";
|
|
1680
1702
|
DataType["Texture"] = "Texture";
|
|
1681
1703
|
DataType["Image"] = "Image";
|
|
1682
1704
|
DataType["AnimationClip"] = "AnimationClip";
|
|
1683
|
-
DataType["TextComponent"] = "TextComponent";
|
|
1684
1705
|
DataType["BinaryAsset"] = "BinaryAsset";
|
|
1685
1706
|
// Timeline
|
|
1686
1707
|
DataType["TrackAsset"] = "TrackAsset";
|
|
@@ -1692,6 +1713,7 @@ var DataType;
|
|
|
1692
1713
|
DataType["SubCompositionTrack"] = "SubCompositionTrack";
|
|
1693
1714
|
DataType["FloatPropertyTrack"] = "FloatPropertyTrack";
|
|
1694
1715
|
DataType["ColorPropertyTrack"] = "ColorPropertyTrack";
|
|
1716
|
+
DataType["Vector2PropertyTrack"] = "Vector2PropertyTrack";
|
|
1695
1717
|
DataType["Vector4PropertyTrack"] = "Vector4PropertyTrack";
|
|
1696
1718
|
DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
|
|
1697
1719
|
DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
|
|
@@ -1699,6 +1721,9 @@ var DataType;
|
|
|
1699
1721
|
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1700
1722
|
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1701
1723
|
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1724
|
+
DataType["Vector2PropertyPlayableAsset"] = "Vector2PropertyPlayableAsset";
|
|
1725
|
+
DataType["Vector4PropertyPlayableAsset"] = "Vector4PropertyPlayableAsset";
|
|
1726
|
+
// Components
|
|
1702
1727
|
DataType["MeshComponent"] = "MeshComponent";
|
|
1703
1728
|
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1704
1729
|
DataType["LightComponent"] = "LightComponent";
|
|
@@ -1712,6 +1737,13 @@ var DataType;
|
|
|
1712
1737
|
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1713
1738
|
DataType["OrientationComponent"] = "OrientationComponent";
|
|
1714
1739
|
DataType["ShapeComponent"] = "ShapeComponent";
|
|
1740
|
+
DataType["SpriteComponent"] = "SpriteComponent";
|
|
1741
|
+
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1742
|
+
DataType["InteractComponent"] = "InteractComponent";
|
|
1743
|
+
DataType["CameraController"] = "CameraController";
|
|
1744
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1745
|
+
DataType["EffectComponent"] = "EffectComponent";
|
|
1746
|
+
DataType["TextComponent"] = "TextComponent";
|
|
1715
1747
|
// Non-EffectObject
|
|
1716
1748
|
DataType["TimelineClip"] = "TimelineClip";
|
|
1717
1749
|
})(DataType || (DataType = {}));
|
|
@@ -1800,8 +1832,11 @@ var VertexBufferSemantic;
|
|
|
1800
1832
|
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1801
1833
|
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1802
1834
|
|
|
1835
|
+
var LATEST_VERSION = JSONSceneVersion.LATEST;
|
|
1836
|
+
|
|
1803
1837
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1804
1838
|
__proto__: null,
|
|
1839
|
+
LATEST_VERSION: LATEST_VERSION,
|
|
1805
1840
|
get RenderLevel () { return RenderLevel; },
|
|
1806
1841
|
get BlendingMode () { return BlendingMode; },
|
|
1807
1842
|
get SideMode () { return SideMode; },
|
|
@@ -1829,6 +1864,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1829
1864
|
MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
|
|
1830
1865
|
get ValueType () { return ValueType; },
|
|
1831
1866
|
get BezierKeyframeType () { return BezierKeyframeType; },
|
|
1867
|
+
get JSONSceneVersion () { return JSONSceneVersion; },
|
|
1832
1868
|
get EndBehavior () { return EndBehavior; },
|
|
1833
1869
|
get ParentItemEndBehavior () { return ParentItemEndBehavior; },
|
|
1834
1870
|
get ParticleInteractionBehavior () { return ParticleInteractionBehavior; },
|
|
@@ -5276,418 +5312,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
5276
5312
|
Matrix4.tempVec2 = new Vector3();
|
|
5277
5313
|
Matrix4.tempMat0 = new Matrix4();
|
|
5278
5314
|
|
|
5279
|
-
function _array_like_to_array(arr, len) {
|
|
5280
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
5281
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5282
|
-
return arr2;
|
|
5283
|
-
}
|
|
5284
|
-
|
|
5285
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
5286
|
-
if (!o) return;
|
|
5287
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
5288
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5289
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5290
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5291
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
5292
|
-
}
|
|
5293
|
-
|
|
5294
|
-
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
5295
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
5296
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
5297
|
-
// Fallback for engines without symbol support
|
|
5298
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
5299
|
-
if (it) o = it;
|
|
5300
|
-
var i = 0;
|
|
5301
|
-
return function() {
|
|
5302
|
-
if (i >= o.length) return {
|
|
5303
|
-
done: true
|
|
5304
|
-
};
|
|
5305
|
-
return {
|
|
5306
|
-
done: false,
|
|
5307
|
-
value: o[i++]
|
|
5308
|
-
};
|
|
5309
|
-
};
|
|
5310
|
-
}
|
|
5311
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5312
|
-
}
|
|
5313
|
-
|
|
5314
|
-
var ShaderCompileResultStatus;
|
|
5315
|
-
(function(ShaderCompileResultStatus) {
|
|
5316
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
|
|
5317
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
|
|
5318
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
|
|
5319
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
|
|
5320
|
-
})(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
|
|
5321
|
-
var GLSLVersion;
|
|
5322
|
-
(function(GLSLVersion) {
|
|
5323
|
-
GLSLVersion["GLSL1"] = "100";
|
|
5324
|
-
GLSLVersion["GLSL3"] = "300 es";
|
|
5325
|
-
})(GLSLVersion || (GLSLVersion = {}));
|
|
5326
|
-
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
5327
|
-
_inherits(ShaderVariant, EffectsObject);
|
|
5328
|
-
function ShaderVariant(engine, source) {
|
|
5329
|
-
var _this;
|
|
5330
|
-
_this = EffectsObject.call(this, engine) || this;
|
|
5331
|
-
_this.source = source;
|
|
5332
|
-
return _this;
|
|
5333
|
-
}
|
|
5334
|
-
return ShaderVariant;
|
|
5335
|
-
}(EffectsObject);
|
|
5336
|
-
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
5337
|
-
_inherits(Shader, EffectsObject);
|
|
5338
|
-
function Shader() {
|
|
5339
|
-
return EffectsObject.apply(this, arguments);
|
|
5340
|
-
}
|
|
5341
|
-
var _proto = Shader.prototype;
|
|
5342
|
-
_proto.createVariant = function createVariant(macros) {
|
|
5343
|
-
var shaderMacros = [];
|
|
5344
|
-
if (macros) {
|
|
5345
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
|
|
5346
|
-
var key = _step.value;
|
|
5347
|
-
shaderMacros.push([
|
|
5348
|
-
key,
|
|
5349
|
-
macros[key]
|
|
5350
|
-
]);
|
|
5351
|
-
}
|
|
5352
|
-
}
|
|
5353
|
-
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
5354
|
-
shaderVariant.shader = this;
|
|
5355
|
-
return shaderVariant;
|
|
5356
|
-
};
|
|
5357
|
-
_proto.fromData = function fromData(data) {
|
|
5358
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
5359
|
-
this.shaderData = data;
|
|
5360
|
-
};
|
|
5361
|
-
return Shader;
|
|
5362
|
-
}(EffectsObject);
|
|
5363
|
-
Shader = __decorate([
|
|
5364
|
-
effectsClass(DataType.Shader)
|
|
5365
|
-
], Shader);
|
|
5366
|
-
|
|
5367
|
-
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
5368
|
-
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
5369
|
-
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}";
|
|
5370
|
-
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";
|
|
5371
|
-
function createCopyShader(level, writeDepth) {
|
|
5372
|
-
var webgl2 = level === 2;
|
|
5373
|
-
return {
|
|
5374
|
-
name: EFFECTS_COPY_MESH_NAME,
|
|
5375
|
-
vertex: COPY_VERTEX_SHADER,
|
|
5376
|
-
fragment: COPY_FRAGMENT_SHADER,
|
|
5377
|
-
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
5378
|
-
macros: [
|
|
5379
|
-
[
|
|
5380
|
-
"DEPTH_TEXTURE",
|
|
5381
|
-
!!writeDepth
|
|
5382
|
-
]
|
|
5383
|
-
],
|
|
5384
|
-
// @ts-expect-error
|
|
5385
|
-
cacheId: COPY_MESH_SHADER_ID + +writeDepth
|
|
5386
|
-
};
|
|
5387
|
-
}
|
|
5388
|
-
|
|
5389
|
-
/**
|
|
5390
|
-
* Helper class to create a WebGL Context
|
|
5391
|
-
*
|
|
5392
|
-
* @param canvas
|
|
5393
|
-
* @param glType
|
|
5394
|
-
* @param options
|
|
5395
|
-
* @returns
|
|
5396
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
5397
|
-
if (glType === void 0) glType = "webgl";
|
|
5398
|
-
var context;
|
|
5399
|
-
if (glType === "webgl2") {
|
|
5400
|
-
context = canvas.getContext("webgl2", options);
|
|
5401
|
-
if (!context) {
|
|
5402
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
5403
|
-
}
|
|
5404
|
-
}
|
|
5405
|
-
if (!context || glType === "webgl") {
|
|
5406
|
-
context = canvas.getContext("webgl", options);
|
|
5407
|
-
}
|
|
5408
|
-
if (!context) {
|
|
5409
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
5410
|
-
}
|
|
5411
|
-
return context;
|
|
5412
|
-
}
|
|
5413
|
-
|
|
5414
|
-
function gpuTimer(gl) {
|
|
5415
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
5416
|
-
if (ext) {
|
|
5417
|
-
var query = gl.createQuery();
|
|
5418
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
5419
|
-
return __generator(this, function(_state) {
|
|
5420
|
-
return [
|
|
5421
|
-
2,
|
|
5422
|
-
new Promise(function(resolve, reject) {
|
|
5423
|
-
if (query) {
|
|
5424
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
5425
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
5426
|
-
if (available && !disjoint) {
|
|
5427
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
5428
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
5429
|
-
// taken to use all significant bits of the result, not just the
|
|
5430
|
-
// least significant 32 bits.
|
|
5431
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
5432
|
-
}
|
|
5433
|
-
if (available || disjoint) {
|
|
5434
|
-
// Clean up the query object.
|
|
5435
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
5436
|
-
query = null;
|
|
5437
|
-
}
|
|
5438
|
-
available !== null && query && window.setTimeout(function() {
|
|
5439
|
-
getTime().then(resolve).catch;
|
|
5440
|
-
}, 1);
|
|
5441
|
-
}
|
|
5442
|
-
})
|
|
5443
|
-
];
|
|
5444
|
-
});
|
|
5445
|
-
});
|
|
5446
|
-
if (!query) {
|
|
5447
|
-
return;
|
|
5448
|
-
}
|
|
5449
|
-
return {
|
|
5450
|
-
begin: function() {
|
|
5451
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
5452
|
-
},
|
|
5453
|
-
end: function() {
|
|
5454
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
5455
|
-
},
|
|
5456
|
-
getTime: getTime
|
|
5457
|
-
};
|
|
5458
|
-
}
|
|
5459
|
-
}
|
|
5460
|
-
|
|
5461
|
-
var initErrors = [];
|
|
5462
|
-
// @ts-expect-error
|
|
5463
|
-
var glContext = {};
|
|
5464
|
-
if (!initErrors.length) {
|
|
5465
|
-
initGLContext();
|
|
5466
|
-
}
|
|
5467
|
-
function initGLContext() {
|
|
5468
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
5469
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
5470
|
-
copy(WebGL2RenderingContext);
|
|
5471
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
5472
|
-
copy(WebGLRenderingContext);
|
|
5473
|
-
copy(WebGLRenderingContext.prototype);
|
|
5474
|
-
} else {
|
|
5475
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
5476
|
-
"iOS16 lockdown mode, WebGL Constants not in global");
|
|
5477
|
-
}
|
|
5478
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
5479
|
-
// @ts-expect-error set default value
|
|
5480
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
function isWebGL2(gl) {
|
|
5484
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
5485
|
-
}
|
|
5486
|
-
function copy(target) {
|
|
5487
|
-
for(var name in target){
|
|
5488
|
-
if (/^[A-Z_]/.test(name)) {
|
|
5489
|
-
// @ts-expect-error safe to assign
|
|
5490
|
-
glContext[name] = target[name];
|
|
5491
|
-
}
|
|
5492
|
-
}
|
|
5493
|
-
}
|
|
5494
|
-
function vertexFormatType2GLType(formatType) {
|
|
5495
|
-
switch(formatType){
|
|
5496
|
-
case VertexFormatType.Float32:
|
|
5497
|
-
return WebGLRenderingContext["FLOAT"];
|
|
5498
|
-
case VertexFormatType.Int16:
|
|
5499
|
-
return WebGLRenderingContext["SHORT"];
|
|
5500
|
-
case VertexFormatType.Int8:
|
|
5501
|
-
return WebGLRenderingContext["BYTE"];
|
|
5502
|
-
case VertexFormatType.UInt16:
|
|
5503
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
5504
|
-
case VertexFormatType.UInt8:
|
|
5505
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
5506
|
-
default:
|
|
5507
|
-
return WebGLRenderingContext["FLOAT"];
|
|
5508
|
-
}
|
|
5509
|
-
}
|
|
5510
|
-
function glType2VertexFormatType(webglType) {
|
|
5511
|
-
switch(webglType){
|
|
5512
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
5513
|
-
return VertexFormatType.Float32;
|
|
5514
|
-
case WebGLRenderingContext["SHORT"]:
|
|
5515
|
-
return VertexFormatType.Int16;
|
|
5516
|
-
case WebGLRenderingContext["BYTE"]:
|
|
5517
|
-
return VertexFormatType.Int8;
|
|
5518
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
5519
|
-
return VertexFormatType.UInt16;
|
|
5520
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
5521
|
-
return VertexFormatType.UInt8;
|
|
5522
|
-
default:
|
|
5523
|
-
return VertexFormatType.Float32;
|
|
5524
|
-
}
|
|
5525
|
-
}
|
|
5526
|
-
|
|
5527
|
-
var ShaderType;
|
|
5528
|
-
(function(ShaderType) {
|
|
5529
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
5530
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
5531
|
-
})(ShaderType || (ShaderType = {}));
|
|
5532
|
-
|
|
5533
|
-
function valIfUndefined(val, def) {
|
|
5534
|
-
if (val === undefined || val === null) {
|
|
5535
|
-
return def;
|
|
5536
|
-
}
|
|
5537
|
-
return val;
|
|
5538
|
-
}
|
|
5539
|
-
function getPreMultiAlpha(blending) {
|
|
5540
|
-
switch(blending){
|
|
5541
|
-
case BlendingMode.ALPHA:
|
|
5542
|
-
return 1;
|
|
5543
|
-
case BlendingMode.ADD:
|
|
5544
|
-
return 1;
|
|
5545
|
-
case BlendingMode.SUBTRACTION:
|
|
5546
|
-
return 1;
|
|
5547
|
-
case BlendingMode.STRONG_LIGHT:
|
|
5548
|
-
return 1;
|
|
5549
|
-
case BlendingMode.WEAK_LIGHT:
|
|
5550
|
-
return 1;
|
|
5551
|
-
case BlendingMode.SUPERPOSITION:
|
|
5552
|
-
return 2;
|
|
5553
|
-
case BlendingMode.BRIGHTNESS:
|
|
5554
|
-
return 3;
|
|
5555
|
-
case BlendingMode.MULTIPLY:
|
|
5556
|
-
return 0;
|
|
5557
|
-
default:
|
|
5558
|
-
// 处理undefined
|
|
5559
|
-
return 1;
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
function setBlendMode(material, blendMode) {
|
|
5563
|
-
switch(blendMode){
|
|
5564
|
-
case undefined:
|
|
5565
|
-
material.blendFunction = [
|
|
5566
|
-
glContext.ONE,
|
|
5567
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5568
|
-
glContext.ONE,
|
|
5569
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5570
|
-
];
|
|
5571
|
-
break;
|
|
5572
|
-
case BlendingMode.ALPHA:
|
|
5573
|
-
material.blendFunction = [
|
|
5574
|
-
glContext.ONE,
|
|
5575
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5576
|
-
glContext.ONE,
|
|
5577
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5578
|
-
];
|
|
5579
|
-
break;
|
|
5580
|
-
case BlendingMode.ADD:
|
|
5581
|
-
material.blendFunction = [
|
|
5582
|
-
glContext.ONE,
|
|
5583
|
-
glContext.ONE,
|
|
5584
|
-
glContext.ONE,
|
|
5585
|
-
glContext.ONE
|
|
5586
|
-
];
|
|
5587
|
-
break;
|
|
5588
|
-
case BlendingMode.SUBTRACTION:
|
|
5589
|
-
material.blendFunction = [
|
|
5590
|
-
glContext.ONE,
|
|
5591
|
-
glContext.ONE,
|
|
5592
|
-
glContext.ZERO,
|
|
5593
|
-
glContext.ONE
|
|
5594
|
-
];
|
|
5595
|
-
material.blendEquation = [
|
|
5596
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
5597
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
5598
|
-
];
|
|
5599
|
-
break;
|
|
5600
|
-
case BlendingMode.SUPERPOSITION:
|
|
5601
|
-
material.blendFunction = [
|
|
5602
|
-
glContext.ONE,
|
|
5603
|
-
glContext.ONE,
|
|
5604
|
-
glContext.ONE,
|
|
5605
|
-
glContext.ONE
|
|
5606
|
-
];
|
|
5607
|
-
break;
|
|
5608
|
-
case BlendingMode.MULTIPLY:
|
|
5609
|
-
material.blendFunction = [
|
|
5610
|
-
glContext.DST_COLOR,
|
|
5611
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5612
|
-
glContext.DST_COLOR,
|
|
5613
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5614
|
-
];
|
|
5615
|
-
break;
|
|
5616
|
-
case BlendingMode.BRIGHTNESS:
|
|
5617
|
-
material.blendFunction = [
|
|
5618
|
-
glContext.ONE,
|
|
5619
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
5620
|
-
glContext.ONE,
|
|
5621
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
5622
|
-
];
|
|
5623
|
-
break;
|
|
5624
|
-
case BlendingMode.STRONG_LIGHT:
|
|
5625
|
-
material.blendFunction = [
|
|
5626
|
-
glContext.DST_COLOR,
|
|
5627
|
-
glContext.DST_ALPHA,
|
|
5628
|
-
glContext.ZERO,
|
|
5629
|
-
glContext.ONE
|
|
5630
|
-
];
|
|
5631
|
-
break;
|
|
5632
|
-
case BlendingMode.WEAK_LIGHT:
|
|
5633
|
-
material.blendFunction = [
|
|
5634
|
-
glContext.DST_COLOR,
|
|
5635
|
-
glContext.ZERO,
|
|
5636
|
-
glContext.ZERO,
|
|
5637
|
-
glContext.ONE
|
|
5638
|
-
];
|
|
5639
|
-
break;
|
|
5640
|
-
default:
|
|
5641
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
5642
|
-
}
|
|
5643
|
-
}
|
|
5644
|
-
function setSideMode(material, side) {
|
|
5645
|
-
if (side === SideMode.DOUBLE) {
|
|
5646
|
-
material.culling = false;
|
|
5647
|
-
} else {
|
|
5648
|
-
material.culling = true;
|
|
5649
|
-
material.frontFace = glContext.CW;
|
|
5650
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
5651
|
-
}
|
|
5652
|
-
}
|
|
5653
|
-
function setMaskMode(material, maskMode) {
|
|
5654
|
-
switch(maskMode){
|
|
5655
|
-
case undefined:
|
|
5656
|
-
material.stencilTest = false;
|
|
5657
|
-
break;
|
|
5658
|
-
case MaskMode.MASK:
|
|
5659
|
-
material.stencilTest = true;
|
|
5660
|
-
material.stencilFunc = [
|
|
5661
|
-
glContext.ALWAYS,
|
|
5662
|
-
glContext.ALWAYS
|
|
5663
|
-
];
|
|
5664
|
-
material.stencilOpZPass = [
|
|
5665
|
-
glContext.REPLACE,
|
|
5666
|
-
glContext.REPLACE
|
|
5667
|
-
];
|
|
5668
|
-
break;
|
|
5669
|
-
case MaskMode.OBSCURED:
|
|
5670
|
-
material.stencilTest = true;
|
|
5671
|
-
material.stencilFunc = [
|
|
5672
|
-
glContext.EQUAL,
|
|
5673
|
-
glContext.EQUAL
|
|
5674
|
-
];
|
|
5675
|
-
break;
|
|
5676
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
5677
|
-
material.stencilTest = true;
|
|
5678
|
-
material.stencilFunc = [
|
|
5679
|
-
glContext.NOTEQUAL,
|
|
5680
|
-
glContext.NOTEQUAL
|
|
5681
|
-
];
|
|
5682
|
-
break;
|
|
5683
|
-
case MaskMode.NONE:
|
|
5684
|
-
material.stencilTest = false;
|
|
5685
|
-
break;
|
|
5686
|
-
default:
|
|
5687
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
5688
|
-
}
|
|
5689
|
-
}
|
|
5690
|
-
|
|
5691
5315
|
function _extends() {
|
|
5692
5316
|
_extends = Object.assign || function assign(target) {
|
|
5693
5317
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -6098,7 +5722,12 @@ function _loadVideo() {
|
|
|
6098
5722
|
});
|
|
6099
5723
|
return _loadVideo.apply(this, arguments);
|
|
6100
5724
|
}
|
|
6101
|
-
|
|
5725
|
+
/**
|
|
5726
|
+
* 异步加载一个媒体文件
|
|
5727
|
+
* @param url
|
|
5728
|
+
* @param loadFn
|
|
5729
|
+
* @returns
|
|
5730
|
+
*/ function loadMedia(url, loadFn) {
|
|
6102
5731
|
return _loadMedia.apply(this, arguments);
|
|
6103
5732
|
}
|
|
6104
5733
|
function _loadMedia() {
|
|
@@ -6260,6 +5889,144 @@ function _loadMipmapImage() {
|
|
|
6260
5889
|
return _loadMipmapImage.apply(this, arguments);
|
|
6261
5890
|
}
|
|
6262
5891
|
|
|
5892
|
+
/**
|
|
5893
|
+
* Helper class to create a WebGL Context
|
|
5894
|
+
*
|
|
5895
|
+
* @param canvas
|
|
5896
|
+
* @param glType
|
|
5897
|
+
* @param options
|
|
5898
|
+
* @returns
|
|
5899
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
5900
|
+
if (glType === void 0) glType = "webgl";
|
|
5901
|
+
var context;
|
|
5902
|
+
if (glType === "webgl2") {
|
|
5903
|
+
context = canvas.getContext("webgl2", options);
|
|
5904
|
+
if (!context) {
|
|
5905
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
if (!context || glType === "webgl") {
|
|
5909
|
+
context = canvas.getContext("webgl", options);
|
|
5910
|
+
}
|
|
5911
|
+
if (!context) {
|
|
5912
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
5913
|
+
}
|
|
5914
|
+
return context;
|
|
5915
|
+
}
|
|
5916
|
+
|
|
5917
|
+
function gpuTimer(gl) {
|
|
5918
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
5919
|
+
if (ext) {
|
|
5920
|
+
var query = gl.createQuery();
|
|
5921
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
5922
|
+
return __generator(this, function(_state) {
|
|
5923
|
+
return [
|
|
5924
|
+
2,
|
|
5925
|
+
new Promise(function(resolve, reject) {
|
|
5926
|
+
if (query) {
|
|
5927
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
5928
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
5929
|
+
if (available && !disjoint) {
|
|
5930
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
5931
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
5932
|
+
// taken to use all significant bits of the result, not just the
|
|
5933
|
+
// least significant 32 bits.
|
|
5934
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
5935
|
+
}
|
|
5936
|
+
if (available || disjoint) {
|
|
5937
|
+
// Clean up the query object.
|
|
5938
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
5939
|
+
query = null;
|
|
5940
|
+
}
|
|
5941
|
+
available !== null && query && window.setTimeout(function() {
|
|
5942
|
+
getTime().then(resolve).catch;
|
|
5943
|
+
}, 1);
|
|
5944
|
+
}
|
|
5945
|
+
})
|
|
5946
|
+
];
|
|
5947
|
+
});
|
|
5948
|
+
});
|
|
5949
|
+
if (!query) {
|
|
5950
|
+
return;
|
|
5951
|
+
}
|
|
5952
|
+
return {
|
|
5953
|
+
begin: function() {
|
|
5954
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
5955
|
+
},
|
|
5956
|
+
end: function() {
|
|
5957
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
5958
|
+
},
|
|
5959
|
+
getTime: getTime
|
|
5960
|
+
};
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
|
|
5964
|
+
var initErrors = [];
|
|
5965
|
+
// @ts-expect-error
|
|
5966
|
+
var glContext = {};
|
|
5967
|
+
if (!initErrors.length) {
|
|
5968
|
+
initGLContext();
|
|
5969
|
+
}
|
|
5970
|
+
function initGLContext() {
|
|
5971
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
5972
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
5973
|
+
copy(WebGL2RenderingContext);
|
|
5974
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
5975
|
+
copy(WebGLRenderingContext);
|
|
5976
|
+
copy(WebGLRenderingContext.prototype);
|
|
5977
|
+
} else {
|
|
5978
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
5979
|
+
"iOS16 lockdown mode, WebGL Constants not in global");
|
|
5980
|
+
}
|
|
5981
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
5982
|
+
// @ts-expect-error set default value
|
|
5983
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
function isWebGL2(gl) {
|
|
5987
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
5988
|
+
}
|
|
5989
|
+
function copy(target) {
|
|
5990
|
+
for(var name in target){
|
|
5991
|
+
if (/^[A-Z_]/.test(name)) {
|
|
5992
|
+
// @ts-expect-error safe to assign
|
|
5993
|
+
glContext[name] = target[name];
|
|
5994
|
+
}
|
|
5995
|
+
}
|
|
5996
|
+
}
|
|
5997
|
+
function vertexFormatType2GLType(formatType) {
|
|
5998
|
+
switch(formatType){
|
|
5999
|
+
case VertexFormatType.Float32:
|
|
6000
|
+
return WebGLRenderingContext["FLOAT"];
|
|
6001
|
+
case VertexFormatType.Int16:
|
|
6002
|
+
return WebGLRenderingContext["SHORT"];
|
|
6003
|
+
case VertexFormatType.Int8:
|
|
6004
|
+
return WebGLRenderingContext["BYTE"];
|
|
6005
|
+
case VertexFormatType.UInt16:
|
|
6006
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
6007
|
+
case VertexFormatType.UInt8:
|
|
6008
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
6009
|
+
default:
|
|
6010
|
+
return WebGLRenderingContext["FLOAT"];
|
|
6011
|
+
}
|
|
6012
|
+
}
|
|
6013
|
+
function glType2VertexFormatType(webglType) {
|
|
6014
|
+
switch(webglType){
|
|
6015
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
6016
|
+
return VertexFormatType.Float32;
|
|
6017
|
+
case WebGLRenderingContext["SHORT"]:
|
|
6018
|
+
return VertexFormatType.Int16;
|
|
6019
|
+
case WebGLRenderingContext["BYTE"]:
|
|
6020
|
+
return VertexFormatType.Int8;
|
|
6021
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
6022
|
+
return VertexFormatType.UInt16;
|
|
6023
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
6024
|
+
return VertexFormatType.UInt8;
|
|
6025
|
+
default:
|
|
6026
|
+
return VertexFormatType.Float32;
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
|
|
6263
6030
|
var seed$a = 1;
|
|
6264
6031
|
/**
|
|
6265
6032
|
* Texture 抽象类
|
|
@@ -6894,6 +6661,280 @@ function setDefaultTextureFactory(factory) {
|
|
|
6894
6661
|
g = factory;
|
|
6895
6662
|
}
|
|
6896
6663
|
|
|
6664
|
+
function _array_like_to_array(arr, len) {
|
|
6665
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
6666
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
6667
|
+
return arr2;
|
|
6668
|
+
}
|
|
6669
|
+
|
|
6670
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
6671
|
+
if (!o) return;
|
|
6672
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
6673
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6674
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6675
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6676
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
6677
|
+
}
|
|
6678
|
+
|
|
6679
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
6680
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
6681
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
6682
|
+
// Fallback for engines without symbol support
|
|
6683
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
6684
|
+
if (it) o = it;
|
|
6685
|
+
var i = 0;
|
|
6686
|
+
return function() {
|
|
6687
|
+
if (i >= o.length) return {
|
|
6688
|
+
done: true
|
|
6689
|
+
};
|
|
6690
|
+
return {
|
|
6691
|
+
done: false,
|
|
6692
|
+
value: o[i++]
|
|
6693
|
+
};
|
|
6694
|
+
};
|
|
6695
|
+
}
|
|
6696
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6697
|
+
}
|
|
6698
|
+
|
|
6699
|
+
var ShaderCompileResultStatus;
|
|
6700
|
+
(function(ShaderCompileResultStatus) {
|
|
6701
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
|
|
6702
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
|
|
6703
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
|
|
6704
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
|
|
6705
|
+
})(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
|
|
6706
|
+
var GLSLVersion;
|
|
6707
|
+
(function(GLSLVersion) {
|
|
6708
|
+
GLSLVersion["GLSL1"] = "100";
|
|
6709
|
+
GLSLVersion["GLSL3"] = "300 es";
|
|
6710
|
+
})(GLSLVersion || (GLSLVersion = {}));
|
|
6711
|
+
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
6712
|
+
_inherits(ShaderVariant, EffectsObject);
|
|
6713
|
+
function ShaderVariant(engine, source) {
|
|
6714
|
+
var _this;
|
|
6715
|
+
_this = EffectsObject.call(this, engine) || this;
|
|
6716
|
+
_this.source = source;
|
|
6717
|
+
return _this;
|
|
6718
|
+
}
|
|
6719
|
+
return ShaderVariant;
|
|
6720
|
+
}(EffectsObject);
|
|
6721
|
+
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
6722
|
+
_inherits(Shader, EffectsObject);
|
|
6723
|
+
function Shader() {
|
|
6724
|
+
return EffectsObject.apply(this, arguments);
|
|
6725
|
+
}
|
|
6726
|
+
var _proto = Shader.prototype;
|
|
6727
|
+
_proto.createVariant = function createVariant(macros) {
|
|
6728
|
+
var shaderMacros = [];
|
|
6729
|
+
if (macros) {
|
|
6730
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
|
|
6731
|
+
var key = _step.value;
|
|
6732
|
+
shaderMacros.push([
|
|
6733
|
+
key,
|
|
6734
|
+
macros[key]
|
|
6735
|
+
]);
|
|
6736
|
+
}
|
|
6737
|
+
}
|
|
6738
|
+
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
6739
|
+
shaderVariant.shader = this;
|
|
6740
|
+
return shaderVariant;
|
|
6741
|
+
};
|
|
6742
|
+
_proto.fromData = function fromData(data) {
|
|
6743
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
6744
|
+
this.shaderData = data;
|
|
6745
|
+
};
|
|
6746
|
+
return Shader;
|
|
6747
|
+
}(EffectsObject);
|
|
6748
|
+
Shader = __decorate([
|
|
6749
|
+
effectsClass(DataType.Shader)
|
|
6750
|
+
], Shader);
|
|
6751
|
+
|
|
6752
|
+
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
6753
|
+
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
6754
|
+
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}";
|
|
6755
|
+
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";
|
|
6756
|
+
function createCopyShader(level, writeDepth) {
|
|
6757
|
+
var webgl2 = level === 2;
|
|
6758
|
+
return {
|
|
6759
|
+
name: EFFECTS_COPY_MESH_NAME,
|
|
6760
|
+
vertex: COPY_VERTEX_SHADER,
|
|
6761
|
+
fragment: COPY_FRAGMENT_SHADER,
|
|
6762
|
+
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
6763
|
+
macros: [
|
|
6764
|
+
[
|
|
6765
|
+
"DEPTH_TEXTURE",
|
|
6766
|
+
!!writeDepth
|
|
6767
|
+
]
|
|
6768
|
+
],
|
|
6769
|
+
// @ts-expect-error
|
|
6770
|
+
cacheId: COPY_MESH_SHADER_ID + +writeDepth
|
|
6771
|
+
};
|
|
6772
|
+
}
|
|
6773
|
+
|
|
6774
|
+
var ShaderType;
|
|
6775
|
+
(function(ShaderType) {
|
|
6776
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
6777
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
6778
|
+
})(ShaderType || (ShaderType = {}));
|
|
6779
|
+
|
|
6780
|
+
function valIfUndefined(val, def) {
|
|
6781
|
+
if (val === undefined || val === null) {
|
|
6782
|
+
return def;
|
|
6783
|
+
}
|
|
6784
|
+
return val;
|
|
6785
|
+
}
|
|
6786
|
+
function getPreMultiAlpha(blending) {
|
|
6787
|
+
switch(blending){
|
|
6788
|
+
case BlendingMode.ALPHA:
|
|
6789
|
+
return 1;
|
|
6790
|
+
case BlendingMode.ADD:
|
|
6791
|
+
return 1;
|
|
6792
|
+
case BlendingMode.SUBTRACTION:
|
|
6793
|
+
return 1;
|
|
6794
|
+
case BlendingMode.STRONG_LIGHT:
|
|
6795
|
+
return 1;
|
|
6796
|
+
case BlendingMode.WEAK_LIGHT:
|
|
6797
|
+
return 1;
|
|
6798
|
+
case BlendingMode.SUPERPOSITION:
|
|
6799
|
+
return 2;
|
|
6800
|
+
case BlendingMode.BRIGHTNESS:
|
|
6801
|
+
return 3;
|
|
6802
|
+
case BlendingMode.MULTIPLY:
|
|
6803
|
+
return 0;
|
|
6804
|
+
default:
|
|
6805
|
+
// 处理undefined
|
|
6806
|
+
return 1;
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
function setBlendMode(material, blendMode) {
|
|
6810
|
+
switch(blendMode){
|
|
6811
|
+
case undefined:
|
|
6812
|
+
material.blendFunction = [
|
|
6813
|
+
glContext.ONE,
|
|
6814
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6815
|
+
glContext.ONE,
|
|
6816
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6817
|
+
];
|
|
6818
|
+
break;
|
|
6819
|
+
case BlendingMode.ALPHA:
|
|
6820
|
+
material.blendFunction = [
|
|
6821
|
+
glContext.ONE,
|
|
6822
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6823
|
+
glContext.ONE,
|
|
6824
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6825
|
+
];
|
|
6826
|
+
break;
|
|
6827
|
+
case BlendingMode.ADD:
|
|
6828
|
+
material.blendFunction = [
|
|
6829
|
+
glContext.ONE,
|
|
6830
|
+
glContext.ONE,
|
|
6831
|
+
glContext.ONE,
|
|
6832
|
+
glContext.ONE
|
|
6833
|
+
];
|
|
6834
|
+
break;
|
|
6835
|
+
case BlendingMode.SUBTRACTION:
|
|
6836
|
+
material.blendFunction = [
|
|
6837
|
+
glContext.ONE,
|
|
6838
|
+
glContext.ONE,
|
|
6839
|
+
glContext.ZERO,
|
|
6840
|
+
glContext.ONE
|
|
6841
|
+
];
|
|
6842
|
+
material.blendEquation = [
|
|
6843
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
6844
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
6845
|
+
];
|
|
6846
|
+
break;
|
|
6847
|
+
case BlendingMode.SUPERPOSITION:
|
|
6848
|
+
material.blendFunction = [
|
|
6849
|
+
glContext.ONE,
|
|
6850
|
+
glContext.ONE,
|
|
6851
|
+
glContext.ONE,
|
|
6852
|
+
glContext.ONE
|
|
6853
|
+
];
|
|
6854
|
+
break;
|
|
6855
|
+
case BlendingMode.MULTIPLY:
|
|
6856
|
+
material.blendFunction = [
|
|
6857
|
+
glContext.DST_COLOR,
|
|
6858
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6859
|
+
glContext.DST_COLOR,
|
|
6860
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6861
|
+
];
|
|
6862
|
+
break;
|
|
6863
|
+
case BlendingMode.BRIGHTNESS:
|
|
6864
|
+
material.blendFunction = [
|
|
6865
|
+
glContext.ONE,
|
|
6866
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
6867
|
+
glContext.ONE,
|
|
6868
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
6869
|
+
];
|
|
6870
|
+
break;
|
|
6871
|
+
case BlendingMode.STRONG_LIGHT:
|
|
6872
|
+
material.blendFunction = [
|
|
6873
|
+
glContext.DST_COLOR,
|
|
6874
|
+
glContext.DST_ALPHA,
|
|
6875
|
+
glContext.ZERO,
|
|
6876
|
+
glContext.ONE
|
|
6877
|
+
];
|
|
6878
|
+
break;
|
|
6879
|
+
case BlendingMode.WEAK_LIGHT:
|
|
6880
|
+
material.blendFunction = [
|
|
6881
|
+
glContext.DST_COLOR,
|
|
6882
|
+
glContext.ZERO,
|
|
6883
|
+
glContext.ZERO,
|
|
6884
|
+
glContext.ONE
|
|
6885
|
+
];
|
|
6886
|
+
break;
|
|
6887
|
+
default:
|
|
6888
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
function setSideMode(material, side) {
|
|
6892
|
+
if (side === SideMode.DOUBLE) {
|
|
6893
|
+
material.culling = false;
|
|
6894
|
+
} else {
|
|
6895
|
+
material.culling = true;
|
|
6896
|
+
material.frontFace = glContext.CW;
|
|
6897
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
function setMaskMode(material, maskMode) {
|
|
6901
|
+
switch(maskMode){
|
|
6902
|
+
case undefined:
|
|
6903
|
+
material.stencilTest = false;
|
|
6904
|
+
break;
|
|
6905
|
+
case MaskMode.MASK:
|
|
6906
|
+
material.stencilTest = true;
|
|
6907
|
+
material.stencilFunc = [
|
|
6908
|
+
glContext.ALWAYS,
|
|
6909
|
+
glContext.ALWAYS
|
|
6910
|
+
];
|
|
6911
|
+
material.stencilOpZPass = [
|
|
6912
|
+
glContext.REPLACE,
|
|
6913
|
+
glContext.REPLACE
|
|
6914
|
+
];
|
|
6915
|
+
break;
|
|
6916
|
+
case MaskMode.OBSCURED:
|
|
6917
|
+
material.stencilTest = true;
|
|
6918
|
+
material.stencilFunc = [
|
|
6919
|
+
glContext.EQUAL,
|
|
6920
|
+
glContext.EQUAL
|
|
6921
|
+
];
|
|
6922
|
+
break;
|
|
6923
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
6924
|
+
material.stencilTest = true;
|
|
6925
|
+
material.stencilFunc = [
|
|
6926
|
+
glContext.NOTEQUAL,
|
|
6927
|
+
glContext.NOTEQUAL
|
|
6928
|
+
];
|
|
6929
|
+
break;
|
|
6930
|
+
case MaskMode.NONE:
|
|
6931
|
+
material.stencilTest = false;
|
|
6932
|
+
break;
|
|
6933
|
+
default:
|
|
6934
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
|
|
6897
6938
|
/**
|
|
6898
6939
|
* 引擎接入暂时不需要实现
|
|
6899
6940
|
*/ var MaterialDataBlock = /*#__PURE__*/ function() {
|
|
@@ -10143,7 +10184,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10143
10184
|
|
|
10144
10185
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10145
10186
|
|
|
10146
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy)
|
|
10187
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nvec2 uv_rgb=vec2(vTexCoord.x*0.5000,vTexCoord.y);vec2 uv_alpha=vec2(vTexCoord.x*0.5000+0.5000,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=texture2D(_MainTex,uv_alpha).r;vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10147
10188
|
|
|
10148
10189
|
var particleFrag = "#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n";
|
|
10149
10190
|
|
|
@@ -13104,6 +13145,27 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13104
13145
|
};
|
|
13105
13146
|
return Vector4Curve;
|
|
13106
13147
|
}(ValueGetter);
|
|
13148
|
+
var Vector2Curve = /*#__PURE__*/ function(ValueGetter) {
|
|
13149
|
+
_inherits(Vector2Curve, ValueGetter);
|
|
13150
|
+
function Vector2Curve() {
|
|
13151
|
+
var _this;
|
|
13152
|
+
_this = ValueGetter.apply(this, arguments) || this;
|
|
13153
|
+
_this.value = new Vector2();
|
|
13154
|
+
return _this;
|
|
13155
|
+
}
|
|
13156
|
+
var _proto = Vector2Curve.prototype;
|
|
13157
|
+
_proto.onCreate = function onCreate(arg) {
|
|
13158
|
+
this.xCurve = createValueGetter(arg[0]);
|
|
13159
|
+
this.yCurve = createValueGetter(arg[1]);
|
|
13160
|
+
};
|
|
13161
|
+
_proto.getValue = function getValue(t) {
|
|
13162
|
+
var x = this.xCurve.getValue(t);
|
|
13163
|
+
var y = this.yCurve.getValue(t);
|
|
13164
|
+
this.value.set(x, y);
|
|
13165
|
+
return this.value;
|
|
13166
|
+
};
|
|
13167
|
+
return Vector2Curve;
|
|
13168
|
+
}(ValueGetter);
|
|
13107
13169
|
|
|
13108
13170
|
var SPRITE_VERTEX_STRIDE = 6;
|
|
13109
13171
|
var SEMANTIC_PRE_COLOR_ATTACHMENT_0 = "PRE_COLOR_0";
|
|
@@ -13167,6 +13229,8 @@ var map$1 = (_obj$4 = {}, _obj$4[ValueType.RANDOM] = function(props) {
|
|
|
13167
13229
|
return new ColorCurve(props);
|
|
13168
13230
|
}, _obj$4[ValueType.VECTOR4_CURVE] = function(props) {
|
|
13169
13231
|
return new Vector4Curve(props);
|
|
13232
|
+
}, _obj$4[ValueType.VECTOR2_CURVE] = function(props) {
|
|
13233
|
+
return new Vector2Curve(props);
|
|
13170
13234
|
}, _obj$4);
|
|
13171
13235
|
function createValueGetter(args) {
|
|
13172
13236
|
if (!args || !isNaN(+args)) {
|
|
@@ -13291,13 +13355,39 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13291
13355
|
this.color = color;
|
|
13292
13356
|
this.material.setVector4("_Color", new Vector4().setFromArray(color));
|
|
13293
13357
|
};
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13358
|
+
_proto.setTexture = function setTexture(input) {
|
|
13359
|
+
var _this = this;
|
|
13360
|
+
return _async_to_generator(function() {
|
|
13361
|
+
var texture;
|
|
13362
|
+
return __generator(this, function(_state) {
|
|
13363
|
+
switch(_state.label){
|
|
13364
|
+
case 0:
|
|
13365
|
+
if (!(typeof input === "string")) return [
|
|
13366
|
+
3,
|
|
13367
|
+
2
|
|
13368
|
+
];
|
|
13369
|
+
return [
|
|
13370
|
+
4,
|
|
13371
|
+
Texture.fromImage(input, _this.item.engine)
|
|
13372
|
+
];
|
|
13373
|
+
case 1:
|
|
13374
|
+
texture = _state.sent();
|
|
13375
|
+
return [
|
|
13376
|
+
3,
|
|
13377
|
+
3
|
|
13378
|
+
];
|
|
13379
|
+
case 2:
|
|
13380
|
+
texture = input;
|
|
13381
|
+
_state.label = 3;
|
|
13382
|
+
case 3:
|
|
13383
|
+
_this.renderer.texture = texture;
|
|
13384
|
+
_this.material.setTexture("_MainTex", texture);
|
|
13385
|
+
return [
|
|
13386
|
+
2
|
|
13387
|
+
];
|
|
13388
|
+
}
|
|
13389
|
+
});
|
|
13390
|
+
})();
|
|
13301
13391
|
};
|
|
13302
13392
|
/**
|
|
13303
13393
|
* @internal
|
|
@@ -13476,11 +13566,14 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13476
13566
|
maxVertex: 4
|
|
13477
13567
|
});
|
|
13478
13568
|
};
|
|
13479
|
-
_proto.
|
|
13480
|
-
|
|
13481
|
-
var materialProps = {
|
|
13569
|
+
_proto.getMaterialProps = function getMaterialProps(renderInfo, count) {
|
|
13570
|
+
return {
|
|
13482
13571
|
shader: spriteMeshShaderFromRenderInfo(renderInfo, count, 1)
|
|
13483
13572
|
};
|
|
13573
|
+
};
|
|
13574
|
+
_proto.createMaterial = function createMaterial(renderInfo, count) {
|
|
13575
|
+
var side = renderInfo.side, occlusion = renderInfo.occlusion, blending = renderInfo.blending, maskMode = renderInfo.maskMode, mask = renderInfo.mask;
|
|
13576
|
+
var materialProps = this.getMaterialProps(renderInfo, count);
|
|
13484
13577
|
this.preMultiAlpha = getPreMultiAlpha(blending);
|
|
13485
13578
|
var material = Material.create(this.engine, materialProps);
|
|
13486
13579
|
var states = {
|
|
@@ -13559,6 +13652,8 @@ function getImageItemRenderInfo(item) {
|
|
|
13559
13652
|
};
|
|
13560
13653
|
}
|
|
13561
13654
|
|
|
13655
|
+
// Based on:
|
|
13656
|
+
// https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/ShapePrimitive.ts
|
|
13562
13657
|
var ShapePrimitive = function ShapePrimitive() {
|
|
13563
13658
|
};
|
|
13564
13659
|
|
|
@@ -14664,6 +14759,7 @@ function triangulate(contours) {
|
|
|
14664
14759
|
return triangleVerts;
|
|
14665
14760
|
}
|
|
14666
14761
|
|
|
14762
|
+
// Based on:
|
|
14667
14763
|
/**
|
|
14668
14764
|
* A class to define a shape via user defined coordinates.
|
|
14669
14765
|
*/ var Polygon = /*#__PURE__*/ function(ShapePrimitive) {
|
|
@@ -14763,12 +14859,13 @@ function triangulate(contours) {
|
|
|
14763
14859
|
var triangles = triangulate([
|
|
14764
14860
|
points
|
|
14765
14861
|
]);
|
|
14862
|
+
var indexStart = vertices.length / 2;
|
|
14766
14863
|
for(var i = 0; i < triangles.length; i++){
|
|
14767
|
-
vertices[verticesOffset + i] = triangles[i];
|
|
14864
|
+
vertices[verticesOffset * 2 + i] = triangles[i];
|
|
14768
14865
|
}
|
|
14769
14866
|
var vertexCount = triangles.length / 2;
|
|
14770
14867
|
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
14771
|
-
indices[indicesOffset + i1] = i1;
|
|
14868
|
+
indices[indicesOffset + i1] = indexStart + i1;
|
|
14772
14869
|
}
|
|
14773
14870
|
};
|
|
14774
14871
|
_create_class(Polygon, [
|
|
@@ -14890,6 +14987,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
14890
14987
|
recursive(x1234, y1234, x234, y234, x34, y34, x4, y4, points, distanceTolerance, level + 1);
|
|
14891
14988
|
}
|
|
14892
14989
|
|
|
14990
|
+
// Based on:
|
|
14893
14991
|
/**
|
|
14894
14992
|
* The Ellipse object is used to help draw graphics and can also be used to specify a hit area for containers.
|
|
14895
14993
|
*/ var Ellipse = /*#__PURE__*/ function(ShapePrimitive) {
|
|
@@ -15096,6 +15194,7 @@ function recursive(x1, y1, x2, y2, x3, y3, x4, y4, points, distanceTolerance, le
|
|
|
15096
15194
|
return Ellipse;
|
|
15097
15195
|
}(ShapePrimitive);
|
|
15098
15196
|
|
|
15197
|
+
// Based on:
|
|
15099
15198
|
var StarType;
|
|
15100
15199
|
(function(StarType) {
|
|
15101
15200
|
StarType[StarType["Star"] = 0] = "Star";
|
|
@@ -15164,12 +15263,13 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15164
15263
|
var triangles = triangulate([
|
|
15165
15264
|
points
|
|
15166
15265
|
]);
|
|
15266
|
+
var indexStart = vertices.length / 2;
|
|
15167
15267
|
for(var i = 0; i < triangles.length; i++){
|
|
15168
|
-
vertices[verticesOffset + i] = triangles[i];
|
|
15268
|
+
vertices[verticesOffset * 2 + i] = triangles[i];
|
|
15169
15269
|
}
|
|
15170
15270
|
var vertexCount = triangles.length / 2;
|
|
15171
15271
|
for(var i1 = 0; i1 < vertexCount; i1++){
|
|
15172
|
-
indices[indicesOffset + i1] = i1;
|
|
15272
|
+
indices[indicesOffset + i1] = indexStart + i1;
|
|
15173
15273
|
}
|
|
15174
15274
|
};
|
|
15175
15275
|
_proto.buildStarPath = function buildStarPath() {
|
|
@@ -15240,6 +15340,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15240
15340
|
return PolyStar;
|
|
15241
15341
|
}(ShapePrimitive);
|
|
15242
15342
|
|
|
15343
|
+
// Based on:
|
|
15243
15344
|
// const tempPoints = [new Point(), new Point(), new Point(), new Point()];
|
|
15244
15345
|
/**
|
|
15245
15346
|
* The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
|
|
@@ -15563,6 +15664,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
|
|
|
15563
15664
|
return Rectangle;
|
|
15564
15665
|
}(ShapePrimitive);
|
|
15565
15666
|
|
|
15667
|
+
// Based on:
|
|
15566
15668
|
var ShapePath = /*#__PURE__*/ function() {
|
|
15567
15669
|
function ShapePath(graphicsPath) {
|
|
15568
15670
|
this.graphicsPath = graphicsPath;
|
|
@@ -15721,6 +15823,7 @@ var ShapePath = /*#__PURE__*/ function() {
|
|
|
15721
15823
|
return ShapePath;
|
|
15722
15824
|
}();
|
|
15723
15825
|
|
|
15826
|
+
// Based on:
|
|
15724
15827
|
var GraphicsPath = /*#__PURE__*/ function() {
|
|
15725
15828
|
function GraphicsPath() {
|
|
15726
15829
|
this.instructions = [];
|
|
@@ -15858,14 +15961,433 @@ var GraphicsPath = /*#__PURE__*/ function() {
|
|
|
15858
15961
|
return GraphicsPath;
|
|
15859
15962
|
}();
|
|
15860
15963
|
|
|
15964
|
+
// Based on:
|
|
15965
|
+
/**
|
|
15966
|
+
* The Point object represents a location in a two-dimensional coordinate system, where `x` represents
|
|
15967
|
+
* the position on the horizontal axis and `y` represents the position on the vertical axis.
|
|
15968
|
+
*/ var Point = /*#__PURE__*/ function() {
|
|
15969
|
+
function Point(x, y) {
|
|
15970
|
+
if (x === void 0) x = 0;
|
|
15971
|
+
if (y === void 0) y = 0;
|
|
15972
|
+
/**
|
|
15973
|
+
* Position of the point on the x axis
|
|
15974
|
+
*/ this.x = 0;
|
|
15975
|
+
/**
|
|
15976
|
+
* Position of the point on the y axis
|
|
15977
|
+
*/ this.y = 0;
|
|
15978
|
+
this.x = x;
|
|
15979
|
+
this.y = y;
|
|
15980
|
+
}
|
|
15981
|
+
var _proto = Point.prototype;
|
|
15982
|
+
/**
|
|
15983
|
+
* Creates a clone of this point
|
|
15984
|
+
* @returns A clone of this point
|
|
15985
|
+
*/ _proto.clone = function clone() {
|
|
15986
|
+
return new Point(this.x, this.y);
|
|
15987
|
+
};
|
|
15988
|
+
/**
|
|
15989
|
+
* Copies `x` and `y` from the given point into this point
|
|
15990
|
+
* @param p - The point to copy from
|
|
15991
|
+
* @returns The point instance itself
|
|
15992
|
+
*/ _proto.copyFrom = function copyFrom(p) {
|
|
15993
|
+
this.set(p.x, p.y);
|
|
15994
|
+
return this;
|
|
15995
|
+
};
|
|
15996
|
+
/**
|
|
15997
|
+
* Copies this point's x and y into the given point (`p`).
|
|
15998
|
+
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
|
15999
|
+
* @returns The point (`p`) with values updated
|
|
16000
|
+
*/ _proto.copyTo = function copyTo(p) {
|
|
16001
|
+
p.set(this.x, this.y);
|
|
16002
|
+
return p;
|
|
16003
|
+
};
|
|
16004
|
+
/**
|
|
16005
|
+
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
|
16006
|
+
* @param p - The point to check
|
|
16007
|
+
* @returns Returns `true` if both `x` and `y` are equal
|
|
16008
|
+
*/ _proto.equals = function equals(p) {
|
|
16009
|
+
return p.x === this.x && p.y === this.y;
|
|
16010
|
+
};
|
|
16011
|
+
/**
|
|
16012
|
+
* Sets the point to a new `x` and `y` position.
|
|
16013
|
+
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
|
16014
|
+
* @param {number} [x=0] - position of the point on the `x` axis
|
|
16015
|
+
* @param {number} [y=x] - position of the point on the `y` axis
|
|
16016
|
+
* @returns The point instance itself
|
|
16017
|
+
*/ _proto.set = function set(x, y) {
|
|
16018
|
+
if (x === void 0) x = 0;
|
|
16019
|
+
if (y === void 0) y = x;
|
|
16020
|
+
this.x = x;
|
|
16021
|
+
this.y = y;
|
|
16022
|
+
return this;
|
|
16023
|
+
};
|
|
16024
|
+
_create_class(Point, null, [
|
|
16025
|
+
{
|
|
16026
|
+
key: "shared",
|
|
16027
|
+
get: /**
|
|
16028
|
+
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
|
16029
|
+
* @readonly
|
|
16030
|
+
*/ function get() {
|
|
16031
|
+
tempPoint.x = 0;
|
|
16032
|
+
tempPoint.y = 0;
|
|
16033
|
+
return tempPoint;
|
|
16034
|
+
}
|
|
16035
|
+
}
|
|
16036
|
+
]);
|
|
16037
|
+
return Point;
|
|
16038
|
+
}();
|
|
16039
|
+
var tempPoint = new Point();
|
|
16040
|
+
|
|
16041
|
+
// Based on:
|
|
16042
|
+
var closePointEps = 1e-4;
|
|
16043
|
+
var curveEps = 0.0001;
|
|
16044
|
+
/**
|
|
16045
|
+
* Buffers vertices to draw a square cap.
|
|
16046
|
+
*
|
|
16047
|
+
* @internal
|
|
16048
|
+
* @private
|
|
16049
|
+
* @param x - X-coord of end point
|
|
16050
|
+
* @param y - Y-coord of end point
|
|
16051
|
+
* @param nx - X-coord of line normal pointing inside
|
|
16052
|
+
* @param ny - Y-coord of line normal pointing inside
|
|
16053
|
+
* @param innerWeight - Weight of inner points
|
|
16054
|
+
* @param outerWeight - Weight of outer points
|
|
16055
|
+
* @param clockwise - Whether the cap is drawn clockwise
|
|
16056
|
+
* @param verts - vertex buffer
|
|
16057
|
+
* @returns - no. of vertices pushed
|
|
16058
|
+
*/ function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) {
|
|
16059
|
+
var ix = x - nx * innerWeight;
|
|
16060
|
+
var iy = y - ny * innerWeight;
|
|
16061
|
+
var ox = x + nx * outerWeight;
|
|
16062
|
+
var oy = y + ny * outerWeight;
|
|
16063
|
+
/* Rotate nx,ny for extension vector */ var exx;
|
|
16064
|
+
var eyy;
|
|
16065
|
+
if (clockwise) {
|
|
16066
|
+
exx = ny;
|
|
16067
|
+
eyy = -nx;
|
|
16068
|
+
} else {
|
|
16069
|
+
exx = -ny;
|
|
16070
|
+
eyy = nx;
|
|
16071
|
+
}
|
|
16072
|
+
/* [i|0]x,y extended at cap */ var eix = ix + exx;
|
|
16073
|
+
var eiy = iy + eyy;
|
|
16074
|
+
var eox = ox + exx;
|
|
16075
|
+
var eoy = oy + eyy;
|
|
16076
|
+
/* Square itself must be inserted clockwise*/ verts.push(eix, eiy);
|
|
16077
|
+
verts.push(eox, eoy);
|
|
16078
|
+
return 2;
|
|
16079
|
+
}
|
|
16080
|
+
/**
|
|
16081
|
+
* Buffers vertices to draw an arc at the line joint or cap.
|
|
16082
|
+
*
|
|
16083
|
+
* @internal
|
|
16084
|
+
* @private
|
|
16085
|
+
* @param cx - X-coord of center
|
|
16086
|
+
* @param cy - Y-coord of center
|
|
16087
|
+
* @param sx - X-coord of arc start
|
|
16088
|
+
* @param sy - Y-coord of arc start
|
|
16089
|
+
* @param ex - X-coord of arc end
|
|
16090
|
+
* @param ey - Y-coord of arc end
|
|
16091
|
+
* @param verts - buffer of vertices
|
|
16092
|
+
* @param clockwise - orientation of vertices
|
|
16093
|
+
* @returns - no. of vertices pushed
|
|
16094
|
+
*/ function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
|
|
16095
|
+
var cx2p0x = sx - cx;
|
|
16096
|
+
var cy2p0y = sy - cy;
|
|
16097
|
+
var angle0 = Math.atan2(cx2p0x, cy2p0y);
|
|
16098
|
+
var angle1 = Math.atan2(ex - cx, ey - cy);
|
|
16099
|
+
if (clockwise && angle0 < angle1) {
|
|
16100
|
+
angle0 += Math.PI * 2;
|
|
16101
|
+
} else if (!clockwise && angle0 > angle1) {
|
|
16102
|
+
angle1 += Math.PI * 2;
|
|
16103
|
+
}
|
|
16104
|
+
var startAngle = angle0;
|
|
16105
|
+
var angleDiff = angle1 - angle0;
|
|
16106
|
+
var absAngleDiff = Math.abs(angleDiff);
|
|
16107
|
+
var radius = Math.sqrt(cx2p0x * cx2p0x + cy2p0y * cy2p0y);
|
|
16108
|
+
var segCount = (15 * absAngleDiff * Math.sqrt(radius) / Math.PI >> 0) + 1;
|
|
16109
|
+
var angleInc = angleDiff / segCount;
|
|
16110
|
+
startAngle += angleInc;
|
|
16111
|
+
if (clockwise) {
|
|
16112
|
+
verts.push(cx, cy);
|
|
16113
|
+
verts.push(sx, sy);
|
|
16114
|
+
for(var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc){
|
|
16115
|
+
verts.push(cx, cy);
|
|
16116
|
+
verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
|
|
16117
|
+
}
|
|
16118
|
+
verts.push(cx, cy);
|
|
16119
|
+
verts.push(ex, ey);
|
|
16120
|
+
} else {
|
|
16121
|
+
verts.push(sx, sy);
|
|
16122
|
+
verts.push(cx, cy);
|
|
16123
|
+
for(var i1 = 1, angle2 = startAngle; i1 < segCount; i1++, angle2 += angleInc){
|
|
16124
|
+
verts.push(cx + Math.sin(angle2) * radius, cy + Math.cos(angle2) * radius);
|
|
16125
|
+
verts.push(cx, cy);
|
|
16126
|
+
}
|
|
16127
|
+
verts.push(ex, ey);
|
|
16128
|
+
verts.push(cx, cy);
|
|
16129
|
+
}
|
|
16130
|
+
return segCount * 2;
|
|
16131
|
+
}
|
|
16132
|
+
function getOrientationOfPoints(points) {
|
|
16133
|
+
var m = points.length;
|
|
16134
|
+
if (m < 6) {
|
|
16135
|
+
return 1;
|
|
16136
|
+
}
|
|
16137
|
+
var area = 0;
|
|
16138
|
+
for(var i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2){
|
|
16139
|
+
var x2 = points[i];
|
|
16140
|
+
var y2 = points[i + 1];
|
|
16141
|
+
area += (x2 - x1) * (y2 + y1);
|
|
16142
|
+
x1 = x2;
|
|
16143
|
+
y1 = y2;
|
|
16144
|
+
}
|
|
16145
|
+
if (area < 0) {
|
|
16146
|
+
return -1;
|
|
16147
|
+
}
|
|
16148
|
+
return 1;
|
|
16149
|
+
}
|
|
16150
|
+
/**
|
|
16151
|
+
* Builds a line to draw using the polygon method.
|
|
16152
|
+
* @param points
|
|
16153
|
+
* @param lineStyle
|
|
16154
|
+
* @param flipAlignment
|
|
16155
|
+
* @param closed
|
|
16156
|
+
* @param vertices
|
|
16157
|
+
* @param _verticesStride
|
|
16158
|
+
* @param _verticesOffset
|
|
16159
|
+
* @param indices
|
|
16160
|
+
* @param _indicesOffset
|
|
16161
|
+
*/ function buildLine(points, lineStyle, flipAlignment, closed, // alignment:number,
|
|
16162
|
+
vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
|
|
16163
|
+
// const shape = graphicsData.shape as Polygon;
|
|
16164
|
+
// let points = graphicsData.points || shape.points.slice();
|
|
16165
|
+
var eps = closePointEps;
|
|
16166
|
+
if (points.length === 0) {
|
|
16167
|
+
return;
|
|
16168
|
+
}
|
|
16169
|
+
var style = lineStyle;
|
|
16170
|
+
var alignment = style.alignment;
|
|
16171
|
+
if (lineStyle.alignment !== 0.5) {
|
|
16172
|
+
// rotate the points!
|
|
16173
|
+
var orientation = getOrientationOfPoints(points);
|
|
16174
|
+
if (flipAlignment) {
|
|
16175
|
+
orientation *= -1;
|
|
16176
|
+
}
|
|
16177
|
+
alignment = (alignment - 0.5) * orientation + 0.5;
|
|
16178
|
+
}
|
|
16179
|
+
// get first and last point.. figure out the middle!
|
|
16180
|
+
var firstPoint = new Point(points[0], points[1]);
|
|
16181
|
+
var lastPoint = new Point(points[points.length - 2], points[points.length - 1]);
|
|
16182
|
+
var closedShape = closed;
|
|
16183
|
+
var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps;
|
|
16184
|
+
// if the first point is the last point - gonna have issues :)
|
|
16185
|
+
if (closedShape) {
|
|
16186
|
+
// need to clone as we are going to slightly modify the shape..
|
|
16187
|
+
points = points.slice();
|
|
16188
|
+
if (closedPath) {
|
|
16189
|
+
points.pop();
|
|
16190
|
+
points.pop();
|
|
16191
|
+
lastPoint.set(points[points.length - 2], points[points.length - 1]);
|
|
16192
|
+
}
|
|
16193
|
+
var midPointX = (firstPoint.x + lastPoint.x) * 0.5;
|
|
16194
|
+
var midPointY = (lastPoint.y + firstPoint.y) * 0.5;
|
|
16195
|
+
points.unshift(midPointX, midPointY);
|
|
16196
|
+
points.push(midPointX, midPointY);
|
|
16197
|
+
}
|
|
16198
|
+
var verts = vertices;
|
|
16199
|
+
var length = points.length / 2;
|
|
16200
|
+
var indexCount = points.length;
|
|
16201
|
+
var indexStart = verts.length / 2;
|
|
16202
|
+
// Max. inner and outer width
|
|
16203
|
+
var width = style.width / 2;
|
|
16204
|
+
var widthSquared = width * width;
|
|
16205
|
+
var miterLimitSquared = style.miterLimit * style.miterLimit;
|
|
16206
|
+
/* Line segments of interest where (x1,y1) forms the corner. */ var x0 = points[0];
|
|
16207
|
+
var y0 = points[1];
|
|
16208
|
+
var x1 = points[2];
|
|
16209
|
+
var y1 = points[3];
|
|
16210
|
+
var x2 = 0;
|
|
16211
|
+
var y2 = 0;
|
|
16212
|
+
/* perp[?](x|y) = the line normal with magnitude lineWidth. */ var perpX = -(y0 - y1);
|
|
16213
|
+
var perpY = x0 - x1;
|
|
16214
|
+
var perp1x = 0;
|
|
16215
|
+
var perp1y = 0;
|
|
16216
|
+
var dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16217
|
+
perpX /= dist;
|
|
16218
|
+
perpY /= dist;
|
|
16219
|
+
perpX *= width;
|
|
16220
|
+
perpY *= width;
|
|
16221
|
+
var ratio = alignment; // 0.5;
|
|
16222
|
+
var innerWeight = (1 - ratio) * 2;
|
|
16223
|
+
var outerWeight = ratio * 2;
|
|
16224
|
+
if (!closedShape) {
|
|
16225
|
+
if (style.cap === "round") {
|
|
16226
|
+
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;
|
|
16227
|
+
} else if (style.cap === "square") {
|
|
16228
|
+
indexCount += square(x0, y0, perpX, perpY, innerWeight, outerWeight, true, verts);
|
|
16229
|
+
}
|
|
16230
|
+
}
|
|
16231
|
+
// Push first point (below & above vertices)
|
|
16232
|
+
verts.push(x0 - perpX * innerWeight, y0 - perpY * innerWeight);
|
|
16233
|
+
verts.push(x0 + perpX * outerWeight, y0 + perpY * outerWeight);
|
|
16234
|
+
for(var i = 1; i < length - 1; ++i){
|
|
16235
|
+
x0 = points[(i - 1) * 2];
|
|
16236
|
+
y0 = points[(i - 1) * 2 + 1];
|
|
16237
|
+
x1 = points[i * 2];
|
|
16238
|
+
y1 = points[i * 2 + 1];
|
|
16239
|
+
x2 = points[(i + 1) * 2];
|
|
16240
|
+
y2 = points[(i + 1) * 2 + 1];
|
|
16241
|
+
perpX = -(y0 - y1);
|
|
16242
|
+
perpY = x0 - x1;
|
|
16243
|
+
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16244
|
+
perpX /= dist;
|
|
16245
|
+
perpY /= dist;
|
|
16246
|
+
perpX *= width;
|
|
16247
|
+
perpY *= width;
|
|
16248
|
+
perp1x = -(y1 - y2);
|
|
16249
|
+
perp1y = x1 - x2;
|
|
16250
|
+
dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
|
|
16251
|
+
perp1x /= dist;
|
|
16252
|
+
perp1y /= dist;
|
|
16253
|
+
perp1x *= width;
|
|
16254
|
+
perp1y *= width;
|
|
16255
|
+
/* d[x|y](0|1) = the component displacement between points p(0,1|1,2) */ var dx0 = x1 - x0;
|
|
16256
|
+
var dy0 = y0 - y1;
|
|
16257
|
+
var dx1 = x1 - x2;
|
|
16258
|
+
var dy1 = y2 - y1;
|
|
16259
|
+
/* +ve if internal angle < 90 degree, -ve if internal angle > 90 degree. */ var dot = dx0 * dx1 + dy0 * dy1;
|
|
16260
|
+
/* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ var cross = dy0 * dx1 - dy1 * dx0;
|
|
16261
|
+
var clockwise = cross < 0;
|
|
16262
|
+
/* Going nearly parallel? */ /* atan(0.001) ~= 0.001 rad ~= 0.057 degree */ if (Math.abs(cross) < 0.001 * Math.abs(dot)) {
|
|
16263
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16264
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16265
|
+
/* 180 degree corner? */ if (dot >= 0) {
|
|
16266
|
+
if (style.join === "round") {
|
|
16267
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
|
|
16268
|
+
} else {
|
|
16269
|
+
indexCount += 2;
|
|
16270
|
+
}
|
|
16271
|
+
verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
|
|
16272
|
+
verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
|
|
16273
|
+
}
|
|
16274
|
+
continue;
|
|
16275
|
+
}
|
|
16276
|
+
/* 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);
|
|
16277
|
+
var c2 = (-perp1x + x2) * (-perp1y + y1) - (-perp1x + x1) * (-perp1y + y2);
|
|
16278
|
+
var px = (dx0 * c2 - dx1 * c1) / cross;
|
|
16279
|
+
var py = (dy1 * c1 - dy0 * c2) / cross;
|
|
16280
|
+
var pDist = (px - x1) * (px - x1) + (py - y1) * (py - y1);
|
|
16281
|
+
/* Inner miter point */ var imx = x1 + (px - x1) * innerWeight;
|
|
16282
|
+
var imy = y1 + (py - y1) * innerWeight;
|
|
16283
|
+
/* Outer miter point */ var omx = x1 - (px - x1) * outerWeight;
|
|
16284
|
+
var omy = y1 - (py - y1) * outerWeight;
|
|
16285
|
+
/* Is the inside miter point too far away, creating a spike? */ var smallerInsideSegmentSq = Math.min(dx0 * dx0 + dy0 * dy0, dx1 * dx1 + dy1 * dy1);
|
|
16286
|
+
var insideWeight = clockwise ? innerWeight : outerWeight;
|
|
16287
|
+
var smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
|
|
16288
|
+
var insideMiterOk = pDist <= smallerInsideDiagonalSq;
|
|
16289
|
+
if (insideMiterOk) {
|
|
16290
|
+
if (style.join === "bevel" || pDist / widthSquared > miterLimitSquared) {
|
|
16291
|
+
if (clockwise) /* rotating at inner angle */ {
|
|
16292
|
+
verts.push(imx, imy); // inner miter point
|
|
16293
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
16294
|
+
verts.push(imx, imy); // inner miter point
|
|
16295
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); // second segment's outer vertex
|
|
16296
|
+
} else /* rotating at outer angle */ {
|
|
16297
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight); // first segment's inner vertex
|
|
16298
|
+
verts.push(omx, omy); // outer miter point
|
|
16299
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); // second segment's outer vertex
|
|
16300
|
+
verts.push(omx, omy); // outer miter point
|
|
16301
|
+
}
|
|
16302
|
+
indexCount += 2;
|
|
16303
|
+
} else if (style.join === "round") {
|
|
16304
|
+
if (clockwise) /* arc is outside */ {
|
|
16305
|
+
verts.push(imx, imy);
|
|
16306
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16307
|
+
indexCount += round(x1, y1, x1 + perpX * outerWeight, y1 + perpY * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
|
|
16308
|
+
verts.push(imx, imy);
|
|
16309
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
|
|
16310
|
+
} else /* arc is inside */ {
|
|
16311
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16312
|
+
verts.push(omx, omy);
|
|
16313
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
|
|
16314
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
|
|
16315
|
+
verts.push(omx, omy);
|
|
16316
|
+
}
|
|
16317
|
+
} else {
|
|
16318
|
+
verts.push(imx, imy);
|
|
16319
|
+
verts.push(omx, omy);
|
|
16320
|
+
}
|
|
16321
|
+
} else {
|
|
16322
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight); // first segment's inner vertex
|
|
16323
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight); // first segment's outer vertex
|
|
16324
|
+
if (style.join === "round") {
|
|
16325
|
+
if (clockwise) /* arc is outside */ {
|
|
16326
|
+
indexCount += round(x1, y1, x1 + perpX * outerWeight, y1 + perpY * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
|
|
16327
|
+
} else /* arc is inside */ {
|
|
16328
|
+
indexCount += round(x1, y1, x1 - perpX * innerWeight, y1 - perpY * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
|
|
16329
|
+
}
|
|
16330
|
+
} else if (style.join === "miter" && pDist / widthSquared <= miterLimitSquared) {
|
|
16331
|
+
if (clockwise) {
|
|
16332
|
+
verts.push(omx, omy); // inner miter point
|
|
16333
|
+
verts.push(omx, omy); // inner miter point
|
|
16334
|
+
} else {
|
|
16335
|
+
verts.push(imx, imy); // outer miter point
|
|
16336
|
+
verts.push(imx, imy); // outer miter point
|
|
16337
|
+
}
|
|
16338
|
+
indexCount += 2;
|
|
16339
|
+
}
|
|
16340
|
+
verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight); // second segment's inner vertex
|
|
16341
|
+
verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight); // second segment's outer vertex
|
|
16342
|
+
indexCount += 2;
|
|
16343
|
+
}
|
|
16344
|
+
}
|
|
16345
|
+
x0 = points[(length - 2) * 2];
|
|
16346
|
+
y0 = points[(length - 2) * 2 + 1];
|
|
16347
|
+
x1 = points[(length - 1) * 2];
|
|
16348
|
+
y1 = points[(length - 1) * 2 + 1];
|
|
16349
|
+
perpX = -(y0 - y1);
|
|
16350
|
+
perpY = x0 - x1;
|
|
16351
|
+
dist = Math.sqrt(perpX * perpX + perpY * perpY);
|
|
16352
|
+
perpX /= dist;
|
|
16353
|
+
perpY /= dist;
|
|
16354
|
+
perpX *= width;
|
|
16355
|
+
perpY *= width;
|
|
16356
|
+
verts.push(x1 - perpX * innerWeight, y1 - perpY * innerWeight);
|
|
16357
|
+
verts.push(x1 + perpX * outerWeight, y1 + perpY * outerWeight);
|
|
16358
|
+
if (!closedShape) {
|
|
16359
|
+
if (style.cap === "round") {
|
|
16360
|
+
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;
|
|
16361
|
+
} else if (style.cap === "square") {
|
|
16362
|
+
indexCount += square(x1, y1, perpX, perpY, innerWeight, outerWeight, false, verts);
|
|
16363
|
+
}
|
|
16364
|
+
}
|
|
16365
|
+
// const indices = graphicsGeometry.indices;
|
|
16366
|
+
var eps2 = curveEps * curveEps;
|
|
16367
|
+
// indices.push(indexStart);
|
|
16368
|
+
for(var i1 = indexStart; i1 < indexCount + indexStart - 2; ++i1){
|
|
16369
|
+
x0 = verts[i1 * 2];
|
|
16370
|
+
y0 = verts[i1 * 2 + 1];
|
|
16371
|
+
x1 = verts[(i1 + 1) * 2];
|
|
16372
|
+
y1 = verts[(i1 + 1) * 2 + 1];
|
|
16373
|
+
x2 = verts[(i1 + 2) * 2];
|
|
16374
|
+
y2 = verts[(i1 + 2) * 2 + 1];
|
|
16375
|
+
/* Skip zero area triangles */ if (Math.abs(x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)) < eps2) {
|
|
16376
|
+
continue;
|
|
16377
|
+
}
|
|
16378
|
+
indices.push(i1, i1 + 1, i1 + 2);
|
|
16379
|
+
}
|
|
16380
|
+
}
|
|
16381
|
+
|
|
15861
16382
|
var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
15862
16383
|
_inherits(ShapeComponent, MeshComponent);
|
|
15863
16384
|
function ShapeComponent(engine) {
|
|
15864
16385
|
var _this;
|
|
15865
16386
|
_this = MeshComponent.call(this, engine) || this;
|
|
15866
|
-
_this.
|
|
16387
|
+
_this.isStroke = false;
|
|
16388
|
+
_this.graphicsPath = new GraphicsPath();
|
|
15867
16389
|
_this.curveValues = [];
|
|
15868
|
-
_this.
|
|
16390
|
+
_this.shapeDirty = true;
|
|
15869
16391
|
_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";
|
|
15870
16392
|
_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";
|
|
15871
16393
|
if (!_this.geometry) {
|
|
@@ -15913,6 +16435,20 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15913
16435
|
_this.material.depthTest = true;
|
|
15914
16436
|
_this.material.blending = true;
|
|
15915
16437
|
}
|
|
16438
|
+
_this.strokeAttributes = {
|
|
16439
|
+
width: 1,
|
|
16440
|
+
alignment: 0.5,
|
|
16441
|
+
cap: "butt",
|
|
16442
|
+
join: "miter",
|
|
16443
|
+
miterLimit: 10
|
|
16444
|
+
};
|
|
16445
|
+
_this.shapeAttribute = {
|
|
16446
|
+
type: ShapePrimitiveType.Custom,
|
|
16447
|
+
points: [],
|
|
16448
|
+
easingIns: [],
|
|
16449
|
+
easingOuts: [],
|
|
16450
|
+
shapes: []
|
|
16451
|
+
};
|
|
15916
16452
|
return _this;
|
|
15917
16453
|
}
|
|
15918
16454
|
var _proto = ShapeComponent.prototype;
|
|
@@ -15920,10 +16456,10 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15920
16456
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
15921
16457
|
};
|
|
15922
16458
|
_proto.onUpdate = function onUpdate(dt) {
|
|
15923
|
-
if (this.
|
|
15924
|
-
this.buildPath(this.
|
|
15925
|
-
this.buildGeometryFromPath(this.
|
|
15926
|
-
this.
|
|
16459
|
+
if (this.shapeDirty) {
|
|
16460
|
+
this.buildPath(this.shapeAttribute);
|
|
16461
|
+
this.buildGeometryFromPath(this.graphicsPath.shapePath);
|
|
16462
|
+
this.shapeDirty = false;
|
|
15927
16463
|
}
|
|
15928
16464
|
};
|
|
15929
16465
|
_proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
|
|
@@ -15938,7 +16474,13 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15938
16474
|
var indexOffset = indices.length;
|
|
15939
16475
|
var vertOffset = vertices.length / 2;
|
|
15940
16476
|
shape.build(points);
|
|
15941
|
-
|
|
16477
|
+
if (!this.isStroke) {
|
|
16478
|
+
shape.triangulate(points, vertices, vertOffset, indices, indexOffset);
|
|
16479
|
+
} else {
|
|
16480
|
+
var close = true;
|
|
16481
|
+
var lineStyle = this.strokeAttributes;
|
|
16482
|
+
buildLine(points, lineStyle, false, close, vertices, 2, vertOffset, indices);
|
|
16483
|
+
}
|
|
15942
16484
|
}
|
|
15943
16485
|
var vertexCount = vertices.length / 2;
|
|
15944
16486
|
// get the current attribute and index arrays from the geometry, avoiding re-creation
|
|
@@ -15951,7 +16493,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15951
16493
|
if (!uvArray || uvArray.length < vertexCount * 2) {
|
|
15952
16494
|
uvArray = new Float32Array(vertexCount * 2);
|
|
15953
16495
|
}
|
|
15954
|
-
if (!indexArray) {
|
|
16496
|
+
if (!indexArray || indexArray.length < indices.length) {
|
|
15955
16497
|
indexArray = new Uint16Array(indices.length);
|
|
15956
16498
|
}
|
|
15957
16499
|
// set position and uv attribute array
|
|
@@ -15973,19 +16515,18 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
15973
16515
|
this.geometry.setIndexData(indexArray);
|
|
15974
16516
|
this.geometry.setDrawCount(indices.length);
|
|
15975
16517
|
};
|
|
15976
|
-
_proto.buildPath = function buildPath(
|
|
15977
|
-
this.
|
|
15978
|
-
|
|
15979
|
-
switch(shapeData.type){
|
|
16518
|
+
_proto.buildPath = function buildPath(shapeAttribute) {
|
|
16519
|
+
this.graphicsPath.clear();
|
|
16520
|
+
switch(shapeAttribute.type){
|
|
15980
16521
|
case ShapePrimitiveType.Custom:
|
|
15981
16522
|
{
|
|
15982
|
-
var
|
|
15983
|
-
var points =
|
|
15984
|
-
var easingIns =
|
|
15985
|
-
var easingOuts =
|
|
15986
|
-
|
|
15987
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(customData.shapes), _step; !(_step = _iterator()).done;){
|
|
16523
|
+
var customShapeAtribute = this.shapeAttribute;
|
|
16524
|
+
var points = customShapeAtribute.points;
|
|
16525
|
+
var easingIns = customShapeAtribute.easingIns;
|
|
16526
|
+
var easingOuts = customShapeAtribute.easingOuts;
|
|
16527
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
|
|
15988
16528
|
var shape = _step.value;
|
|
16529
|
+
this.curveValues = [];
|
|
15989
16530
|
this.setFillColor(shape.fill);
|
|
15990
16531
|
var indices = shape.indexes;
|
|
15991
16532
|
for(var i = 1; i < indices.length; i++){
|
|
@@ -16003,42 +16544,42 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16003
16544
|
controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
|
|
16004
16545
|
controlPoint2: easingIns[indices[0].easingIn]
|
|
16005
16546
|
});
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16547
|
+
this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
|
|
16548
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
|
|
16549
|
+
var curveValue = _step1.value;
|
|
16550
|
+
var point = curveValue.point;
|
|
16551
|
+
var control1 = curveValue.controlPoint1;
|
|
16552
|
+
var control2 = curveValue.controlPoint2;
|
|
16553
|
+
this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
|
|
16554
|
+
}
|
|
16014
16555
|
}
|
|
16015
16556
|
break;
|
|
16016
16557
|
}
|
|
16017
16558
|
case ShapePrimitiveType.Ellipse:
|
|
16018
16559
|
{
|
|
16019
|
-
var ellipseData =
|
|
16020
|
-
this.
|
|
16560
|
+
var ellipseData = shapeAttribute;
|
|
16561
|
+
this.graphicsPath.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
|
|
16021
16562
|
this.setFillColor(ellipseData.fill);
|
|
16022
16563
|
break;
|
|
16023
16564
|
}
|
|
16024
16565
|
case ShapePrimitiveType.Rectangle:
|
|
16025
16566
|
{
|
|
16026
|
-
var rectangleData =
|
|
16027
|
-
this.
|
|
16567
|
+
var rectangleData = shapeAttribute;
|
|
16568
|
+
this.graphicsPath.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
|
|
16028
16569
|
this.setFillColor(rectangleData.fill);
|
|
16029
16570
|
break;
|
|
16030
16571
|
}
|
|
16031
16572
|
case ShapePrimitiveType.Star:
|
|
16032
16573
|
{
|
|
16033
|
-
var starData =
|
|
16034
|
-
this.
|
|
16574
|
+
var starData = shapeAttribute;
|
|
16575
|
+
this.graphicsPath.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
|
|
16035
16576
|
this.setFillColor(starData.fill);
|
|
16036
16577
|
break;
|
|
16037
16578
|
}
|
|
16038
16579
|
case ShapePrimitiveType.Polygon:
|
|
16039
16580
|
{
|
|
16040
|
-
var polygonData =
|
|
16041
|
-
this.
|
|
16581
|
+
var polygonData = shapeAttribute;
|
|
16582
|
+
this.graphicsPath.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
|
|
16042
16583
|
this.setFillColor(polygonData.fill);
|
|
16043
16584
|
break;
|
|
16044
16585
|
}
|
|
@@ -16052,7 +16593,93 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16052
16593
|
};
|
|
16053
16594
|
_proto.fromData = function fromData(data) {
|
|
16054
16595
|
MeshComponent.prototype.fromData.call(this, data);
|
|
16055
|
-
this.
|
|
16596
|
+
this.shapeDirty = true;
|
|
16597
|
+
var strokeParam = data.stroke;
|
|
16598
|
+
if (strokeParam) {
|
|
16599
|
+
this.isStroke = true;
|
|
16600
|
+
this.strokeAttributes.width = strokeParam.width;
|
|
16601
|
+
}
|
|
16602
|
+
switch(data.type){
|
|
16603
|
+
case ShapePrimitiveType.Custom:
|
|
16604
|
+
{
|
|
16605
|
+
this.shapeAttribute = {
|
|
16606
|
+
type: ShapePrimitiveType.Custom,
|
|
16607
|
+
points: [],
|
|
16608
|
+
easingIns: [],
|
|
16609
|
+
easingOuts: [],
|
|
16610
|
+
shapes: []
|
|
16611
|
+
};
|
|
16612
|
+
var customShapeData = data;
|
|
16613
|
+
var customShapeAttribute = this.shapeAttribute;
|
|
16614
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeData.points), _step; !(_step = _iterator()).done;){
|
|
16615
|
+
var point = _step.value;
|
|
16616
|
+
customShapeAttribute.points.push(new Vector2(point.x, point.y));
|
|
16617
|
+
}
|
|
16618
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeData.easingIns), _step1; !(_step1 = _iterator1()).done;){
|
|
16619
|
+
var easingIn = _step1.value;
|
|
16620
|
+
customShapeAttribute.easingIns.push(new Vector2(easingIn.x, easingIn.y));
|
|
16621
|
+
}
|
|
16622
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(customShapeData.easingOuts), _step2; !(_step2 = _iterator2()).done;){
|
|
16623
|
+
var easingOut = _step2.value;
|
|
16624
|
+
customShapeAttribute.easingOuts.push(new Vector2(easingOut.x, easingOut.y));
|
|
16625
|
+
}
|
|
16626
|
+
customShapeAttribute.shapes = customShapeData.shapes;
|
|
16627
|
+
break;
|
|
16628
|
+
}
|
|
16629
|
+
case ShapePrimitiveType.Ellipse:
|
|
16630
|
+
{
|
|
16631
|
+
var ellipseData = data;
|
|
16632
|
+
var ellipseAttribute = {
|
|
16633
|
+
type: ShapePrimitiveType.Ellipse,
|
|
16634
|
+
xRadius: ellipseData.xRadius,
|
|
16635
|
+
yRadius: ellipseData.yRadius,
|
|
16636
|
+
fill: ellipseData.fill
|
|
16637
|
+
};
|
|
16638
|
+
this.shapeAttribute = ellipseAttribute;
|
|
16639
|
+
break;
|
|
16640
|
+
}
|
|
16641
|
+
case ShapePrimitiveType.Rectangle:
|
|
16642
|
+
{
|
|
16643
|
+
var rectangleData = data;
|
|
16644
|
+
var rectangleAttribute = {
|
|
16645
|
+
type: ShapePrimitiveType.Rectangle,
|
|
16646
|
+
width: rectangleData.width,
|
|
16647
|
+
height: rectangleData.height,
|
|
16648
|
+
roundness: rectangleData.roundness,
|
|
16649
|
+
fill: rectangleData.fill
|
|
16650
|
+
};
|
|
16651
|
+
this.shapeAttribute = rectangleAttribute;
|
|
16652
|
+
break;
|
|
16653
|
+
}
|
|
16654
|
+
case ShapePrimitiveType.Star:
|
|
16655
|
+
{
|
|
16656
|
+
var starData = data;
|
|
16657
|
+
var starAttribute = {
|
|
16658
|
+
type: ShapePrimitiveType.Star,
|
|
16659
|
+
pointCount: starData.pointCount,
|
|
16660
|
+
innerRadius: starData.innerRadius,
|
|
16661
|
+
outerRadius: starData.outerRadius,
|
|
16662
|
+
innerRoundness: starData.innerRoundness,
|
|
16663
|
+
outerRoundness: starData.outerRoundness,
|
|
16664
|
+
fill: starData.fill
|
|
16665
|
+
};
|
|
16666
|
+
this.shapeAttribute = starAttribute;
|
|
16667
|
+
break;
|
|
16668
|
+
}
|
|
16669
|
+
case ShapePrimitiveType.Polygon:
|
|
16670
|
+
{
|
|
16671
|
+
var polygonData = data;
|
|
16672
|
+
var polygonAttribute = {
|
|
16673
|
+
type: ShapePrimitiveType.Polygon,
|
|
16674
|
+
pointCount: polygonData.pointCount,
|
|
16675
|
+
radius: polygonData.radius,
|
|
16676
|
+
roundness: polygonData.roundness,
|
|
16677
|
+
fill: polygonData.fill
|
|
16678
|
+
};
|
|
16679
|
+
this.shapeAttribute = polygonAttribute;
|
|
16680
|
+
break;
|
|
16681
|
+
}
|
|
16682
|
+
}
|
|
16056
16683
|
var material = this.material;
|
|
16057
16684
|
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16058
16685
|
material.stencilRef = data.renderer.mask !== undefined ? [
|
|
@@ -16062,6 +16689,15 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16062
16689
|
//@ts-expect-error // TODO 新版蒙版上线后重构
|
|
16063
16690
|
setMaskMode(material, data.renderer.maskMode);
|
|
16064
16691
|
};
|
|
16692
|
+
_create_class(ShapeComponent, [
|
|
16693
|
+
{
|
|
16694
|
+
key: "shape",
|
|
16695
|
+
get: function get() {
|
|
16696
|
+
this.shapeDirty = true;
|
|
16697
|
+
return this.shapeAttribute;
|
|
16698
|
+
}
|
|
16699
|
+
}
|
|
16700
|
+
]);
|
|
16065
16701
|
return ShapeComponent;
|
|
16066
16702
|
}(MeshComponent);
|
|
16067
16703
|
ShapeComponent = __decorate([
|
|
@@ -18749,10 +19385,19 @@ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
|
|
|
18749
19385
|
// 后处理配置相关
|
|
18750
19386
|
var POST_PROCESS_SETTINGS = "post_process_settings";
|
|
18751
19387
|
var config = {};
|
|
18752
|
-
|
|
19388
|
+
/**
|
|
19389
|
+
* 获取全局配置项
|
|
19390
|
+
* @param name
|
|
19391
|
+
* @returns
|
|
19392
|
+
*/ function getConfig(name) {
|
|
18753
19393
|
return config[name];
|
|
18754
19394
|
}
|
|
18755
|
-
|
|
19395
|
+
/**
|
|
19396
|
+
* 设置全局配置项
|
|
19397
|
+
* @param name
|
|
19398
|
+
* @param value
|
|
19399
|
+
* @returns
|
|
19400
|
+
*/ function setConfig(name, value) {
|
|
18756
19401
|
return config[name] = value;
|
|
18757
19402
|
}
|
|
18758
19403
|
|
|
@@ -20454,19 +21099,17 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
20454
21099
|
rotation: rotation,
|
|
20455
21100
|
path: path
|
|
20456
21101
|
};
|
|
20457
|
-
var parentTransform = this.transform.parentTransform;
|
|
20458
21102
|
var selfPos = position.clone();
|
|
20459
21103
|
if (path) {
|
|
20460
21104
|
selfPos.add(path.getValue(0));
|
|
20461
21105
|
}
|
|
20462
21106
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
20463
|
-
if (this.options.particleFollowParent
|
|
20464
|
-
var worldMatrix =
|
|
21107
|
+
if (this.options.particleFollowParent) {
|
|
21108
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
20465
21109
|
this.renderer.updateWorldMatrix(worldMatrix);
|
|
20466
21110
|
}
|
|
20467
21111
|
};
|
|
20468
21112
|
_proto.updateEmitterTransform = function updateEmitterTransform(time) {
|
|
20469
|
-
var parentTransform = this.transform.parentTransform;
|
|
20470
21113
|
var _this_basicTransform = this.basicTransform, path = _this_basicTransform.path, position = _this_basicTransform.position;
|
|
20471
21114
|
var selfPos = position.clone();
|
|
20472
21115
|
if (path) {
|
|
@@ -20474,8 +21117,8 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
20474
21117
|
selfPos.add(path.getValue(time / duration));
|
|
20475
21118
|
}
|
|
20476
21119
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
20477
|
-
if (this.options.particleFollowParent
|
|
20478
|
-
var worldMatrix =
|
|
21120
|
+
if (this.options.particleFollowParent) {
|
|
21121
|
+
var worldMatrix = this.transform.getWorldMatrix();
|
|
20479
21122
|
this.renderer.updateWorldMatrix(worldMatrix);
|
|
20480
21123
|
}
|
|
20481
21124
|
};
|
|
@@ -20863,7 +21506,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
20863
21506
|
var lifetime = this.lifetime;
|
|
20864
21507
|
var shape = this.shape;
|
|
20865
21508
|
var speed = options.startSpeed.getValue(lifetime);
|
|
20866
|
-
var matrix4 = options.particleFollowParent ?
|
|
21509
|
+
var matrix4 = options.particleFollowParent ? Matrix4.IDENTITY : this.transform.getWorldMatrix();
|
|
20867
21510
|
var pointPosition = data.position;
|
|
20868
21511
|
// 粒子的位置受发射器的位置影响,自身的旋转和缩放不受影响
|
|
20869
21512
|
var position = matrix4.transformPoint(pointPosition, new Vector3());
|
|
@@ -23099,88 +23742,81 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
23099
23742
|
return PropertyClipPlayable;
|
|
23100
23743
|
}(Playable);
|
|
23101
23744
|
|
|
23102
|
-
var
|
|
23103
|
-
_inherits(
|
|
23104
|
-
function
|
|
23745
|
+
var PropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
23746
|
+
_inherits(PropertyMixerPlayable, TrackMixerPlayable);
|
|
23747
|
+
function PropertyMixerPlayable() {
|
|
23105
23748
|
var _this;
|
|
23106
23749
|
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23107
23750
|
_this.propertyName = "";
|
|
23108
23751
|
return _this;
|
|
23109
23752
|
}
|
|
23110
|
-
var _proto =
|
|
23753
|
+
var _proto = PropertyMixerPlayable.prototype;
|
|
23111
23754
|
_proto.evaluate = function evaluate(context) {
|
|
23112
23755
|
var boundObject = context.output.getUserData();
|
|
23113
23756
|
if (!boundObject) {
|
|
23114
23757
|
return;
|
|
23115
23758
|
}
|
|
23116
23759
|
var hasInput = false;
|
|
23117
|
-
|
|
23118
|
-
if (
|
|
23760
|
+
this.propertyValue = boundObject[this.propertyName];
|
|
23761
|
+
if (this.propertyValue === undefined || this.propertyValue === null) {
|
|
23119
23762
|
return;
|
|
23120
23763
|
}
|
|
23121
|
-
|
|
23764
|
+
this.resetPropertyValue();
|
|
23122
23765
|
// evaluate the curve
|
|
23123
23766
|
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23124
23767
|
var weight = this.getClipWeight(i);
|
|
23125
23768
|
if (weight > 0) {
|
|
23126
23769
|
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23127
23770
|
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23128
|
-
console.error("
|
|
23771
|
+
console.error("PropertyTrack added non-PropertyPlayableAsset");
|
|
23129
23772
|
continue;
|
|
23130
23773
|
}
|
|
23131
23774
|
var curveValue = propertyClipPlayable.value;
|
|
23132
|
-
|
|
23133
|
-
value.g += curveValue.g * weight;
|
|
23134
|
-
value.b += curveValue.b * weight;
|
|
23135
|
-
value.a += curveValue.a * weight;
|
|
23775
|
+
this.addWeightedValue(curveValue, weight);
|
|
23136
23776
|
hasInput = true;
|
|
23137
23777
|
}
|
|
23138
23778
|
}
|
|
23139
23779
|
// set value
|
|
23140
23780
|
if (hasInput) {
|
|
23141
|
-
boundObject[this.propertyName] =
|
|
23781
|
+
boundObject[this.propertyName] = this.propertyValue;
|
|
23142
23782
|
}
|
|
23143
23783
|
};
|
|
23144
|
-
return
|
|
23784
|
+
return PropertyMixerPlayable;
|
|
23145
23785
|
}(TrackMixerPlayable);
|
|
23146
23786
|
|
|
23147
|
-
var
|
|
23148
|
-
_inherits(
|
|
23787
|
+
var ColorPropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
23788
|
+
_inherits(ColorPropertyMixerPlayable, PropertyMixerPlayable);
|
|
23789
|
+
function ColorPropertyMixerPlayable() {
|
|
23790
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23791
|
+
}
|
|
23792
|
+
var _proto = ColorPropertyMixerPlayable.prototype;
|
|
23793
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
23794
|
+
this.propertyValue.setZero();
|
|
23795
|
+
};
|
|
23796
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
23797
|
+
var result = this.propertyValue;
|
|
23798
|
+
result.r += curveValue.r * weight;
|
|
23799
|
+
result.g += curveValue.g * weight;
|
|
23800
|
+
result.b += curveValue.b * weight;
|
|
23801
|
+
result.a += curveValue.a * weight;
|
|
23802
|
+
};
|
|
23803
|
+
return ColorPropertyMixerPlayable;
|
|
23804
|
+
}(PropertyMixerPlayable);
|
|
23805
|
+
|
|
23806
|
+
var FloatPropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
23807
|
+
_inherits(FloatPropertyMixerPlayable, PropertyMixerPlayable);
|
|
23149
23808
|
function FloatPropertyMixerPlayable() {
|
|
23150
|
-
|
|
23151
|
-
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23152
|
-
_this.propertyName = "";
|
|
23153
|
-
return _this;
|
|
23809
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23154
23810
|
}
|
|
23155
23811
|
var _proto = FloatPropertyMixerPlayable.prototype;
|
|
23156
|
-
_proto.
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23160
|
-
|
|
23161
|
-
var hasInput = false;
|
|
23162
|
-
var value = 0;
|
|
23163
|
-
// evaluate the curve
|
|
23164
|
-
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23165
|
-
var weight = this.getClipWeight(i);
|
|
23166
|
-
if (weight > 0) {
|
|
23167
|
-
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23168
|
-
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23169
|
-
console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
|
|
23170
|
-
continue;
|
|
23171
|
-
}
|
|
23172
|
-
var curveValue = propertyClipPlayable.value;
|
|
23173
|
-
value += curveValue * weight;
|
|
23174
|
-
hasInput = true;
|
|
23175
|
-
}
|
|
23176
|
-
}
|
|
23177
|
-
// set value
|
|
23178
|
-
if (hasInput) {
|
|
23179
|
-
boundObject[this.propertyName] = value;
|
|
23180
|
-
}
|
|
23812
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
23813
|
+
this.propertyValue = 0;
|
|
23814
|
+
};
|
|
23815
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
23816
|
+
this.propertyValue += curveValue * weight;
|
|
23181
23817
|
};
|
|
23182
23818
|
return FloatPropertyMixerPlayable;
|
|
23183
|
-
}(
|
|
23819
|
+
}(PropertyMixerPlayable);
|
|
23184
23820
|
|
|
23185
23821
|
var ParticleMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
23186
23822
|
_inherits(ParticleMixerPlayable, TrackMixerPlayable);
|
|
@@ -23692,7 +24328,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
23692
24328
|
this.timelinePlayable.setTime(time);
|
|
23693
24329
|
// The properties of the object may change dynamically,
|
|
23694
24330
|
// so reset the track binding to avoid invalidation of the previously obtained binding object.
|
|
23695
|
-
|
|
24331
|
+
this.resolveBindings();
|
|
23696
24332
|
this.timelinePlayable.evaluate();
|
|
23697
24333
|
this.graph.evaluate(dt);
|
|
23698
24334
|
};
|
|
@@ -23924,50 +24560,44 @@ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
23924
24560
|
return TransformMixerPlayable;
|
|
23925
24561
|
}(TrackMixerPlayable);
|
|
23926
24562
|
|
|
23927
|
-
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(
|
|
23928
|
-
_inherits(Vector4PropertyMixerPlayable,
|
|
24563
|
+
var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
24564
|
+
_inherits(Vector4PropertyMixerPlayable, PropertyMixerPlayable);
|
|
23929
24565
|
function Vector4PropertyMixerPlayable() {
|
|
23930
|
-
|
|
23931
|
-
_this = TrackMixerPlayable.apply(this, arguments) || this;
|
|
23932
|
-
_this.propertyName = "";
|
|
23933
|
-
return _this;
|
|
24566
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
23934
24567
|
}
|
|
23935
24568
|
var _proto = Vector4PropertyMixerPlayable.prototype;
|
|
23936
|
-
_proto.
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
|
|
23944
|
-
|
|
23945
|
-
|
|
23946
|
-
|
|
23947
|
-
|
|
23948
|
-
for(var i = 0; i < this.clipPlayables.length; i++){
|
|
23949
|
-
var weight = this.getClipWeight(i);
|
|
23950
|
-
if (weight > 0) {
|
|
23951
|
-
var propertyClipPlayable = this.getClipPlayable(i);
|
|
23952
|
-
if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
|
|
23953
|
-
console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
|
|
23954
|
-
continue;
|
|
23955
|
-
}
|
|
23956
|
-
var curveValue = propertyClipPlayable.value;
|
|
23957
|
-
value.x += curveValue.x * weight;
|
|
23958
|
-
value.y += curveValue.y * weight;
|
|
23959
|
-
value.z += curveValue.z * weight;
|
|
23960
|
-
value.w += curveValue.w * weight;
|
|
23961
|
-
hasInput = true;
|
|
23962
|
-
}
|
|
23963
|
-
}
|
|
23964
|
-
// set value
|
|
23965
|
-
if (hasInput) {
|
|
23966
|
-
boundObject[this.propertyName] = value;
|
|
23967
|
-
}
|
|
24569
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24570
|
+
this.propertyValue.x = 0;
|
|
24571
|
+
this.propertyValue.y = 0;
|
|
24572
|
+
this.propertyValue.z = 0;
|
|
24573
|
+
this.propertyValue.w = 0;
|
|
24574
|
+
};
|
|
24575
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24576
|
+
var result = this.propertyValue;
|
|
24577
|
+
result.x += curveValue.x * weight;
|
|
24578
|
+
result.y += curveValue.y * weight;
|
|
24579
|
+
result.z += curveValue.z * weight;
|
|
24580
|
+
result.w += curveValue.w * weight;
|
|
23968
24581
|
};
|
|
23969
24582
|
return Vector4PropertyMixerPlayable;
|
|
23970
|
-
}(
|
|
24583
|
+
}(PropertyMixerPlayable);
|
|
24584
|
+
var Vector2PropertyMixerPlayable = /*#__PURE__*/ function(PropertyMixerPlayable) {
|
|
24585
|
+
_inherits(Vector2PropertyMixerPlayable, PropertyMixerPlayable);
|
|
24586
|
+
function Vector2PropertyMixerPlayable() {
|
|
24587
|
+
return PropertyMixerPlayable.apply(this, arguments);
|
|
24588
|
+
}
|
|
24589
|
+
var _proto = Vector2PropertyMixerPlayable.prototype;
|
|
24590
|
+
_proto.resetPropertyValue = function resetPropertyValue() {
|
|
24591
|
+
this.propertyValue.x = 0;
|
|
24592
|
+
this.propertyValue.y = 0;
|
|
24593
|
+
};
|
|
24594
|
+
_proto.addWeightedValue = function addWeightedValue(curveValue, weight) {
|
|
24595
|
+
var result = this.propertyValue;
|
|
24596
|
+
result.x += curveValue.x * weight;
|
|
24597
|
+
result.y += curveValue.y * weight;
|
|
24598
|
+
};
|
|
24599
|
+
return Vector2PropertyMixerPlayable;
|
|
24600
|
+
}(PropertyMixerPlayable);
|
|
23971
24601
|
|
|
23972
24602
|
/**
|
|
23973
24603
|
* @since 2.0.0
|
|
@@ -24348,6 +24978,26 @@ var Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
|
24348
24978
|
Vector4PropertyTrack = __decorate([
|
|
24349
24979
|
effectsClass(DataType.Vector4PropertyTrack)
|
|
24350
24980
|
], Vector4PropertyTrack);
|
|
24981
|
+
var Vector2PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
24982
|
+
_inherits(Vector2PropertyTrack, PropertyTrack);
|
|
24983
|
+
function Vector2PropertyTrack() {
|
|
24984
|
+
return PropertyTrack.apply(this, arguments);
|
|
24985
|
+
}
|
|
24986
|
+
var _proto = Vector2PropertyTrack.prototype;
|
|
24987
|
+
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
24988
|
+
var mixer = new Vector2PropertyMixerPlayable(graph);
|
|
24989
|
+
var propertyNames = this.propertyNames;
|
|
24990
|
+
if (propertyNames.length > 0) {
|
|
24991
|
+
var propertyName = propertyNames[propertyNames.length - 1];
|
|
24992
|
+
mixer.propertyName = propertyName;
|
|
24993
|
+
}
|
|
24994
|
+
return mixer;
|
|
24995
|
+
};
|
|
24996
|
+
return Vector2PropertyTrack;
|
|
24997
|
+
}(PropertyTrack);
|
|
24998
|
+
Vector2PropertyTrack = __decorate([
|
|
24999
|
+
effectsClass("Vector2PropertyTrack")
|
|
25000
|
+
], Vector2PropertyTrack);
|
|
24351
25001
|
|
|
24352
25002
|
var ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
|
|
24353
25003
|
_inherits(ColorPropertyTrack, PropertyTrack);
|
|
@@ -24614,8 +25264,28 @@ __decorate([
|
|
|
24614
25264
|
serialize()
|
|
24615
25265
|
], Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
24616
25266
|
Vector4PropertyPlayableAsset = __decorate([
|
|
24617
|
-
effectsClass(
|
|
25267
|
+
effectsClass(DataType.Vector4PropertyPlayableAsset)
|
|
24618
25268
|
], Vector4PropertyPlayableAsset);
|
|
25269
|
+
var Vector2PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
25270
|
+
_inherits(Vector2PropertyPlayableAsset, PlayableAsset);
|
|
25271
|
+
function Vector2PropertyPlayableAsset() {
|
|
25272
|
+
return PlayableAsset.apply(this, arguments);
|
|
25273
|
+
}
|
|
25274
|
+
var _proto = Vector2PropertyPlayableAsset.prototype;
|
|
25275
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
25276
|
+
var clipPlayable = new PropertyClipPlayable(graph);
|
|
25277
|
+
clipPlayable.curve = createValueGetter(this.curveData);
|
|
25278
|
+
clipPlayable.value = clipPlayable.curve.getValue(0);
|
|
25279
|
+
return clipPlayable;
|
|
25280
|
+
};
|
|
25281
|
+
return Vector2PropertyPlayableAsset;
|
|
25282
|
+
}(PlayableAsset);
|
|
25283
|
+
__decorate([
|
|
25284
|
+
serialize()
|
|
25285
|
+
], Vector2PropertyPlayableAsset.prototype, "curveData", void 0);
|
|
25286
|
+
Vector2PropertyPlayableAsset = __decorate([
|
|
25287
|
+
effectsClass(DataType.Vector2PropertyPlayableAsset)
|
|
25288
|
+
], Vector2PropertyPlayableAsset);
|
|
24619
25289
|
|
|
24620
25290
|
var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
24621
25291
|
_inherits(ObjectBindingTrack, TrackAsset);
|
|
@@ -25998,7 +26668,7 @@ function getStandardInteractContent(ui) {
|
|
|
25998
26668
|
}
|
|
25999
26669
|
});
|
|
26000
26670
|
});
|
|
26001
|
-
json.version = "
|
|
26671
|
+
json.version = JSONSceneVersion["2_1"];
|
|
26002
26672
|
return json;
|
|
26003
26673
|
}
|
|
26004
26674
|
/**
|
|
@@ -26337,7 +27007,7 @@ function getStandardInteractContent(ui) {
|
|
|
26337
27007
|
break;
|
|
26338
27008
|
}
|
|
26339
27009
|
}
|
|
26340
|
-
result.version = "
|
|
27010
|
+
result.version = JSONSceneVersion["3_0"];
|
|
26341
27011
|
return result;
|
|
26342
27012
|
}
|
|
26343
27013
|
/**
|
|
@@ -26879,13 +27549,13 @@ function getStandardJSON(json) {
|
|
|
26879
27549
|
}
|
|
26880
27550
|
throw new Error("Invalid JSON version: " + json.version + ".");
|
|
26881
27551
|
}
|
|
26882
|
-
var currentVersion = "
|
|
27552
|
+
var currentVersion = JSONSceneVersion["1_0"];
|
|
26883
27553
|
function getStandardJSONFromV0(json) {
|
|
26884
27554
|
var _json_bins;
|
|
26885
|
-
currentVersion = "
|
|
27555
|
+
currentVersion = JSONSceneVersion["1_0"];
|
|
26886
27556
|
var plugins = json.plugins || [];
|
|
26887
27557
|
if ((_json_bins = json.bins) == null ? void 0 : _json_bins.length) {
|
|
26888
|
-
currentVersion = "
|
|
27558
|
+
currentVersion = JSONSceneVersion["1_3"];
|
|
26889
27559
|
}
|
|
26890
27560
|
var requires = (json.requires || []).slice();
|
|
26891
27561
|
var images = json.images.map(function(img, index) {
|
|
@@ -28808,7 +29478,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28808
29478
|
*/ _proto.getSpeed = function getSpeed() {
|
|
28809
29479
|
return this.speed;
|
|
28810
29480
|
};
|
|
28811
|
-
|
|
29481
|
+
/**
|
|
29482
|
+
*
|
|
29483
|
+
*/ _proto.play = function play() {
|
|
28812
29484
|
if (this.isEnded && this.reusable) {
|
|
28813
29485
|
this.restart();
|
|
28814
29486
|
}
|
|
@@ -28823,7 +29495,10 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
28823
29495
|
*/ _proto.pause = function pause() {
|
|
28824
29496
|
this.paused = true;
|
|
28825
29497
|
};
|
|
28826
|
-
|
|
29498
|
+
/**
|
|
29499
|
+
*
|
|
29500
|
+
* @returns
|
|
29501
|
+
*/ _proto.getPaused = function getPaused() {
|
|
28827
29502
|
return this.paused;
|
|
28828
29503
|
};
|
|
28829
29504
|
/**
|
|
@@ -31401,7 +32076,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
31401
32076
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
31402
32077
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
31403
32078
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
31404
|
-
var version$1 = "2.
|
|
32079
|
+
var version$1 = "2.3.0-alpha.1";
|
|
31405
32080
|
logger.info("Core version: " + version$1 + ".");
|
|
31406
32081
|
|
|
31407
32082
|
var _obj;
|
|
@@ -33034,8 +33709,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33034
33709
|
*/ Mesh.create = function(engine, props) {
|
|
33035
33710
|
return new ThreeMesh(engine, props);
|
|
33036
33711
|
};
|
|
33037
|
-
var version = "2.
|
|
33712
|
+
var version = "2.3.0-alpha.1";
|
|
33038
33713
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33039
33714
|
|
|
33040
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
33715
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
33041
33716
|
//# sourceMappingURL=index.mjs.map
|