@galacean/effects-specification 2.0.0-alpha.2 → 2.0.0-alpha.21
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/README.md +2 -10
- package/es/animation-clip-data.d.ts +26 -0
- package/es/animation-clip-data.js +1 -0
- package/{dist/src → es}/binary.d.ts +9 -2
- package/es/binary.js +1 -0
- package/es/buitin-object-guid.d.ts +5 -0
- package/es/buitin-object-guid.js +5 -0
- package/es/components.d.ts +209 -0
- package/es/components.js +129 -0
- package/{dist/src → es}/composition.d.ts +28 -70
- package/es/composition.js +12 -0
- package/{dist/src → es}/constants.d.ts +23 -0
- package/es/constants.js +34 -0
- package/{dist/src → es}/image.d.ts +21 -27
- package/es/image.js +9 -0
- package/{dist/src → es}/index.d.ts +4 -2
- package/es/index.js +28 -0
- package/{dist/src → es}/item/base-item.d.ts +27 -8
- package/es/item/base-item.js +27 -0
- package/{dist/src → es}/item/camera-item.d.ts +6 -6
- package/es/item/camera-item.js +1 -0
- package/{dist/src → es}/item/composition-item.d.ts +4 -4
- package/es/item/composition-item.js +1 -0
- package/es/item/effect-item.d.ts +35 -0
- package/es/item/effect-item.js +1 -0
- package/{dist/src → es}/item/interact-item.d.ts +3 -3
- package/es/item/interact-item.js +1 -0
- package/es/item/model/binary.js +1 -0
- package/{dist/src → es}/item/model/camera.d.ts +2 -2
- package/es/item/model/camera.js +5 -0
- package/es/item/model/index.js +35 -0
- package/{dist/src → es}/item/model/light.d.ts +2 -2
- package/es/item/model/light.js +19 -0
- package/{dist/src → es}/item/model/material.d.ts +3 -3
- package/es/item/model/material.js +16 -0
- package/{dist/src → es}/item/model/mesh.d.ts +9 -8
- package/es/item/model/mesh.js +5 -0
- package/es/item/model/render.js +42 -0
- package/{dist/src → es}/item/model/skybox.d.ts +9 -3
- package/es/item/model/skybox.js +1 -0
- package/{dist/src → es}/item/model/tree.d.ts +10 -0
- package/es/item/model/tree.js +1 -0
- package/es/item/null-item.d.ts +46 -0
- package/es/item/null-item.js +1 -0
- package/{dist/src → es}/item/particle-item.d.ts +20 -23
- package/es/item/particle-item.js +14 -0
- package/es/item/particle-shape.js +19 -0
- package/{dist/src → es}/item/plugin-item.d.ts +3 -3
- package/es/item/plugin-item.js +1 -0
- package/{dist/src → es}/item/spine-item.d.ts +44 -20
- package/es/item/spine-item.js +1 -0
- package/{dist/src → es}/item/sprite-item.d.ts +3 -3
- package/es/item/sprite-item.js +1 -0
- package/{dist/src → es}/item/text-item.d.ts +3 -3
- package/es/item/text-item.js +1 -0
- package/{dist/src → es}/item.d.ts +2 -5
- package/es/item.js +1 -0
- package/{dist/src → es}/number-expression.d.ts +21 -8
- package/es/number-expression.js +91 -0
- package/{dist/src → es}/scene.d.ts +19 -19
- package/es/scene.js +1 -0
- package/{dist/src → es}/text.d.ts +3 -55
- package/es/text.js +84 -0
- package/es/timeline/index.d.ts +5 -0
- package/es/timeline/index.js +5 -0
- package/es/timeline/playables/sprite-color-playable-asset-data.d.ts +8 -0
- package/es/timeline/playables/sprite-color-playable-asset-data.js +1 -0
- package/es/timeline/playables/transform-playable-asset-data.d.ts +17 -0
- package/es/timeline/playables/transform-playable-asset-data.js +1 -0
- package/es/timeline/timeline-asset-data.d.ts +8 -0
- package/es/timeline/timeline-asset-data.js +1 -0
- package/es/timeline/timeline-clip-data.d.ts +11 -0
- package/es/timeline/timeline-clip-data.js +1 -0
- package/es/timeline/track/track-asset-data.d.ts +9 -0
- package/es/timeline/track/track-asset-data.js +1 -0
- package/{dist/src → es}/type.d.ts +45 -20
- package/es/type.js +342 -0
- package/{dist/src → es}/vfx-item-data.d.ts +10 -11
- package/es/vfx-item-data.js +1 -0
- package/package.json +26 -47
- package/dist/fallback/camera.d.ts +0 -2
- package/dist/fallback/filter.d.ts +0 -2
- package/dist/fallback/index.d.ts +0 -12
- package/dist/fallback/interact.d.ts +0 -2
- package/dist/fallback/migration.d.ts +0 -13
- package/dist/fallback/particle.d.ts +0 -2
- package/dist/fallback/sprite.d.ts +0 -3
- package/dist/fallback/utils.d.ts +0 -36
- package/dist/fallback.js +0 -2155
- package/dist/fallback.js.map +0 -1
- package/dist/fallback.mjs +0 -2127
- package/dist/fallback.mjs.map +0 -1
- package/dist/index.js +0 -758
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -743
- package/dist/index.mjs.map +0 -1
- package/dist/src/components.d.ts +0 -93
- package/dist/src/item/effect-item.d.ts +0 -17
- package/dist/src/item/filter-item.d.ts +0 -99
- package/dist/src/item/null-item.d.ts +0 -94
- /package/{dist/src → es}/item/model/binary.d.ts +0 -0
- /package/{dist/src → es}/item/model/index.d.ts +0 -0
- /package/{dist/src → es}/item/model/render.d.ts +0 -0
- /package/{dist/src → es}/item/particle-shape.d.ts +0 -0
package/dist/fallback.js
DELETED
|
@@ -1,2155 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Name: @galacean/effects-specification
|
|
3
|
-
* Description: Galacean Effects JSON Specification
|
|
4
|
-
* Author: Ant Group CO., Ltd.
|
|
5
|
-
* Version: v2.0.0-alpha.2
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
13
|
-
var native = {
|
|
14
|
-
randomUUID
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
18
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
19
|
-
// generators (like Math.random()).
|
|
20
|
-
let getRandomValues;
|
|
21
|
-
const rnds8 = new Uint8Array(16);
|
|
22
|
-
function rng() {
|
|
23
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
24
|
-
if (!getRandomValues) {
|
|
25
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
26
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
27
|
-
|
|
28
|
-
if (!getRandomValues) {
|
|
29
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return getRandomValues(rnds8);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
38
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
const byteToHex = [];
|
|
42
|
-
|
|
43
|
-
for (let i = 0; i < 256; ++i) {
|
|
44
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function unsafeStringify(arr, offset = 0) {
|
|
48
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
49
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
50
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function v4(options, buf, offset) {
|
|
54
|
-
if (native.randomUUID && !buf && !options) {
|
|
55
|
-
return native.randomUUID();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
options = options || {};
|
|
59
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
60
|
-
|
|
61
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
62
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
63
|
-
|
|
64
|
-
if (buf) {
|
|
65
|
-
offset = offset || 0;
|
|
66
|
-
|
|
67
|
-
for (let i = 0; i < 16; ++i) {
|
|
68
|
-
buf[offset + i] = rnds[i];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return buf;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return unsafeStringify(rnds);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/*********************************************/
|
|
78
|
-
/* 元素属性参数类型 */
|
|
79
|
-
/*********************************************/
|
|
80
|
-
/**
|
|
81
|
-
* 渲染等级
|
|
82
|
-
*/
|
|
83
|
-
var RenderLevel;
|
|
84
|
-
(function (RenderLevel) {
|
|
85
|
-
RenderLevel["S"] = "S";
|
|
86
|
-
RenderLevel["APlus"] = "A+";
|
|
87
|
-
RenderLevel["A"] = "A";
|
|
88
|
-
RenderLevel["BPlus"] = "B+";
|
|
89
|
-
RenderLevel["B"] = "B";
|
|
90
|
-
})(RenderLevel || (RenderLevel = {}));
|
|
91
|
-
/**
|
|
92
|
-
* 混合模式
|
|
93
|
-
*/
|
|
94
|
-
var BlendingMode;
|
|
95
|
-
(function (BlendingMode) {
|
|
96
|
-
/**
|
|
97
|
-
* 普通混合模式
|
|
98
|
-
*/
|
|
99
|
-
BlendingMode[BlendingMode["ALPHA"] = 0] = "ALPHA";
|
|
100
|
-
/**
|
|
101
|
-
* 叠加混合模式
|
|
102
|
-
*/
|
|
103
|
-
BlendingMode[BlendingMode["ADD"] = 1] = "ADD";
|
|
104
|
-
/**
|
|
105
|
-
* 相乘混合模式
|
|
106
|
-
*/
|
|
107
|
-
BlendingMode[BlendingMode["MULTIPLY"] = 2] = "MULTIPLY";
|
|
108
|
-
/**
|
|
109
|
-
* 亮度混合模式
|
|
110
|
-
*/
|
|
111
|
-
BlendingMode[BlendingMode["BRIGHTNESS"] = 3] = "BRIGHTNESS";
|
|
112
|
-
/**
|
|
113
|
-
* 减色混合模式
|
|
114
|
-
*/
|
|
115
|
-
BlendingMode[BlendingMode["SUBTRACTION"] = 4] = "SUBTRACTION";
|
|
116
|
-
/**
|
|
117
|
-
* 强光混合模式
|
|
118
|
-
*/
|
|
119
|
-
BlendingMode[BlendingMode["STRONG_LIGHT"] = 5] = "STRONG_LIGHT";
|
|
120
|
-
/**
|
|
121
|
-
* 弱光混合模式
|
|
122
|
-
*/
|
|
123
|
-
BlendingMode[BlendingMode["WEAK_LIGHT"] = 6] = "WEAK_LIGHT";
|
|
124
|
-
/**
|
|
125
|
-
* 亮度叠加混合模式
|
|
126
|
-
*/
|
|
127
|
-
BlendingMode[BlendingMode["SUPERPOSITION"] = 7] = "SUPERPOSITION";
|
|
128
|
-
})(BlendingMode || (BlendingMode = {}));
|
|
129
|
-
/**
|
|
130
|
-
* 单双面模式
|
|
131
|
-
*/
|
|
132
|
-
var SideMode;
|
|
133
|
-
(function (SideMode) {
|
|
134
|
-
/**
|
|
135
|
-
* 双面模式
|
|
136
|
-
*/
|
|
137
|
-
SideMode[SideMode["DOUBLE"] = 1032] = "DOUBLE";
|
|
138
|
-
/**
|
|
139
|
-
* 正面模式
|
|
140
|
-
*/
|
|
141
|
-
SideMode[SideMode["FRONT"] = 1028] = "FRONT";
|
|
142
|
-
/**
|
|
143
|
-
* 背面模式
|
|
144
|
-
*/
|
|
145
|
-
SideMode[SideMode["BACK"] = 1029] = "BACK";
|
|
146
|
-
})(SideMode || (SideMode = {}));
|
|
147
|
-
/**
|
|
148
|
-
* 蒙版模式
|
|
149
|
-
*/
|
|
150
|
-
var MaskMode;
|
|
151
|
-
(function (MaskMode) {
|
|
152
|
-
/**
|
|
153
|
-
* 无蒙版
|
|
154
|
-
*/
|
|
155
|
-
MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
156
|
-
/**
|
|
157
|
-
* 蒙版
|
|
158
|
-
*/
|
|
159
|
-
MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
160
|
-
/**
|
|
161
|
-
* 被遮挡
|
|
162
|
-
*/
|
|
163
|
-
MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
164
|
-
/**
|
|
165
|
-
* 被反向遮挡
|
|
166
|
-
*/
|
|
167
|
-
MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
168
|
-
})(MaskMode || (MaskMode = {}));
|
|
169
|
-
/**
|
|
170
|
-
* 发射器形状
|
|
171
|
-
*/
|
|
172
|
-
var ShapeType;
|
|
173
|
-
(function (ShapeType) {
|
|
174
|
-
/**
|
|
175
|
-
* 没有类型
|
|
176
|
-
*/
|
|
177
|
-
ShapeType[ShapeType["NONE"] = 0] = "NONE";
|
|
178
|
-
/**
|
|
179
|
-
* 圆球
|
|
180
|
-
*/
|
|
181
|
-
ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
|
|
182
|
-
/**
|
|
183
|
-
* 圆锥
|
|
184
|
-
*/
|
|
185
|
-
ShapeType[ShapeType["CONE"] = 2] = "CONE";
|
|
186
|
-
/**
|
|
187
|
-
* 半球
|
|
188
|
-
*/
|
|
189
|
-
ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
|
|
190
|
-
/**
|
|
191
|
-
* 圆
|
|
192
|
-
*/
|
|
193
|
-
ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
|
|
194
|
-
/**
|
|
195
|
-
* 圆环
|
|
196
|
-
*/
|
|
197
|
-
ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
|
|
198
|
-
/**
|
|
199
|
-
* 矩形
|
|
200
|
-
*/
|
|
201
|
-
ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
|
|
202
|
-
/**
|
|
203
|
-
* 矩形框
|
|
204
|
-
*/
|
|
205
|
-
ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
|
|
206
|
-
/**
|
|
207
|
-
* 直线
|
|
208
|
-
*/
|
|
209
|
-
ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
|
|
210
|
-
/**
|
|
211
|
-
* 贴图
|
|
212
|
-
*/
|
|
213
|
-
ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
|
|
214
|
-
})(ShapeType || (ShapeType = {}));
|
|
215
|
-
/**
|
|
216
|
-
* 插件类型
|
|
217
|
-
*/
|
|
218
|
-
var PluginType;
|
|
219
|
-
(function (PluginType) {
|
|
220
|
-
/**
|
|
221
|
-
* 陀螺仪
|
|
222
|
-
*/
|
|
223
|
-
PluginType[PluginType["GYROSCOPE"] = 0] = "GYROSCOPE";
|
|
224
|
-
/**
|
|
225
|
-
* Spine
|
|
226
|
-
*/
|
|
227
|
-
PluginType[PluginType["SPINE"] = 1] = "SPINE";
|
|
228
|
-
})(PluginType || (PluginType = {}));
|
|
229
|
-
/**
|
|
230
|
-
* 交互类型
|
|
231
|
-
*/
|
|
232
|
-
var InteractType;
|
|
233
|
-
(function (InteractType) {
|
|
234
|
-
/**
|
|
235
|
-
* 点击
|
|
236
|
-
*/
|
|
237
|
-
InteractType[InteractType["CLICK"] = 0] = "CLICK";
|
|
238
|
-
/**
|
|
239
|
-
* 消息
|
|
240
|
-
* 前端收到 onMessageItem 回调
|
|
241
|
-
*/
|
|
242
|
-
InteractType[InteractType["MESSAGE"] = 1] = "MESSAGE";
|
|
243
|
-
/**
|
|
244
|
-
* 拖拽
|
|
245
|
-
*/
|
|
246
|
-
InteractType[InteractType["DRAG"] = 2] = "DRAG";
|
|
247
|
-
})(InteractType || (InteractType = {}));
|
|
248
|
-
/**
|
|
249
|
-
* 交互行为
|
|
250
|
-
*/
|
|
251
|
-
var InteractBehavior;
|
|
252
|
-
(function (InteractBehavior) {
|
|
253
|
-
/**
|
|
254
|
-
* 无
|
|
255
|
-
*/
|
|
256
|
-
InteractBehavior[InteractBehavior["NONE"] = 0] = "NONE";
|
|
257
|
-
/**
|
|
258
|
-
* 通知
|
|
259
|
-
*/
|
|
260
|
-
InteractBehavior[InteractBehavior["NOTIFY"] = 1] = "NOTIFY";
|
|
261
|
-
/**
|
|
262
|
-
* 重置播放器
|
|
263
|
-
*/
|
|
264
|
-
InteractBehavior[InteractBehavior["RESUME_PLAYER"] = 2] = "RESUME_PLAYER";
|
|
265
|
-
/**
|
|
266
|
-
* 清除元素
|
|
267
|
-
*/
|
|
268
|
-
InteractBehavior[InteractBehavior["REMOVE"] = 3] = "REMOVE";
|
|
269
|
-
/**
|
|
270
|
-
* 暂停播放器
|
|
271
|
-
*/
|
|
272
|
-
InteractBehavior[InteractBehavior["PAUSE"] = 4] = "PAUSE";
|
|
273
|
-
})(InteractBehavior || (InteractBehavior = {}));
|
|
274
|
-
/**
|
|
275
|
-
* 元素类型
|
|
276
|
-
*/
|
|
277
|
-
var ItemType;
|
|
278
|
-
(function (ItemType) {
|
|
279
|
-
/**
|
|
280
|
-
* 错误元素
|
|
281
|
-
*/
|
|
282
|
-
ItemType["base"] = "0";
|
|
283
|
-
/**
|
|
284
|
-
* 图层元素
|
|
285
|
-
*/
|
|
286
|
-
ItemType["sprite"] = "1";
|
|
287
|
-
/**
|
|
288
|
-
* 粒子元素
|
|
289
|
-
*/
|
|
290
|
-
ItemType["particle"] = "2";
|
|
291
|
-
/**
|
|
292
|
-
* 空节点元素
|
|
293
|
-
*/
|
|
294
|
-
ItemType["null"] = "3";
|
|
295
|
-
/**
|
|
296
|
-
* 交互元素
|
|
297
|
-
*/
|
|
298
|
-
ItemType["interact"] = "4";
|
|
299
|
-
/**
|
|
300
|
-
* 插件元素
|
|
301
|
-
*/
|
|
302
|
-
ItemType["plugin"] = "5";
|
|
303
|
-
/**
|
|
304
|
-
* 相机元素
|
|
305
|
-
*/
|
|
306
|
-
ItemType["camera"] = "6";
|
|
307
|
-
/**
|
|
308
|
-
* 预合成元素
|
|
309
|
-
*/
|
|
310
|
-
ItemType["composition"] = "7";
|
|
311
|
-
/**
|
|
312
|
-
* 滤镜图层
|
|
313
|
-
*/
|
|
314
|
-
ItemType["filter"] = "8";
|
|
315
|
-
/**
|
|
316
|
-
* Spine 元素
|
|
317
|
-
*/
|
|
318
|
-
ItemType["spine"] = "spine";
|
|
319
|
-
/**
|
|
320
|
-
* Mesh 元素
|
|
321
|
-
*/
|
|
322
|
-
ItemType["mesh"] = "mesh";
|
|
323
|
-
/**
|
|
324
|
-
* 节点树元素
|
|
325
|
-
*/
|
|
326
|
-
ItemType["tree"] = "tree";
|
|
327
|
-
/**
|
|
328
|
-
* 文本元素
|
|
329
|
-
*/
|
|
330
|
-
ItemType["text"] = "text";
|
|
331
|
-
/**
|
|
332
|
-
* 灯光元素
|
|
333
|
-
*/
|
|
334
|
-
ItemType["light"] = "light";
|
|
335
|
-
/**
|
|
336
|
-
* 天空盒元素
|
|
337
|
-
*/
|
|
338
|
-
ItemType["skybox"] = "skybox";
|
|
339
|
-
/**
|
|
340
|
-
* 特效元素
|
|
341
|
-
*/
|
|
342
|
-
ItemType["effect"] = "effect";
|
|
343
|
-
})(ItemType || (ItemType = {}));
|
|
344
|
-
/**
|
|
345
|
-
* 渲染模式
|
|
346
|
-
*/
|
|
347
|
-
var RenderMode;
|
|
348
|
-
(function (RenderMode) {
|
|
349
|
-
/**
|
|
350
|
-
* 广告牌模式
|
|
351
|
-
*/
|
|
352
|
-
RenderMode[RenderMode["BILLBOARD"] = 0] = "BILLBOARD";
|
|
353
|
-
/**
|
|
354
|
-
* 网格模式
|
|
355
|
-
*/
|
|
356
|
-
RenderMode[RenderMode["MESH"] = 1] = "MESH";
|
|
357
|
-
/**
|
|
358
|
-
* 垂直广告牌模式
|
|
359
|
-
*/
|
|
360
|
-
RenderMode[RenderMode["VERTICAL_BILLBOARD"] = 2] = "VERTICAL_BILLBOARD";
|
|
361
|
-
/**
|
|
362
|
-
* 水平广告牌模式
|
|
363
|
-
*/
|
|
364
|
-
RenderMode[RenderMode["HORIZONTAL_BILLBOARD"] = 3] = "HORIZONTAL_BILLBOARD";
|
|
365
|
-
})(RenderMode || (RenderMode = {}));
|
|
366
|
-
/**
|
|
367
|
-
* 变换中心
|
|
368
|
-
*/
|
|
369
|
-
var ParticleOrigin;
|
|
370
|
-
(function (ParticleOrigin) {
|
|
371
|
-
/**
|
|
372
|
-
* 水平和垂直中点
|
|
373
|
-
*/
|
|
374
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER"] = 0] = "PARTICLE_ORIGIN_CENTER";
|
|
375
|
-
/**
|
|
376
|
-
* 水平左侧 垂直顶部
|
|
377
|
-
*/
|
|
378
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_TOP"] = 1] = "PARTICLE_ORIGIN_LEFT_TOP";
|
|
379
|
-
/**
|
|
380
|
-
* 水平左侧 垂直中间
|
|
381
|
-
*/
|
|
382
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_CENTER"] = 2] = "PARTICLE_ORIGIN_LEFT_CENTER";
|
|
383
|
-
/**
|
|
384
|
-
* 水平左侧 垂直底部
|
|
385
|
-
*/
|
|
386
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_BOTTOM"] = 3] = "PARTICLE_ORIGIN_LEFT_BOTTOM";
|
|
387
|
-
/**
|
|
388
|
-
* 水平中间 垂直顶部
|
|
389
|
-
*/
|
|
390
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_TOP"] = 4] = "PARTICLE_ORIGIN_CENTER_TOP";
|
|
391
|
-
/**
|
|
392
|
-
* 水平中间 垂直底部
|
|
393
|
-
*/
|
|
394
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_BOTTOM"] = 5] = "PARTICLE_ORIGIN_CENTER_BOTTOM";
|
|
395
|
-
/**
|
|
396
|
-
* 水平右侧 垂直顶部
|
|
397
|
-
*/
|
|
398
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_TOP"] = 6] = "PARTICLE_ORIGIN_RIGHT_TOP";
|
|
399
|
-
/**
|
|
400
|
-
* 水平右侧 垂直中间
|
|
401
|
-
*/
|
|
402
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_CENTER"] = 7] = "PARTICLE_ORIGIN_RIGHT_CENTER";
|
|
403
|
-
/**
|
|
404
|
-
* 水平右侧 垂直底部
|
|
405
|
-
*/
|
|
406
|
-
ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_BOTTOM"] = 8] = "PARTICLE_ORIGIN_RIGHT_BOTTOM";
|
|
407
|
-
})(ParticleOrigin || (ParticleOrigin = {}));
|
|
408
|
-
|
|
409
|
-
var END_BEHAVIOR_DESTROY = 0;
|
|
410
|
-
var END_BEHAVIOR_PAUSE = 1;
|
|
411
|
-
var END_BEHAVIOR_FORWARD = 2;
|
|
412
|
-
var END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
|
|
413
|
-
var END_BEHAVIOR_FREEZE = 4;
|
|
414
|
-
var END_BEHAVIOR_RESTART = 5;
|
|
415
|
-
var END_BEHAVIOR_DESTROY_CHILDREN = 6;
|
|
416
|
-
var CAMERA_CLIP_MODE_VERTICAL = 1;
|
|
417
|
-
var CAMERA_CLIP_MODE_NORMAL = 0;
|
|
418
|
-
|
|
419
|
-
var CameraClipMode;
|
|
420
|
-
(function (CameraClipMode) {
|
|
421
|
-
/**
|
|
422
|
-
* 剪裁上下
|
|
423
|
-
*/
|
|
424
|
-
CameraClipMode[CameraClipMode["portrait"] = CAMERA_CLIP_MODE_VERTICAL] = "portrait";
|
|
425
|
-
/**
|
|
426
|
-
* 剪裁左右
|
|
427
|
-
*/
|
|
428
|
-
CameraClipMode[CameraClipMode["landscape"] = CAMERA_CLIP_MODE_NORMAL] = "landscape";
|
|
429
|
-
})(CameraClipMode || (CameraClipMode = {}));
|
|
430
|
-
/**
|
|
431
|
-
* 结束行为
|
|
432
|
-
*/
|
|
433
|
-
var CompositionEndBehavior;
|
|
434
|
-
(function (CompositionEndBehavior) {
|
|
435
|
-
/**
|
|
436
|
-
* 销毁
|
|
437
|
-
*/
|
|
438
|
-
CompositionEndBehavior[CompositionEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
439
|
-
/**
|
|
440
|
-
* 暂停
|
|
441
|
-
*/
|
|
442
|
-
CompositionEndBehavior[CompositionEndBehavior["pause"] = END_BEHAVIOR_PAUSE] = "pause";
|
|
443
|
-
/**
|
|
444
|
-
* 重播
|
|
445
|
-
*/
|
|
446
|
-
CompositionEndBehavior[CompositionEndBehavior["restart"] = END_BEHAVIOR_RESTART] = "restart";
|
|
447
|
-
/**
|
|
448
|
-
* 无限播放
|
|
449
|
-
*/
|
|
450
|
-
CompositionEndBehavior[CompositionEndBehavior["forward"] = END_BEHAVIOR_FORWARD] = "forward";
|
|
451
|
-
/**
|
|
452
|
-
* 销毁并保留最后一帧
|
|
453
|
-
*/
|
|
454
|
-
CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = END_BEHAVIOR_PAUSE_AND_DESTROY] = "pause_destroy";
|
|
455
|
-
/**
|
|
456
|
-
* 冻结
|
|
457
|
-
*/
|
|
458
|
-
CompositionEndBehavior[CompositionEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
459
|
-
})(CompositionEndBehavior || (CompositionEndBehavior = {}));
|
|
460
|
-
|
|
461
|
-
/*********************************************/
|
|
462
|
-
/* 基本数值属性参数 */
|
|
463
|
-
/*********************************************/
|
|
464
|
-
var ValueType;
|
|
465
|
-
(function (ValueType) {
|
|
466
|
-
/**
|
|
467
|
-
* 常数
|
|
468
|
-
*/
|
|
469
|
-
ValueType[ValueType["CONSTANT"] = 0] = "CONSTANT";
|
|
470
|
-
/**
|
|
471
|
-
* 二维常数向量
|
|
472
|
-
*/
|
|
473
|
-
ValueType[ValueType["CONSTANT_VEC2"] = 1] = "CONSTANT_VEC2";
|
|
474
|
-
/**
|
|
475
|
-
* 三维常数向量
|
|
476
|
-
*/
|
|
477
|
-
ValueType[ValueType["CONSTANT_VEC3"] = 2] = "CONSTANT_VEC3";
|
|
478
|
-
/**
|
|
479
|
-
* 四维常数向量
|
|
480
|
-
*/
|
|
481
|
-
ValueType[ValueType["CONSTANT_VEC4"] = 3] = "CONSTANT_VEC4";
|
|
482
|
-
/**
|
|
483
|
-
* 随机数
|
|
484
|
-
*/
|
|
485
|
-
ValueType[ValueType["RANDOM"] = 4] = "RANDOM";
|
|
486
|
-
/**
|
|
487
|
-
* 直线
|
|
488
|
-
*/
|
|
489
|
-
ValueType[ValueType["LINE"] = 5] = "LINE";
|
|
490
|
-
/**
|
|
491
|
-
* 曲线
|
|
492
|
-
*/
|
|
493
|
-
ValueType[ValueType["CURVE"] = 6] = "CURVE";
|
|
494
|
-
/**
|
|
495
|
-
* 贝塞尔路径
|
|
496
|
-
*/
|
|
497
|
-
ValueType[ValueType["BEZIER_PATH"] = 7] = "BEZIER_PATH";
|
|
498
|
-
/**
|
|
499
|
-
* 颜色
|
|
500
|
-
*/
|
|
501
|
-
ValueType[ValueType["RGBA_COLOR"] = 8] = "RGBA_COLOR";
|
|
502
|
-
/**
|
|
503
|
-
* 渐变色
|
|
504
|
-
*/
|
|
505
|
-
ValueType[ValueType["GRADIENT_COLOR"] = 9] = "GRADIENT_COLOR";
|
|
506
|
-
/**
|
|
507
|
-
* 蒙版形状点集
|
|
508
|
-
*/
|
|
509
|
-
ValueType[ValueType["SHAPE_POINTS"] = 10] = "SHAPE_POINTS";
|
|
510
|
-
/**
|
|
511
|
-
* 蒙版形状切分
|
|
512
|
-
*/
|
|
513
|
-
ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
|
|
514
|
-
/**
|
|
515
|
-
*直线路径
|
|
516
|
-
*/
|
|
517
|
-
ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
|
|
518
|
-
/**
|
|
519
|
-
* 多色
|
|
520
|
-
*/
|
|
521
|
-
ValueType[ValueType["COLORS"] = 13] = "COLORS";
|
|
522
|
-
/**
|
|
523
|
-
* 二进制指针
|
|
524
|
-
*/
|
|
525
|
-
ValueType[ValueType["BINARY"] = 20] = "BINARY";
|
|
526
|
-
/**
|
|
527
|
-
* 贝塞尔曲线
|
|
528
|
-
*/
|
|
529
|
-
ValueType[ValueType["BEZIER_CURVE"] = 21] = "BEZIER_CURVE";
|
|
530
|
-
/**
|
|
531
|
-
* 贝塞尔曲线路径
|
|
532
|
-
*/
|
|
533
|
-
ValueType[ValueType["BEZIER_CURVE_PATH"] = 22] = "BEZIER_CURVE_PATH";
|
|
534
|
-
})(ValueType || (ValueType = {}));
|
|
535
|
-
/**
|
|
536
|
-
* 关键帧类型
|
|
537
|
-
*/
|
|
538
|
-
var BezierKeyframeType;
|
|
539
|
-
(function (BezierKeyframeType) {
|
|
540
|
-
BezierKeyframeType[BezierKeyframeType["AUTO"] = 0] = "AUTO";
|
|
541
|
-
BezierKeyframeType[BezierKeyframeType["EASE"] = 1] = "EASE";
|
|
542
|
-
BezierKeyframeType[BezierKeyframeType["EASE_IN"] = 2] = "EASE_IN";
|
|
543
|
-
BezierKeyframeType[BezierKeyframeType["EASE_OUT"] = 3] = "EASE_OUT";
|
|
544
|
-
BezierKeyframeType[BezierKeyframeType["LINE"] = 4] = "LINE";
|
|
545
|
-
BezierKeyframeType[BezierKeyframeType["HOLD"] = 5] = "HOLD";
|
|
546
|
-
BezierKeyframeType[BezierKeyframeType["LINE_OUT"] = 6] = "LINE_OUT";
|
|
547
|
-
})(BezierKeyframeType || (BezierKeyframeType = {}));
|
|
548
|
-
|
|
549
|
-
var ItemEndBehavior;
|
|
550
|
-
(function (ItemEndBehavior) {
|
|
551
|
-
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
552
|
-
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
|
|
553
|
-
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
554
|
-
})(ItemEndBehavior || (ItemEndBehavior = {}));
|
|
555
|
-
var ParentItemEndBehavior;
|
|
556
|
-
(function (ParentItemEndBehavior) {
|
|
557
|
-
ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = END_BEHAVIOR_DESTROY_CHILDREN] = "destroyChildren";
|
|
558
|
-
})(ParentItemEndBehavior || (ParentItemEndBehavior = {}));
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* 粒子交互行为
|
|
562
|
-
*/
|
|
563
|
-
var ParticleInteractionBehavior;
|
|
564
|
-
(function (ParticleInteractionBehavior) {
|
|
565
|
-
/**
|
|
566
|
-
* 无
|
|
567
|
-
*/
|
|
568
|
-
ParticleInteractionBehavior[ParticleInteractionBehavior["none"] = 0] = "none";
|
|
569
|
-
/**
|
|
570
|
-
* 移出粒子
|
|
571
|
-
*/
|
|
572
|
-
ParticleInteractionBehavior[ParticleInteractionBehavior["removeParticle"] = 1] = "removeParticle";
|
|
573
|
-
})(ParticleInteractionBehavior || (ParticleInteractionBehavior = {}));
|
|
574
|
-
|
|
575
|
-
var ShapeArcMode;
|
|
576
|
-
(function (ShapeArcMode) {
|
|
577
|
-
/**
|
|
578
|
-
* 随机
|
|
579
|
-
*/
|
|
580
|
-
ShapeArcMode[ShapeArcMode["RANDOM"] = 0] = "RANDOM";
|
|
581
|
-
/**
|
|
582
|
-
* 单向循环
|
|
583
|
-
*/
|
|
584
|
-
ShapeArcMode[ShapeArcMode["UNIDIRECTIONAL_CYCLE"] = 1] = "UNIDIRECTIONAL_CYCLE";
|
|
585
|
-
/**
|
|
586
|
-
* 双向循环
|
|
587
|
-
*/
|
|
588
|
-
ShapeArcMode[ShapeArcMode["BIDIRECTIONAL_CYCLE"] = 2] = "BIDIRECTIONAL_CYCLE";
|
|
589
|
-
/**
|
|
590
|
-
* 均匀爆发
|
|
591
|
-
*/
|
|
592
|
-
ShapeArcMode[ShapeArcMode["UNIFORM_BURST"] = 3] = "UNIFORM_BURST";
|
|
593
|
-
})(ShapeArcMode || (ShapeArcMode = {}));
|
|
594
|
-
|
|
595
|
-
var LightType;
|
|
596
|
-
(function (LightType) {
|
|
597
|
-
/**
|
|
598
|
-
* 点光源
|
|
599
|
-
*/
|
|
600
|
-
LightType["point"] = "point";
|
|
601
|
-
/**
|
|
602
|
-
* 聚光灯
|
|
603
|
-
*/
|
|
604
|
-
LightType["spot"] = "spot";
|
|
605
|
-
/**
|
|
606
|
-
* 方向光
|
|
607
|
-
*/
|
|
608
|
-
LightType["directional"] = "directional";
|
|
609
|
-
/**
|
|
610
|
-
* 环境光
|
|
611
|
-
*/
|
|
612
|
-
LightType["ambient"] = "ambient";
|
|
613
|
-
})(LightType || (LightType = {}));
|
|
614
|
-
|
|
615
|
-
var ModelBoundingType;
|
|
616
|
-
(function (ModelBoundingType) {
|
|
617
|
-
ModelBoundingType[ModelBoundingType["box"] = 2] = "box";
|
|
618
|
-
ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
|
|
619
|
-
})(ModelBoundingType || (ModelBoundingType = {}));
|
|
620
|
-
|
|
621
|
-
var CameraType;
|
|
622
|
-
(function (CameraType) {
|
|
623
|
-
CameraType["orthographic"] = "orthographic";
|
|
624
|
-
CameraType["perspective"] = "perspective";
|
|
625
|
-
})(CameraType || (CameraType = {}));
|
|
626
|
-
|
|
627
|
-
// 材质类型
|
|
628
|
-
var MaterialType;
|
|
629
|
-
(function (MaterialType) {
|
|
630
|
-
MaterialType["unlit"] = "unlit";
|
|
631
|
-
MaterialType["pbr"] = "pbr";
|
|
632
|
-
// 头发材质,在 pbr 材质基础上扩展
|
|
633
|
-
MaterialType["hair"] = "hair";
|
|
634
|
-
})(MaterialType || (MaterialType = {}));
|
|
635
|
-
// 混合模式
|
|
636
|
-
var MaterialBlending;
|
|
637
|
-
(function (MaterialBlending) {
|
|
638
|
-
MaterialBlending[MaterialBlending["opaque"] = 100] = "opaque";
|
|
639
|
-
MaterialBlending[MaterialBlending["masked"] = 101] = "masked";
|
|
640
|
-
MaterialBlending[MaterialBlending["translucent"] = 102] = "translucent";
|
|
641
|
-
MaterialBlending[MaterialBlending["additive"] = 103] = "additive";
|
|
642
|
-
})(MaterialBlending || (MaterialBlending = {}));
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* 3D渲染模式:将渲染过程中的中间结果输出,主要用于排查渲染效果问题,支持 pbr 和 unlit 材质
|
|
646
|
-
*/
|
|
647
|
-
var RenderMode3D;
|
|
648
|
-
(function (RenderMode3D) {
|
|
649
|
-
/**
|
|
650
|
-
* 正常渲染
|
|
651
|
-
*/
|
|
652
|
-
RenderMode3D["none"] = "none";
|
|
653
|
-
/**
|
|
654
|
-
* 纹理坐标
|
|
655
|
-
*/
|
|
656
|
-
RenderMode3D["uv"] = "uv";
|
|
657
|
-
/**
|
|
658
|
-
* 世界坐标法线
|
|
659
|
-
*/
|
|
660
|
-
RenderMode3D["normal"] = "normal";
|
|
661
|
-
/**
|
|
662
|
-
* 基础颜色
|
|
663
|
-
*/
|
|
664
|
-
RenderMode3D["basecolor"] = "basecolor";
|
|
665
|
-
/**
|
|
666
|
-
* 基础颜色 Alpha
|
|
667
|
-
*/
|
|
668
|
-
RenderMode3D["alpha"] = "alpha";
|
|
669
|
-
/**
|
|
670
|
-
* 金属度
|
|
671
|
-
*/
|
|
672
|
-
RenderMode3D["metallic"] = "metallic";
|
|
673
|
-
/**
|
|
674
|
-
* 粗超度
|
|
675
|
-
*/
|
|
676
|
-
RenderMode3D["roughness"] = "roughness";
|
|
677
|
-
/**
|
|
678
|
-
* 环境遮蔽
|
|
679
|
-
*/
|
|
680
|
-
RenderMode3D["ao"] = "ao";
|
|
681
|
-
/**
|
|
682
|
-
* 自发光
|
|
683
|
-
*/
|
|
684
|
-
RenderMode3D["emissive"] = "emissive";
|
|
685
|
-
})(RenderMode3D || (RenderMode3D = {}));
|
|
686
|
-
|
|
687
|
-
var TextOverflow;
|
|
688
|
-
(function (TextOverflow) {
|
|
689
|
-
/**
|
|
690
|
-
* display 模式下,会显示所有文本,存在文本超过边界框的情况。
|
|
691
|
-
*/
|
|
692
|
-
TextOverflow[TextOverflow["display"] = 0] = "display";
|
|
693
|
-
/**
|
|
694
|
-
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
695
|
-
*/
|
|
696
|
-
TextOverflow[TextOverflow["clip"] = 1] = "clip";
|
|
697
|
-
/**
|
|
698
|
-
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
699
|
-
*/
|
|
700
|
-
TextOverflow[TextOverflow["ellipsis"] = 2] = "ellipsis";
|
|
701
|
-
})(TextOverflow || (TextOverflow = {}));
|
|
702
|
-
var TextBaseline;
|
|
703
|
-
(function (TextBaseline) {
|
|
704
|
-
/**
|
|
705
|
-
* 文本顶对齐。
|
|
706
|
-
*/
|
|
707
|
-
TextBaseline[TextBaseline["top"] = 0] = "top";
|
|
708
|
-
/**
|
|
709
|
-
* 文本垂直居中对齐。
|
|
710
|
-
*/
|
|
711
|
-
TextBaseline[TextBaseline["middle"] = 1] = "middle";
|
|
712
|
-
/**
|
|
713
|
-
* 文本底对齐。
|
|
714
|
-
*/
|
|
715
|
-
TextBaseline[TextBaseline["bottom"] = 2] = "bottom";
|
|
716
|
-
})(TextBaseline || (TextBaseline = {}));
|
|
717
|
-
var TextAlignment;
|
|
718
|
-
(function (TextAlignment) {
|
|
719
|
-
/**
|
|
720
|
-
* text alignment starts from(x,y) to right direction
|
|
721
|
-
* 从(x,y)开始第一个字符,向右边延伸
|
|
722
|
-
*/
|
|
723
|
-
TextAlignment[TextAlignment["left"] = 0] = "left";
|
|
724
|
-
/**
|
|
725
|
-
* (x,y) is middle position of text, where (left + right)/2 =(x,y)
|
|
726
|
-
* (x,y) 为文字中间位置,(最左位置 + 最右位置)/2 = (x,y)
|
|
727
|
-
*/
|
|
728
|
-
TextAlignment[TextAlignment["middle"] = 1] = "middle";
|
|
729
|
-
/**
|
|
730
|
-
* text alignment ends with(x,y) from left direction
|
|
731
|
-
* 从(x,y)结束最后一个字符,向左边延伸
|
|
732
|
-
*/
|
|
733
|
-
TextAlignment[TextAlignment["right"] = 2] = "right";
|
|
734
|
-
})(TextAlignment || (TextAlignment = {}));
|
|
735
|
-
/**
|
|
736
|
-
* 文本字重
|
|
737
|
-
*/
|
|
738
|
-
var TextWeight;
|
|
739
|
-
(function (TextWeight) {
|
|
740
|
-
/**
|
|
741
|
-
* 正常
|
|
742
|
-
*/
|
|
743
|
-
TextWeight["normal"] = "normal";
|
|
744
|
-
/**
|
|
745
|
-
* 粗体
|
|
746
|
-
*/
|
|
747
|
-
TextWeight["bold"] = "bold";
|
|
748
|
-
/**
|
|
749
|
-
* 瘦体
|
|
750
|
-
*/
|
|
751
|
-
TextWeight["lighter"] = "lighter";
|
|
752
|
-
})(TextWeight || (TextWeight = {}));
|
|
753
|
-
/**
|
|
754
|
-
* 文本样式
|
|
755
|
-
*/
|
|
756
|
-
var FontStyle;
|
|
757
|
-
(function (FontStyle) {
|
|
758
|
-
/**
|
|
759
|
-
* 正常
|
|
760
|
-
*/
|
|
761
|
-
FontStyle["normal"] = "normal";
|
|
762
|
-
/**
|
|
763
|
-
* 斜体
|
|
764
|
-
*/
|
|
765
|
-
FontStyle["italic"] = "italic";
|
|
766
|
-
/**
|
|
767
|
-
* 倾斜体
|
|
768
|
-
*/
|
|
769
|
-
FontStyle["oblique"] = "oblique";
|
|
770
|
-
})(FontStyle || (FontStyle = {}));
|
|
771
|
-
|
|
772
|
-
var DataType;
|
|
773
|
-
(function (DataType) {
|
|
774
|
-
DataType["VFXItemData"] = "VFXItemData";
|
|
775
|
-
DataType["EffectComponent"] = "EffectComponent";
|
|
776
|
-
DataType["Material"] = "Material";
|
|
777
|
-
DataType["Shader"] = "Shader";
|
|
778
|
-
DataType["SpriteComponent"] = "SpriteComponent";
|
|
779
|
-
DataType["ParticleSystem"] = "ParticleSystem";
|
|
780
|
-
DataType["InteractComponent"] = "InteractComponent";
|
|
781
|
-
DataType["CameraController"] = "CameraController";
|
|
782
|
-
DataType["Geometry"] = "Geometry";
|
|
783
|
-
DataType["Texture"] = "Texture";
|
|
784
|
-
DataType["TextComponent"] = "TextComponent";
|
|
785
|
-
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
786
|
-
DataType["MeshComponent"] = "MeshComponent";
|
|
787
|
-
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
788
|
-
DataType["LightComponent"] = "LightComponent";
|
|
789
|
-
DataType["CameraComponent"] = "CameraComponent";
|
|
790
|
-
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
791
|
-
DataType["TreeComponent"] = "TreeComponent";
|
|
792
|
-
})(DataType || (DataType = {}));
|
|
793
|
-
|
|
794
|
-
/******************************************************************************
|
|
795
|
-
Copyright (c) Microsoft Corporation.
|
|
796
|
-
|
|
797
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
798
|
-
purpose with or without fee is hereby granted.
|
|
799
|
-
|
|
800
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
801
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
802
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
803
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
804
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
805
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
806
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
807
|
-
***************************************************************************** */
|
|
808
|
-
|
|
809
|
-
var __assign = function() {
|
|
810
|
-
__assign = Object.assign || function __assign(t) {
|
|
811
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
812
|
-
s = arguments[i];
|
|
813
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
814
|
-
}
|
|
815
|
-
return t;
|
|
816
|
-
};
|
|
817
|
-
return __assign.apply(this, arguments);
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
function __values(o) {
|
|
821
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
822
|
-
if (m) return m.call(o);
|
|
823
|
-
if (o && typeof o.length === "number") return {
|
|
824
|
-
next: function () {
|
|
825
|
-
if (o && i >= o.length) o = void 0;
|
|
826
|
-
return { value: o && o[i++], done: !o };
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
function __read(o, n) {
|
|
833
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
834
|
-
if (!m) return o;
|
|
835
|
-
var i = m.call(o), r, ar = [], e;
|
|
836
|
-
try {
|
|
837
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
838
|
-
}
|
|
839
|
-
catch (error) { e = { error: error }; }
|
|
840
|
-
finally {
|
|
841
|
-
try {
|
|
842
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
843
|
-
}
|
|
844
|
-
finally { if (e) throw e.error; }
|
|
845
|
-
}
|
|
846
|
-
return ar;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
function __spreadArray(to, from, pack) {
|
|
850
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
851
|
-
if (ar || !(i in from)) {
|
|
852
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
853
|
-
ar[i] = from[i];
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
860
|
-
var e = new Error(message);
|
|
861
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
var _a;
|
|
865
|
-
function arrAdd(arr, item) {
|
|
866
|
-
if (!arr.includes(item)) {
|
|
867
|
-
arr.push(item);
|
|
868
|
-
return true;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* @deprecated 请直接使用 Array.prototype.forEach 或 for...of
|
|
873
|
-
* @param object
|
|
874
|
-
* @param callback
|
|
875
|
-
* @returns the mutated input object
|
|
876
|
-
*/
|
|
877
|
-
function forEach(object, callback, thisObj) {
|
|
878
|
-
if (object) {
|
|
879
|
-
for (var name_1 in object) {
|
|
880
|
-
if (Object.hasOwnProperty.call(object, name_1)) {
|
|
881
|
-
callback.call(thisObj, object[name_1], name_1);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return object;
|
|
886
|
-
}
|
|
887
|
-
function ensureFixedNumber(a) {
|
|
888
|
-
if (Number.isFinite(a)) {
|
|
889
|
-
return [ValueType.CONSTANT, a];
|
|
890
|
-
}
|
|
891
|
-
if (a) {
|
|
892
|
-
if (a[0] === 'lines') {
|
|
893
|
-
return [ValueType.LINE, a[1]];
|
|
894
|
-
}
|
|
895
|
-
if (a[0] === 'curve') {
|
|
896
|
-
return [ValueType.CURVE, a[1]];
|
|
897
|
-
}
|
|
898
|
-
if (a[0] === 'static') {
|
|
899
|
-
return [ValueType.CONSTANT, a[1]];
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
function ensureFixedNumberWithRandom(a, p) {
|
|
904
|
-
if (Array.isArray(a) && a[0] === 'random') {
|
|
905
|
-
return [ValueType.CONSTANT, a[1][p]];
|
|
906
|
-
}
|
|
907
|
-
return ensureFixedNumber(a);
|
|
908
|
-
}
|
|
909
|
-
function ensureRGBAValue(a) {
|
|
910
|
-
if (a && a[0] === 'color') {
|
|
911
|
-
return colorToArr(a[1], true);
|
|
912
|
-
}
|
|
913
|
-
return [1, 1, 1, 1];
|
|
914
|
-
}
|
|
915
|
-
function ensureColorExpression(a, normalized) {
|
|
916
|
-
if (a) {
|
|
917
|
-
if (a[0] === 'colors') {
|
|
918
|
-
return [ValueType.COLORS, a[1].map(function (color) { return colorToArr(color, normalized); })];
|
|
919
|
-
}
|
|
920
|
-
else if (a[0] === 'gradient') {
|
|
921
|
-
return ensureGradient(a[1], normalized);
|
|
922
|
-
}
|
|
923
|
-
else if (a[0] === 'color') {
|
|
924
|
-
return [ValueType.RGBA_COLOR, colorToArr(a[1], normalized)];
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
function ensureNumberExpression(a) {
|
|
929
|
-
if (a && a[0] === 'random') {
|
|
930
|
-
return [ValueType.RANDOM, a[1]];
|
|
931
|
-
}
|
|
932
|
-
return ensureFixedNumber(a);
|
|
933
|
-
}
|
|
934
|
-
function ensureValueGetter(a) {
|
|
935
|
-
if (Array.isArray(a) && typeof a[0] === 'string') {
|
|
936
|
-
return ensureNumberExpression(a) || ensureFixedVec3(a) || ensureColorExpression(a) || a;
|
|
937
|
-
}
|
|
938
|
-
return a;
|
|
939
|
-
}
|
|
940
|
-
function ensureGradient(a, normalized) {
|
|
941
|
-
if (a) {
|
|
942
|
-
var stops_1 = [];
|
|
943
|
-
Object.getOwnPropertyNames(a).forEach(function (p) {
|
|
944
|
-
var stop = parsePercent(p);
|
|
945
|
-
var color = colorToArr(a[p], normalized);
|
|
946
|
-
stops_1.push([stop, color[0], color[1], color[2], color[3]]);
|
|
947
|
-
});
|
|
948
|
-
stops_1 = stops_1.sort(function (a, b) { return a[0] - b[0]; });
|
|
949
|
-
return [ValueType.GRADIENT_COLOR, stops_1];
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
function colorToArr(hex, normalized) {
|
|
953
|
-
var ret;
|
|
954
|
-
if (typeof hex === 'string') {
|
|
955
|
-
hex = hex.replace(/[\s\t\r\n]/g, '');
|
|
956
|
-
var m = /rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(hex);
|
|
957
|
-
if (m) {
|
|
958
|
-
var a = +m[4];
|
|
959
|
-
ret = [+m[1], +m[2], +m[3], isNaN(a) ? 255 : Math.round(a * 255)];
|
|
960
|
-
}
|
|
961
|
-
else if (/^#[a-f\d]{3}$/i.test(hex)) {
|
|
962
|
-
ret = [parseInt(hex[1] + hex[1], 16), parseInt(hex[2] + hex[2], 16), parseInt(hex[3] + hex[3], 16), 255];
|
|
963
|
-
// eslint-disable-next-line no-cond-assign
|
|
964
|
-
}
|
|
965
|
-
else if (m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)) {
|
|
966
|
-
ret = [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16), 255] || [0, 0, 0, 255];
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
else if (hex instanceof Array) {
|
|
970
|
-
ret = [hex[0], hex[1], hex[2], isNaN(hex[3]) ? 255 : Math.round(hex[3] * 255)];
|
|
971
|
-
}
|
|
972
|
-
if (normalized) {
|
|
973
|
-
// @ts-expect-error
|
|
974
|
-
ret = normalizeColor(ret);
|
|
975
|
-
}
|
|
976
|
-
// @ts-expect-error
|
|
977
|
-
return ret;
|
|
978
|
-
}
|
|
979
|
-
function normalizeColor(a) {
|
|
980
|
-
if (Array.isArray(a)) {
|
|
981
|
-
return a.map(function (i) { return Number.isFinite(i / 255) ? Number((i / 255).toFixed(6)) : 0; });
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
function parsePercent(c) {
|
|
985
|
-
var match = /^(-)?([\d+.]+)%$/.exec(c);
|
|
986
|
-
if (match) {
|
|
987
|
-
return +match[2] / 100 * (match[1] ? -1 : 1);
|
|
988
|
-
}
|
|
989
|
-
return +c;
|
|
990
|
-
}
|
|
991
|
-
function getGradientColor(color, normalized) {
|
|
992
|
-
if (Array.isArray(color)) {
|
|
993
|
-
// @ts-expect-error
|
|
994
|
-
return (color[0] === 'gradient' || color[0] === 'color') && ensureGradient(color[1], normalized);
|
|
995
|
-
}
|
|
996
|
-
else {
|
|
997
|
-
return ensureGradient(color, normalized);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
function ensureFixedVec3(a) {
|
|
1001
|
-
if (a) {
|
|
1002
|
-
if (a.length === 3) {
|
|
1003
|
-
return [ValueType.CONSTANT_VEC3, a];
|
|
1004
|
-
}
|
|
1005
|
-
if (a[0] === 'path') {
|
|
1006
|
-
return [ValueType.LINEAR_PATH, a[1]];
|
|
1007
|
-
}
|
|
1008
|
-
if (a[0] === 'bezier') {
|
|
1009
|
-
return [ValueType.BEZIER_PATH, a[1]];
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
function objectValueToNumber(o) {
|
|
1014
|
-
var e_1, _a;
|
|
1015
|
-
try {
|
|
1016
|
-
for (var _b = __values(Object.keys(o)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1017
|
-
var key = _c.value;
|
|
1018
|
-
o[key] = Number(o[key]);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1022
|
-
finally {
|
|
1023
|
-
try {
|
|
1024
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1025
|
-
}
|
|
1026
|
-
finally { if (e_1) throw e_1.error; }
|
|
1027
|
-
}
|
|
1028
|
-
return o;
|
|
1029
|
-
}
|
|
1030
|
-
function deleteEmptyValue(o) {
|
|
1031
|
-
var e_2, _a;
|
|
1032
|
-
try {
|
|
1033
|
-
for (var _b = __values(Object.keys(o)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1034
|
-
var key = _c.value;
|
|
1035
|
-
if (o[key] === undefined) {
|
|
1036
|
-
delete o[key];
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1041
|
-
finally {
|
|
1042
|
-
try {
|
|
1043
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1044
|
-
}
|
|
1045
|
-
finally { if (e_2) throw e_2.error; }
|
|
1046
|
-
}
|
|
1047
|
-
return o;
|
|
1048
|
-
}
|
|
1049
|
-
var cos = Math.cos;
|
|
1050
|
-
var sin = Math.sin;
|
|
1051
|
-
var d2r = Math.PI / 180;
|
|
1052
|
-
var r2d = 180 / Math.PI;
|
|
1053
|
-
function quatFromXYZRotation(out, x, y, z) {
|
|
1054
|
-
var c1 = cos((x * d2r) / 2);
|
|
1055
|
-
var c2 = cos((y * d2r) / 2);
|
|
1056
|
-
var c3 = cos((z * d2r) / 2);
|
|
1057
|
-
var s1 = sin((x * d2r) / 2);
|
|
1058
|
-
var s2 = sin((y * d2r) / 2);
|
|
1059
|
-
var s3 = sin((z * d2r) / 2);
|
|
1060
|
-
out[0] = s1 * c2 * c3 + c1 * s2 * s3;
|
|
1061
|
-
out[1] = c1 * s2 * c3 - s1 * c2 * s3;
|
|
1062
|
-
out[2] = c1 * c2 * s3 + s1 * s2 * c3;
|
|
1063
|
-
out[3] = c1 * c2 * c3 - s1 * s2 * s3;
|
|
1064
|
-
return out;
|
|
1065
|
-
}
|
|
1066
|
-
function clamp(v, min, max) {
|
|
1067
|
-
return v > max ? max : (v < min ? min : v);
|
|
1068
|
-
}
|
|
1069
|
-
function rotationZYXFromQuat(out, quat) {
|
|
1070
|
-
var x = quat[0];
|
|
1071
|
-
var y = quat[1];
|
|
1072
|
-
var z = quat[2];
|
|
1073
|
-
var w = quat[3];
|
|
1074
|
-
var x2 = x + x;
|
|
1075
|
-
var y2 = y + y;
|
|
1076
|
-
var z2 = z + z;
|
|
1077
|
-
var xx = x * x2;
|
|
1078
|
-
var yx = y * x2;
|
|
1079
|
-
var yy = y * y2;
|
|
1080
|
-
var zx = z * x2;
|
|
1081
|
-
var zy = z * y2;
|
|
1082
|
-
var zz = z * z2;
|
|
1083
|
-
var wx = w * x2;
|
|
1084
|
-
var wy = w * y2;
|
|
1085
|
-
var wz = w * z2;
|
|
1086
|
-
var m11 = 1 - yy - zz, m12 = yx - wz;
|
|
1087
|
-
var m21 = yx + wz, m22 = 1 - xx - zz;
|
|
1088
|
-
var m31 = zx - wy, m32 = zy + wx, m33 = 1 - xx - yy;
|
|
1089
|
-
out[1] = Math.asin(clamp(-m31, -1, 1)) * r2d;
|
|
1090
|
-
if (Math.abs(m31) < 0.9999999) {
|
|
1091
|
-
out[0] = Math.atan2(m32, m33) * r2d;
|
|
1092
|
-
out[2] = Math.atan2(m21, m11) * r2d;
|
|
1093
|
-
}
|
|
1094
|
-
else {
|
|
1095
|
-
out[0] = 0;
|
|
1096
|
-
out[2] = Math.atan2(-m12, m22) * r2d;
|
|
1097
|
-
}
|
|
1098
|
-
return out;
|
|
1099
|
-
}
|
|
1100
|
-
function generateGUID() {
|
|
1101
|
-
return v4().replace(/-/g, '');
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* 提取并转换 JSON 数据中的 anchor 值
|
|
1105
|
-
*/
|
|
1106
|
-
function convertAnchor(anchor, particleOrigin) {
|
|
1107
|
-
if (anchor) {
|
|
1108
|
-
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
1109
|
-
}
|
|
1110
|
-
else if (particleOrigin) {
|
|
1111
|
-
return particleOriginTranslateMap[particleOrigin];
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
return [0, 0];
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
var particleOriginTranslateMap = (_a = {},
|
|
1118
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [0, 0],
|
|
1119
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [0, -0.5],
|
|
1120
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [0, 0.5],
|
|
1121
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [-0.5, 0.5],
|
|
1122
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [-0.5, 0],
|
|
1123
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [-0.5, -0.5],
|
|
1124
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [0.5, 0],
|
|
1125
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [0.5, -0.5],
|
|
1126
|
-
_a[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [0.5, 0.5],
|
|
1127
|
-
_a);
|
|
1128
|
-
|
|
1129
|
-
function getStandardParticleContent(particle) {
|
|
1130
|
-
var _a;
|
|
1131
|
-
var options = particle.options;
|
|
1132
|
-
var transform = particle.transform;
|
|
1133
|
-
var shape = {
|
|
1134
|
-
type: ShapeType.NONE,
|
|
1135
|
-
};
|
|
1136
|
-
if (particle.shape) {
|
|
1137
|
-
var shapeType = (_a = particle.shape.shape) === null || _a === void 0 ? void 0 : _a.replace(/([A-Z])/g, '_$1').toUpperCase().replace(/^_/, '');
|
|
1138
|
-
shape = __assign(__assign({}, particle.shape), { type: ShapeType[shapeType] });
|
|
1139
|
-
if (particle.shape.upDirection) {
|
|
1140
|
-
var _b = __read(particle.shape.upDirection, 3), x = _b[0], y = _b[1], z = _b[2];
|
|
1141
|
-
if (x === 0 && y === 0 && z === 0) {
|
|
1142
|
-
delete shape.upDirection;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
if (options.startTurbulence) {
|
|
1147
|
-
shape.turbulenceX = ensureNumberExpression(options.turbulenceX);
|
|
1148
|
-
shape.turbulenceY = ensureNumberExpression(options.turbulenceY);
|
|
1149
|
-
shape.turbulenceZ = ensureNumberExpression(options.turbulenceZ);
|
|
1150
|
-
}
|
|
1151
|
-
var emission = particle.emission;
|
|
1152
|
-
if (emission.bursts && emission.bursts.length > 0) {
|
|
1153
|
-
emission.bursts = emission.bursts.map(function (b) { return objectValueToNumber(b); });
|
|
1154
|
-
}
|
|
1155
|
-
if (emission.burstOffsets && emission.burstOffsets.length > 0) {
|
|
1156
|
-
emission.burstOffsets = emission.burstOffsets.map(function (b) { return objectValueToNumber(b); });
|
|
1157
|
-
}
|
|
1158
|
-
if (emission.rateOverTime) {
|
|
1159
|
-
emission.rateOverTime = ensureNumberExpression(emission.rateOverTime);
|
|
1160
|
-
}
|
|
1161
|
-
var ret = {
|
|
1162
|
-
renderer: particle.renderer,
|
|
1163
|
-
shape: shape,
|
|
1164
|
-
splits: particle.splits,
|
|
1165
|
-
emission: emission,
|
|
1166
|
-
options: {
|
|
1167
|
-
startLifetime: ensureNumberExpression(options.startLifetime),
|
|
1168
|
-
start3DSize: !!options.start3DSize,
|
|
1169
|
-
startSize: ensureNumberExpression(options.startSize),
|
|
1170
|
-
startSizeX: ensureNumberExpression(options.startSizeX),
|
|
1171
|
-
startSizeY: ensureNumberExpression(options.startSizeY),
|
|
1172
|
-
sizeAspect: ensureNumberExpression(options.sizeAspect),
|
|
1173
|
-
maxCount: options.maxCount,
|
|
1174
|
-
startDelay: ensureNumberExpression(options.startDelay),
|
|
1175
|
-
startColor: ensureColorExpression(options.startColor, true),
|
|
1176
|
-
startRotationZ: ensureNumberExpression(options.startRotation || options.startRotationZ),
|
|
1177
|
-
particleFollowParent: options.particleFollowParent,
|
|
1178
|
-
},
|
|
1179
|
-
};
|
|
1180
|
-
if (options.start3DRotation) {
|
|
1181
|
-
ret.options.startRotationX = ensureNumberExpression(options.startRotationX);
|
|
1182
|
-
ret.options.startRotationY = ensureNumberExpression(options.startRotationY);
|
|
1183
|
-
}
|
|
1184
|
-
if (particle.filter) {
|
|
1185
|
-
var filter_1 = {};
|
|
1186
|
-
forEach(particle.filter, function (val, key) {
|
|
1187
|
-
// @ts-expect-error
|
|
1188
|
-
filter_1[key] = ensureValueGetter(val);
|
|
1189
|
-
});
|
|
1190
|
-
ret.filter = filter_1;
|
|
1191
|
-
}
|
|
1192
|
-
if (transform && transform.path) {
|
|
1193
|
-
ret.emitterTransform = {
|
|
1194
|
-
path: ensureFixedVec3(transform.path),
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
var sizeOverLifetime = particle.sizeOverLifetime;
|
|
1198
|
-
if (sizeOverLifetime) {
|
|
1199
|
-
if (sizeOverLifetime.separateAxes) {
|
|
1200
|
-
ret.sizeOverLifetime = {
|
|
1201
|
-
separateAxes: true,
|
|
1202
|
-
x: ensureNumberExpression(sizeOverLifetime.x),
|
|
1203
|
-
y: ensureNumberExpression(sizeOverLifetime.y),
|
|
1204
|
-
};
|
|
1205
|
-
}
|
|
1206
|
-
else {
|
|
1207
|
-
ret.sizeOverLifetime = {
|
|
1208
|
-
size: ensureNumberExpression(sizeOverLifetime.size),
|
|
1209
|
-
};
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
var velocityOverLifetime = particle.velocityOverLifetime || {};
|
|
1213
|
-
var sol = velocityOverLifetime.speedOverLifetime;
|
|
1214
|
-
if (sol) {
|
|
1215
|
-
sol = ensureFixedNumber(sol);
|
|
1216
|
-
}
|
|
1217
|
-
else {
|
|
1218
|
-
sol = undefined;
|
|
1219
|
-
}
|
|
1220
|
-
ret.positionOverLifetime = {
|
|
1221
|
-
gravity: options.gravity,
|
|
1222
|
-
gravityOverLifetime: ensureFixedNumber(options.gravityModifier),
|
|
1223
|
-
startSpeed: ensureNumberExpression(options.startSpeed),
|
|
1224
|
-
speedOverLifetime: sol,
|
|
1225
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
1226
|
-
linearX: ensureNumberExpression(velocityOverLifetime.linearX),
|
|
1227
|
-
linearY: ensureNumberExpression(velocityOverLifetime.linearY),
|
|
1228
|
-
linearZ: ensureNumberExpression(velocityOverLifetime.linearZ),
|
|
1229
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
1230
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
1231
|
-
orbitalX: ensureNumberExpression(velocityOverLifetime.orbitalX),
|
|
1232
|
-
orbitalY: ensureNumberExpression(velocityOverLifetime.orbitalY),
|
|
1233
|
-
orbitalZ: ensureNumberExpression(velocityOverLifetime.orbitalZ),
|
|
1234
|
-
forceTarget: velocityOverLifetime.forceTarget,
|
|
1235
|
-
target: velocityOverLifetime.target,
|
|
1236
|
-
forceCurve: ensureFixedNumber(velocityOverLifetime.forceCurve),
|
|
1237
|
-
};
|
|
1238
|
-
deleteEmptyValue(ret.positionOverLifetime);
|
|
1239
|
-
var rotationOverLifetime = particle.rotationOverLifetime;
|
|
1240
|
-
if (rotationOverLifetime) {
|
|
1241
|
-
ret.rotationOverLifetime = {
|
|
1242
|
-
separateAxes: rotationOverLifetime.separateAxes,
|
|
1243
|
-
asRotation: rotationOverLifetime.asRotation,
|
|
1244
|
-
z: ensureNumberExpression(rotationOverLifetime.separateAxes ? rotationOverLifetime.z : rotationOverLifetime.angularVelocity),
|
|
1245
|
-
};
|
|
1246
|
-
if (rotationOverLifetime.separateAxes) {
|
|
1247
|
-
ret.rotationOverLifetime.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
1248
|
-
ret.rotationOverLifetime.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
var colorOverLifetime = particle.colorOverLifetime;
|
|
1252
|
-
if (colorOverLifetime) {
|
|
1253
|
-
var col = ret.colorOverLifetime = {
|
|
1254
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity),
|
|
1255
|
-
};
|
|
1256
|
-
if (colorOverLifetime.color) {
|
|
1257
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
1261
|
-
if (textureSheetAnimation) {
|
|
1262
|
-
ret.textureSheetAnimation = {
|
|
1263
|
-
row: textureSheetAnimation.row,
|
|
1264
|
-
col: textureSheetAnimation.col,
|
|
1265
|
-
total: textureSheetAnimation.total,
|
|
1266
|
-
animate: textureSheetAnimation.animate,
|
|
1267
|
-
cycles: ensureFixedNumber(textureSheetAnimation.cycles),
|
|
1268
|
-
animationDelay: ensureFixedNumberWithRandom(textureSheetAnimation.animationDelay, 0),
|
|
1269
|
-
animationDuration: ensureFixedNumberWithRandom(textureSheetAnimation.animationDuration, 0),
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
var trials = particle.trails;
|
|
1273
|
-
if (trials) {
|
|
1274
|
-
ret.trails = {
|
|
1275
|
-
lifetime: ensureNumberExpression(trials.lifetime),
|
|
1276
|
-
dieWithParticles: trials.dieWithParticles,
|
|
1277
|
-
maxPointPerTrail: trials.maxPointPerTrail,
|
|
1278
|
-
minimumVertexDistance: trials.minimumVertexDistance,
|
|
1279
|
-
widthOverTrail: ensureFixedNumber(trials.widthOverTrail),
|
|
1280
|
-
colorOverTrail: trials.colorOverTrail && getGradientColor(trials.colorOverTrail, false),
|
|
1281
|
-
blending: trials.blending,
|
|
1282
|
-
colorOverLifetime: trials.colorOverLifetime && getGradientColor(trials.colorOverLifetime, false),
|
|
1283
|
-
inheritParticleColor: trials.inheritParticleColor,
|
|
1284
|
-
occlusion: trials.occlusion,
|
|
1285
|
-
transparentOcclusion: trials.transparentOcclusion,
|
|
1286
|
-
orderOffset: trials.orderOffset,
|
|
1287
|
-
sizeAffectsLifetime: trials.sizeAffectsLifetime,
|
|
1288
|
-
sizeAffectsWidth: trials.sizeAffectsWidth,
|
|
1289
|
-
texture: trials.texture,
|
|
1290
|
-
parentAffectsPosition: trials.parentAffectsPosition,
|
|
1291
|
-
opacityOverLifetime: ensureNumberExpression(trials.opacityOverLifetime),
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
ret.trails && deleteEmptyValue(ret.trails);
|
|
1295
|
-
var interaction = particle.interaction;
|
|
1296
|
-
if (interaction) {
|
|
1297
|
-
ret.interaction = {
|
|
1298
|
-
behavior: interaction.behavior,
|
|
1299
|
-
radius: interaction.radius,
|
|
1300
|
-
multiple: interaction.multiple,
|
|
1301
|
-
};
|
|
1302
|
-
}
|
|
1303
|
-
return ret;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
function getStandardNullContent(sprite, transform) {
|
|
1307
|
-
var _a;
|
|
1308
|
-
var opt = sprite.options;
|
|
1309
|
-
var velocityOverLifetime = sprite.velocityOverLifetime || {};
|
|
1310
|
-
var positionOverLifetime = {
|
|
1311
|
-
path: ensureFixedVec3((_a = sprite.transform) === null || _a === void 0 ? void 0 : _a.path),
|
|
1312
|
-
gravity: opt.gravity,
|
|
1313
|
-
gravityOverLifetime: ensureFixedNumber(opt.gravityModifier),
|
|
1314
|
-
direction: opt.direction,
|
|
1315
|
-
startSpeed: opt.startSpeed,
|
|
1316
|
-
asMovement: velocityOverLifetime.asMovement,
|
|
1317
|
-
linearX: ensureFixedNumber(velocityOverLifetime.linearX),
|
|
1318
|
-
linearY: ensureFixedNumber(velocityOverLifetime.linearY),
|
|
1319
|
-
linearZ: ensureFixedNumber(velocityOverLifetime.linearZ),
|
|
1320
|
-
asRotation: velocityOverLifetime.asRotation,
|
|
1321
|
-
orbCenter: velocityOverLifetime.orbCenter,
|
|
1322
|
-
orbitalX: ensureFixedNumber(velocityOverLifetime.orbitalX),
|
|
1323
|
-
orbitalY: ensureFixedNumber(velocityOverLifetime.orbitalY),
|
|
1324
|
-
orbitalZ: ensureFixedNumber(velocityOverLifetime.orbitalZ),
|
|
1325
|
-
speedOverLifetime: ensureFixedNumber(velocityOverLifetime.speedOverLifetime),
|
|
1326
|
-
};
|
|
1327
|
-
deleteEmptyValue(positionOverLifetime);
|
|
1328
|
-
var ret = {
|
|
1329
|
-
options: {
|
|
1330
|
-
startColor: ensureRGBAValue(opt.startColor),
|
|
1331
|
-
},
|
|
1332
|
-
positionOverLifetime: positionOverLifetime,
|
|
1333
|
-
};
|
|
1334
|
-
if (opt.startSize) {
|
|
1335
|
-
transform.scale = [opt.startSize, opt.startSize / (opt.sizeAspect || 1), 1];
|
|
1336
|
-
}
|
|
1337
|
-
if (opt.startRotation) {
|
|
1338
|
-
if (!transform.rotation) {
|
|
1339
|
-
transform.rotation = [0, 0, opt.startRotation];
|
|
1340
|
-
}
|
|
1341
|
-
else {
|
|
1342
|
-
transform.rotation[2] += opt.startRotation;
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
var rotationOverLifetime = sprite.rotationOverLifetime;
|
|
1346
|
-
if (rotationOverLifetime) {
|
|
1347
|
-
var rot = ret.rotationOverLifetime = {
|
|
1348
|
-
separateAxes: rotationOverLifetime.separateAxes,
|
|
1349
|
-
asRotation: rotationOverLifetime.asRotation,
|
|
1350
|
-
};
|
|
1351
|
-
if (rot.separateAxes) {
|
|
1352
|
-
rot.x = ensureFixedNumber(rotationOverLifetime.x);
|
|
1353
|
-
rot.y = ensureFixedNumber(rotationOverLifetime.y);
|
|
1354
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.z);
|
|
1355
|
-
}
|
|
1356
|
-
else {
|
|
1357
|
-
rot.z = ensureFixedNumber(rotationOverLifetime.angularVelocity);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
var colorOverLifetime = sprite.colorOverLifetime;
|
|
1361
|
-
if (colorOverLifetime) {
|
|
1362
|
-
var col = ret.colorOverLifetime = {
|
|
1363
|
-
opacity: ensureFixedNumber(colorOverLifetime.opacity),
|
|
1364
|
-
};
|
|
1365
|
-
if (colorOverLifetime.color) {
|
|
1366
|
-
col.color = getGradientColor(colorOverLifetime.color);
|
|
1367
|
-
}
|
|
1368
|
-
}
|
|
1369
|
-
var sizeOverLifetime = sprite.sizeOverLifetime;
|
|
1370
|
-
if (sizeOverLifetime) {
|
|
1371
|
-
ret.sizeOverLifetime = {
|
|
1372
|
-
separateAxes: sizeOverLifetime.separateAxes,
|
|
1373
|
-
size: ensureFixedNumber(sizeOverLifetime.size),
|
|
1374
|
-
x: ensureFixedNumber(sizeOverLifetime.x),
|
|
1375
|
-
y: ensureFixedNumber(sizeOverLifetime.y),
|
|
1376
|
-
z: ensureFixedNumber(sizeOverLifetime.z),
|
|
1377
|
-
};
|
|
1378
|
-
}
|
|
1379
|
-
return ret;
|
|
1380
|
-
}
|
|
1381
|
-
function getStandardSpriteContent(sprite, transform) {
|
|
1382
|
-
var ret = getStandardNullContent(sprite, transform);
|
|
1383
|
-
var texAni = sprite.textureSheetAnimation;
|
|
1384
|
-
if (texAni) {
|
|
1385
|
-
ret.textureSheetAnimation = {
|
|
1386
|
-
row: texAni.row,
|
|
1387
|
-
col: texAni.col,
|
|
1388
|
-
total: texAni.total || undefined,
|
|
1389
|
-
animate: texAni.animate,
|
|
1390
|
-
};
|
|
1391
|
-
}
|
|
1392
|
-
ret.renderer = sprite.renderer;
|
|
1393
|
-
if (sprite.splits) {
|
|
1394
|
-
ret.splits = sprite.splits;
|
|
1395
|
-
}
|
|
1396
|
-
if (sprite.interaction) {
|
|
1397
|
-
ret.interaction = sprite.interaction;
|
|
1398
|
-
}
|
|
1399
|
-
return ret;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
function getStandardInteractContent(ui) {
|
|
1403
|
-
var options = ui.options;
|
|
1404
|
-
var option;
|
|
1405
|
-
switch (options.type) {
|
|
1406
|
-
case 'click': {
|
|
1407
|
-
option = {
|
|
1408
|
-
type: InteractType.CLICK,
|
|
1409
|
-
showPreview: options.showPreview,
|
|
1410
|
-
previewColor: options.previewColor && ensureRGBAValue(options.previewColor),
|
|
1411
|
-
behavior: options.behavior || InteractBehavior.NOTIFY,
|
|
1412
|
-
};
|
|
1413
|
-
break;
|
|
1414
|
-
}
|
|
1415
|
-
case 'drag': {
|
|
1416
|
-
option = {
|
|
1417
|
-
type: InteractType.DRAG,
|
|
1418
|
-
enableInEditor: !!options.enableInEditor,
|
|
1419
|
-
dxRange: options.dxRange,
|
|
1420
|
-
dyRange: options.dyRange,
|
|
1421
|
-
target: options.target,
|
|
1422
|
-
};
|
|
1423
|
-
break;
|
|
1424
|
-
}
|
|
1425
|
-
case 'message': {
|
|
1426
|
-
option = {
|
|
1427
|
-
type: InteractType.MESSAGE,
|
|
1428
|
-
};
|
|
1429
|
-
break;
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
var ret = {
|
|
1433
|
-
// @ts-expect-error
|
|
1434
|
-
options: option,
|
|
1435
|
-
};
|
|
1436
|
-
return ret;
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
function getStandardCameraContent(model) {
|
|
1440
|
-
var _a, _b;
|
|
1441
|
-
var opt = model.options;
|
|
1442
|
-
var ret = {
|
|
1443
|
-
options: {
|
|
1444
|
-
fov: opt.fov,
|
|
1445
|
-
far: opt.far,
|
|
1446
|
-
near: opt.near,
|
|
1447
|
-
clipMode: opt.clipMode,
|
|
1448
|
-
},
|
|
1449
|
-
};
|
|
1450
|
-
var velocityOverLifetime = model.velocityOverLifetime;
|
|
1451
|
-
if (velocityOverLifetime || ((_a = model.transform) === null || _a === void 0 ? void 0 : _a.path)) {
|
|
1452
|
-
var positionOverLifetime = {
|
|
1453
|
-
path: ensureFixedVec3((_b = model.transform) === null || _b === void 0 ? void 0 : _b.path),
|
|
1454
|
-
linearX: ensureFixedNumber(velocityOverLifetime === null || velocityOverLifetime === void 0 ? void 0 : velocityOverLifetime.translateX),
|
|
1455
|
-
linearY: ensureFixedNumber(velocityOverLifetime === null || velocityOverLifetime === void 0 ? void 0 : velocityOverLifetime.translateY),
|
|
1456
|
-
linearZ: ensureFixedNumber(velocityOverLifetime === null || velocityOverLifetime === void 0 ? void 0 : velocityOverLifetime.translateZ),
|
|
1457
|
-
};
|
|
1458
|
-
deleteEmptyValue(positionOverLifetime);
|
|
1459
|
-
ret.positionOverLifetime = positionOverLifetime;
|
|
1460
|
-
}
|
|
1461
|
-
var rol = model.rotationOverLifetime;
|
|
1462
|
-
if (rol) {
|
|
1463
|
-
var rotationOverLifetime = {
|
|
1464
|
-
separateAxes: rol.separateAxes,
|
|
1465
|
-
x: ensureFixedNumber(rol === null || rol === void 0 ? void 0 : rol.rotateX),
|
|
1466
|
-
y: ensureFixedNumber(rol === null || rol === void 0 ? void 0 : rol.rotateY),
|
|
1467
|
-
z: rol.separateAxes ? ensureFixedNumber(rol === null || rol === void 0 ? void 0 : rol.rotateZ) : ensureFixedNumber(rol.rotation),
|
|
1468
|
-
};
|
|
1469
|
-
deleteEmptyValue(rotationOverLifetime);
|
|
1470
|
-
ret.rotationOverLifetime = rotationOverLifetime;
|
|
1471
|
-
}
|
|
1472
|
-
return ret;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
var convertParams = [
|
|
1476
|
-
'strength',
|
|
1477
|
-
'bloomAddon',
|
|
1478
|
-
'colorAddon',
|
|
1479
|
-
'period',
|
|
1480
|
-
'waveMovement',
|
|
1481
|
-
'colorThreshold',
|
|
1482
|
-
'xOpacity',
|
|
1483
|
-
'yOpacity',
|
|
1484
|
-
'feather',
|
|
1485
|
-
];
|
|
1486
|
-
var pathParams = [
|
|
1487
|
-
'path', 'position',
|
|
1488
|
-
];
|
|
1489
|
-
function getStandardFilterContent(filter) {
|
|
1490
|
-
var ret = {};
|
|
1491
|
-
forEach(filter, function (val, key) {
|
|
1492
|
-
if (convertParams.includes(key)) {
|
|
1493
|
-
ret[key] = ensureFixedNumber(val);
|
|
1494
|
-
}
|
|
1495
|
-
else if (pathParams.includes(key)) {
|
|
1496
|
-
ret[key] = ensureFixedVec3(val);
|
|
1497
|
-
}
|
|
1498
|
-
else {
|
|
1499
|
-
ret[key] = val;
|
|
1500
|
-
}
|
|
1501
|
-
});
|
|
1502
|
-
return ret;
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
1507
|
-
*/
|
|
1508
|
-
function version21Migration(json) {
|
|
1509
|
-
json.compositions.forEach(function (composition) {
|
|
1510
|
-
composition.items.forEach(function (item) {
|
|
1511
|
-
if (item.type === ItemType.null) {
|
|
1512
|
-
if (item.endBehavior === ItemEndBehavior.destroy) {
|
|
1513
|
-
item.endBehavior = ItemEndBehavior.freeze;
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
});
|
|
1517
|
-
});
|
|
1518
|
-
json.version = '2.1';
|
|
1519
|
-
return json;
|
|
1520
|
-
}
|
|
1521
|
-
/**
|
|
1522
|
-
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
1523
|
-
*/
|
|
1524
|
-
function version22Migration(json) {
|
|
1525
|
-
var _a;
|
|
1526
|
-
var singleVersion = (_a = json.version) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
1527
|
-
if (!singleVersion || Number(singleVersion[0]) > 2 || (Number(singleVersion[0]) === 2 && Number(singleVersion[1]) >= 2)) {
|
|
1528
|
-
return json;
|
|
1529
|
-
}
|
|
1530
|
-
json.compositions.forEach(function (composition) {
|
|
1531
|
-
composition.items.forEach(function (item) {
|
|
1532
|
-
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
1533
|
-
item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
|
|
1534
|
-
}
|
|
1535
|
-
});
|
|
1536
|
-
});
|
|
1537
|
-
return json;
|
|
1538
|
-
}
|
|
1539
|
-
/**
|
|
1540
|
-
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
1541
|
-
*/
|
|
1542
|
-
function version30Migration(json) {
|
|
1543
|
-
var e_1, _a;
|
|
1544
|
-
var _b, _c, _d, _e;
|
|
1545
|
-
var result = Object.assign({}, json, {
|
|
1546
|
-
items: [],
|
|
1547
|
-
components: [],
|
|
1548
|
-
materials: [],
|
|
1549
|
-
shaders: [],
|
|
1550
|
-
geometries: [],
|
|
1551
|
-
});
|
|
1552
|
-
// 兼容老版本数据中不存在textures的情况
|
|
1553
|
-
(_b = result.textures) !== null && _b !== void 0 ? _b : (result.textures = []);
|
|
1554
|
-
result.textures.forEach(function (textureOptions) {
|
|
1555
|
-
Object.assign(textureOptions, {
|
|
1556
|
-
id: generateGUID(),
|
|
1557
|
-
dataType: DataType.Texture,
|
|
1558
|
-
});
|
|
1559
|
-
});
|
|
1560
|
-
if (result.textures.length < result.images.length) {
|
|
1561
|
-
for (var i = result.textures.length; i < result.images.length; i++) {
|
|
1562
|
-
result.textures.push({
|
|
1563
|
-
//@ts-expect-error
|
|
1564
|
-
id: generateGUID(),
|
|
1565
|
-
dataType: DataType.Texture,
|
|
1566
|
-
source: i,
|
|
1567
|
-
flipY: true,
|
|
1568
|
-
});
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
var _loop_1 = function (composition) {
|
|
1572
|
-
var e_2, _h, e_3, _j;
|
|
1573
|
-
// composition 的 endbehaviour 兼容
|
|
1574
|
-
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
1575
|
-
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
1576
|
-
}
|
|
1577
|
-
var itemGuidMap = {};
|
|
1578
|
-
try {
|
|
1579
|
-
for (var _k = (e_2 = void 0, __values(composition.items)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1580
|
-
var item = _l.value;
|
|
1581
|
-
itemGuidMap[item.id] = generateGUID();
|
|
1582
|
-
// TODO: 编辑器测试用,上线后删除
|
|
1583
|
-
//@ts-expect-error
|
|
1584
|
-
item.oldId = item.id;
|
|
1585
|
-
item.id = itemGuidMap[item.id];
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1589
|
-
finally {
|
|
1590
|
-
try {
|
|
1591
|
-
if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
|
|
1592
|
-
}
|
|
1593
|
-
finally { if (e_2) throw e_2.error; }
|
|
1594
|
-
}
|
|
1595
|
-
composition.items.forEach(function (item, index) {
|
|
1596
|
-
if (item.parentId) {
|
|
1597
|
-
if (item.parentId.includes('^')) {
|
|
1598
|
-
var parentId = (item.parentId).split('^')[0];
|
|
1599
|
-
var nodeId = (item.parentId).split('^')[1];
|
|
1600
|
-
item.parentId = itemGuidMap[parentId] + '^' + nodeId;
|
|
1601
|
-
}
|
|
1602
|
-
else {
|
|
1603
|
-
item.parentId = itemGuidMap[item.parentId];
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
// @ts-expect-error fix item type
|
|
1607
|
-
result.items.push(item);
|
|
1608
|
-
// @ts-expect-error fix item type
|
|
1609
|
-
composition.items[index] = { id: item.id };
|
|
1610
|
-
});
|
|
1611
|
-
try {
|
|
1612
|
-
for (var _m = (e_3 = void 0, __values(result.items)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1613
|
-
var item = _o.value;
|
|
1614
|
-
// 原 texture 索引转为统一 guid 索引
|
|
1615
|
-
if (item.content) {
|
|
1616
|
-
if (item.content.renderer) {
|
|
1617
|
-
if (item.content.renderer.texture !== undefined) {
|
|
1618
|
-
var oldTextureId = item.content.renderer.texture;
|
|
1619
|
-
//@ts-expect-error
|
|
1620
|
-
item.content.renderer.texture = { id: result.textures[oldTextureId].id };
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
if (item.content.trails) {
|
|
1624
|
-
if (item.content.trails.texture !== undefined) {
|
|
1625
|
-
var oldTextureId = item.content.trails.texture;
|
|
1626
|
-
//@ts-expect-error
|
|
1627
|
-
item.content.trails.texture = { id: result.textures[oldTextureId].id };
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
// item 的 transform 属性由数组转为 {x:n, y:n, z:n}
|
|
1632
|
-
if (item.transform) {
|
|
1633
|
-
//@ts-expect-error
|
|
1634
|
-
var position = __spreadArray([], __read((_c = item.transform.position) !== null && _c !== void 0 ? _c : [0, 0, 0]), false);
|
|
1635
|
-
//@ts-expect-error
|
|
1636
|
-
var rotation = __spreadArray([], __read((_d = item.transform.rotation) !== null && _d !== void 0 ? _d : [0, 0, 0]), false);
|
|
1637
|
-
//@ts-expect-error
|
|
1638
|
-
var scale = __spreadArray([], __read((_e = item.transform.scale) !== null && _e !== void 0 ? _e : [1, 1, 1]), false);
|
|
1639
|
-
Object.assign(item, {
|
|
1640
|
-
transform: {
|
|
1641
|
-
position: { x: position[0], y: position[1], z: position[2] },
|
|
1642
|
-
rotation: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
1643
|
-
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
1644
|
-
},
|
|
1645
|
-
});
|
|
1646
|
-
// sprite 的 scale 转为 size
|
|
1647
|
-
if (item.type === ItemType.sprite) {
|
|
1648
|
-
item.transform.size = { x: scale[0], y: scale[1] };
|
|
1649
|
-
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
1650
|
-
}
|
|
1651
|
-
// sprite 的 anchor 修正
|
|
1652
|
-
if (item.type === ItemType.sprite) {
|
|
1653
|
-
var content = item.content;
|
|
1654
|
-
if (!content.renderer) {
|
|
1655
|
-
content.renderer = {};
|
|
1656
|
-
}
|
|
1657
|
-
var renderer = content.renderer;
|
|
1658
|
-
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
1659
|
-
var startSize = item.transform.size;
|
|
1660
|
-
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
1661
|
-
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
1662
|
-
//@ts-expect-error
|
|
1663
|
-
item.transform.position.x += -realAnchor[0] * startSize.x;
|
|
1664
|
-
//@ts-expect-error
|
|
1665
|
-
item.transform.position.y += -realAnchor[1] * startSize.y;
|
|
1666
|
-
}
|
|
1667
|
-
//@ts-expect-error
|
|
1668
|
-
item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
if (item.type === ItemType.particle) {
|
|
1672
|
-
var content = item.content;
|
|
1673
|
-
if (!content.renderer) {
|
|
1674
|
-
content.renderer = {};
|
|
1675
|
-
}
|
|
1676
|
-
var renderer = content.renderer;
|
|
1677
|
-
content.renderer.anchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
1678
|
-
}
|
|
1679
|
-
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
1680
|
-
item.content.tracks = [];
|
|
1681
|
-
var tracks = item.content.tracks;
|
|
1682
|
-
if (item.type !== ItemType.particle) {
|
|
1683
|
-
tracks.push({
|
|
1684
|
-
clips: [
|
|
1685
|
-
{
|
|
1686
|
-
dataType: 'TransformAnimationPlayableAsset',
|
|
1687
|
-
animationClip: {
|
|
1688
|
-
sizeOverLifetime: item.content.sizeOverLifetime,
|
|
1689
|
-
rotationOverLifetime: item.content.rotationOverLifetime,
|
|
1690
|
-
positionOverLifetime: item.content.positionOverLifetime,
|
|
1691
|
-
},
|
|
1692
|
-
},
|
|
1693
|
-
],
|
|
1694
|
-
});
|
|
1695
|
-
}
|
|
1696
|
-
if (item.type === ItemType.sprite) {
|
|
1697
|
-
tracks.push({
|
|
1698
|
-
clips: [
|
|
1699
|
-
{
|
|
1700
|
-
dataType: 'SpriteColorAnimationPlayableAsset',
|
|
1701
|
-
animationClip: {
|
|
1702
|
-
colorOverLifetime: item.content.colorOverLifetime,
|
|
1703
|
-
startColor: item.content.options.startColor,
|
|
1704
|
-
},
|
|
1705
|
-
},
|
|
1706
|
-
],
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
// gizmo 的 target id 转换为新的 item guid
|
|
1710
|
-
if (item.content.options.target) {
|
|
1711
|
-
item.content.options.target = itemGuidMap[item.content.options.target];
|
|
1712
|
-
}
|
|
1713
|
-
// item 的 content 转为 component data 加入 JSONScene.components
|
|
1714
|
-
var uuid = generateGUID();
|
|
1715
|
-
if (item.type === ItemType.sprite) {
|
|
1716
|
-
item.components = [];
|
|
1717
|
-
result.components.push(item.content);
|
|
1718
|
-
item.content.id = uuid;
|
|
1719
|
-
item.content.dataType = DataType.SpriteComponent;
|
|
1720
|
-
item.content.item = { id: item.id };
|
|
1721
|
-
item.dataType = DataType.VFXItemData;
|
|
1722
|
-
//@ts-expect-error
|
|
1723
|
-
item.components.push({ id: item.content.id });
|
|
1724
|
-
}
|
|
1725
|
-
else if (item.type === ItemType.particle) {
|
|
1726
|
-
item.components = [];
|
|
1727
|
-
result.components.push(item.content);
|
|
1728
|
-
item.content.id = uuid;
|
|
1729
|
-
item.content.dataType = DataType.ParticleSystem;
|
|
1730
|
-
item.content.item = { id: item.id };
|
|
1731
|
-
item.dataType = DataType.VFXItemData;
|
|
1732
|
-
//@ts-expect-error
|
|
1733
|
-
item.components.push({ id: item.content.id });
|
|
1734
|
-
}
|
|
1735
|
-
else if (item.type === ItemType.mesh) {
|
|
1736
|
-
item.components = [];
|
|
1737
|
-
result.components.push(item.content);
|
|
1738
|
-
item.content.id = uuid;
|
|
1739
|
-
item.content.dataType = DataType.MeshComponent;
|
|
1740
|
-
item.content.item = { id: item.id };
|
|
1741
|
-
item.dataType = DataType.VFXItemData;
|
|
1742
|
-
//@ts-expect-error
|
|
1743
|
-
item.components.push({ id: item.content.id });
|
|
1744
|
-
}
|
|
1745
|
-
else if (item.type === ItemType.skybox) {
|
|
1746
|
-
item.components = [];
|
|
1747
|
-
result.components.push(item.content);
|
|
1748
|
-
item.content.id = uuid;
|
|
1749
|
-
item.content.dataType = DataType.SkyboxComponent;
|
|
1750
|
-
item.content.item = { id: item.id };
|
|
1751
|
-
item.dataType = DataType.VFXItemData;
|
|
1752
|
-
//@ts-expect-error
|
|
1753
|
-
item.components.push({ id: item.content.id });
|
|
1754
|
-
}
|
|
1755
|
-
else if (item.type === ItemType.light) {
|
|
1756
|
-
item.components = [];
|
|
1757
|
-
result.components.push(item.content);
|
|
1758
|
-
item.content.id = uuid;
|
|
1759
|
-
item.content.dataType = DataType.LightComponent;
|
|
1760
|
-
item.content.item = { id: item.id };
|
|
1761
|
-
item.dataType = DataType.VFXItemData;
|
|
1762
|
-
//@ts-expect-error
|
|
1763
|
-
item.components.push({ id: item.content.id });
|
|
1764
|
-
}
|
|
1765
|
-
else if (item.type === 'camera') {
|
|
1766
|
-
item.components = [];
|
|
1767
|
-
result.components.push(item.content);
|
|
1768
|
-
item.content.id = uuid;
|
|
1769
|
-
item.content.dataType = DataType.CameraComponent;
|
|
1770
|
-
item.content.item = { id: item.id };
|
|
1771
|
-
item.dataType = DataType.VFXItemData;
|
|
1772
|
-
//@ts-expect-error
|
|
1773
|
-
item.components.push({ id: item.content.id });
|
|
1774
|
-
}
|
|
1775
|
-
else if (item.type === ItemType.tree) {
|
|
1776
|
-
item.components = [];
|
|
1777
|
-
result.components.push(item.content);
|
|
1778
|
-
item.content.id = uuid;
|
|
1779
|
-
item.content.dataType = DataType.TreeComponent;
|
|
1780
|
-
item.content.item = { id: item.id };
|
|
1781
|
-
item.dataType = DataType.VFXItemData;
|
|
1782
|
-
//@ts-expect-error
|
|
1783
|
-
item.components.push({ id: item.content.id });
|
|
1784
|
-
}
|
|
1785
|
-
else if (item.type === ItemType.interact) {
|
|
1786
|
-
item.components = [];
|
|
1787
|
-
result.components.push(item.content);
|
|
1788
|
-
item.content.id = uuid;
|
|
1789
|
-
item.content.dataType = DataType.InteractComponent;
|
|
1790
|
-
item.content.item = { id: item.id };
|
|
1791
|
-
item.dataType = DataType.VFXItemData;
|
|
1792
|
-
//@ts-expect-error
|
|
1793
|
-
item.components.push({ id: item.content.id });
|
|
1794
|
-
}
|
|
1795
|
-
else if (item.type === ItemType.camera) {
|
|
1796
|
-
item.components = [];
|
|
1797
|
-
result.components.push(item.content);
|
|
1798
|
-
item.content.id = uuid;
|
|
1799
|
-
item.content.dataType = DataType.CameraController;
|
|
1800
|
-
item.content.item = { id: item.id };
|
|
1801
|
-
item.dataType = DataType.VFXItemData;
|
|
1802
|
-
//@ts-expect-error
|
|
1803
|
-
item.components.push({ id: item.content.id });
|
|
1804
|
-
}
|
|
1805
|
-
else if (item.type === ItemType.text) {
|
|
1806
|
-
item.components = [];
|
|
1807
|
-
result.components.push(item.content);
|
|
1808
|
-
item.content.id = uuid;
|
|
1809
|
-
item.content.dataType = DataType.TextComponent;
|
|
1810
|
-
item.content.item = { id: item.id };
|
|
1811
|
-
item.dataType = DataType.VFXItemData;
|
|
1812
|
-
//@ts-expect-error
|
|
1813
|
-
item.components.push({ id: item.content.id });
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1818
|
-
finally {
|
|
1819
|
-
try {
|
|
1820
|
-
if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
|
|
1821
|
-
}
|
|
1822
|
-
finally { if (e_3) throw e_3.error; }
|
|
1823
|
-
}
|
|
1824
|
-
};
|
|
1825
|
-
try {
|
|
1826
|
-
// 更正Composition.endBehavior
|
|
1827
|
-
for (var _f = __values(json.compositions), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1828
|
-
var composition = _g.value;
|
|
1829
|
-
_loop_1(composition);
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1833
|
-
finally {
|
|
1834
|
-
try {
|
|
1835
|
-
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
1836
|
-
}
|
|
1837
|
-
finally { if (e_1) throw e_1.error; }
|
|
1838
|
-
}
|
|
1839
|
-
result.version = '3.0';
|
|
1840
|
-
return result;
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
1844
|
-
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
1845
|
-
var reverseParticle = false;
|
|
1846
|
-
function getStandardJSON(json) {
|
|
1847
|
-
var _a, _b;
|
|
1848
|
-
if (!json || typeof json !== 'object') {
|
|
1849
|
-
throw Error('expect a json object');
|
|
1850
|
-
}
|
|
1851
|
-
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
1852
|
-
version22Migration(json);
|
|
1853
|
-
if (v0.test(json.version)) {
|
|
1854
|
-
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
1855
|
-
return version30Migration(version21Migration(getStandardJSONFromV0(json)));
|
|
1856
|
-
}
|
|
1857
|
-
var mainVersion = (_b = standardVersion.exec(json.version)) === null || _b === void 0 ? void 0 : _b[1];
|
|
1858
|
-
if (mainVersion) {
|
|
1859
|
-
if (Number(mainVersion) < 3) {
|
|
1860
|
-
return version30Migration(version21Migration(json));
|
|
1861
|
-
}
|
|
1862
|
-
return json;
|
|
1863
|
-
}
|
|
1864
|
-
throw Error('invalid json version ' + json.version);
|
|
1865
|
-
}
|
|
1866
|
-
var currentVersion = '1.0';
|
|
1867
|
-
function getStandardJSONFromV0(json) {
|
|
1868
|
-
var _a, _b;
|
|
1869
|
-
currentVersion = '1.0';
|
|
1870
|
-
var plugins = json.plugins || [];
|
|
1871
|
-
if ((_a = json.bins) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1872
|
-
currentVersion = '1.3';
|
|
1873
|
-
}
|
|
1874
|
-
var requires = (json.requires || []).slice();
|
|
1875
|
-
var images = json.images.map(function (img, index) { return getStandardImage(img, index, json.imageTags || []); });
|
|
1876
|
-
var textures = json.textures || images.map(function (img, i) { return ({ source: i, flipY: true }); });
|
|
1877
|
-
var ret = {
|
|
1878
|
-
plugins: plugins,
|
|
1879
|
-
shapes: json.shapes || [],
|
|
1880
|
-
type: 'ge',
|
|
1881
|
-
version: currentVersion,
|
|
1882
|
-
playerVersion: (_b = json.playerVersion) !== null && _b !== void 0 ? _b : {
|
|
1883
|
-
web: '',
|
|
1884
|
-
native: '',
|
|
1885
|
-
},
|
|
1886
|
-
compositionId: json.compositionId + '',
|
|
1887
|
-
compositions: json.compositions.map(function (comp) { return getStandardComposition(comp, { plugins: plugins, requires: requires }); }),
|
|
1888
|
-
images: images,
|
|
1889
|
-
imgUsage: json._imgs,
|
|
1890
|
-
binUsage: json.binUsage,
|
|
1891
|
-
spines: json.spines,
|
|
1892
|
-
requires: json.requires,
|
|
1893
|
-
textures: textures,
|
|
1894
|
-
bins: (json.bins || []).slice(),
|
|
1895
|
-
};
|
|
1896
|
-
if (json._textures) {
|
|
1897
|
-
ret._textures = json._textures;
|
|
1898
|
-
}
|
|
1899
|
-
return ret;
|
|
1900
|
-
}
|
|
1901
|
-
function getStandardImage(image, index, imageTags) {
|
|
1902
|
-
var renderLevel = imageTags[index];
|
|
1903
|
-
var oriY = image.oriY;
|
|
1904
|
-
if (typeof image === 'string') {
|
|
1905
|
-
return {
|
|
1906
|
-
renderLevel: renderLevel,
|
|
1907
|
-
url: image,
|
|
1908
|
-
oriY: oriY,
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
else if (image.template) {
|
|
1912
|
-
return {
|
|
1913
|
-
url: image.url,
|
|
1914
|
-
template: image.template,
|
|
1915
|
-
webp: image.webp,
|
|
1916
|
-
renderLevel: renderLevel,
|
|
1917
|
-
oriY: oriY,
|
|
1918
|
-
};
|
|
1919
|
-
}
|
|
1920
|
-
else if (image.compressed) {
|
|
1921
|
-
return {
|
|
1922
|
-
url: image.url,
|
|
1923
|
-
oriY: oriY,
|
|
1924
|
-
compressed: {
|
|
1925
|
-
astc: image.compressed.android,
|
|
1926
|
-
pvrtc: image.compressed.iOS,
|
|
1927
|
-
},
|
|
1928
|
-
webp: image.webp,
|
|
1929
|
-
renderLevel: renderLevel,
|
|
1930
|
-
};
|
|
1931
|
-
}
|
|
1932
|
-
else if (image.url) {
|
|
1933
|
-
return {
|
|
1934
|
-
url: image.url,
|
|
1935
|
-
type: image.type,
|
|
1936
|
-
webp: image.webp,
|
|
1937
|
-
renderLevel: renderLevel,
|
|
1938
|
-
oriY: oriY,
|
|
1939
|
-
loop: image.loop,
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
else if (image && image.sourceType) {
|
|
1943
|
-
return image;
|
|
1944
|
-
}
|
|
1945
|
-
throw Error('invalid image type');
|
|
1946
|
-
}
|
|
1947
|
-
function getStandardComposition(composition, opt) {
|
|
1948
|
-
var _a;
|
|
1949
|
-
if (opt === void 0) { opt = {}; }
|
|
1950
|
-
var ret = {
|
|
1951
|
-
id: composition.id + '',
|
|
1952
|
-
camera: Object.assign({ clipMode: CAMERA_CLIP_MODE_NORMAL }, composition.camera),
|
|
1953
|
-
duration: composition.duration,
|
|
1954
|
-
endBehavior: composition.endBehavior,
|
|
1955
|
-
items: composition.items.map(function (item) { return getStandardItem(item, opt); }),
|
|
1956
|
-
name: composition.name,
|
|
1957
|
-
};
|
|
1958
|
-
var startTime = composition.startTime || composition.st;
|
|
1959
|
-
if (startTime) {
|
|
1960
|
-
ret.startTime = startTime;
|
|
1961
|
-
}
|
|
1962
|
-
var previewSize = (_a = composition.meta) === null || _a === void 0 ? void 0 : _a.previewSize;
|
|
1963
|
-
if (previewSize && previewSize[0] === previewSize[1] && previewSize[0] === 0) {
|
|
1964
|
-
previewSize = undefined;
|
|
1965
|
-
}
|
|
1966
|
-
if (previewSize) {
|
|
1967
|
-
ret.previewSize = previewSize;
|
|
1968
|
-
}
|
|
1969
|
-
return ret;
|
|
1970
|
-
}
|
|
1971
|
-
var tempQuat = [0, 0, 0, 1];
|
|
1972
|
-
var stdAnchor = 0.5;
|
|
1973
|
-
function getStandardItem(item, opt) {
|
|
1974
|
-
var _a, _b, _c;
|
|
1975
|
-
if (opt === void 0) { opt = {}; }
|
|
1976
|
-
var type = ItemType.base;
|
|
1977
|
-
var transform;
|
|
1978
|
-
var originContent;
|
|
1979
|
-
var content;
|
|
1980
|
-
var endBehavior = item.endBehavior;
|
|
1981
|
-
var renderLevel;
|
|
1982
|
-
var pluginName;
|
|
1983
|
-
var duration = NaN;
|
|
1984
|
-
var pn;
|
|
1985
|
-
if (item.content) {
|
|
1986
|
-
type = item.type || ItemType.plugin;
|
|
1987
|
-
pn = item.pn;
|
|
1988
|
-
pluginName = item.pluginName;
|
|
1989
|
-
content = item.content;
|
|
1990
|
-
originContent = item.content;
|
|
1991
|
-
if (isNaN(pn) && !pluginName) {
|
|
1992
|
-
pluginName = content.options.type;
|
|
1993
|
-
}
|
|
1994
|
-
if (item.duration) {
|
|
1995
|
-
duration = item.duration;
|
|
1996
|
-
}
|
|
1997
|
-
transform = item.transform || getTransform(originContent.transform);
|
|
1998
|
-
if (type === ItemType.filter) {
|
|
1999
|
-
if (currentVersion < '1.1') {
|
|
2000
|
-
currentVersion = '1.1';
|
|
2001
|
-
}
|
|
2002
|
-
content = getStandardSpriteContent(originContent, transform);
|
|
2003
|
-
// @ts-expect-error
|
|
2004
|
-
content.filter = getStandardFilterContent(originContent.filter);
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
else if (item.particle) {
|
|
2008
|
-
type = ItemType.particle;
|
|
2009
|
-
originContent = item.particle;
|
|
2010
|
-
transform = getTransform(originContent.transform, reverseParticle, true);
|
|
2011
|
-
content = getStandardParticleContent(originContent);
|
|
2012
|
-
}
|
|
2013
|
-
else if (item.sprite) {
|
|
2014
|
-
type = ItemType.sprite;
|
|
2015
|
-
originContent = item.sprite;
|
|
2016
|
-
transform = getTransform(originContent.transform, false, true);
|
|
2017
|
-
content = getStandardSpriteContent(originContent, transform);
|
|
2018
|
-
}
|
|
2019
|
-
else if (item.cal) {
|
|
2020
|
-
type = ItemType.null;
|
|
2021
|
-
originContent = item.cal;
|
|
2022
|
-
transform = getTransform(originContent.transform, false, true);
|
|
2023
|
-
content = getStandardNullContent(originContent, transform);
|
|
2024
|
-
}
|
|
2025
|
-
else if (item.ui) {
|
|
2026
|
-
type = ItemType.interact;
|
|
2027
|
-
originContent = item.ui;
|
|
2028
|
-
transform = getTransform(originContent.transform);
|
|
2029
|
-
content = getStandardInteractContent(originContent);
|
|
2030
|
-
transform.scale = [originContent.options.width || 1, originContent.options.height || 1, 1];
|
|
2031
|
-
}
|
|
2032
|
-
else if (item.model) {
|
|
2033
|
-
originContent = item.model;
|
|
2034
|
-
if (item.model.options.type === 1) {
|
|
2035
|
-
type = ItemType.camera;
|
|
2036
|
-
transform = getTransform(originContent.transform);
|
|
2037
|
-
content = getStandardCameraContent(originContent);
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
if ((_a = content.renderer) === null || _a === void 0 ? void 0 : _a.anchor) {
|
|
2041
|
-
var anchor = new Float32Array(content.renderer.anchor);
|
|
2042
|
-
if (anchor[0] == stdAnchor && anchor[1] == stdAnchor) {
|
|
2043
|
-
delete content.renderer.anchor;
|
|
2044
|
-
}
|
|
2045
|
-
else if (opt.requires) {
|
|
2046
|
-
arrAdd(opt.requires, 'anchor');
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
if (originContent) {
|
|
2050
|
-
var looping = (_b = originContent.options) === null || _b === void 0 ? void 0 : _b.looping;
|
|
2051
|
-
if (looping) {
|
|
2052
|
-
if (Array.isArray(looping)) {
|
|
2053
|
-
endBehavior = looping[1] ? ItemEndBehavior.loop : ItemEndBehavior.destroy;
|
|
2054
|
-
}
|
|
2055
|
-
else {
|
|
2056
|
-
endBehavior = ItemEndBehavior.loop;
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
else {
|
|
2060
|
-
endBehavior = endBehavior || ((_c = originContent === null || originContent === void 0 ? void 0 : originContent.options) === null || _c === void 0 ? void 0 : _c.endBehavior) || ItemEndBehavior.destroy;
|
|
2061
|
-
}
|
|
2062
|
-
if (originContent.options.renderLevel) {
|
|
2063
|
-
renderLevel = originContent.options.renderLevel;
|
|
2064
|
-
}
|
|
2065
|
-
if (isNaN(duration)) {
|
|
2066
|
-
duration = originContent.options.duration;
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
var ret = {
|
|
2070
|
-
type: type,
|
|
2071
|
-
name: item.name,
|
|
2072
|
-
delay: item.delay,
|
|
2073
|
-
duration: duration,
|
|
2074
|
-
id: item.id + '',
|
|
2075
|
-
// @ts-expect-error
|
|
2076
|
-
transform: transform,
|
|
2077
|
-
endBehavior: endBehavior,
|
|
2078
|
-
// @ts-expect-error
|
|
2079
|
-
renderLevel: renderLevel,
|
|
2080
|
-
content: content,
|
|
2081
|
-
};
|
|
2082
|
-
// @ts-expect-error
|
|
2083
|
-
if (pluginName) {
|
|
2084
|
-
if (opt.plugins) {
|
|
2085
|
-
arrAdd(opt.plugins, pluginName);
|
|
2086
|
-
ret.pn = opt.plugins.indexOf(pluginName);
|
|
2087
|
-
}
|
|
2088
|
-
else {
|
|
2089
|
-
ret.pluginName = pluginName;
|
|
2090
|
-
}
|
|
2091
|
-
// @ts-expect-error
|
|
2092
|
-
}
|
|
2093
|
-
else if (Number.isInteger(pn)) {
|
|
2094
|
-
// @ts-expect-error
|
|
2095
|
-
ret.pn = pn;
|
|
2096
|
-
}
|
|
2097
|
-
if (item.parentId) {
|
|
2098
|
-
ret.parentId = item.parentId + '';
|
|
2099
|
-
}
|
|
2100
|
-
return ret;
|
|
2101
|
-
function getTransform(originTransform, inverseRotation, changeOrder) {
|
|
2102
|
-
if (originTransform) {
|
|
2103
|
-
var transform_1 = {};
|
|
2104
|
-
var rotation = originTransform.rotation;
|
|
2105
|
-
if (rotation) {
|
|
2106
|
-
if (inverseRotation) {
|
|
2107
|
-
transform_1.rotation = [-rotation[0], -rotation[1], -rotation[2]];
|
|
2108
|
-
}
|
|
2109
|
-
else {
|
|
2110
|
-
transform_1.rotation = [rotation[0], rotation[1], rotation[2]];
|
|
2111
|
-
}
|
|
2112
|
-
if (changeOrder) {
|
|
2113
|
-
var q = quatFromXYZRotation(tempQuat, transform_1.rotation[0], transform_1.rotation[1], transform_1.rotation[2]);
|
|
2114
|
-
transform_1.rotation = rotationZYXFromQuat([], q);
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
var position = originTransform.position;
|
|
2118
|
-
if (position) {
|
|
2119
|
-
transform_1.position = originTransform.position;
|
|
2120
|
-
}
|
|
2121
|
-
if (Array.isArray(originTransform.scale)) {
|
|
2122
|
-
transform_1.scale = [originTransform.scale[0] || 1, originTransform.scale[1] || 1, originTransform.scale[2] || 1];
|
|
2123
|
-
}
|
|
2124
|
-
return transform_1;
|
|
2125
|
-
}
|
|
2126
|
-
return {};
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
exports.arrAdd = arrAdd;
|
|
2131
|
-
exports.colorToArr = colorToArr;
|
|
2132
|
-
exports.convertAnchor = convertAnchor;
|
|
2133
|
-
exports.deleteEmptyValue = deleteEmptyValue;
|
|
2134
|
-
exports.ensureColorExpression = ensureColorExpression;
|
|
2135
|
-
exports.ensureFixedNumber = ensureFixedNumber;
|
|
2136
|
-
exports.ensureFixedNumberWithRandom = ensureFixedNumberWithRandom;
|
|
2137
|
-
exports.ensureFixedVec3 = ensureFixedVec3;
|
|
2138
|
-
exports.ensureGradient = ensureGradient;
|
|
2139
|
-
exports.ensureNumberExpression = ensureNumberExpression;
|
|
2140
|
-
exports.ensureRGBAValue = ensureRGBAValue;
|
|
2141
|
-
exports.ensureValueGetter = ensureValueGetter;
|
|
2142
|
-
exports.forEach = forEach;
|
|
2143
|
-
exports.generateGUID = generateGUID;
|
|
2144
|
-
exports.getGradientColor = getGradientColor;
|
|
2145
|
-
exports.getStandardComposition = getStandardComposition;
|
|
2146
|
-
exports.getStandardImage = getStandardImage;
|
|
2147
|
-
exports.getStandardItem = getStandardItem;
|
|
2148
|
-
exports.getStandardJSON = getStandardJSON;
|
|
2149
|
-
exports.normalizeColor = normalizeColor;
|
|
2150
|
-
exports.objectValueToNumber = objectValueToNumber;
|
|
2151
|
-
exports.parsePercent = parsePercent;
|
|
2152
|
-
exports.particleOriginTranslateMap = particleOriginTranslateMap;
|
|
2153
|
-
exports.quatFromXYZRotation = quatFromXYZRotation;
|
|
2154
|
-
exports.rotationZYXFromQuat = rotationZYXFromQuat;
|
|
2155
|
-
//# sourceMappingURL=fallback.js.map
|