@galacean/effects-threejs 2.0.0-alpha.3 → 2.0.0-alpha.4
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 +727 -254
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +763 -291
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +3 -3
- 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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -124,7 +124,7 @@ function __read$3(o, n) {
|
|
|
124
124
|
return ar;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function __spreadArray$
|
|
127
|
+
function __spreadArray$3(to, from, pack) {
|
|
128
128
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
129
129
|
if (ar || !(i in from)) {
|
|
130
130
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
@@ -142,20 +142,20 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
142
142
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
143
143
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
144
144
|
// generators (like Math.random()).
|
|
145
|
-
let getRandomValues;
|
|
146
|
-
const rnds8 = new Uint8Array(16);
|
|
147
|
-
function rng() {
|
|
145
|
+
let getRandomValues$1;
|
|
146
|
+
const rnds8$1 = new Uint8Array(16);
|
|
147
|
+
function rng$1() {
|
|
148
148
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
149
|
-
if (!getRandomValues) {
|
|
149
|
+
if (!getRandomValues$1) {
|
|
150
150
|
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
151
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
151
|
+
getRandomValues$1 = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
152
152
|
|
|
153
|
-
if (!getRandomValues) {
|
|
153
|
+
if (!getRandomValues$1) {
|
|
154
154
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
return getRandomValues(rnds8);
|
|
158
|
+
return getRandomValues$1(rnds8$1);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/**
|
|
@@ -163,30 +163,30 @@ function rng() {
|
|
|
163
163
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
164
164
|
*/
|
|
165
165
|
|
|
166
|
-
const byteToHex = [];
|
|
166
|
+
const byteToHex$2 = [];
|
|
167
167
|
|
|
168
168
|
for (let i = 0; i < 256; ++i) {
|
|
169
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
169
|
+
byteToHex$2.push((i + 0x100).toString(16).slice(1));
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
function unsafeStringify(arr, offset = 0) {
|
|
172
|
+
function unsafeStringify$1(arr, offset = 0) {
|
|
173
173
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
174
174
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
175
|
-
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]];
|
|
175
|
+
return byteToHex$2[arr[offset + 0]] + byteToHex$2[arr[offset + 1]] + byteToHex$2[arr[offset + 2]] + byteToHex$2[arr[offset + 3]] + '-' + byteToHex$2[arr[offset + 4]] + byteToHex$2[arr[offset + 5]] + '-' + byteToHex$2[arr[offset + 6]] + byteToHex$2[arr[offset + 7]] + '-' + byteToHex$2[arr[offset + 8]] + byteToHex$2[arr[offset + 9]] + '-' + byteToHex$2[arr[offset + 10]] + byteToHex$2[arr[offset + 11]] + byteToHex$2[arr[offset + 12]] + byteToHex$2[arr[offset + 13]] + byteToHex$2[arr[offset + 14]] + byteToHex$2[arr[offset + 15]];
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
179
|
-
var native = {
|
|
180
|
-
randomUUID
|
|
178
|
+
const randomUUID$1 = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
179
|
+
var native$1 = {
|
|
180
|
+
randomUUID: randomUUID$1
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
-
function v4(options, buf, offset) {
|
|
184
|
-
if (native.randomUUID && !buf && !options) {
|
|
185
|
-
return native.randomUUID();
|
|
183
|
+
function v4$1(options, buf, offset) {
|
|
184
|
+
if (native$1.randomUUID && !buf && !options) {
|
|
185
|
+
return native$1.randomUUID();
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
options = options || {};
|
|
189
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
189
|
+
const rnds = options.random || (options.rng || rng$1)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
190
190
|
|
|
191
191
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
192
192
|
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
@@ -201,7 +201,7 @@ function v4(options, buf, offset) {
|
|
|
201
201
|
return buf;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
return unsafeStringify(rnds);
|
|
204
|
+
return unsafeStringify$1(rnds);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
function addItem(arr, value) {
|
|
@@ -2188,7 +2188,7 @@ var __read$2 = (undefined && undefined.__read) || function (o, n) {
|
|
|
2188
2188
|
}
|
|
2189
2189
|
return ar;
|
|
2190
2190
|
};
|
|
2191
|
-
var __spreadArray$
|
|
2191
|
+
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
2192
2192
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2193
2193
|
if (ar || !(i in from)) {
|
|
2194
2194
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
@@ -2505,7 +2505,7 @@ var Matrix4 = /** @class */ (function () {
|
|
|
2505
2505
|
* @returns 复制结果
|
|
2506
2506
|
*/
|
|
2507
2507
|
Matrix4.prototype.copyFrom = function (m) {
|
|
2508
|
-
this.elements = __spreadArray$
|
|
2508
|
+
this.elements = __spreadArray$2([], __read$2(m.elements), false);
|
|
2509
2509
|
return this;
|
|
2510
2510
|
};
|
|
2511
2511
|
/**
|
|
@@ -3034,7 +3034,7 @@ var Matrix4 = /** @class */ (function () {
|
|
|
3034
3034
|
* @returns
|
|
3035
3035
|
*/
|
|
3036
3036
|
Matrix4.prototype.toArray = function () {
|
|
3037
|
-
return __spreadArray$
|
|
3037
|
+
return __spreadArray$2([], __read$2(this.elements), false);
|
|
3038
3038
|
};
|
|
3039
3039
|
Matrix4.prototype.fill = function (array, offset) {
|
|
3040
3040
|
if (offset === void 0) { offset = 0; }
|
|
@@ -4287,7 +4287,7 @@ var __read$1 = (undefined && undefined.__read) || function (o, n) {
|
|
|
4287
4287
|
}
|
|
4288
4288
|
return ar;
|
|
4289
4289
|
};
|
|
4290
|
-
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
4290
|
+
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
4291
4291
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4292
4292
|
if (ar || !(i in from)) {
|
|
4293
4293
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
@@ -4474,7 +4474,7 @@ var Matrix3 = /** @class */ (function () {
|
|
|
4474
4474
|
* @returns 复制结果
|
|
4475
4475
|
*/
|
|
4476
4476
|
Matrix3.prototype.copyFrom = function (m) {
|
|
4477
|
-
this.elements = __spreadArray([], __read$1(m.elements), false);
|
|
4477
|
+
this.elements = __spreadArray$1([], __read$1(m.elements), false);
|
|
4478
4478
|
return this;
|
|
4479
4479
|
};
|
|
4480
4480
|
/**
|
|
@@ -4690,7 +4690,7 @@ var Matrix3 = /** @class */ (function () {
|
|
|
4690
4690
|
* @returns
|
|
4691
4691
|
*/
|
|
4692
4692
|
Matrix3.prototype.toArray = function () {
|
|
4693
|
-
return __spreadArray([], __read$1(this.elements), false);
|
|
4693
|
+
return __spreadArray$1([], __read$1(this.elements), false);
|
|
4694
4694
|
};
|
|
4695
4695
|
Matrix3.prototype.fill = function (array, offset) {
|
|
4696
4696
|
if (offset === void 0) { offset = 0; }
|
|
@@ -6448,7 +6448,7 @@ function error(message) {
|
|
|
6448
6448
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
6449
6449
|
args[_i - 1] = arguments[_i];
|
|
6450
6450
|
}
|
|
6451
|
-
console.error.apply(console, __spreadArray$
|
|
6451
|
+
console.error.apply(console, __spreadArray$3(__spreadArray$3([], __read$3(format(message)), false), [args], false));
|
|
6452
6452
|
localLogger === null || localLogger === void 0 ? void 0 : localLogger('error', message, args);
|
|
6453
6453
|
}
|
|
6454
6454
|
/**
|
|
@@ -6461,7 +6461,7 @@ function info(message) {
|
|
|
6461
6461
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
6462
6462
|
args[_i - 1] = arguments[_i];
|
|
6463
6463
|
}
|
|
6464
|
-
console.debug.apply(console, __spreadArray$
|
|
6464
|
+
console.debug.apply(console, __spreadArray$3([], __read$3(format(message)), false));
|
|
6465
6465
|
localLogger === null || localLogger === void 0 ? void 0 : localLogger('info', message, args);
|
|
6466
6466
|
}
|
|
6467
6467
|
function warn(message) {
|
|
@@ -6469,7 +6469,7 @@ function warn(message) {
|
|
|
6469
6469
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
6470
6470
|
args[_i - 1] = arguments[_i];
|
|
6471
6471
|
}
|
|
6472
|
-
console.warn.apply(console, __spreadArray$
|
|
6472
|
+
console.warn.apply(console, __spreadArray$3([], __read$3(format(message)), false));
|
|
6473
6473
|
localLogger === null || localLogger === void 0 ? void 0 : localLogger('warn', message, args);
|
|
6474
6474
|
}
|
|
6475
6475
|
/**
|
|
@@ -6566,17 +6566,30 @@ function random(min, max) {
|
|
|
6566
6566
|
function throwDestroyedError() {
|
|
6567
6567
|
throw Error('destroyed item cannot be used again');
|
|
6568
6568
|
}
|
|
6569
|
-
function generateGUID() {
|
|
6570
|
-
return v4().replace(/-/g, '');
|
|
6569
|
+
function generateGUID$1() {
|
|
6570
|
+
return v4$1().replace(/-/g, '');
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
6573
|
/*!
|
|
6574
6574
|
* Name: @galacean/effects-specification
|
|
6575
6575
|
* Description: Galacean Effects JSON Specification
|
|
6576
6576
|
* Author: Ant Group CO., Ltd.
|
|
6577
|
-
* Version:
|
|
6577
|
+
* Version: v2.0.0-alpha.2
|
|
6578
|
+
*/
|
|
6579
|
+
|
|
6580
|
+
typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
6581
|
+
|
|
6582
|
+
/**
|
|
6583
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
6584
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
6578
6585
|
*/
|
|
6579
6586
|
|
|
6587
|
+
const byteToHex$1 = [];
|
|
6588
|
+
|
|
6589
|
+
for (let i = 0; i < 256; ++i) {
|
|
6590
|
+
byteToHex$1.push((i + 0x100).toString(16).slice(1));
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6580
6593
|
/*********************************************/
|
|
6581
6594
|
/* 元素属性参数类型 */
|
|
6582
6595
|
/*********************************************/
|
|
@@ -6839,6 +6852,10 @@ var ItemType$1;
|
|
|
6839
6852
|
* 天空盒元素
|
|
6840
6853
|
*/
|
|
6841
6854
|
ItemType["skybox"] = "skybox";
|
|
6855
|
+
/**
|
|
6856
|
+
* 特效元素
|
|
6857
|
+
*/
|
|
6858
|
+
ItemType["effect"] = "effect";
|
|
6842
6859
|
})(ItemType$1 || (ItemType$1 = {}));
|
|
6843
6860
|
/**
|
|
6844
6861
|
* 渲染模式
|
|
@@ -6953,6 +6970,10 @@ var CompositionEndBehavior$1;
|
|
|
6953
6970
|
* 销毁并保留最后一帧
|
|
6954
6971
|
*/
|
|
6955
6972
|
CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = END_BEHAVIOR_PAUSE_AND_DESTROY$1] = "pause_destroy";
|
|
6973
|
+
/**
|
|
6974
|
+
* 冻结
|
|
6975
|
+
*/
|
|
6976
|
+
CompositionEndBehavior[CompositionEndBehavior["freeze"] = END_BEHAVIOR_FREEZE$1] = "freeze";
|
|
6956
6977
|
})(CompositionEndBehavior$1 || (CompositionEndBehavior$1 = {}));
|
|
6957
6978
|
|
|
6958
6979
|
/*********************************************/
|
|
@@ -7091,12 +7112,38 @@ var ShapeArcMode$1;
|
|
|
7091
7112
|
|
|
7092
7113
|
var BloomFilterThresholdAvgColor = 0;
|
|
7093
7114
|
|
|
7115
|
+
var LightType$1;
|
|
7116
|
+
(function (LightType) {
|
|
7117
|
+
/**
|
|
7118
|
+
* 点光源
|
|
7119
|
+
*/
|
|
7120
|
+
LightType["point"] = "point";
|
|
7121
|
+
/**
|
|
7122
|
+
* 聚光灯
|
|
7123
|
+
*/
|
|
7124
|
+
LightType["spot"] = "spot";
|
|
7125
|
+
/**
|
|
7126
|
+
* 方向光
|
|
7127
|
+
*/
|
|
7128
|
+
LightType["directional"] = "directional";
|
|
7129
|
+
/**
|
|
7130
|
+
* 环境光
|
|
7131
|
+
*/
|
|
7132
|
+
LightType["ambient"] = "ambient";
|
|
7133
|
+
})(LightType$1 || (LightType$1 = {}));
|
|
7134
|
+
|
|
7094
7135
|
var ModelBoundingType$1;
|
|
7095
7136
|
(function (ModelBoundingType) {
|
|
7096
7137
|
ModelBoundingType[ModelBoundingType["box"] = 2] = "box";
|
|
7097
7138
|
ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
|
|
7098
7139
|
})(ModelBoundingType$1 || (ModelBoundingType$1 = {}));
|
|
7099
7140
|
|
|
7141
|
+
var CameraType$1;
|
|
7142
|
+
(function (CameraType) {
|
|
7143
|
+
CameraType["orthographic"] = "orthographic";
|
|
7144
|
+
CameraType["perspective"] = "perspective";
|
|
7145
|
+
})(CameraType$1 || (CameraType$1 = {}));
|
|
7146
|
+
|
|
7100
7147
|
// 材质类型
|
|
7101
7148
|
var MaterialType$1;
|
|
7102
7149
|
(function (MaterialType) {
|
|
@@ -7242,6 +7289,28 @@ var FontStyle$1;
|
|
|
7242
7289
|
FontStyle["oblique"] = "oblique";
|
|
7243
7290
|
})(FontStyle$1 || (FontStyle$1 = {}));
|
|
7244
7291
|
|
|
7292
|
+
var DataType$2;
|
|
7293
|
+
(function (DataType) {
|
|
7294
|
+
DataType["VFXItemData"] = "VFXItemData";
|
|
7295
|
+
DataType["EffectComponent"] = "EffectComponent";
|
|
7296
|
+
DataType["Material"] = "Material";
|
|
7297
|
+
DataType["Shader"] = "Shader";
|
|
7298
|
+
DataType["SpriteComponent"] = "SpriteComponent";
|
|
7299
|
+
DataType["ParticleSystem"] = "ParticleSystem";
|
|
7300
|
+
DataType["InteractComponent"] = "InteractComponent";
|
|
7301
|
+
DataType["CameraController"] = "CameraController";
|
|
7302
|
+
DataType["Geometry"] = "Geometry";
|
|
7303
|
+
DataType["Texture"] = "Texture";
|
|
7304
|
+
DataType["TextComponent"] = "TextComponent";
|
|
7305
|
+
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
7306
|
+
DataType["MeshComponent"] = "MeshComponent";
|
|
7307
|
+
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
7308
|
+
DataType["LightComponent"] = "LightComponent";
|
|
7309
|
+
DataType["CameraComponent"] = "CameraComponent";
|
|
7310
|
+
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
7311
|
+
DataType["TreeComponent"] = "TreeComponent";
|
|
7312
|
+
})(DataType$2 || (DataType$2 = {}));
|
|
7313
|
+
|
|
7245
7314
|
var index = /*#__PURE__*/Object.freeze({
|
|
7246
7315
|
__proto__: null,
|
|
7247
7316
|
get BezierKeyframeType () { return BezierKeyframeType$1; },
|
|
@@ -7250,7 +7319,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
7250
7319
|
CAMERA_CLIP_MODE_NORMAL: CAMERA_CLIP_MODE_NORMAL$1,
|
|
7251
7320
|
CAMERA_CLIP_MODE_VERTICAL: CAMERA_CLIP_MODE_VERTICAL$1,
|
|
7252
7321
|
get CameraClipMode () { return CameraClipMode$1; },
|
|
7322
|
+
get CameraType () { return CameraType$1; },
|
|
7253
7323
|
get CompositionEndBehavior () { return CompositionEndBehavior$1; },
|
|
7324
|
+
get DataType () { return DataType$2; },
|
|
7254
7325
|
END_BEHAVIOR_DESTROY: END_BEHAVIOR_DESTROY$1,
|
|
7255
7326
|
END_BEHAVIOR_DESTROY_CHILDREN: END_BEHAVIOR_DESTROY_CHILDREN$1,
|
|
7256
7327
|
END_BEHAVIOR_FORWARD: END_BEHAVIOR_FORWARD$1,
|
|
@@ -7263,6 +7334,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
7263
7334
|
get InteractType () { return InteractType$1; },
|
|
7264
7335
|
get ItemEndBehavior () { return ItemEndBehavior$1; },
|
|
7265
7336
|
get ItemType () { return ItemType$1; },
|
|
7337
|
+
get LightType () { return LightType$1; },
|
|
7266
7338
|
MESSAGE_ITEM_PHRASE_BEGIN: MESSAGE_ITEM_PHRASE_BEGIN,
|
|
7267
7339
|
MESSAGE_ITEM_PHRASE_END: MESSAGE_ITEM_PHRASE_END,
|
|
7268
7340
|
get MaskMode () { return MaskMode$1; },
|
|
@@ -7454,7 +7526,7 @@ function copy$1(target) {
|
|
|
7454
7526
|
}
|
|
7455
7527
|
}
|
|
7456
7528
|
|
|
7457
|
-
var _a$
|
|
7529
|
+
var _a$7;
|
|
7458
7530
|
function valIfUndefined(val, def) {
|
|
7459
7531
|
if (val === undefined || val === null) {
|
|
7460
7532
|
return def;
|
|
@@ -7484,15 +7556,15 @@ function getPreMultiAlpha(blending) {
|
|
|
7484
7556
|
return 1;
|
|
7485
7557
|
}
|
|
7486
7558
|
}
|
|
7487
|
-
var downgradeKeywords = (_a$
|
|
7488
|
-
_a$
|
|
7559
|
+
var downgradeKeywords = (_a$7 = {},
|
|
7560
|
+
_a$7[ShaderType.vertex] = {
|
|
7489
7561
|
in: 'attribute',
|
|
7490
7562
|
out: 'varying',
|
|
7491
7563
|
},
|
|
7492
|
-
_a$
|
|
7564
|
+
_a$7[ShaderType.fragment] = {
|
|
7493
7565
|
in: 'varying',
|
|
7494
7566
|
},
|
|
7495
|
-
_a$
|
|
7567
|
+
_a$7);
|
|
7496
7568
|
/**
|
|
7497
7569
|
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
7498
7570
|
* @param marcos - 宏定义数组
|
|
@@ -7933,7 +8005,7 @@ function loadMipmapImage(pointer, bins) {
|
|
|
7933
8005
|
var EffectsObject = /** @class */ (function () {
|
|
7934
8006
|
function EffectsObject(engine) {
|
|
7935
8007
|
this.engine = engine;
|
|
7936
|
-
this.guid = generateGUID();
|
|
8008
|
+
this.guid = generateGUID$1();
|
|
7937
8009
|
this.taggedProperties = {};
|
|
7938
8010
|
this.engine.addInstance(this);
|
|
7939
8011
|
}
|
|
@@ -8630,13 +8702,49 @@ var GLSLVersion;
|
|
|
8630
8702
|
GLSLVersion["GLSL1"] = "100";
|
|
8631
8703
|
GLSLVersion["GLSL3"] = "300 es";
|
|
8632
8704
|
})(GLSLVersion || (GLSLVersion = {}));
|
|
8633
|
-
var
|
|
8634
|
-
__extends(
|
|
8635
|
-
function
|
|
8705
|
+
var ShaderVariant = /** @class */ (function (_super) {
|
|
8706
|
+
__extends(ShaderVariant, _super);
|
|
8707
|
+
function ShaderVariant(engine, source) {
|
|
8636
8708
|
var _this = _super.call(this, engine) || this;
|
|
8637
8709
|
_this.source = source;
|
|
8638
8710
|
return _this;
|
|
8639
8711
|
}
|
|
8712
|
+
return ShaderVariant;
|
|
8713
|
+
}(EffectsObject));
|
|
8714
|
+
var Shader = /** @class */ (function (_super) {
|
|
8715
|
+
__extends(Shader, _super);
|
|
8716
|
+
function Shader() {
|
|
8717
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
8718
|
+
}
|
|
8719
|
+
Shader.prototype.createVariant = function (macros) {
|
|
8720
|
+
var e_1, _a;
|
|
8721
|
+
var shaderMacros = [];
|
|
8722
|
+
if (macros) {
|
|
8723
|
+
try {
|
|
8724
|
+
for (var _b = __values$1(Object.keys(macros)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8725
|
+
var key = _c.value;
|
|
8726
|
+
shaderMacros.push([key, macros[key]]);
|
|
8727
|
+
}
|
|
8728
|
+
}
|
|
8729
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8730
|
+
finally {
|
|
8731
|
+
try {
|
|
8732
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8733
|
+
}
|
|
8734
|
+
finally { if (e_1) throw e_1.error; }
|
|
8735
|
+
}
|
|
8736
|
+
}
|
|
8737
|
+
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
8738
|
+
shaderVariant.shader = this;
|
|
8739
|
+
return shaderVariant;
|
|
8740
|
+
};
|
|
8741
|
+
Shader.prototype.fromData = function (data) {
|
|
8742
|
+
_super.prototype.fromData.call(this, data);
|
|
8743
|
+
this.shaderData = data;
|
|
8744
|
+
};
|
|
8745
|
+
Shader = __decorate([
|
|
8746
|
+
effectsClass('Shader')
|
|
8747
|
+
], Shader);
|
|
8640
8748
|
return Shader;
|
|
8641
8749
|
}(EffectsObject));
|
|
8642
8750
|
|
|
@@ -8649,8 +8757,8 @@ function createCopyShader(level, writeDepth) {
|
|
|
8649
8757
|
var version = webgl2 ? '#version 300 es' : '';
|
|
8650
8758
|
return {
|
|
8651
8759
|
name: EFFECTS_COPY_MESH_NAME,
|
|
8652
|
-
vertex:
|
|
8653
|
-
fragment:
|
|
8760
|
+
vertex: version + '\n' + COPY_VERTEX_SHADER,
|
|
8761
|
+
fragment: version + '\n' + COPY_FRAGMENT_SHADER,
|
|
8654
8762
|
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
8655
8763
|
marcos: [
|
|
8656
8764
|
['WEBGL2', !!webgl2],
|
|
@@ -8782,13 +8890,13 @@ var SemanticMap = /** @class */ (function () {
|
|
|
8782
8890
|
return SemanticMap;
|
|
8783
8891
|
}());
|
|
8784
8892
|
|
|
8785
|
-
var _a$
|
|
8786
|
-
var BYTES_TYPE_MAP = (_a$
|
|
8787
|
-
_a$
|
|
8788
|
-
_a$
|
|
8789
|
-
_a$
|
|
8790
|
-
_a$
|
|
8791
|
-
_a$
|
|
8893
|
+
var _a$6;
|
|
8894
|
+
var BYTES_TYPE_MAP = (_a$6 = {},
|
|
8895
|
+
_a$6[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT,
|
|
8896
|
+
_a$6[glContext.INT] = Int32Array.BYTES_PER_ELEMENT,
|
|
8897
|
+
_a$6[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT,
|
|
8898
|
+
_a$6[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT,
|
|
8899
|
+
_a$6);
|
|
8792
8900
|
/**
|
|
8793
8901
|
* Geometry 抽象类
|
|
8794
8902
|
*/
|
|
@@ -9357,7 +9465,7 @@ var RenderPass = /** @class */ (function () {
|
|
|
9357
9465
|
RenderPass.prototype.setMeshes = function (meshes) {
|
|
9358
9466
|
var _a;
|
|
9359
9467
|
this.meshes.length = 0;
|
|
9360
|
-
(_a = this.meshes).splice.apply(_a, __spreadArray$
|
|
9468
|
+
(_a = this.meshes).splice.apply(_a, __spreadArray$3([0, 0], __read$3(meshes), false));
|
|
9361
9469
|
sortByOrder(this.meshes, this.meshOrder);
|
|
9362
9470
|
return this.meshes;
|
|
9363
9471
|
};
|
|
@@ -11542,18 +11650,15 @@ var AssetLoader = /** @class */ (function () {
|
|
|
11542
11650
|
return undefined;
|
|
11543
11651
|
}
|
|
11544
11652
|
switch (effectsObjectData.dataType) {
|
|
11545
|
-
case DataType.Material:
|
|
11653
|
+
case DataType$1.Material:
|
|
11546
11654
|
effectsObject = Material.create(this.engine);
|
|
11547
11655
|
break;
|
|
11548
|
-
case DataType.Geometry:
|
|
11656
|
+
case DataType$1.Geometry:
|
|
11549
11657
|
effectsObject = Geometry.create(this.engine);
|
|
11550
11658
|
break;
|
|
11551
|
-
case DataType.Texture:
|
|
11659
|
+
case DataType$1.Texture:
|
|
11552
11660
|
effectsObject = Texture.create(this.engine, effectsObjectData);
|
|
11553
11661
|
return effectsObject;
|
|
11554
|
-
case DataType.Shader:
|
|
11555
|
-
effectsObject = this.engine.getShaderLibrary().createShader(effectsObjectData);
|
|
11556
|
-
break;
|
|
11557
11662
|
default: {
|
|
11558
11663
|
var classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
11559
11664
|
if (classConstructor) {
|
|
@@ -11597,18 +11702,15 @@ var AssetLoader = /** @class */ (function () {
|
|
|
11597
11702
|
return [2 /*return*/, effectsObject];
|
|
11598
11703
|
case 2:
|
|
11599
11704
|
switch (effectsObjectData.dataType) {
|
|
11600
|
-
case DataType.Material:
|
|
11705
|
+
case DataType$1.Material:
|
|
11601
11706
|
effectsObject = Material.create(this.engine);
|
|
11602
11707
|
break;
|
|
11603
|
-
case DataType.Geometry:
|
|
11708
|
+
case DataType$1.Geometry:
|
|
11604
11709
|
effectsObject = Geometry.create(this.engine);
|
|
11605
11710
|
break;
|
|
11606
|
-
case DataType.Texture:
|
|
11711
|
+
case DataType$1.Texture:
|
|
11607
11712
|
effectsObject = Texture.create(this.engine, effectsObjectData);
|
|
11608
11713
|
return [2 /*return*/, effectsObject];
|
|
11609
|
-
case DataType.Shader:
|
|
11610
|
-
effectsObject = this.engine.getShaderLibrary().createShader(effectsObjectData);
|
|
11611
|
-
break;
|
|
11612
11714
|
default: {
|
|
11613
11715
|
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
11614
11716
|
if (classConstructor) {
|
|
@@ -11650,7 +11752,7 @@ var Database = /** @class */ (function () {
|
|
|
11650
11752
|
};
|
|
11651
11753
|
return Database;
|
|
11652
11754
|
}());
|
|
11653
|
-
var DataType;
|
|
11755
|
+
var DataType$1;
|
|
11654
11756
|
(function (DataType) {
|
|
11655
11757
|
DataType["VFXItemData"] = "VFXItemData";
|
|
11656
11758
|
DataType["EffectComponent"] = "EffectComponent";
|
|
@@ -11670,7 +11772,7 @@ var DataType;
|
|
|
11670
11772
|
DataType["CameraComponent"] = "CameraComponent";
|
|
11671
11773
|
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
11672
11774
|
DataType["TreeComponent"] = "TreeComponent";
|
|
11673
|
-
})(DataType || (DataType = {}));
|
|
11775
|
+
})(DataType$1 || (DataType$1 = {}));
|
|
11674
11776
|
|
|
11675
11777
|
/**
|
|
11676
11778
|
* 抽象插件类
|
|
@@ -11821,7 +11923,7 @@ function calculateTranslation(out, target, acc, time, duration, posData, velData
|
|
|
11821
11923
|
return ret;
|
|
11822
11924
|
}
|
|
11823
11925
|
|
|
11824
|
-
var _a$
|
|
11926
|
+
var _a$5;
|
|
11825
11927
|
function ensureVec3(num) {
|
|
11826
11928
|
return Array.isArray(num) ? [num[0], num[1], num[2]] : [0, 0, 0];
|
|
11827
11929
|
}
|
|
@@ -11844,7 +11946,7 @@ function vecNormalize(out, a) {
|
|
|
11844
11946
|
out = [];
|
|
11845
11947
|
}
|
|
11846
11948
|
var ap = a;
|
|
11847
|
-
var sum = Math.hypot.apply(Math, __spreadArray$
|
|
11949
|
+
var sum = Math.hypot.apply(Math, __spreadArray$3([], __read$3(ap), false));
|
|
11848
11950
|
if (sum === 0) {
|
|
11849
11951
|
return vecAssign(out, ap, ap.length);
|
|
11850
11952
|
}
|
|
@@ -11875,17 +11977,17 @@ function vecMulCombine(out, a, b) {
|
|
|
11875
11977
|
}
|
|
11876
11978
|
return out;
|
|
11877
11979
|
}
|
|
11878
|
-
var particleOriginTranslateMap = (_a$
|
|
11879
|
-
_a$
|
|
11880
|
-
_a$
|
|
11881
|
-
_a$
|
|
11882
|
-
_a$
|
|
11883
|
-
_a$
|
|
11884
|
-
_a$
|
|
11885
|
-
_a$
|
|
11886
|
-
_a$
|
|
11887
|
-
_a$
|
|
11888
|
-
_a$
|
|
11980
|
+
var particleOriginTranslateMap$1 = (_a$5 = {},
|
|
11981
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_CENTER] = [0, 0],
|
|
11982
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_CENTER_BOTTOM] = [0, -0.5],
|
|
11983
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_CENTER_TOP] = [0, 0.5],
|
|
11984
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_LEFT_TOP] = [-0.5, 0.5],
|
|
11985
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_LEFT_CENTER] = [-0.5, 0],
|
|
11986
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_LEFT_BOTTOM] = [-0.5, -0.5],
|
|
11987
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_CENTER] = [0.5, 0],
|
|
11988
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [0.5, -0.5],
|
|
11989
|
+
_a$5[ParticleOrigin$1.PARTICLE_ORIGIN_RIGHT_TOP] = [0.5, 0.5],
|
|
11990
|
+
_a$5);
|
|
11889
11991
|
function nearestPowerOfTwo(value) {
|
|
11890
11992
|
return Math.pow(2, Math.round(Math.log(value) / Math.LN2));
|
|
11891
11993
|
}
|
|
@@ -11910,7 +12012,7 @@ function trianglesFromRect(position, halfWidth, halfHeight) {
|
|
|
11910
12012
|
];
|
|
11911
12013
|
}
|
|
11912
12014
|
|
|
11913
|
-
var _a$
|
|
12015
|
+
var _a$4;
|
|
11914
12016
|
var NOT_IMPLEMENT = 'not_implement';
|
|
11915
12017
|
var ValueGetter = /** @class */ (function () {
|
|
11916
12018
|
function ValueGetter(arg) {
|
|
@@ -12418,50 +12520,50 @@ var BezierSegments = /** @class */ (function (_super) {
|
|
|
12418
12520
|
};
|
|
12419
12521
|
return BezierSegments;
|
|
12420
12522
|
}(PathSegments));
|
|
12421
|
-
var map$1 = (_a$
|
|
12422
|
-
_a$
|
|
12523
|
+
var map$1 = (_a$4 = {},
|
|
12524
|
+
_a$4[ValueType$1.RANDOM] = function (props) {
|
|
12423
12525
|
if (props[0] instanceof Array) {
|
|
12424
12526
|
return new RandomVectorValue(props);
|
|
12425
12527
|
}
|
|
12426
12528
|
return new RandomValue(props);
|
|
12427
12529
|
},
|
|
12428
|
-
_a$
|
|
12530
|
+
_a$4[ValueType$1.CONSTANT] = function (props) {
|
|
12429
12531
|
return new StaticValue(props);
|
|
12430
12532
|
},
|
|
12431
|
-
_a$
|
|
12533
|
+
_a$4[ValueType$1.CONSTANT_VEC2] = function (props) {
|
|
12432
12534
|
return new StaticValue(props);
|
|
12433
12535
|
},
|
|
12434
|
-
_a$
|
|
12536
|
+
_a$4[ValueType$1.CONSTANT_VEC3] = function (props) {
|
|
12435
12537
|
return new StaticValue(props);
|
|
12436
12538
|
},
|
|
12437
|
-
_a$
|
|
12539
|
+
_a$4[ValueType$1.CONSTANT_VEC4] = function (props) {
|
|
12438
12540
|
return new StaticValue(props);
|
|
12439
12541
|
},
|
|
12440
|
-
_a$
|
|
12542
|
+
_a$4[ValueType$1.CURVE] = function (props) {
|
|
12441
12543
|
return new CurveValue(props);
|
|
12442
12544
|
},
|
|
12443
|
-
_a$
|
|
12545
|
+
_a$4[ValueType$1.RGBA_COLOR] = function (props) {
|
|
12444
12546
|
return new StaticValue(props);
|
|
12445
12547
|
},
|
|
12446
|
-
_a$
|
|
12548
|
+
_a$4[ValueType$1.COLORS] = function (props) {
|
|
12447
12549
|
return new RandomSetValue(props.map(function (c) { return colorToArr$1(c, false); }));
|
|
12448
12550
|
},
|
|
12449
|
-
_a$
|
|
12551
|
+
_a$4[ValueType$1.LINE] = function (props) {
|
|
12450
12552
|
if (props.length === 2 && props[0][0] === 0 && props[1][0] === 1) {
|
|
12451
12553
|
return new LinearValue([props[0][1], props[1][1]]);
|
|
12452
12554
|
}
|
|
12453
12555
|
return new LineSegments(props);
|
|
12454
12556
|
},
|
|
12455
|
-
_a$
|
|
12557
|
+
_a$4[ValueType$1.GRADIENT_COLOR] = function (props) {
|
|
12456
12558
|
return new GradientValue(props);
|
|
12457
12559
|
},
|
|
12458
|
-
_a$
|
|
12560
|
+
_a$4[ValueType$1.LINEAR_PATH] = function (pros) {
|
|
12459
12561
|
return new PathSegments(pros);
|
|
12460
12562
|
},
|
|
12461
|
-
_a$
|
|
12563
|
+
_a$4[ValueType$1.BEZIER_PATH] = function (pros) {
|
|
12462
12564
|
return new BezierSegments(pros);
|
|
12463
12565
|
},
|
|
12464
|
-
_a$
|
|
12566
|
+
_a$4);
|
|
12465
12567
|
function createValueGetter(args) {
|
|
12466
12568
|
if (!args || !isNaN(+args)) {
|
|
12467
12569
|
return new StaticValue(args || 0);
|
|
@@ -13191,7 +13293,7 @@ var CameraController = /** @class */ (function (_super) {
|
|
|
13191
13293
|
}
|
|
13192
13294
|
};
|
|
13193
13295
|
CameraController = __decorate([
|
|
13194
|
-
effectsClass(DataType.CameraController)
|
|
13296
|
+
effectsClass(DataType$1.CameraController)
|
|
13195
13297
|
], CameraController);
|
|
13196
13298
|
return CameraController;
|
|
13197
13299
|
}(ItemBehaviour));
|
|
@@ -13412,13 +13514,13 @@ var InteractMesh = /** @class */ (function () {
|
|
|
13412
13514
|
['ENV_EDITOR', ((_a = this.engine.renderer) === null || _a === void 0 ? void 0 : _a.env) === PLAYER_OPTIONS_ENV_EDITOR],
|
|
13413
13515
|
];
|
|
13414
13516
|
var color = createValueGetter(this.color).getValue(0);
|
|
13415
|
-
var level = this.engine.gpuCapability.level;
|
|
13416
13517
|
var materialProps = {
|
|
13417
13518
|
shader: {
|
|
13418
|
-
vertex:
|
|
13419
|
-
fragment:
|
|
13519
|
+
vertex: vertex,
|
|
13520
|
+
fragment: fragment,
|
|
13420
13521
|
glslVersion: GLSLVersion.GLSL1,
|
|
13421
13522
|
cacheId: "".concat(rendererOptions.cachePrefix, "_effects_interact"),
|
|
13523
|
+
marcos: marcos,
|
|
13422
13524
|
},
|
|
13423
13525
|
uniformSemantics: {
|
|
13424
13526
|
effects_MatrixVP: 'VIEWPROJECTION',
|
|
@@ -13492,11 +13594,11 @@ var InteractComponent = /** @class */ (function (_super) {
|
|
|
13492
13594
|
}
|
|
13493
13595
|
InteractComponent_1 = InteractComponent;
|
|
13494
13596
|
InteractComponent.prototype.start = function () {
|
|
13495
|
-
var
|
|
13597
|
+
var _this = this;
|
|
13496
13598
|
var options = this.item.props.content.options;
|
|
13497
|
-
var env =
|
|
13599
|
+
var env = this.item.engine.renderer.env;
|
|
13498
13600
|
var composition = this.item.composition;
|
|
13499
|
-
var
|
|
13601
|
+
var _a = this.interactData.options, type = _a.type, showPreview = _a.showPreview;
|
|
13500
13602
|
if (type === InteractType$1.CLICK) {
|
|
13501
13603
|
this.clickable = true;
|
|
13502
13604
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
@@ -13504,7 +13606,8 @@ var InteractComponent = /** @class */ (function (_super) {
|
|
|
13504
13606
|
this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
|
|
13505
13607
|
}
|
|
13506
13608
|
}
|
|
13507
|
-
|
|
13609
|
+
composition.addInteractiveItem(this.item, options.type);
|
|
13610
|
+
this.item.onEnd = function () { return composition.removeInteractiveItem(_this.item, options.type); };
|
|
13508
13611
|
if (options.type === InteractType$1.DRAG) {
|
|
13509
13612
|
if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
|
|
13510
13613
|
composition.event && this.beginDragTarget(options, composition.event);
|
|
@@ -13648,7 +13751,7 @@ var InteractComponent = /** @class */ (function (_super) {
|
|
|
13648
13751
|
};
|
|
13649
13752
|
var InteractComponent_1;
|
|
13650
13753
|
InteractComponent = InteractComponent_1 = __decorate([
|
|
13651
|
-
effectsClass(DataType.InteractComponent)
|
|
13754
|
+
effectsClass(DataType$1.InteractComponent)
|
|
13652
13755
|
], InteractComponent);
|
|
13653
13756
|
return InteractComponent;
|
|
13654
13757
|
}(RendererComponent));
|
|
@@ -13697,8 +13800,8 @@ function spriteMeshShaderFromFilter(level, options) {
|
|
|
13697
13800
|
var fragment = wireframe ? itemFrameFrag : itemFrag.replace(/#pragma\s+FILTER_FRAG/, '');
|
|
13698
13801
|
var vertex = itemVert.replace(/#pragma\s+FILTER_VERT/, 'vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}');
|
|
13699
13802
|
return {
|
|
13700
|
-
fragment:
|
|
13701
|
-
vertex:
|
|
13803
|
+
fragment: fragment,
|
|
13804
|
+
vertex: vertex,
|
|
13702
13805
|
glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
|
|
13703
13806
|
marcos: marcos,
|
|
13704
13807
|
shared: true,
|
|
@@ -15017,7 +15120,7 @@ var SpriteComponent = /** @class */ (function (_super) {
|
|
|
15017
15120
|
_super.prototype.toData.call(this);
|
|
15018
15121
|
};
|
|
15019
15122
|
SpriteComponent = __decorate([
|
|
15020
|
-
effectsClass(DataType.SpriteComponent)
|
|
15123
|
+
effectsClass(DataType$1.SpriteComponent)
|
|
15021
15124
|
], SpriteComponent);
|
|
15022
15125
|
return SpriteComponent;
|
|
15023
15126
|
}(RendererComponent));
|
|
@@ -15178,8 +15281,8 @@ var ParticleMesh = /** @class */ (function () {
|
|
|
15178
15281
|
var originalVertex = "#define LOOKUP_TEXTURE_CURVE ".concat(vertex_lookup_texture, "\n").concat(particleVert);
|
|
15179
15282
|
var vertex = originalVertex;
|
|
15180
15283
|
var shader = {
|
|
15181
|
-
fragment:
|
|
15182
|
-
vertex:
|
|
15284
|
+
fragment: fragment,
|
|
15285
|
+
vertex: vertex,
|
|
15183
15286
|
glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
|
|
15184
15287
|
shared: true,
|
|
15185
15288
|
cacheId: shaderCache,
|
|
@@ -15734,8 +15837,8 @@ var TrailMesh = /** @class */ (function () {
|
|
|
15734
15837
|
else {
|
|
15735
15838
|
uniformValues.uVCurveValues = CurveValue.getAllData(keyFrameMeta);
|
|
15736
15839
|
}
|
|
15737
|
-
var vertex =
|
|
15738
|
-
var fragment =
|
|
15840
|
+
var vertex = trailVert;
|
|
15841
|
+
var fragment = particleFrag;
|
|
15739
15842
|
var mtl = ({
|
|
15740
15843
|
shader: {
|
|
15741
15844
|
vertex: vertex,
|
|
@@ -16422,7 +16525,7 @@ var TextureShape = /** @class */ (function () {
|
|
|
16422
16525
|
return TextureShape;
|
|
16423
16526
|
}());
|
|
16424
16527
|
|
|
16425
|
-
var _a$
|
|
16528
|
+
var _a$3;
|
|
16426
16529
|
var ShapeNone = /** @class */ (function () {
|
|
16427
16530
|
function ShapeNone() {
|
|
16428
16531
|
}
|
|
@@ -16434,18 +16537,18 @@ var ShapeNone = /** @class */ (function () {
|
|
|
16434
16537
|
};
|
|
16435
16538
|
return ShapeNone;
|
|
16436
16539
|
}());
|
|
16437
|
-
var map = (_a$
|
|
16438
|
-
_a$
|
|
16439
|
-
_a$
|
|
16440
|
-
_a$
|
|
16441
|
-
_a$
|
|
16442
|
-
_a$
|
|
16443
|
-
_a$
|
|
16444
|
-
_a$
|
|
16445
|
-
_a$
|
|
16446
|
-
_a$
|
|
16447
|
-
_a$
|
|
16448
|
-
_a$
|
|
16540
|
+
var map = (_a$3 = {},
|
|
16541
|
+
_a$3[ShapeType$1.NONE] = ShapeNone,
|
|
16542
|
+
_a$3[ShapeType$1.CONE] = Cone,
|
|
16543
|
+
_a$3[ShapeType$1.SPHERE] = Sphere,
|
|
16544
|
+
_a$3[ShapeType$1.HEMISPHERE] = Hemisphere,
|
|
16545
|
+
_a$3[ShapeType$1.CIRCLE] = Circle,
|
|
16546
|
+
_a$3[ShapeType$1.DONUT] = Donut,
|
|
16547
|
+
_a$3[ShapeType$1.RECTANGLE] = Rectangle,
|
|
16548
|
+
_a$3[ShapeType$1.EDGE] = Edge,
|
|
16549
|
+
_a$3[ShapeType$1.RECTANGLE_EDGE] = RectangleEdge,
|
|
16550
|
+
_a$3[ShapeType$1.TEXTURE] = TextureShape,
|
|
16551
|
+
_a$3);
|
|
16449
16552
|
function createShape(shapeOptions) {
|
|
16450
16553
|
if (!shapeOptions) {
|
|
16451
16554
|
return new ShapeNone();
|
|
@@ -17774,7 +17877,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
17774
17877
|
}));
|
|
17775
17878
|
p.delay += meshTime;
|
|
17776
17879
|
cursor++;
|
|
17777
|
-
(_a = p.transform).translate.apply(_a, __spreadArray$
|
|
17880
|
+
(_a = p.transform).translate.apply(_a, __spreadArray$3([], __read$3(burstOffset), false));
|
|
17778
17881
|
this.addParticle(p, maxCount_1);
|
|
17779
17882
|
}
|
|
17780
17883
|
}
|
|
@@ -18363,7 +18466,7 @@ var ParticleSystem = /** @class */ (function (_super) {
|
|
|
18363
18466
|
timeline.createTrack(Track).createClip(ParticleBehaviourPlayable);
|
|
18364
18467
|
};
|
|
18365
18468
|
ParticleSystem = __decorate([
|
|
18366
|
-
effectsClass(DataType.ParticleSystem)
|
|
18469
|
+
effectsClass(DataType$1.ParticleSystem)
|
|
18367
18470
|
], ParticleSystem);
|
|
18368
18471
|
return ParticleSystem;
|
|
18369
18472
|
}(Component));
|
|
@@ -18546,7 +18649,9 @@ var TextStyle = /** @class */ (function () {
|
|
|
18546
18649
|
this.fontOffset = 0;
|
|
18547
18650
|
var _g = options.textColor, textColor = _g === void 0 ? [1, 1, 1, 1] : _g, _h = options.fontSize, fontSize = _h === void 0 ? 40 : _h, outline = options.outline, shadow = options.shadow, _j = options.fontWeight, fontWeight = _j === void 0 ? 'normal' : _j, _k = options.fontStyle, fontStyle = _k === void 0 ? 'normal' : _k, _l = options.fontFamily, fontFamily = _l === void 0 ? 'sans-serif' : _l;
|
|
18548
18651
|
this.textColor = textColor;
|
|
18652
|
+
//@ts-expect-error
|
|
18549
18653
|
this.textWeight = fontWeight;
|
|
18654
|
+
//@ts-expect-error
|
|
18550
18655
|
this.fontStyle = fontStyle;
|
|
18551
18656
|
this.fontFamily = fontFamily;
|
|
18552
18657
|
this.fontSize = fontSize; // 暂时取消字号限制 Math.min(fontSize, this.maxFontSize);
|
|
@@ -20056,7 +20161,7 @@ var TextComponent = /** @class */ (function (_super) {
|
|
|
20056
20161
|
context.shadowOffsetY = -style.shadowOffsetY;
|
|
20057
20162
|
};
|
|
20058
20163
|
TextComponent = __decorate([
|
|
20059
|
-
effectsClass(DataType.TextComponent)
|
|
20164
|
+
effectsClass(DataType$1.TextComponent)
|
|
20060
20165
|
], TextComponent);
|
|
20061
20166
|
return TextComponent;
|
|
20062
20167
|
}(SpriteComponent));
|
|
@@ -20212,7 +20317,7 @@ var EffectComponent = /** @class */ (function (_super) {
|
|
|
20212
20317
|
serialize()
|
|
20213
20318
|
], EffectComponent.prototype, "geometry", void 0);
|
|
20214
20319
|
EffectComponent = __decorate([
|
|
20215
|
-
effectsClass(DataType.EffectComponent)
|
|
20320
|
+
effectsClass(DataType$1.EffectComponent)
|
|
20216
20321
|
], EffectComponent);
|
|
20217
20322
|
return EffectComponent;
|
|
20218
20323
|
}(RendererComponent));
|
|
@@ -20614,7 +20719,10 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20614
20719
|
try {
|
|
20615
20720
|
for (var _e = __values$1(this.children), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
20616
20721
|
var child = _f.value;
|
|
20617
|
-
|
|
20722
|
+
var res = child.find(name);
|
|
20723
|
+
if (res) {
|
|
20724
|
+
return res;
|
|
20725
|
+
}
|
|
20618
20726
|
}
|
|
20619
20727
|
}
|
|
20620
20728
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -20631,6 +20739,7 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20631
20739
|
_super.prototype.fromData.call(this, data);
|
|
20632
20740
|
var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _b = data.listIndex, listIndex = _b === void 0 ? 0 : _b, _c = data.duration, duration = _c === void 0 ? 0 : _c;
|
|
20633
20741
|
this.props = data;
|
|
20742
|
+
//@ts-expect-error
|
|
20634
20743
|
this.type = data.type;
|
|
20635
20744
|
this.id = id.toString(); // TODO 老数据 id 是 number,需要转换
|
|
20636
20745
|
this.name = name;
|
|
@@ -20699,7 +20808,7 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20699
20808
|
var _b, _c;
|
|
20700
20809
|
this.taggedProperties.id = this.guid;
|
|
20701
20810
|
this.taggedProperties.transform = this.transform.toData();
|
|
20702
|
-
this.taggedProperties.dataType = DataType.VFXItemData;
|
|
20811
|
+
this.taggedProperties.dataType = DataType$1.VFXItemData;
|
|
20703
20812
|
if (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.name) !== 'rootItem') {
|
|
20704
20813
|
this.taggedProperties.parentId = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.guid;
|
|
20705
20814
|
}
|
|
@@ -20726,10 +20835,10 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20726
20835
|
};
|
|
20727
20836
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
20728
20837
|
if (this.composition) {
|
|
20838
|
+
// @ts-expect-error
|
|
20839
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
20729
20840
|
var z = this.transform.getWorldPosition().z;
|
|
20730
|
-
var
|
|
20731
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
20732
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
20841
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
20733
20842
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
20734
20843
|
}
|
|
20735
20844
|
};
|
|
@@ -20796,7 +20905,7 @@ var VFXItem = /** @class */ (function (_super) {
|
|
|
20796
20905
|
};
|
|
20797
20906
|
var VFXItem_1;
|
|
20798
20907
|
VFXItem = VFXItem_1 = __decorate([
|
|
20799
|
-
effectsClass(DataType.VFXItemData)
|
|
20908
|
+
effectsClass(DataType$1.VFXItemData)
|
|
20800
20909
|
], VFXItem);
|
|
20801
20910
|
return VFXItem;
|
|
20802
20911
|
}(EffectsObject));
|
|
@@ -20834,7 +20943,6 @@ function createVFXItem(props, composition) {
|
|
|
20834
20943
|
if (!pluginName) {
|
|
20835
20944
|
switch (type) {
|
|
20836
20945
|
case ItemType$1.null:
|
|
20837
|
-
case ItemType$1.base:
|
|
20838
20946
|
pluginName = 'cal';
|
|
20839
20947
|
break;
|
|
20840
20948
|
case ItemType$1.sprite:
|
|
@@ -20955,7 +21063,7 @@ var PluginSystem = /** @class */ (function () {
|
|
|
20955
21063
|
plugin = plugins[i];
|
|
20956
21064
|
ctrl = pluginLoaderMap[plugin.name];
|
|
20957
21065
|
if (name in ctrl) {
|
|
20958
|
-
pendings.push(Promise.resolve(ctrl[name].apply(ctrl, __spreadArray$
|
|
21066
|
+
pendings.push(Promise.resolve(ctrl[name].apply(ctrl, __spreadArray$3([], __read$3(args), false))));
|
|
20959
21067
|
}
|
|
20960
21068
|
}
|
|
20961
21069
|
return [2 /*return*/, Promise.all(pendings)];
|
|
@@ -21000,9 +21108,74 @@ function getPluginUsageInfo(name) {
|
|
|
21000
21108
|
* Name: @galacean/effects-specification
|
|
21001
21109
|
* Description: Galacean Effects JSON Specification
|
|
21002
21110
|
* Author: Ant Group CO., Ltd.
|
|
21003
|
-
* Version:
|
|
21111
|
+
* Version: v2.0.0-alpha.2
|
|
21112
|
+
*/
|
|
21113
|
+
|
|
21114
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
21115
|
+
var native = {
|
|
21116
|
+
randomUUID
|
|
21117
|
+
};
|
|
21118
|
+
|
|
21119
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
21120
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
21121
|
+
// generators (like Math.random()).
|
|
21122
|
+
let getRandomValues;
|
|
21123
|
+
const rnds8 = new Uint8Array(16);
|
|
21124
|
+
function rng() {
|
|
21125
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
21126
|
+
if (!getRandomValues) {
|
|
21127
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
21128
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
21129
|
+
|
|
21130
|
+
if (!getRandomValues) {
|
|
21131
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
21132
|
+
}
|
|
21133
|
+
}
|
|
21134
|
+
|
|
21135
|
+
return getRandomValues(rnds8);
|
|
21136
|
+
}
|
|
21137
|
+
|
|
21138
|
+
/**
|
|
21139
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
21140
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
21004
21141
|
*/
|
|
21005
21142
|
|
|
21143
|
+
const byteToHex = [];
|
|
21144
|
+
|
|
21145
|
+
for (let i = 0; i < 256; ++i) {
|
|
21146
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
21147
|
+
}
|
|
21148
|
+
|
|
21149
|
+
function unsafeStringify(arr, offset = 0) {
|
|
21150
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
21151
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
21152
|
+
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]];
|
|
21153
|
+
}
|
|
21154
|
+
|
|
21155
|
+
function v4(options, buf, offset) {
|
|
21156
|
+
if (native.randomUUID && !buf && !options) {
|
|
21157
|
+
return native.randomUUID();
|
|
21158
|
+
}
|
|
21159
|
+
|
|
21160
|
+
options = options || {};
|
|
21161
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
21162
|
+
|
|
21163
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
21164
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
21165
|
+
|
|
21166
|
+
if (buf) {
|
|
21167
|
+
offset = offset || 0;
|
|
21168
|
+
|
|
21169
|
+
for (let i = 0; i < 16; ++i) {
|
|
21170
|
+
buf[offset + i] = rnds[i];
|
|
21171
|
+
}
|
|
21172
|
+
|
|
21173
|
+
return buf;
|
|
21174
|
+
}
|
|
21175
|
+
|
|
21176
|
+
return unsafeStringify(rnds);
|
|
21177
|
+
}
|
|
21178
|
+
|
|
21006
21179
|
/*********************************************/
|
|
21007
21180
|
/* 元素属性参数类型 */
|
|
21008
21181
|
/*********************************************/
|
|
@@ -21265,6 +21438,10 @@ var ItemType;
|
|
|
21265
21438
|
* 天空盒元素
|
|
21266
21439
|
*/
|
|
21267
21440
|
ItemType["skybox"] = "skybox";
|
|
21441
|
+
/**
|
|
21442
|
+
* 特效元素
|
|
21443
|
+
*/
|
|
21444
|
+
ItemType["effect"] = "effect";
|
|
21268
21445
|
})(ItemType || (ItemType = {}));
|
|
21269
21446
|
/**
|
|
21270
21447
|
* 渲染模式
|
|
@@ -21377,6 +21554,10 @@ var CompositionEndBehavior;
|
|
|
21377
21554
|
* 销毁并保留最后一帧
|
|
21378
21555
|
*/
|
|
21379
21556
|
CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = END_BEHAVIOR_PAUSE_AND_DESTROY] = "pause_destroy";
|
|
21557
|
+
/**
|
|
21558
|
+
* 冻结
|
|
21559
|
+
*/
|
|
21560
|
+
CompositionEndBehavior[CompositionEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
21380
21561
|
})(CompositionEndBehavior || (CompositionEndBehavior = {}));
|
|
21381
21562
|
|
|
21382
21563
|
/*********************************************/
|
|
@@ -21513,12 +21694,38 @@ var ShapeArcMode;
|
|
|
21513
21694
|
ShapeArcMode[ShapeArcMode["UNIFORM_BURST"] = 3] = "UNIFORM_BURST";
|
|
21514
21695
|
})(ShapeArcMode || (ShapeArcMode = {}));
|
|
21515
21696
|
|
|
21697
|
+
var LightType;
|
|
21698
|
+
(function (LightType) {
|
|
21699
|
+
/**
|
|
21700
|
+
* 点光源
|
|
21701
|
+
*/
|
|
21702
|
+
LightType["point"] = "point";
|
|
21703
|
+
/**
|
|
21704
|
+
* 聚光灯
|
|
21705
|
+
*/
|
|
21706
|
+
LightType["spot"] = "spot";
|
|
21707
|
+
/**
|
|
21708
|
+
* 方向光
|
|
21709
|
+
*/
|
|
21710
|
+
LightType["directional"] = "directional";
|
|
21711
|
+
/**
|
|
21712
|
+
* 环境光
|
|
21713
|
+
*/
|
|
21714
|
+
LightType["ambient"] = "ambient";
|
|
21715
|
+
})(LightType || (LightType = {}));
|
|
21716
|
+
|
|
21516
21717
|
var ModelBoundingType;
|
|
21517
21718
|
(function (ModelBoundingType) {
|
|
21518
21719
|
ModelBoundingType[ModelBoundingType["box"] = 2] = "box";
|
|
21519
21720
|
ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
|
|
21520
21721
|
})(ModelBoundingType || (ModelBoundingType = {}));
|
|
21521
21722
|
|
|
21723
|
+
var CameraType;
|
|
21724
|
+
(function (CameraType) {
|
|
21725
|
+
CameraType["orthographic"] = "orthographic";
|
|
21726
|
+
CameraType["perspective"] = "perspective";
|
|
21727
|
+
})(CameraType || (CameraType = {}));
|
|
21728
|
+
|
|
21522
21729
|
// 材质类型
|
|
21523
21730
|
var MaterialType;
|
|
21524
21731
|
(function (MaterialType) {
|
|
@@ -21664,6 +21871,28 @@ var FontStyle;
|
|
|
21664
21871
|
FontStyle["oblique"] = "oblique";
|
|
21665
21872
|
})(FontStyle || (FontStyle = {}));
|
|
21666
21873
|
|
|
21874
|
+
var DataType;
|
|
21875
|
+
(function (DataType) {
|
|
21876
|
+
DataType["VFXItemData"] = "VFXItemData";
|
|
21877
|
+
DataType["EffectComponent"] = "EffectComponent";
|
|
21878
|
+
DataType["Material"] = "Material";
|
|
21879
|
+
DataType["Shader"] = "Shader";
|
|
21880
|
+
DataType["SpriteComponent"] = "SpriteComponent";
|
|
21881
|
+
DataType["ParticleSystem"] = "ParticleSystem";
|
|
21882
|
+
DataType["InteractComponent"] = "InteractComponent";
|
|
21883
|
+
DataType["CameraController"] = "CameraController";
|
|
21884
|
+
DataType["Geometry"] = "Geometry";
|
|
21885
|
+
DataType["Texture"] = "Texture";
|
|
21886
|
+
DataType["TextComponent"] = "TextComponent";
|
|
21887
|
+
// FIXME: 先完成ECS的场景转换,后面移到spec中
|
|
21888
|
+
DataType["MeshComponent"] = "MeshComponent";
|
|
21889
|
+
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
21890
|
+
DataType["LightComponent"] = "LightComponent";
|
|
21891
|
+
DataType["CameraComponent"] = "CameraComponent";
|
|
21892
|
+
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
21893
|
+
DataType["TreeComponent"] = "TreeComponent";
|
|
21894
|
+
})(DataType || (DataType = {}));
|
|
21895
|
+
|
|
21667
21896
|
/******************************************************************************
|
|
21668
21897
|
Copyright (c) Microsoft Corporation.
|
|
21669
21898
|
|
|
@@ -21719,11 +21948,22 @@ function __read(o, n) {
|
|
|
21719
21948
|
return ar;
|
|
21720
21949
|
}
|
|
21721
21950
|
|
|
21951
|
+
function __spreadArray(to, from, pack) {
|
|
21952
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
21953
|
+
if (ar || !(i in from)) {
|
|
21954
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21955
|
+
ar[i] = from[i];
|
|
21956
|
+
}
|
|
21957
|
+
}
|
|
21958
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21959
|
+
}
|
|
21960
|
+
|
|
21722
21961
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
21723
21962
|
var e = new Error(message);
|
|
21724
21963
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
21725
21964
|
};
|
|
21726
21965
|
|
|
21966
|
+
var _a$2;
|
|
21727
21967
|
function arrAdd(arr, item) {
|
|
21728
21968
|
if (!arr.includes(item)) {
|
|
21729
21969
|
arr.push(item);
|
|
@@ -21959,6 +22199,34 @@ function rotationZYXFromQuat(out, quat) {
|
|
|
21959
22199
|
}
|
|
21960
22200
|
return out;
|
|
21961
22201
|
}
|
|
22202
|
+
function generateGUID() {
|
|
22203
|
+
return v4().replace(/-/g, '');
|
|
22204
|
+
}
|
|
22205
|
+
/**
|
|
22206
|
+
* 提取并转换 JSON 数据中的 anchor 值
|
|
22207
|
+
*/
|
|
22208
|
+
function convertAnchor$1(anchor, particleOrigin) {
|
|
22209
|
+
if (anchor) {
|
|
22210
|
+
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
22211
|
+
}
|
|
22212
|
+
else if (particleOrigin) {
|
|
22213
|
+
return particleOriginTranslateMap[particleOrigin];
|
|
22214
|
+
}
|
|
22215
|
+
else {
|
|
22216
|
+
return [0, 0];
|
|
22217
|
+
}
|
|
22218
|
+
}
|
|
22219
|
+
var particleOriginTranslateMap = (_a$2 = {},
|
|
22220
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [0, 0],
|
|
22221
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [0, -0.5],
|
|
22222
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [0, 0.5],
|
|
22223
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [-0.5, 0.5],
|
|
22224
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [-0.5, 0],
|
|
22225
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [-0.5, -0.5],
|
|
22226
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [0.5, 0],
|
|
22227
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [0.5, -0.5],
|
|
22228
|
+
_a$2[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [0.5, 0.5],
|
|
22229
|
+
_a$2);
|
|
21962
22230
|
|
|
21963
22231
|
function getStandardParticleContent(particle) {
|
|
21964
22232
|
var _a;
|
|
@@ -22370,6 +22638,309 @@ function version22Migration(json) {
|
|
|
22370
22638
|
});
|
|
22371
22639
|
return json;
|
|
22372
22640
|
}
|
|
22641
|
+
/**
|
|
22642
|
+
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
22643
|
+
*/
|
|
22644
|
+
function version30Migration(json) {
|
|
22645
|
+
var e_1, _a;
|
|
22646
|
+
var _b, _c, _d, _e;
|
|
22647
|
+
var result = Object.assign({}, json, {
|
|
22648
|
+
items: [],
|
|
22649
|
+
components: [],
|
|
22650
|
+
materials: [],
|
|
22651
|
+
shaders: [],
|
|
22652
|
+
geometries: [],
|
|
22653
|
+
});
|
|
22654
|
+
// 兼容老版本数据中不存在textures的情况
|
|
22655
|
+
(_b = result.textures) !== null && _b !== void 0 ? _b : (result.textures = []);
|
|
22656
|
+
result.textures.forEach(function (textureOptions) {
|
|
22657
|
+
Object.assign(textureOptions, {
|
|
22658
|
+
id: generateGUID(),
|
|
22659
|
+
dataType: DataType.Texture,
|
|
22660
|
+
});
|
|
22661
|
+
});
|
|
22662
|
+
if (result.textures.length < result.images.length) {
|
|
22663
|
+
for (var i = result.textures.length; i < result.images.length; i++) {
|
|
22664
|
+
result.textures.push({
|
|
22665
|
+
//@ts-expect-error
|
|
22666
|
+
id: generateGUID(),
|
|
22667
|
+
dataType: DataType.Texture,
|
|
22668
|
+
source: i,
|
|
22669
|
+
flipY: true,
|
|
22670
|
+
});
|
|
22671
|
+
}
|
|
22672
|
+
}
|
|
22673
|
+
var _loop_1 = function (composition) {
|
|
22674
|
+
var e_2, _h, e_3, _j;
|
|
22675
|
+
// composition 的 endbehaviour 兼容
|
|
22676
|
+
if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
|
|
22677
|
+
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
22678
|
+
}
|
|
22679
|
+
var itemGuidMap = {};
|
|
22680
|
+
try {
|
|
22681
|
+
for (var _k = (e_2 = void 0, __values(composition.items)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
22682
|
+
var item = _l.value;
|
|
22683
|
+
itemGuidMap[item.id] = generateGUID();
|
|
22684
|
+
// TODO: 编辑器测试用,上线后删除
|
|
22685
|
+
//@ts-expect-error
|
|
22686
|
+
item.oldId = item.id;
|
|
22687
|
+
item.id = itemGuidMap[item.id];
|
|
22688
|
+
}
|
|
22689
|
+
}
|
|
22690
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
22691
|
+
finally {
|
|
22692
|
+
try {
|
|
22693
|
+
if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
|
|
22694
|
+
}
|
|
22695
|
+
finally { if (e_2) throw e_2.error; }
|
|
22696
|
+
}
|
|
22697
|
+
composition.items.forEach(function (item, index) {
|
|
22698
|
+
if (item.parentId) {
|
|
22699
|
+
if (item.parentId.includes('^')) {
|
|
22700
|
+
var parentId = (item.parentId).split('^')[0];
|
|
22701
|
+
var nodeId = (item.parentId).split('^')[1];
|
|
22702
|
+
item.parentId = itemGuidMap[parentId] + '^' + nodeId;
|
|
22703
|
+
}
|
|
22704
|
+
else {
|
|
22705
|
+
item.parentId = itemGuidMap[item.parentId];
|
|
22706
|
+
}
|
|
22707
|
+
}
|
|
22708
|
+
// @ts-expect-error fix item type
|
|
22709
|
+
result.items.push(item);
|
|
22710
|
+
// @ts-expect-error fix item type
|
|
22711
|
+
composition.items[index] = { id: item.id };
|
|
22712
|
+
});
|
|
22713
|
+
try {
|
|
22714
|
+
for (var _m = (e_3 = void 0, __values(result.items)), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
22715
|
+
var item = _o.value;
|
|
22716
|
+
// 原 texture 索引转为统一 guid 索引
|
|
22717
|
+
if (item.content) {
|
|
22718
|
+
if (item.content.renderer) {
|
|
22719
|
+
if (item.content.renderer.texture !== undefined) {
|
|
22720
|
+
var oldTextureId = item.content.renderer.texture;
|
|
22721
|
+
//@ts-expect-error
|
|
22722
|
+
item.content.renderer.texture = { id: result.textures[oldTextureId].id };
|
|
22723
|
+
}
|
|
22724
|
+
}
|
|
22725
|
+
if (item.content.trails) {
|
|
22726
|
+
if (item.content.trails.texture !== undefined) {
|
|
22727
|
+
var oldTextureId = item.content.trails.texture;
|
|
22728
|
+
//@ts-expect-error
|
|
22729
|
+
item.content.trails.texture = { id: result.textures[oldTextureId].id };
|
|
22730
|
+
}
|
|
22731
|
+
}
|
|
22732
|
+
}
|
|
22733
|
+
// item 的 transform 属性由数组转为 {x:n, y:n, z:n}
|
|
22734
|
+
if (item.transform) {
|
|
22735
|
+
//@ts-expect-error
|
|
22736
|
+
var position = __spreadArray([], __read((_c = item.transform.position) !== null && _c !== void 0 ? _c : [0, 0, 0]), false);
|
|
22737
|
+
//@ts-expect-error
|
|
22738
|
+
var rotation = __spreadArray([], __read((_d = item.transform.rotation) !== null && _d !== void 0 ? _d : [0, 0, 0]), false);
|
|
22739
|
+
//@ts-expect-error
|
|
22740
|
+
var scale = __spreadArray([], __read((_e = item.transform.scale) !== null && _e !== void 0 ? _e : [1, 1, 1]), false);
|
|
22741
|
+
Object.assign(item, {
|
|
22742
|
+
transform: {
|
|
22743
|
+
position: { x: position[0], y: position[1], z: position[2] },
|
|
22744
|
+
rotation: { x: rotation[0], y: rotation[1], z: rotation[2] },
|
|
22745
|
+
scale: { x: scale[0], y: scale[1], z: scale[0] },
|
|
22746
|
+
},
|
|
22747
|
+
});
|
|
22748
|
+
// sprite 的 scale 转为 size
|
|
22749
|
+
if (item.type === ItemType.sprite) {
|
|
22750
|
+
item.transform.size = { x: scale[0], y: scale[1] };
|
|
22751
|
+
item.transform.scale = { x: 1, y: 1, z: 1 };
|
|
22752
|
+
}
|
|
22753
|
+
// sprite 的 anchor 修正
|
|
22754
|
+
if (item.type === ItemType.sprite) {
|
|
22755
|
+
var content = item.content;
|
|
22756
|
+
if (!content.renderer) {
|
|
22757
|
+
content.renderer = {};
|
|
22758
|
+
}
|
|
22759
|
+
var renderer = content.renderer;
|
|
22760
|
+
var realAnchor = convertAnchor$1(renderer.anchor, renderer.particleOrigin);
|
|
22761
|
+
var startSize = item.transform.size;
|
|
22762
|
+
// 兼容旧JSON(anchor和particleOrigin可能同时存在)
|
|
22763
|
+
if (!renderer.anchor && renderer.particleOrigin !== undefined) {
|
|
22764
|
+
//@ts-expect-error
|
|
22765
|
+
item.transform.position.x += -realAnchor[0] * startSize.x;
|
|
22766
|
+
//@ts-expect-error
|
|
22767
|
+
item.transform.position.y += -realAnchor[1] * startSize.y;
|
|
22768
|
+
}
|
|
22769
|
+
//@ts-expect-error
|
|
22770
|
+
item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
|
|
22771
|
+
}
|
|
22772
|
+
}
|
|
22773
|
+
if (item.type === ItemType.particle) {
|
|
22774
|
+
var content = item.content;
|
|
22775
|
+
if (!content.renderer) {
|
|
22776
|
+
content.renderer = {};
|
|
22777
|
+
}
|
|
22778
|
+
var renderer = content.renderer;
|
|
22779
|
+
content.renderer.anchor = convertAnchor$1(renderer.anchor, renderer.particleOrigin);
|
|
22780
|
+
}
|
|
22781
|
+
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
22782
|
+
item.content.tracks = [];
|
|
22783
|
+
var tracks = item.content.tracks;
|
|
22784
|
+
if (item.type !== ItemType.particle) {
|
|
22785
|
+
tracks.push({
|
|
22786
|
+
clips: [
|
|
22787
|
+
{
|
|
22788
|
+
dataType: 'TransformAnimationPlayableAsset',
|
|
22789
|
+
animationClip: {
|
|
22790
|
+
sizeOverLifetime: item.content.sizeOverLifetime,
|
|
22791
|
+
rotationOverLifetime: item.content.rotationOverLifetime,
|
|
22792
|
+
positionOverLifetime: item.content.positionOverLifetime,
|
|
22793
|
+
},
|
|
22794
|
+
},
|
|
22795
|
+
],
|
|
22796
|
+
});
|
|
22797
|
+
}
|
|
22798
|
+
if (item.type === ItemType.sprite) {
|
|
22799
|
+
tracks.push({
|
|
22800
|
+
clips: [
|
|
22801
|
+
{
|
|
22802
|
+
dataType: 'SpriteColorAnimationPlayableAsset',
|
|
22803
|
+
animationClip: {
|
|
22804
|
+
colorOverLifetime: item.content.colorOverLifetime,
|
|
22805
|
+
startColor: item.content.options.startColor,
|
|
22806
|
+
},
|
|
22807
|
+
},
|
|
22808
|
+
],
|
|
22809
|
+
});
|
|
22810
|
+
}
|
|
22811
|
+
// gizmo 的 target id 转换为新的 item guid
|
|
22812
|
+
if (item.content.options.target) {
|
|
22813
|
+
item.content.options.target = itemGuidMap[item.content.options.target];
|
|
22814
|
+
}
|
|
22815
|
+
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22816
|
+
var uuid = generateGUID();
|
|
22817
|
+
if (item.type === ItemType.sprite) {
|
|
22818
|
+
item.components = [];
|
|
22819
|
+
result.components.push(item.content);
|
|
22820
|
+
item.content.id = uuid;
|
|
22821
|
+
item.content.dataType = DataType.SpriteComponent;
|
|
22822
|
+
item.content.item = { id: item.id };
|
|
22823
|
+
item.dataType = DataType.VFXItemData;
|
|
22824
|
+
//@ts-expect-error
|
|
22825
|
+
item.components.push({ id: item.content.id });
|
|
22826
|
+
}
|
|
22827
|
+
else if (item.type === ItemType.particle) {
|
|
22828
|
+
item.components = [];
|
|
22829
|
+
result.components.push(item.content);
|
|
22830
|
+
item.content.id = uuid;
|
|
22831
|
+
item.content.dataType = DataType.ParticleSystem;
|
|
22832
|
+
item.content.item = { id: item.id };
|
|
22833
|
+
item.dataType = DataType.VFXItemData;
|
|
22834
|
+
//@ts-expect-error
|
|
22835
|
+
item.components.push({ id: item.content.id });
|
|
22836
|
+
}
|
|
22837
|
+
else if (item.type === ItemType.mesh) {
|
|
22838
|
+
item.components = [];
|
|
22839
|
+
result.components.push(item.content);
|
|
22840
|
+
item.content.id = uuid;
|
|
22841
|
+
item.content.dataType = DataType.MeshComponent;
|
|
22842
|
+
item.content.item = { id: item.id };
|
|
22843
|
+
item.dataType = DataType.VFXItemData;
|
|
22844
|
+
//@ts-expect-error
|
|
22845
|
+
item.components.push({ id: item.content.id });
|
|
22846
|
+
}
|
|
22847
|
+
else if (item.type === ItemType.skybox) {
|
|
22848
|
+
item.components = [];
|
|
22849
|
+
result.components.push(item.content);
|
|
22850
|
+
item.content.id = uuid;
|
|
22851
|
+
item.content.dataType = DataType.SkyboxComponent;
|
|
22852
|
+
item.content.item = { id: item.id };
|
|
22853
|
+
item.dataType = DataType.VFXItemData;
|
|
22854
|
+
//@ts-expect-error
|
|
22855
|
+
item.components.push({ id: item.content.id });
|
|
22856
|
+
}
|
|
22857
|
+
else if (item.type === ItemType.light) {
|
|
22858
|
+
item.components = [];
|
|
22859
|
+
result.components.push(item.content);
|
|
22860
|
+
item.content.id = uuid;
|
|
22861
|
+
item.content.dataType = DataType.LightComponent;
|
|
22862
|
+
item.content.item = { id: item.id };
|
|
22863
|
+
item.dataType = DataType.VFXItemData;
|
|
22864
|
+
//@ts-expect-error
|
|
22865
|
+
item.components.push({ id: item.content.id });
|
|
22866
|
+
}
|
|
22867
|
+
else if (item.type === 'camera') {
|
|
22868
|
+
item.components = [];
|
|
22869
|
+
result.components.push(item.content);
|
|
22870
|
+
item.content.id = uuid;
|
|
22871
|
+
item.content.dataType = DataType.CameraComponent;
|
|
22872
|
+
item.content.item = { id: item.id };
|
|
22873
|
+
item.dataType = DataType.VFXItemData;
|
|
22874
|
+
//@ts-expect-error
|
|
22875
|
+
item.components.push({ id: item.content.id });
|
|
22876
|
+
}
|
|
22877
|
+
else if (item.type === ItemType.tree) {
|
|
22878
|
+
item.components = [];
|
|
22879
|
+
result.components.push(item.content);
|
|
22880
|
+
item.content.id = uuid;
|
|
22881
|
+
item.content.dataType = DataType.TreeComponent;
|
|
22882
|
+
item.content.item = { id: item.id };
|
|
22883
|
+
item.dataType = DataType.VFXItemData;
|
|
22884
|
+
//@ts-expect-error
|
|
22885
|
+
item.components.push({ id: item.content.id });
|
|
22886
|
+
}
|
|
22887
|
+
else if (item.type === ItemType.interact) {
|
|
22888
|
+
item.components = [];
|
|
22889
|
+
result.components.push(item.content);
|
|
22890
|
+
item.content.id = uuid;
|
|
22891
|
+
item.content.dataType = DataType.InteractComponent;
|
|
22892
|
+
item.content.item = { id: item.id };
|
|
22893
|
+
item.dataType = DataType.VFXItemData;
|
|
22894
|
+
//@ts-expect-error
|
|
22895
|
+
item.components.push({ id: item.content.id });
|
|
22896
|
+
}
|
|
22897
|
+
else if (item.type === ItemType.camera) {
|
|
22898
|
+
item.components = [];
|
|
22899
|
+
result.components.push(item.content);
|
|
22900
|
+
item.content.id = uuid;
|
|
22901
|
+
item.content.dataType = DataType.CameraController;
|
|
22902
|
+
item.content.item = { id: item.id };
|
|
22903
|
+
item.dataType = DataType.VFXItemData;
|
|
22904
|
+
//@ts-expect-error
|
|
22905
|
+
item.components.push({ id: item.content.id });
|
|
22906
|
+
}
|
|
22907
|
+
else if (item.type === ItemType.text) {
|
|
22908
|
+
item.components = [];
|
|
22909
|
+
result.components.push(item.content);
|
|
22910
|
+
item.content.id = uuid;
|
|
22911
|
+
item.content.dataType = DataType.TextComponent;
|
|
22912
|
+
item.content.item = { id: item.id };
|
|
22913
|
+
item.dataType = DataType.VFXItemData;
|
|
22914
|
+
//@ts-expect-error
|
|
22915
|
+
item.components.push({ id: item.content.id });
|
|
22916
|
+
}
|
|
22917
|
+
}
|
|
22918
|
+
}
|
|
22919
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
22920
|
+
finally {
|
|
22921
|
+
try {
|
|
22922
|
+
if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
|
|
22923
|
+
}
|
|
22924
|
+
finally { if (e_3) throw e_3.error; }
|
|
22925
|
+
}
|
|
22926
|
+
};
|
|
22927
|
+
try {
|
|
22928
|
+
// 更正Composition.endBehavior
|
|
22929
|
+
for (var _f = __values(json.compositions), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
22930
|
+
var composition = _g.value;
|
|
22931
|
+
_loop_1(composition);
|
|
22932
|
+
}
|
|
22933
|
+
}
|
|
22934
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22935
|
+
finally {
|
|
22936
|
+
try {
|
|
22937
|
+
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
22938
|
+
}
|
|
22939
|
+
finally { if (e_1) throw e_1.error; }
|
|
22940
|
+
}
|
|
22941
|
+
result.version = '3.0';
|
|
22942
|
+
return result;
|
|
22943
|
+
}
|
|
22373
22944
|
|
|
22374
22945
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
22375
22946
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -22379,16 +22950,16 @@ function getStandardJSON(json) {
|
|
|
22379
22950
|
if (!json || typeof json !== 'object') {
|
|
22380
22951
|
throw Error('expect a json object');
|
|
22381
22952
|
}
|
|
22382
|
-
// 修正老版本数据中,meshItem以及lightItem结束行为错误问题
|
|
22953
|
+
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
22383
22954
|
version22Migration(json);
|
|
22384
22955
|
if (v0.test(json.version)) {
|
|
22385
22956
|
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
22386
|
-
return version21Migration(getStandardJSONFromV0(json));
|
|
22957
|
+
return version30Migration(version21Migration(getStandardJSONFromV0(json)));
|
|
22387
22958
|
}
|
|
22388
22959
|
var mainVersion = (_b = standardVersion.exec(json.version)) === null || _b === void 0 ? void 0 : _b[1];
|
|
22389
22960
|
if (mainVersion) {
|
|
22390
|
-
if (Number(mainVersion) <
|
|
22391
|
-
return version21Migration(json);
|
|
22961
|
+
if (Number(mainVersion) < 3) {
|
|
22962
|
+
return version30Migration(version21Migration(json));
|
|
22392
22963
|
}
|
|
22393
22964
|
return json;
|
|
22394
22965
|
}
|
|
@@ -22712,7 +23283,7 @@ function version3Migration(scene) {
|
|
|
22712
23283
|
try {
|
|
22713
23284
|
for (var _j = __values$1(ecScene.items), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
22714
23285
|
var item = _k.value;
|
|
22715
|
-
itemGuidMap[item.id] = generateGUID();
|
|
23286
|
+
itemGuidMap[item.id] = generateGUID$1();
|
|
22716
23287
|
// TODO: 编辑器测试用,上线后删除
|
|
22717
23288
|
//@ts-expect-error
|
|
22718
23289
|
item.oldId = item.id;
|
|
@@ -22768,8 +23339,8 @@ function version3Migration(scene) {
|
|
|
22768
23339
|
// texture 增加 id 和 dataType
|
|
22769
23340
|
for (var _q = __values$1(scene.textureOptions), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
22770
23341
|
var texture = _r.value;
|
|
22771
|
-
texture.id = generateGUID();
|
|
22772
|
-
texture.dataType = DataType.Texture;
|
|
23342
|
+
texture.id = generateGUID$1();
|
|
23343
|
+
texture.dataType = DataType$1.Texture;
|
|
22773
23344
|
}
|
|
22774
23345
|
}
|
|
22775
23346
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
@@ -22788,23 +23359,15 @@ function version3Migration(scene) {
|
|
|
22788
23359
|
var item = _t.value;
|
|
22789
23360
|
// 原 texture 索引转为统一 guid 索引
|
|
22790
23361
|
if (item.content) {
|
|
22791
|
-
//@ts-expect-error
|
|
22792
23362
|
if (item.content.renderer) {
|
|
22793
|
-
//@ts-expect-error
|
|
22794
23363
|
if (item.content.renderer.texture !== undefined) {
|
|
22795
|
-
//@ts-expect-error
|
|
22796
23364
|
var oldTextureId = item.content.renderer.texture;
|
|
22797
|
-
//@ts-expect-error
|
|
22798
23365
|
item.content.renderer.texture = { id: scene.textureOptions[oldTextureId].id };
|
|
22799
23366
|
}
|
|
22800
23367
|
}
|
|
22801
|
-
//@ts-expect-error
|
|
22802
23368
|
if (item.content.trails) {
|
|
22803
|
-
//@ts-expect-error
|
|
22804
23369
|
if (item.content.trails.texture !== undefined) {
|
|
22805
|
-
//@ts-expect-error
|
|
22806
23370
|
var oldTextureId = item.content.trails.texture;
|
|
22807
|
-
//@ts-expect-error
|
|
22808
23371
|
item.content.trails.texture = { id: scene.textureOptions[oldTextureId].id };
|
|
22809
23372
|
}
|
|
22810
23373
|
}
|
|
@@ -22815,12 +23378,14 @@ function version3Migration(scene) {
|
|
|
22815
23378
|
var rotation = item.transform.rotation;
|
|
22816
23379
|
var scale = item.transform.scale;
|
|
22817
23380
|
if (!position) {
|
|
23381
|
+
//@ts-expect-error
|
|
22818
23382
|
position = [0, 0, 0];
|
|
22819
23383
|
}
|
|
22820
23384
|
if (!rotation) {
|
|
22821
23385
|
rotation = [0, 0, 0];
|
|
22822
23386
|
}
|
|
22823
23387
|
if (!scale) {
|
|
23388
|
+
//@ts-expect-error
|
|
22824
23389
|
scale = [1, 1, 1];
|
|
22825
23390
|
}
|
|
22826
23391
|
item.transform = {
|
|
@@ -22841,12 +23406,9 @@ function version3Migration(scene) {
|
|
|
22841
23406
|
// sprite 的 anchor 修正
|
|
22842
23407
|
if (item.type === ItemType$1.sprite) {
|
|
22843
23408
|
var content = item.content;
|
|
22844
|
-
//@ts-expect-error
|
|
22845
23409
|
if (!content.renderer) {
|
|
22846
|
-
//@ts-expect-error
|
|
22847
23410
|
content.renderer = {};
|
|
22848
23411
|
}
|
|
22849
|
-
//@ts-expect-error
|
|
22850
23412
|
var renderer = content.renderer;
|
|
22851
23413
|
var realAnchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22852
23414
|
//@ts-expect-error
|
|
@@ -22864,14 +23426,10 @@ function version3Migration(scene) {
|
|
|
22864
23426
|
}
|
|
22865
23427
|
if (item.type === ItemType$1.particle) {
|
|
22866
23428
|
var content = item.content;
|
|
22867
|
-
//@ts-expect-error
|
|
22868
23429
|
if (!content.renderer) {
|
|
22869
|
-
//@ts-expect-error
|
|
22870
23430
|
content.renderer = {};
|
|
22871
23431
|
}
|
|
22872
|
-
//@ts-expect-error
|
|
22873
23432
|
var renderer = content.renderer;
|
|
22874
|
-
//@ts-expect-error
|
|
22875
23433
|
content.renderer.anchor = convertAnchor(renderer.anchor, renderer.particleOrigin);
|
|
22876
23434
|
}
|
|
22877
23435
|
// item 的 endbehaviour 兼容
|
|
@@ -22880,9 +23438,7 @@ function version3Migration(scene) {
|
|
|
22880
23438
|
item.endBehavior = END_BEHAVIOR_FREEZE$1;
|
|
22881
23439
|
}
|
|
22882
23440
|
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
22883
|
-
//@ts-expect-error
|
|
22884
23441
|
item.content.tracks = [];
|
|
22885
|
-
//@ts-expect-error
|
|
22886
23442
|
var tracks = item.content.tracks;
|
|
22887
23443
|
if (item.type !== ItemType$1.particle) {
|
|
22888
23444
|
tracks.push({
|
|
@@ -22890,11 +23446,8 @@ function version3Migration(scene) {
|
|
|
22890
23446
|
{
|
|
22891
23447
|
dataType: 'TransformAnimationPlayableAsset',
|
|
22892
23448
|
animationClip: {
|
|
22893
|
-
//@ts-expect-error
|
|
22894
23449
|
sizeOverLifetime: item.content.sizeOverLifetime,
|
|
22895
|
-
//@ts-expect-error
|
|
22896
23450
|
rotationOverLifetime: item.content.rotationOverLifetime,
|
|
22897
|
-
//@ts-expect-error
|
|
22898
23451
|
positionOverLifetime: item.content.positionOverLifetime,
|
|
22899
23452
|
},
|
|
22900
23453
|
},
|
|
@@ -22907,9 +23460,7 @@ function version3Migration(scene) {
|
|
|
22907
23460
|
{
|
|
22908
23461
|
dataType: 'SpriteColorAnimationPlayableAsset',
|
|
22909
23462
|
animationClip: {
|
|
22910
|
-
//@ts-expect-error
|
|
22911
23463
|
colorOverLifetime: item.content.colorOverLifetime,
|
|
22912
|
-
//@ts-expect-error
|
|
22913
23464
|
startColor: item.content.options.startColor,
|
|
22914
23465
|
},
|
|
22915
23466
|
},
|
|
@@ -22917,170 +23468,108 @@ function version3Migration(scene) {
|
|
|
22917
23468
|
});
|
|
22918
23469
|
}
|
|
22919
23470
|
// gizmo 的 target id 转换为新的 item guid
|
|
22920
|
-
|
|
22921
|
-
if (item.content.options.target) {
|
|
22922
|
-
//@ts-expect-error
|
|
23471
|
+
if (item.content && item.content.options && item.content.options.target) {
|
|
22923
23472
|
item.content.options.target = itemGuidMap[item.content.options.target];
|
|
22924
23473
|
}
|
|
22925
23474
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22926
|
-
var uuid = v4().replace(/-/g, '');
|
|
23475
|
+
var uuid = v4$1().replace(/-/g, '');
|
|
22927
23476
|
if (item.type === ItemType$1.sprite) {
|
|
22928
|
-
//@ts-expect-error
|
|
22929
23477
|
item.components = [];
|
|
22930
|
-
//@ts-expect-error
|
|
22931
23478
|
components.push(item.content);
|
|
22932
|
-
//@ts-expect-error
|
|
22933
23479
|
item.content.id = uuid;
|
|
22934
|
-
|
|
22935
|
-
item.content.dataType = DataType.SpriteComponent;
|
|
22936
|
-
//@ts-expect-error
|
|
23480
|
+
item.content.dataType = DataType$1.SpriteComponent;
|
|
22937
23481
|
item.content.item = { id: item.id };
|
|
22938
|
-
|
|
22939
|
-
item.dataType = DataType.VFXItemData;
|
|
23482
|
+
item.dataType = DataType$1.VFXItemData;
|
|
22940
23483
|
//@ts-expect-error
|
|
22941
23484
|
item.components.push({ id: item.content.id });
|
|
22942
23485
|
}
|
|
22943
23486
|
else if (item.type === ItemType$1.particle) {
|
|
22944
|
-
//@ts-expect-error
|
|
22945
23487
|
item.components = [];
|
|
22946
|
-
//@ts-expect-error
|
|
22947
23488
|
components.push(item.content);
|
|
22948
|
-
//@ts-expect-error
|
|
22949
23489
|
item.content.id = uuid;
|
|
22950
|
-
|
|
22951
|
-
item.content.dataType = DataType.ParticleSystem;
|
|
22952
|
-
//@ts-expect-error
|
|
23490
|
+
item.content.dataType = DataType$1.ParticleSystem;
|
|
22953
23491
|
item.content.item = { id: item.id };
|
|
22954
|
-
|
|
22955
|
-
item.dataType = DataType.VFXItemData;
|
|
23492
|
+
item.dataType = DataType$1.VFXItemData;
|
|
22956
23493
|
//@ts-expect-error
|
|
22957
23494
|
item.components.push({ id: item.content.id });
|
|
22958
23495
|
}
|
|
22959
23496
|
else if (item.type === ItemType$1.mesh) {
|
|
22960
|
-
//@ts-expect-error
|
|
22961
23497
|
item.components = [];
|
|
22962
|
-
//@ts-expect-error
|
|
22963
23498
|
components.push(item.content);
|
|
22964
|
-
//@ts-expect-error
|
|
22965
23499
|
item.content.id = uuid;
|
|
22966
|
-
|
|
22967
|
-
item.content.dataType = DataType.MeshComponent;
|
|
22968
|
-
//@ts-expect-error
|
|
23500
|
+
item.content.dataType = DataType$1.MeshComponent;
|
|
22969
23501
|
item.content.item = { id: item.id };
|
|
22970
|
-
|
|
22971
|
-
item.dataType = DataType.VFXItemData;
|
|
23502
|
+
item.dataType = DataType$1.VFXItemData;
|
|
22972
23503
|
//@ts-expect-error
|
|
22973
23504
|
item.components.push({ id: item.content.id });
|
|
22974
23505
|
}
|
|
22975
23506
|
else if (item.type === ItemType$1.skybox) {
|
|
22976
|
-
//@ts-expect-error
|
|
22977
23507
|
item.components = [];
|
|
22978
|
-
//@ts-expect-error
|
|
22979
23508
|
components.push(item.content);
|
|
22980
|
-
//@ts-expect-error
|
|
22981
23509
|
item.content.id = uuid;
|
|
22982
|
-
|
|
22983
|
-
item.content.dataType = DataType.SkyboxComponent;
|
|
22984
|
-
//@ts-expect-error
|
|
23510
|
+
item.content.dataType = DataType$1.SkyboxComponent;
|
|
22985
23511
|
item.content.item = { id: item.id };
|
|
22986
|
-
|
|
22987
|
-
item.dataType = DataType.VFXItemData;
|
|
23512
|
+
item.dataType = DataType$1.VFXItemData;
|
|
22988
23513
|
//@ts-expect-error
|
|
22989
23514
|
item.components.push({ id: item.content.id });
|
|
22990
23515
|
}
|
|
22991
23516
|
else if (item.type === ItemType$1.light) {
|
|
22992
|
-
//@ts-expect-error
|
|
22993
23517
|
item.components = [];
|
|
22994
|
-
//@ts-expect-error
|
|
22995
23518
|
components.push(item.content);
|
|
22996
|
-
//@ts-expect-error
|
|
22997
23519
|
item.content.id = uuid;
|
|
22998
|
-
|
|
22999
|
-
item.content.dataType = DataType.LightComponent;
|
|
23000
|
-
//@ts-expect-error
|
|
23520
|
+
item.content.dataType = DataType$1.LightComponent;
|
|
23001
23521
|
item.content.item = { id: item.id };
|
|
23002
|
-
|
|
23003
|
-
item.dataType = DataType.VFXItemData;
|
|
23522
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23004
23523
|
//@ts-expect-error
|
|
23005
23524
|
item.components.push({ id: item.content.id });
|
|
23006
23525
|
}
|
|
23007
23526
|
else if (item.type === 'camera') {
|
|
23008
|
-
//@ts-expect-error
|
|
23009
23527
|
item.components = [];
|
|
23010
|
-
//@ts-expect-error
|
|
23011
23528
|
components.push(item.content);
|
|
23012
|
-
//@ts-expect-error
|
|
23013
23529
|
item.content.id = uuid;
|
|
23014
|
-
|
|
23015
|
-
item.content.dataType = DataType.CameraComponent;
|
|
23016
|
-
//@ts-expect-error
|
|
23530
|
+
item.content.dataType = DataType$1.CameraComponent;
|
|
23017
23531
|
item.content.item = { id: item.id };
|
|
23018
|
-
|
|
23019
|
-
item.dataType = DataType.VFXItemData;
|
|
23532
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23020
23533
|
//@ts-expect-error
|
|
23021
23534
|
item.components.push({ id: item.content.id });
|
|
23022
23535
|
}
|
|
23023
23536
|
else if (item.type === ItemType$1.tree) {
|
|
23024
|
-
//@ts-expect-error
|
|
23025
23537
|
item.components = [];
|
|
23026
|
-
//@ts-expect-error
|
|
23027
23538
|
components.push(item.content);
|
|
23028
|
-
//@ts-expect-error
|
|
23029
23539
|
item.content.id = uuid;
|
|
23030
|
-
|
|
23031
|
-
item.content.dataType = DataType.TreeComponent;
|
|
23032
|
-
//@ts-expect-error
|
|
23540
|
+
item.content.dataType = DataType$1.TreeComponent;
|
|
23033
23541
|
item.content.item = { id: item.id };
|
|
23034
|
-
|
|
23035
|
-
item.dataType = DataType.VFXItemData;
|
|
23542
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23036
23543
|
//@ts-expect-error
|
|
23037
23544
|
item.components.push({ id: item.content.id });
|
|
23038
23545
|
}
|
|
23039
23546
|
else if (item.type === ItemType$1.interact) {
|
|
23040
|
-
//@ts-expect-error
|
|
23041
23547
|
item.components = [];
|
|
23042
|
-
//@ts-expect-error
|
|
23043
23548
|
components.push(item.content);
|
|
23044
|
-
//@ts-expect-error
|
|
23045
23549
|
item.content.id = uuid;
|
|
23046
|
-
|
|
23047
|
-
item.content.dataType = DataType.InteractComponent;
|
|
23048
|
-
//@ts-expect-error
|
|
23550
|
+
item.content.dataType = DataType$1.InteractComponent;
|
|
23049
23551
|
item.content.item = { id: item.id };
|
|
23050
|
-
|
|
23051
|
-
item.dataType = DataType.VFXItemData;
|
|
23552
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23052
23553
|
//@ts-expect-error
|
|
23053
23554
|
item.components.push({ id: item.content.id });
|
|
23054
23555
|
}
|
|
23055
23556
|
else if (item.type === ItemType$1.camera) {
|
|
23056
|
-
//@ts-expect-error
|
|
23057
23557
|
item.components = [];
|
|
23058
|
-
//@ts-expect-error
|
|
23059
23558
|
components.push(item.content);
|
|
23060
|
-
//@ts-expect-error
|
|
23061
23559
|
item.content.id = uuid;
|
|
23062
|
-
|
|
23063
|
-
item.content.dataType = DataType.CameraController;
|
|
23064
|
-
//@ts-expect-error
|
|
23560
|
+
item.content.dataType = DataType$1.CameraController;
|
|
23065
23561
|
item.content.item = { id: item.id };
|
|
23066
|
-
|
|
23067
|
-
item.dataType = DataType.VFXItemData;
|
|
23562
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23068
23563
|
//@ts-expect-error
|
|
23069
23564
|
item.components.push({ id: item.content.id });
|
|
23070
23565
|
}
|
|
23071
23566
|
else if (item.type === ItemType$1.text) {
|
|
23072
|
-
//@ts-expect-error
|
|
23073
23567
|
item.components = [];
|
|
23074
|
-
//@ts-expect-error
|
|
23075
23568
|
components.push(item.content);
|
|
23076
|
-
//@ts-expect-error
|
|
23077
23569
|
item.content.id = uuid;
|
|
23078
|
-
|
|
23079
|
-
item.content.dataType = DataType.TextComponent;
|
|
23080
|
-
//@ts-expect-error
|
|
23570
|
+
item.content.dataType = DataType$1.TextComponent;
|
|
23081
23571
|
item.content.item = { id: item.id };
|
|
23082
|
-
|
|
23083
|
-
item.dataType = DataType.VFXItemData;
|
|
23572
|
+
item.dataType = DataType$1.VFXItemData;
|
|
23084
23573
|
//@ts-expect-error
|
|
23085
23574
|
item.components.push({ id: item.content.id });
|
|
23086
23575
|
}
|
|
@@ -23103,7 +23592,7 @@ function convertAnchor(anchor, particleOrigin) {
|
|
|
23103
23592
|
return [anchor[0] - 0.5, 0.5 - anchor[1]];
|
|
23104
23593
|
}
|
|
23105
23594
|
else if (particleOrigin) {
|
|
23106
|
-
return particleOriginTranslateMap[particleOrigin];
|
|
23595
|
+
return particleOriginTranslateMap$1[particleOrigin];
|
|
23107
23596
|
}
|
|
23108
23597
|
else {
|
|
23109
23598
|
return [0, 0];
|
|
@@ -23381,16 +23870,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23381
23870
|
};
|
|
23382
23871
|
AssetManager.prototype.processBins = function (bins) {
|
|
23383
23872
|
return __awaiter(this, void 0, void 0, function () {
|
|
23384
|
-
var renderLevel, jobs;
|
|
23873
|
+
var renderLevel, baseUrl, jobs;
|
|
23385
23874
|
var _this = this;
|
|
23386
23875
|
return __generator(this, function (_a) {
|
|
23387
23876
|
renderLevel = this.options.renderLevel;
|
|
23877
|
+
baseUrl = this.baseUrl;
|
|
23388
23878
|
jobs = bins.map(function (bin) {
|
|
23389
23879
|
if (bin instanceof ArrayBuffer) {
|
|
23390
23880
|
return bin;
|
|
23391
23881
|
}
|
|
23392
23882
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23393
|
-
return _this.loadBins(bin.url);
|
|
23883
|
+
return _this.loadBins(new URL(bin.url, baseUrl).href);
|
|
23394
23884
|
}
|
|
23395
23885
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23396
23886
|
});
|
|
@@ -23408,13 +23898,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23408
23898
|
return [2 /*return*/];
|
|
23409
23899
|
}
|
|
23410
23900
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23411
|
-
var fontFace;
|
|
23901
|
+
var url, fontFace;
|
|
23412
23902
|
var _a;
|
|
23413
23903
|
return __generator(this, function (_b) {
|
|
23414
23904
|
switch (_b.label) {
|
|
23415
23905
|
case 0:
|
|
23416
23906
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23417
|
-
|
|
23907
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
23908
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23418
23909
|
_b.label = 1;
|
|
23419
23910
|
case 1:
|
|
23420
23911
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23427,7 +23918,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23427
23918
|
return [3 /*break*/, 4];
|
|
23428
23919
|
case 3:
|
|
23429
23920
|
_b.sent();
|
|
23430
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23921
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23431
23922
|
return [3 /*break*/, 4];
|
|
23432
23923
|
case 4: return [2 /*return*/];
|
|
23433
23924
|
}
|
|
@@ -23676,7 +24167,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23676
24167
|
return image.source;
|
|
23677
24168
|
}
|
|
23678
24169
|
else if (image instanceof HTMLImageElement ||
|
|
23679
|
-
image
|
|
24170
|
+
isCanvas(image)) {
|
|
23680
24171
|
return {
|
|
23681
24172
|
image: image,
|
|
23682
24173
|
sourceType: TextureSourceType.image,
|
|
@@ -23738,6 +24229,11 @@ function base64ToFile(base64, filename, contentType) {
|
|
|
23738
24229
|
var file = new File([blob], filename, { type: contentType });
|
|
23739
24230
|
return file;
|
|
23740
24231
|
}
|
|
24232
|
+
function isCanvas(cavnas) {
|
|
24233
|
+
var _a;
|
|
24234
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24235
|
+
return typeof cavnas === 'object' && cavnas !== null && ((_a = cavnas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24236
|
+
}
|
|
23741
24237
|
|
|
23742
24238
|
var tmpScale = new Vector3(1, 1, 1);
|
|
23743
24239
|
/**
|
|
@@ -23957,8 +24453,9 @@ var Camera = /** @class */ (function () {
|
|
|
23957
24453
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
23958
24454
|
var pos = new Vector3(0, 0, z);
|
|
23959
24455
|
var mat = this.getViewProjectionMatrix();
|
|
23960
|
-
var
|
|
23961
|
-
|
|
24456
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
24457
|
+
var nz = mat.projectPoint(pos).z;
|
|
24458
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
23962
24459
|
};
|
|
23963
24460
|
/**
|
|
23964
24461
|
* 设置相机的旋转四元数
|
|
@@ -23970,7 +24467,6 @@ var Camera = /** @class */ (function () {
|
|
|
23970
24467
|
this.dirty = true;
|
|
23971
24468
|
}
|
|
23972
24469
|
else {
|
|
23973
|
-
this.options.quat;
|
|
23974
24470
|
if (!this.options.quat.equals(value)) {
|
|
23975
24471
|
this.options.quat.copyFrom(value);
|
|
23976
24472
|
this.dirty = true;
|
|
@@ -24138,8 +24634,7 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
24138
24634
|
}
|
|
24139
24635
|
item.getComponent(CompositionComponent).createContent();
|
|
24140
24636
|
}
|
|
24141
|
-
else if (itemData.type ===
|
|
24142
|
-
itemData.type === ItemType$1.sprite ||
|
|
24637
|
+
else if (itemData.type === ItemType$1.sprite ||
|
|
24143
24638
|
itemData.type === ItemType$1.text ||
|
|
24144
24639
|
itemData.type === ItemType$1.particle ||
|
|
24145
24640
|
itemData.type === ItemType$1.mesh ||
|
|
@@ -24157,20 +24652,7 @@ var CompositionComponent = /** @class */ (function (_super) {
|
|
|
24157
24652
|
item = new VFXItem(this.engine, itemData);
|
|
24158
24653
|
item.composition = this.item.composition;
|
|
24159
24654
|
// 兼容老的数据代码,json 更新后可移除
|
|
24160
|
-
|
|
24161
|
-
case ItemType$1.text: {
|
|
24162
|
-
// 添加文本组件
|
|
24163
|
-
var textItem = new TextComponent(this.engine, itemData.content);
|
|
24164
|
-
textItem.item = item;
|
|
24165
|
-
item.components.push(textItem);
|
|
24166
|
-
item.rendererComponents.push(textItem);
|
|
24167
|
-
item._content = textItem;
|
|
24168
|
-
break;
|
|
24169
|
-
}
|
|
24170
|
-
default: {
|
|
24171
|
-
item = createVFXItem(itemData, this.item.composition);
|
|
24172
|
-
}
|
|
24173
|
-
}
|
|
24655
|
+
item = createVFXItem(itemData, this.item.composition);
|
|
24174
24656
|
}
|
|
24175
24657
|
item.parent = this.item;
|
|
24176
24658
|
// 相机不跟随合成移动
|
|
@@ -25560,10 +26042,8 @@ var Engine = /** @class */ (function () {
|
|
|
25560
26042
|
Engine.prototype.addPackageDatas = function (scene) {
|
|
25561
26043
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
25562
26044
|
var jsonScene = scene.jsonScene;
|
|
25563
|
-
//@ts-expect-error
|
|
25564
26045
|
if (jsonScene.items) {
|
|
25565
26046
|
try {
|
|
25566
|
-
//@ts-expect-error
|
|
25567
26047
|
for (var _g = __values$1(jsonScene.items), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
25568
26048
|
var vfxItemData = _h.value;
|
|
25569
26049
|
this.addEffectsObjectData(vfxItemData);
|
|
@@ -25577,10 +26057,8 @@ var Engine = /** @class */ (function () {
|
|
|
25577
26057
|
finally { if (e_1) throw e_1.error; }
|
|
25578
26058
|
}
|
|
25579
26059
|
}
|
|
25580
|
-
//@ts-expect-error
|
|
25581
26060
|
if (jsonScene.materials) {
|
|
25582
26061
|
try {
|
|
25583
|
-
//@ts-expect-error
|
|
25584
26062
|
for (var _j = __values$1(jsonScene.materials), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
25585
26063
|
var materialData = _k.value;
|
|
25586
26064
|
this.addEffectsObjectData(materialData);
|
|
@@ -25594,10 +26072,8 @@ var Engine = /** @class */ (function () {
|
|
|
25594
26072
|
finally { if (e_2) throw e_2.error; }
|
|
25595
26073
|
}
|
|
25596
26074
|
}
|
|
25597
|
-
//@ts-expect-error
|
|
25598
26075
|
if (jsonScene.shaders) {
|
|
25599
26076
|
try {
|
|
25600
|
-
//@ts-expect-error
|
|
25601
26077
|
for (var _l = __values$1(jsonScene.shaders), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
25602
26078
|
var shaderData = _m.value;
|
|
25603
26079
|
this.addEffectsObjectData(shaderData);
|
|
@@ -25611,10 +26087,8 @@ var Engine = /** @class */ (function () {
|
|
|
25611
26087
|
finally { if (e_3) throw e_3.error; }
|
|
25612
26088
|
}
|
|
25613
26089
|
}
|
|
25614
|
-
//@ts-expect-error
|
|
25615
26090
|
if (jsonScene.geometries) {
|
|
25616
26091
|
try {
|
|
25617
|
-
//@ts-expect-error
|
|
25618
26092
|
for (var _o = __values$1(jsonScene.geometries), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
25619
26093
|
var geometryData = _p.value;
|
|
25620
26094
|
this.addEffectsObjectData(geometryData);
|
|
@@ -25628,10 +26102,8 @@ var Engine = /** @class */ (function () {
|
|
|
25628
26102
|
finally { if (e_4) throw e_4.error; }
|
|
25629
26103
|
}
|
|
25630
26104
|
}
|
|
25631
|
-
//@ts-expect-error
|
|
25632
26105
|
if (jsonScene.components) {
|
|
25633
26106
|
try {
|
|
25634
|
-
//@ts-expect-error
|
|
25635
26107
|
for (var _q = __values$1(jsonScene.components), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
25636
26108
|
var componentData = _r.value;
|
|
25637
26109
|
this.addEffectsObjectData(componentData);
|
|
@@ -26556,13 +27028,13 @@ var ThreeMaterial = /** @class */ (function (_super) {
|
|
|
26556
27028
|
this.uniforms[name] = this.material.uniforms[name] = uniform;
|
|
26557
27029
|
};
|
|
26558
27030
|
// 下列三个方法暂时不需要实现
|
|
26559
|
-
ThreeMaterial.prototype.
|
|
27031
|
+
ThreeMaterial.prototype.enableMacro = function (keyword) {
|
|
26560
27032
|
throw new Error('Method not implemented.');
|
|
26561
27033
|
};
|
|
26562
|
-
ThreeMaterial.prototype.
|
|
27034
|
+
ThreeMaterial.prototype.disableMacro = function (keyword) {
|
|
26563
27035
|
throw new Error('Method not implemented.');
|
|
26564
27036
|
};
|
|
26565
|
-
ThreeMaterial.prototype.
|
|
27037
|
+
ThreeMaterial.prototype.isMacroEnabled = function (keyword) {
|
|
26566
27038
|
throw new Error('Method not implemented.');
|
|
26567
27039
|
};
|
|
26568
27040
|
ThreeMaterial.prototype.clone = function (props) {
|
|
@@ -27568,7 +28040,7 @@ var ThreeSpriteComponent = /** @class */ (function (_super) {
|
|
|
27568
28040
|
this.threeMesh.clear();
|
|
27569
28041
|
};
|
|
27570
28042
|
ThreeSpriteComponent = __decorate([
|
|
27571
|
-
effectsClass(DataType.SpriteComponent)
|
|
28043
|
+
effectsClass(DataType$1.SpriteComponent)
|
|
27572
28044
|
], ThreeSpriteComponent);
|
|
27573
28045
|
return ThreeSpriteComponent;
|
|
27574
28046
|
}(SpriteComponent));
|
|
@@ -27620,8 +28092,8 @@ Geometry.create = function (engine, options) {
|
|
|
27620
28092
|
Mesh.create = function (engine, props) {
|
|
27621
28093
|
return new ThreeMesh(engine, props);
|
|
27622
28094
|
};
|
|
27623
|
-
var version = "2.0.0-alpha.
|
|
28095
|
+
var version = "2.0.0-alpha.4";
|
|
27624
28096
|
logger.info('THREEJS plugin version: ' + version);
|
|
27625
28097
|
|
|
27626
|
-
export { AbstractPlugin, ActivationPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, 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, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineClip, TimelineComponent, Track, Transform, TransformAnimationPlayable, TransformAnimationPlayableAsset, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, copy as copyFrag, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, deepClone, defaultGlobalVolume, defaultPlugins, delay_frag as delayFrag, deserializeMipmapTexture, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, item_define as itemDefine, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadVideo, loadWebPOptional, logger, index$1 as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleVert, pluginLoaderMap, random, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
|
28098
|
+
export { AbstractPlugin, ActivationPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, 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, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType$1 as DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineClip, TimelineComponent, Track, Transform, TransformAnimationPlayable, TransformAnimationPlayableAsset, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, copy as copyFrag, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, deepClone, defaultGlobalVolume, defaultPlugins, delay_frag as delayFrag, deserializeMipmapTexture, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID$1 as generateGUID, generateHalfFloatTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, item_define as itemDefine, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadVideo, loadWebPOptional, logger, index$1 as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleVert, pluginLoaderMap, random, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
|
27627
28099
|
//# sourceMappingURL=index.mjs.map
|