@galacean/effects-threejs 1.3.0-alpha.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +158 -146
- 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 +158 -146
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.3.0
|
|
6
|
+
* Version: v1.3.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -708,7 +708,7 @@ function asserts(condition, msg) {
|
|
|
708
708
|
* Name: @galacean/effects-specification
|
|
709
709
|
* Description: Galacean Effects JSON Specification
|
|
710
710
|
* Author: Ant Group CO., Ltd.
|
|
711
|
-
* Version: v1.1.0
|
|
711
|
+
* Version: v1.1.0
|
|
712
712
|
*/
|
|
713
713
|
|
|
714
714
|
/*********************************************/
|
|
@@ -7152,9 +7152,9 @@ var Float16ArrayWrapper = /** @class */ (function () {
|
|
|
7152
7152
|
this.data = new Uint16Array(num);
|
|
7153
7153
|
}
|
|
7154
7154
|
else if (num && typeof num === 'object' && Number.isInteger(num.length)) {
|
|
7155
|
-
var
|
|
7156
|
-
for (var i = 0; i <
|
|
7157
|
-
|
|
7155
|
+
var data_1 = this.data = new Uint16Array(num.length);
|
|
7156
|
+
for (var i = 0; i < data_1.length; i++) {
|
|
7157
|
+
data_1[i] = toHalf(num[i]);
|
|
7158
7158
|
}
|
|
7159
7159
|
}
|
|
7160
7160
|
}
|
|
@@ -7527,9 +7527,9 @@ var CurveValue = /** @class */ (function (_super) {
|
|
|
7527
7527
|
CurveValue.getAllData = function (meta, halfFloat) {
|
|
7528
7528
|
var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
|
|
7529
7529
|
for (var i = 0, cursor = 0, curves = meta.curves; i < curves.length; i++) {
|
|
7530
|
-
var
|
|
7531
|
-
ret.set(
|
|
7532
|
-
cursor +=
|
|
7530
|
+
var data_1 = curves[i].toData();
|
|
7531
|
+
ret.set(data_1, cursor);
|
|
7532
|
+
cursor += data_1.length;
|
|
7533
7533
|
}
|
|
7534
7534
|
return halfFloat ? ret.data : ret;
|
|
7535
7535
|
};
|
|
@@ -7538,17 +7538,17 @@ var CurveValue = /** @class */ (function (_super) {
|
|
|
7538
7538
|
var max = -Infinity;
|
|
7539
7539
|
//formatted number
|
|
7540
7540
|
if (Number.isFinite(props[0]) && Number.isFinite(props[1])) {
|
|
7541
|
-
var
|
|
7541
|
+
var keys_1 = [];
|
|
7542
7542
|
for (var i = 2; i < props.length; i++) {
|
|
7543
7543
|
// FIXME
|
|
7544
|
-
|
|
7544
|
+
keys_1.push(props[i].slice(0, 4));
|
|
7545
7545
|
}
|
|
7546
|
-
this.keys =
|
|
7546
|
+
this.keys = keys_1;
|
|
7547
7547
|
this.min = props[0];
|
|
7548
7548
|
this.dist = props[1] - props[0];
|
|
7549
7549
|
}
|
|
7550
7550
|
else {
|
|
7551
|
-
var
|
|
7551
|
+
var keys_2 = props.map(function (item) {
|
|
7552
7552
|
if (isArray(item)) {
|
|
7553
7553
|
min = Math.min(min, item[1]);
|
|
7554
7554
|
max = Math.max(max, item[1]);
|
|
@@ -7563,22 +7563,22 @@ var CurveValue = /** @class */ (function (_super) {
|
|
|
7563
7563
|
throw new Error('invalid keyframe');
|
|
7564
7564
|
});
|
|
7565
7565
|
var dist = max - min;
|
|
7566
|
-
this.keys =
|
|
7566
|
+
this.keys = keys_2;
|
|
7567
7567
|
if (dist !== 0) {
|
|
7568
|
-
for (var i = 0; i <
|
|
7569
|
-
var key =
|
|
7568
|
+
for (var i = 0; i < keys_2.length; i++) {
|
|
7569
|
+
var key = keys_2[i];
|
|
7570
7570
|
key[1] = (key[1] - min) / dist;
|
|
7571
7571
|
}
|
|
7572
7572
|
}
|
|
7573
|
-
var key0 =
|
|
7573
|
+
var key0 = keys_2[0];
|
|
7574
7574
|
if (key0[0] > 0) {
|
|
7575
7575
|
key0[2] = 0;
|
|
7576
|
-
|
|
7576
|
+
keys_2.unshift([0, key0[1], 0, 0]);
|
|
7577
7577
|
}
|
|
7578
|
-
var key1 =
|
|
7578
|
+
var key1 = keys_2[keys_2.length - 1];
|
|
7579
7579
|
if (key1[0] < 1) {
|
|
7580
7580
|
key1[3] = 0;
|
|
7581
|
-
|
|
7581
|
+
keys_2.push([1, key1[1], 0, 0]);
|
|
7582
7582
|
}
|
|
7583
7583
|
this.min = min;
|
|
7584
7584
|
this.dist = dist;
|
|
@@ -7953,14 +7953,14 @@ function curveValueIntegrateByTime(t1, keyframe0, keyframe1) {
|
|
|
7953
7953
|
function getKeyFrameMetaByRawValue(meta, value) {
|
|
7954
7954
|
if (value) {
|
|
7955
7955
|
var type = value[0];
|
|
7956
|
-
var
|
|
7956
|
+
var keys_3 = value[1];
|
|
7957
7957
|
if (type === ValueType$1.CURVE) {
|
|
7958
|
-
meta.curves.push(
|
|
7959
|
-
var keyLen =
|
|
7960
|
-
if (
|
|
7958
|
+
meta.curves.push(keys_3);
|
|
7959
|
+
var keyLen = keys_3.length;
|
|
7960
|
+
if (keys_3[0][0] > 0) {
|
|
7961
7961
|
keyLen++;
|
|
7962
7962
|
}
|
|
7963
|
-
if (
|
|
7963
|
+
if (keys_3[keys_3.length - 1][0] < 1) {
|
|
7964
7964
|
keyLen++;
|
|
7965
7965
|
}
|
|
7966
7966
|
meta.index += keyLen;
|
|
@@ -7968,19 +7968,19 @@ function getKeyFrameMetaByRawValue(meta, value) {
|
|
|
7968
7968
|
meta.curveCount += keyLen;
|
|
7969
7969
|
}
|
|
7970
7970
|
else if (type === ValueType$1.LINE) {
|
|
7971
|
-
var keyLen =
|
|
7972
|
-
if (keyLen === 2 &&
|
|
7971
|
+
var keyLen = keys_3.length;
|
|
7972
|
+
if (keyLen === 2 && keys_3[0][0] === 0 && keys_3[1][0] === 1) {
|
|
7973
7973
|
return;
|
|
7974
7974
|
}
|
|
7975
|
-
if (
|
|
7975
|
+
if (keys_3[0][0] > 0) {
|
|
7976
7976
|
keyLen++;
|
|
7977
7977
|
}
|
|
7978
|
-
if (
|
|
7978
|
+
if (keys_3[keys_3.length - 1][0] < 1) {
|
|
7979
7979
|
keyLen++;
|
|
7980
7980
|
}
|
|
7981
7981
|
var uniformCount = Math.ceil(keyLen / 2);
|
|
7982
7982
|
meta.lineSegCount += uniformCount;
|
|
7983
|
-
meta.curves.push(
|
|
7983
|
+
meta.curves.push(keys_3);
|
|
7984
7984
|
meta.index += uniformCount;
|
|
7985
7985
|
meta.max = Math.max(meta.max, uniformCount);
|
|
7986
7986
|
}
|
|
@@ -9280,10 +9280,10 @@ var VFXItem = /** @class */ (function () {
|
|
|
9280
9280
|
};
|
|
9281
9281
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
9282
9282
|
if (this.composition) {
|
|
9283
|
+
// @ts-expect-error
|
|
9284
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
9283
9285
|
var z = this.transform.getWorldPosition().z;
|
|
9284
|
-
var
|
|
9285
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
9286
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
9286
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
9287
9287
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
9288
9288
|
}
|
|
9289
9289
|
};
|
|
@@ -10461,9 +10461,9 @@ var KTXTexture = /** @class */ (function () {
|
|
|
10461
10461
|
for (var level = 0; level < mipmapCount; level++) {
|
|
10462
10462
|
var imageSize = new Int32Array(this.arrayBuffer, this.baseOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps
|
|
10463
10463
|
for (var face = 0; face < this.numberOfFaces; face++) {
|
|
10464
|
-
var
|
|
10464
|
+
var data_1 = new Uint8Array(this.arrayBuffer, this.baseOffset + dataOffset + 4, imageSize);
|
|
10465
10465
|
mipmaps.push({
|
|
10466
|
-
data:
|
|
10466
|
+
data: data_1,
|
|
10467
10467
|
width: width,
|
|
10468
10468
|
height: height,
|
|
10469
10469
|
});
|
|
@@ -13174,9 +13174,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13174
13174
|
this.handleDragMove(this.dragEvent, this.bouncingArg);
|
|
13175
13175
|
}
|
|
13176
13176
|
};
|
|
13177
|
-
InteractVFXItem.prototype.
|
|
13177
|
+
InteractVFXItem.prototype.onEnd = function () {
|
|
13178
|
+
if (this.composition) {
|
|
13179
|
+
this.composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13180
|
+
}
|
|
13181
|
+
};
|
|
13182
|
+
InteractVFXItem.prototype.onItemRemoved = function () {
|
|
13178
13183
|
var _a;
|
|
13179
|
-
composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13180
13184
|
this.clickable = false;
|
|
13181
13185
|
(_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
|
|
13182
13186
|
this.endDragTarget();
|
|
@@ -13288,16 +13292,16 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13288
13292
|
var nx = position[0] - width;
|
|
13289
13293
|
var ny = position[1] - height;
|
|
13290
13294
|
if (options.dxRange) {
|
|
13291
|
-
var _d = __read$3(options.dxRange, 2),
|
|
13292
|
-
nx = clamp$1(nx,
|
|
13293
|
-
if (nx !==
|
|
13295
|
+
var _d = __read$3(options.dxRange, 2), min_1 = _d[0], max_1 = _d[1];
|
|
13296
|
+
nx = clamp$1(nx, min_1, max_1);
|
|
13297
|
+
if (nx !== min_1 && nx !== max_1 && min_1 !== max_1) {
|
|
13294
13298
|
(_a = event.origin) === null || _a === void 0 ? void 0 : _a.preventDefault();
|
|
13295
13299
|
}
|
|
13296
13300
|
}
|
|
13297
13301
|
if (options.dyRange) {
|
|
13298
|
-
var _e = __read$3(options.dyRange, 2),
|
|
13299
|
-
ny = clamp$1(ny,
|
|
13300
|
-
if (ny !==
|
|
13302
|
+
var _e = __read$3(options.dyRange, 2), min_2 = _e[0], max_2 = _e[1];
|
|
13303
|
+
ny = clamp$1(ny, min_2, max_2);
|
|
13304
|
+
if (ny !== min_2 && ny !== max_2 && min_2 !== max_2) {
|
|
13301
13305
|
(_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
|
|
13302
13306
|
}
|
|
13303
13307
|
}
|
|
@@ -13411,11 +13415,11 @@ var SpriteMesh = /** @class */ (function () {
|
|
|
13411
13415
|
var item = items[i];
|
|
13412
13416
|
var texture = item === null || item === void 0 ? void 0 : item.renderer.texture;
|
|
13413
13417
|
var textureIndex = texture ? textures.indexOf(texture) : -1;
|
|
13414
|
-
var
|
|
13415
|
-
aPointLen +=
|
|
13416
|
-
indexLen +=
|
|
13417
|
-
datas.push(
|
|
13418
|
-
pointCount +=
|
|
13418
|
+
var data_1 = this.getItemInitData(item, i, pointCount, textureIndex);
|
|
13419
|
+
aPointLen += data_1.aPoint.length;
|
|
13420
|
+
indexLen += data_1.index.length;
|
|
13421
|
+
datas.push(data_1);
|
|
13422
|
+
pointCount += data_1.aPoint.length / 6;
|
|
13419
13423
|
this.updateItem(item, true);
|
|
13420
13424
|
}
|
|
13421
13425
|
var bundle = {
|
|
@@ -13427,10 +13431,10 @@ var SpriteMesh = /** @class */ (function () {
|
|
|
13427
13431
|
index: 0,
|
|
13428
13432
|
};
|
|
13429
13433
|
var _loop_1 = function (i) {
|
|
13430
|
-
var
|
|
13434
|
+
var data_2 = datas[i];
|
|
13431
13435
|
Object.keys(bundle).forEach(function (name) {
|
|
13432
13436
|
var arr = bundle[name];
|
|
13433
|
-
var ta =
|
|
13437
|
+
var ta = data_2[name];
|
|
13434
13438
|
arr.set(ta, cursor[name]);
|
|
13435
13439
|
cursor[name] += ta.length;
|
|
13436
13440
|
});
|
|
@@ -13697,14 +13701,14 @@ var SpriteMesh = /** @class */ (function () {
|
|
|
13697
13701
|
for (var y = 0; y < row; y++) {
|
|
13698
13702
|
var base = (y * 2 + x) * 4;
|
|
13699
13703
|
// @ts-expect-error
|
|
13700
|
-
var
|
|
13701
|
-
var texOffset =
|
|
13704
|
+
var split_1 = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
|
|
13705
|
+
var texOffset = split_1[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
13702
13706
|
var dw = ((x + x + 1) / col - 1) / 2;
|
|
13703
13707
|
var dh = ((y + y + 1) / row - 1) / 2;
|
|
13704
|
-
var tox =
|
|
13705
|
-
var toy =
|
|
13706
|
-
var tsx =
|
|
13707
|
-
var tsy =
|
|
13708
|
+
var tox = split_1[0];
|
|
13709
|
+
var toy = split_1[1];
|
|
13710
|
+
var tsx = split_1[4] ? split_1[3] : split_1[2];
|
|
13711
|
+
var tsy = split_1[4] ? split_1[2] : split_1[3];
|
|
13708
13712
|
var origin_1 = [
|
|
13709
13713
|
originData[0] / col + dw,
|
|
13710
13714
|
originData[1] / row + dh,
|
|
@@ -13801,13 +13805,13 @@ function generateFeatureTexture(engine, feather) {
|
|
|
13801
13805
|
}
|
|
13802
13806
|
else {
|
|
13803
13807
|
var len = 128;
|
|
13804
|
-
var
|
|
13808
|
+
var data_3 = new Uint8Array(len);
|
|
13805
13809
|
for (var i = 0, s = len - 1; i < len; i++) {
|
|
13806
13810
|
var p = i / s;
|
|
13807
13811
|
var val = feather.getValue(p);
|
|
13808
|
-
|
|
13812
|
+
data_3[i] = Math.round(val * 255);
|
|
13809
13813
|
}
|
|
13810
|
-
tex = Texture.createWithData(engine, { width: len, height: 1, data:
|
|
13814
|
+
tex = Texture.createWithData(engine, { width: len, height: 1, data: data_3 }, {
|
|
13811
13815
|
name: 'feather',
|
|
13812
13816
|
format: glContext.LUMINANCE,
|
|
13813
13817
|
minFilter: glContext.LINEAR,
|
|
@@ -13965,22 +13969,22 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
13965
13969
|
* 需要则添加到meshToModify数组
|
|
13966
13970
|
*/
|
|
13967
13971
|
for (var i = 0; i < splits.length; i++) {
|
|
13968
|
-
var
|
|
13972
|
+
var split_1 = splits[i];
|
|
13969
13973
|
// @ts-expect-error
|
|
13970
|
-
var spriteMesh =
|
|
13971
|
-
if (
|
|
13974
|
+
var spriteMesh = split_1.spriteMesh;
|
|
13975
|
+
if (split_1.items.length === 0) {
|
|
13972
13976
|
throw new Error('split not combined');
|
|
13973
13977
|
}
|
|
13974
|
-
if (
|
|
13975
|
-
var priority =
|
|
13978
|
+
if (split_1.dirty) {
|
|
13979
|
+
var priority = split_1.indexStart;
|
|
13976
13980
|
if (spriteMesh.mesh.priority !== priority) {
|
|
13977
13981
|
spriteMesh.mesh.priority = priority;
|
|
13978
13982
|
meshToModify.push(spriteMesh.mesh);
|
|
13979
13983
|
}
|
|
13980
|
-
spriteMesh.setItems(
|
|
13984
|
+
spriteMesh.setItems(split_1.items.map(function (item) { return item.content; }));
|
|
13981
13985
|
}
|
|
13982
13986
|
spriteMesh.applyChange();
|
|
13983
|
-
|
|
13987
|
+
split_1.dirty = false;
|
|
13984
13988
|
}
|
|
13985
13989
|
/**
|
|
13986
13990
|
* 有需要移除的meshSplit 则废弃对应的mesh 保留material
|
|
@@ -13988,8 +13992,8 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
13988
13992
|
*/
|
|
13989
13993
|
if (splitsToRemove.length) {
|
|
13990
13994
|
for (var i = 0; i < splitsToRemove.length; i++) {
|
|
13991
|
-
var
|
|
13992
|
-
var sp =
|
|
13995
|
+
var split_2 = splitsToRemove[i];
|
|
13996
|
+
var sp = split_2.spriteMesh;
|
|
13993
13997
|
// @ts-expect-error
|
|
13994
13998
|
var mesh = sp.mesh;
|
|
13995
13999
|
mesh.dispose({ material: { textures: exports.DestroyOptions.keep } });
|
|
@@ -14106,7 +14110,7 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14106
14110
|
addItemWithOrder(items, item, itemSortProperty);
|
|
14107
14111
|
if (isSprite(item)) {
|
|
14108
14112
|
var content = item.createContent();
|
|
14109
|
-
var
|
|
14113
|
+
var split_4 = {
|
|
14110
14114
|
indexStart: item.listIndex,
|
|
14111
14115
|
indexEnd: item.listIndex,
|
|
14112
14116
|
items: [item],
|
|
@@ -14114,21 +14118,21 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14114
14118
|
cacheId: content.renderInfo.cacheId,
|
|
14115
14119
|
textures: [item.content.renderer.texture],
|
|
14116
14120
|
};
|
|
14117
|
-
splits.unshift(
|
|
14118
|
-
return [
|
|
14121
|
+
splits.unshift(split_4);
|
|
14122
|
+
return [split_4];
|
|
14119
14123
|
}
|
|
14120
14124
|
return [];
|
|
14121
14125
|
}
|
|
14122
14126
|
var _loop_2 = function (i) {
|
|
14123
|
-
var
|
|
14127
|
+
var split_5 = splits[i];
|
|
14124
14128
|
var listIndex = item.listIndex;
|
|
14125
14129
|
if (isSprite(item)) {
|
|
14126
14130
|
// @ts-expect-error
|
|
14127
|
-
if (listIndex <=
|
|
14131
|
+
if (listIndex <= split_5.indexEnd) {
|
|
14128
14132
|
addItemWithOrder(items, item, itemSortProperty);
|
|
14129
14133
|
var itemIndex_1 = items.indexOf(item);
|
|
14130
|
-
var indexStart = Math.min(itemIndex_1, items.indexOf(
|
|
14131
|
-
var indexEnd = Math.max(itemIndex_1, items.indexOf(
|
|
14134
|
+
var indexStart = Math.min(itemIndex_1, items.indexOf(split_5.items[0]));
|
|
14135
|
+
var indexEnd = Math.max(itemIndex_1, items.indexOf(split_5.items[split_5.items.length - 1]));
|
|
14132
14136
|
var neoSplits_1 = this_2.getMeshSplits(items, indexStart, indexEnd);
|
|
14133
14137
|
var neoSplitIndex_1 = neoSplits_1.findIndex(function (split) { return split.items.includes(item); });
|
|
14134
14138
|
if (neoSplits_1.length === 2) {
|
|
@@ -14136,14 +14140,14 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14136
14140
|
//1 or 0
|
|
14137
14141
|
Object.keys(neoSplits_1[1 - neoSplitIndex_1]).forEach(function (key) {
|
|
14138
14142
|
// @ts-expect-error
|
|
14139
|
-
|
|
14143
|
+
split_5[key] = neoSplits_1[1 - neoSplitIndex_1][key];
|
|
14140
14144
|
});
|
|
14141
14145
|
return { value: [neoSplits_1[neoSplitIndex_1]] };
|
|
14142
14146
|
}
|
|
14143
14147
|
else if (neoSplits_1.length === 3) {
|
|
14144
14148
|
Object.keys(neoSplits_1[0]).forEach(function (key) {
|
|
14145
14149
|
// @ts-expect-error
|
|
14146
|
-
|
|
14150
|
+
split_5[key] = neoSplits_1[0][key];
|
|
14147
14151
|
});
|
|
14148
14152
|
splits.splice(i + 1, 0, neoSplits_1[1], neoSplits_1[2]);
|
|
14149
14153
|
if (neoSplitIndex_1 !== 1) {
|
|
@@ -14157,25 +14161,25 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14157
14161
|
//todo add case
|
|
14158
14162
|
Object.keys(neoSplits_1[0]).forEach(function (key) {
|
|
14159
14163
|
// @ts-expect-error
|
|
14160
|
-
|
|
14164
|
+
split_5[key] = neoSplits_1[0][key];
|
|
14161
14165
|
});
|
|
14162
14166
|
return { value: [] };
|
|
14163
14167
|
}
|
|
14164
14168
|
}
|
|
14165
14169
|
else {
|
|
14166
|
-
if (listIndex <
|
|
14170
|
+
if (listIndex < split_5.indexStart || listIndex === split_5.indexEnd) {
|
|
14167
14171
|
addItemWithOrder(items, item, itemSortProperty);
|
|
14168
14172
|
return { value: [] };
|
|
14169
14173
|
// @ts-expect-error
|
|
14170
14174
|
}
|
|
14171
|
-
else if (listIndex <
|
|
14175
|
+
else if (listIndex < split_5.indexEnd) {
|
|
14172
14176
|
addItemWithOrder(items, item, itemSortProperty);
|
|
14173
|
-
var lastItem =
|
|
14177
|
+
var lastItem = split_5.items[split_5.items.length - 1];
|
|
14174
14178
|
var endIndex = items.indexOf(lastItem);
|
|
14175
|
-
var neoSplits_2 = this_2.getMeshSplits(items, items.indexOf(
|
|
14179
|
+
var neoSplits_2 = this_2.getMeshSplits(items, items.indexOf(split_5.items[0]), endIndex);
|
|
14176
14180
|
Object.keys(neoSplits_2[0]).forEach(function (key) {
|
|
14177
14181
|
// @ts-expect-error
|
|
14178
|
-
|
|
14182
|
+
split_5[key] = neoSplits_2[0][key];
|
|
14179
14183
|
});
|
|
14180
14184
|
if (neoSplits_2.length === 2) {
|
|
14181
14185
|
splits.splice(i + 1, 0, neoSplits_2[1]);
|
|
@@ -14236,10 +14240,10 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14236
14240
|
* 遍历this.meshSplits,找到元素的listIndex在split的indexStart和indexEnd范围内的第一个meshSplit
|
|
14237
14241
|
*/
|
|
14238
14242
|
for (var i = 0; i < splits.length; i++) {
|
|
14239
|
-
var
|
|
14243
|
+
var split_6 = splits[i];
|
|
14240
14244
|
// @ts-expect-error
|
|
14241
|
-
if (
|
|
14242
|
-
targetSplit =
|
|
14245
|
+
if (split_6.indexStart <= item.listIndex && split_6.indexEnd >= item.listIndex) {
|
|
14246
|
+
targetSplit = split_6;
|
|
14243
14247
|
targetSplitIndex = i;
|
|
14244
14248
|
break;
|
|
14245
14249
|
}
|
|
@@ -14349,8 +14353,8 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
14349
14353
|
// FIXME: 可选性
|
|
14350
14354
|
var targetSplitIndex = void 0;
|
|
14351
14355
|
for (var i = 0; i < splits.length; i++) {
|
|
14352
|
-
var
|
|
14353
|
-
if (
|
|
14356
|
+
var split_7 = splits[i];
|
|
14357
|
+
if (split_7.items.includes(item)) {
|
|
14354
14358
|
targetSplitIndex = i;
|
|
14355
14359
|
break;
|
|
14356
14360
|
}
|
|
@@ -14968,7 +14972,6 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
14968
14972
|
ret.texOffset = [0, 0, 1, 1];
|
|
14969
14973
|
}
|
|
14970
14974
|
ret.visible = this.vfxItem.contentVisible;
|
|
14971
|
-
// 图层元素作为父节点时,除了k的大小变换,自身的尺寸也需要传递给子元素,子元素可以通过startSize读取
|
|
14972
14975
|
ret.startSize = this.startSize;
|
|
14973
14976
|
return ret;
|
|
14974
14977
|
};
|
|
@@ -15066,7 +15069,9 @@ var SpriteVFXItem = /** @class */ (function (_super) {
|
|
|
15066
15069
|
};
|
|
15067
15070
|
SpriteVFXItem.prototype.doCreateContent = function (composition) {
|
|
15068
15071
|
var emptyTexture = composition.getRendererOptions().emptyTexture;
|
|
15069
|
-
|
|
15072
|
+
var content = new SpriteItem(this.sprite, { emptyTexture: emptyTexture }, this);
|
|
15073
|
+
content.getRenderData(0, true);
|
|
15074
|
+
return content;
|
|
15070
15075
|
};
|
|
15071
15076
|
SpriteVFXItem.prototype.createWireframeMesh = function (item, color) {
|
|
15072
15077
|
var spMesh = new SpriteMesh(this.composition.getEngine(), __assign$1({ wireframe: true }, item.renderInfo), this.composition);
|
|
@@ -15500,10 +15505,10 @@ var ParticleMesh = /** @class */ (function () {
|
|
|
15500
15505
|
var index = geometry.getIndexData();
|
|
15501
15506
|
for (var i = 0; i < names.length; i++) {
|
|
15502
15507
|
var name_1 = names[i];
|
|
15503
|
-
var
|
|
15504
|
-
if (
|
|
15508
|
+
var data_1 = geometry.getAttributeData(name_1);
|
|
15509
|
+
if (data_1) {
|
|
15505
15510
|
// @ts-expect-error
|
|
15506
|
-
geometry.setAttributeData(name_1, new
|
|
15511
|
+
geometry.setAttributeData(name_1, new data_1.constructor(0));
|
|
15507
15512
|
}
|
|
15508
15513
|
}
|
|
15509
15514
|
// @ts-expect-error
|
|
@@ -16878,10 +16883,10 @@ function getGeometryTriangles(geometry, options) {
|
|
|
16878
16883
|
var segment = segments[i];
|
|
16879
16884
|
var p0 = points[i];
|
|
16880
16885
|
var p1 = points[i + 1] || points[0];
|
|
16881
|
-
var
|
|
16886
|
+
var keys_1 = segment;
|
|
16882
16887
|
var point = [0, 0];
|
|
16883
|
-
for (var j = 0; j <
|
|
16884
|
-
var key =
|
|
16888
|
+
for (var j = 0; j < keys_1.length - 1; j++) {
|
|
16889
|
+
var key = keys_1[j];
|
|
16885
16890
|
getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
|
|
16886
16891
|
setPoint(point[0], point[1]);
|
|
16887
16892
|
}
|
|
@@ -16940,11 +16945,11 @@ function getGeometryByShape(shape, uvTransform) {
|
|
|
16940
16945
|
var index = 0;
|
|
16941
16946
|
for (var i = 0; i < geometries.length; i++) {
|
|
16942
16947
|
var geometry = geometries[i];
|
|
16943
|
-
var
|
|
16944
|
-
indexBase +=
|
|
16945
|
-
datas.push(
|
|
16946
|
-
aPoint +=
|
|
16947
|
-
index +=
|
|
16948
|
+
var data_1 = getGeometryTriangles(geometry, { indexBase: indexBase, uvTransform: uvTransform });
|
|
16949
|
+
indexBase += data_1.aPoint.length / 5;
|
|
16950
|
+
datas.push(data_1);
|
|
16951
|
+
aPoint += data_1.aPoint.length;
|
|
16952
|
+
index += data_1.index.length;
|
|
16948
16953
|
}
|
|
16949
16954
|
if (datas.length === 1) {
|
|
16950
16955
|
return datas[0];
|
|
@@ -16953,11 +16958,11 @@ function getGeometryByShape(shape, uvTransform) {
|
|
|
16953
16958
|
var indexData = new Uint16Array(index);
|
|
16954
16959
|
// @ts-expect-error
|
|
16955
16960
|
for (var i = 0, pointIndex = 0, idx = 0; i < datas[i]; i++) {
|
|
16956
|
-
var
|
|
16957
|
-
aPointData.set(
|
|
16958
|
-
pointIndex +=
|
|
16959
|
-
indexData.set(
|
|
16960
|
-
idx +=
|
|
16961
|
+
var data_2 = datas[i];
|
|
16962
|
+
aPointData.set(data_2.aPoint, pointIndex);
|
|
16963
|
+
pointIndex += data_2.aPoint.length;
|
|
16964
|
+
indexData.set(data_2.index, idx);
|
|
16965
|
+
idx += data_2.index.length;
|
|
16961
16966
|
}
|
|
16962
16967
|
return {
|
|
16963
16968
|
aPoint: aPointData,
|
|
@@ -17268,10 +17273,10 @@ var TrailMesh = /** @class */ (function () {
|
|
|
17268
17273
|
var pointCountPerTrail = this.pointCountPerTrail;
|
|
17269
17274
|
if (index >= 0 && index < pointCountPerTrail) {
|
|
17270
17275
|
var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
|
|
17271
|
-
var
|
|
17272
|
-
out.x =
|
|
17273
|
-
out.y =
|
|
17274
|
-
out.z =
|
|
17276
|
+
var data_1 = this.geometry.getAttributeData('aColor');
|
|
17277
|
+
out.x = data_1[startIndex];
|
|
17278
|
+
out.y = data_1[1 + startIndex];
|
|
17279
|
+
out.z = data_1[2 + startIndex];
|
|
17275
17280
|
return out;
|
|
17276
17281
|
}
|
|
17277
17282
|
};
|
|
@@ -18677,14 +18682,14 @@ var TextMesh = /** @class */ (function (_super) {
|
|
|
18677
18682
|
for (var y_1 = 0; y_1 < row; y_1++) {
|
|
18678
18683
|
var base = (y_1 * 2 + x_1) * 4;
|
|
18679
18684
|
// @ts-expect-error
|
|
18680
|
-
var
|
|
18681
|
-
var texOffset =
|
|
18685
|
+
var split_1 = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y_1 * 2 + x_1];
|
|
18686
|
+
var texOffset = split_1[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
|
|
18682
18687
|
var dw = ((x_1 + x_1 + 1) / col - 1) / 2;
|
|
18683
18688
|
var dh = ((y_1 + y_1 + 1) / row - 1) / 2;
|
|
18684
|
-
var tox =
|
|
18685
|
-
var toy =
|
|
18686
|
-
var tsx =
|
|
18687
|
-
var tsy =
|
|
18689
|
+
var tox = split_1[0];
|
|
18690
|
+
var toy = split_1[1];
|
|
18691
|
+
var tsx = split_1[4] ? split_1[3] : split_1[2];
|
|
18692
|
+
var tsy = split_1[4] ? split_1[2] : split_1[3];
|
|
18688
18693
|
var origin_1 = [
|
|
18689
18694
|
originData[0] / col + dw,
|
|
18690
18695
|
originData[1] / row + dh,
|
|
@@ -21404,8 +21409,9 @@ var Camera = /** @class */ (function () {
|
|
|
21404
21409
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21405
21410
|
var pos = new Vector3(0, 0, z);
|
|
21406
21411
|
var mat = this.getViewProjectionMatrix();
|
|
21407
|
-
var
|
|
21408
|
-
|
|
21412
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21413
|
+
var nz = mat.projectPoint(pos).z;
|
|
21414
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
21409
21415
|
};
|
|
21410
21416
|
/**
|
|
21411
21417
|
* 设置相机的旋转四元数
|
|
@@ -21417,7 +21423,6 @@ var Camera = /** @class */ (function () {
|
|
|
21417
21423
|
this.dirty = true;
|
|
21418
21424
|
}
|
|
21419
21425
|
else {
|
|
21420
|
-
this.options.quat;
|
|
21421
21426
|
if (!this.options.quat.equals(value)) {
|
|
21422
21427
|
this.options.quat.copyFrom(value);
|
|
21423
21428
|
this.dirty = true;
|
|
@@ -21594,7 +21599,7 @@ var filters = {
|
|
|
21594
21599
|
* Name: @galacean/effects-specification
|
|
21595
21600
|
* Description: Galacean Effects JSON Specification
|
|
21596
21601
|
* Author: Ant Group CO., Ltd.
|
|
21597
|
-
* Version: v1.1.0
|
|
21602
|
+
* Version: v1.1.0
|
|
21598
21603
|
*/
|
|
21599
21604
|
|
|
21600
21605
|
/*********************************************/
|
|
@@ -23364,13 +23369,13 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
23364
23369
|
if (renderContent.renderer) {
|
|
23365
23370
|
renderContent.renderer = _this.changeTex(renderContent.renderer);
|
|
23366
23371
|
_this.processMask(renderContent.renderer);
|
|
23367
|
-
var
|
|
23372
|
+
var split_1 = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
23368
23373
|
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
23369
23374
|
// TODO: scene.shapes 类型问题?
|
|
23370
|
-
renderContent.renderer.shape = getGeometryByShape((_a = _this.jsonScene) === null || _a === void 0 ? void 0 : _a.shapes[renderContent.renderer.shape],
|
|
23375
|
+
renderContent.renderer.shape = getGeometryByShape((_a = _this.jsonScene) === null || _a === void 0 ? void 0 : _a.shapes[renderContent.renderer.shape], split_1);
|
|
23371
23376
|
}
|
|
23372
23377
|
else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
23373
|
-
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape,
|
|
23378
|
+
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split_1);
|
|
23374
23379
|
}
|
|
23375
23380
|
}
|
|
23376
23381
|
else {
|
|
@@ -23382,14 +23387,14 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
23382
23387
|
if (renderContent.filter) {
|
|
23383
23388
|
renderContent.filter = __assign$1({}, renderContent.filter);
|
|
23384
23389
|
}
|
|
23385
|
-
var name_1 = item.name, _b = item.delay, delay = _b === void 0 ? 0 : _b,
|
|
23390
|
+
var name_1 = item.name, _b = item.delay, delay = _b === void 0 ? 0 : _b, id_1 = item.id, parentId = item.parentId, duration = item.duration, endBehavior = item.endBehavior, pluginName = item.pluginName, pn = item.pn, transform = item.transform;
|
|
23386
23391
|
// FIXME: specification 下定义的 Item 不存在 refCount 类型定义
|
|
23387
23392
|
// @ts-expect-error
|
|
23388
23393
|
var refCount = item.refCount;
|
|
23389
23394
|
var _c = _this.jsonScene.plugins, plugins = _c === void 0 ? [] : _c;
|
|
23390
23395
|
option.name = name_1;
|
|
23391
23396
|
option.delay = delay;
|
|
23392
|
-
option.id =
|
|
23397
|
+
option.id = id_1;
|
|
23393
23398
|
if (parentId) {
|
|
23394
23399
|
option.parentId = parentId;
|
|
23395
23400
|
}
|
|
@@ -23757,16 +23762,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23757
23762
|
};
|
|
23758
23763
|
AssetManager.prototype.processBins = function (bins) {
|
|
23759
23764
|
return __awaiter(this, void 0, void 0, function () {
|
|
23760
|
-
var renderLevel, jobs;
|
|
23765
|
+
var renderLevel, baseUrl, jobs;
|
|
23761
23766
|
var _this = this;
|
|
23762
23767
|
return __generator(this, function (_a) {
|
|
23763
23768
|
renderLevel = this.options.renderLevel;
|
|
23769
|
+
baseUrl = this.baseUrl;
|
|
23764
23770
|
jobs = bins.map(function (bin) {
|
|
23765
23771
|
if (bin instanceof ArrayBuffer) {
|
|
23766
23772
|
return bin;
|
|
23767
23773
|
}
|
|
23768
23774
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23769
|
-
return _this.loadBins(bin.url);
|
|
23775
|
+
return _this.loadBins(new URL(bin.url, baseUrl).href);
|
|
23770
23776
|
}
|
|
23771
23777
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23772
23778
|
});
|
|
@@ -23784,13 +23790,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23784
23790
|
return [2 /*return*/];
|
|
23785
23791
|
}
|
|
23786
23792
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23787
|
-
var fontFace;
|
|
23793
|
+
var url, fontFace;
|
|
23788
23794
|
var _a;
|
|
23789
23795
|
return __generator(this, function (_b) {
|
|
23790
23796
|
switch (_b.label) {
|
|
23791
23797
|
case 0:
|
|
23792
23798
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23793
|
-
|
|
23799
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
23800
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23794
23801
|
_b.label = 1;
|
|
23795
23802
|
case 1:
|
|
23796
23803
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23803,7 +23810,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23803
23810
|
return [3 /*break*/, 4];
|
|
23804
23811
|
case 3:
|
|
23805
23812
|
_b.sent();
|
|
23806
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23813
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23807
23814
|
return [3 /*break*/, 4];
|
|
23808
23815
|
case 4: return [2 /*return*/];
|
|
23809
23816
|
}
|
|
@@ -23998,14 +24005,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23998
24005
|
}());
|
|
23999
24006
|
function fixOldImageUsage(usedImages, compositions, imgUsage, images, renderLevel) {
|
|
24000
24007
|
for (var i = 0; i < compositions.length; i++) {
|
|
24001
|
-
var
|
|
24002
|
-
var ids = imgUsage[
|
|
24008
|
+
var id_1 = compositions[i].id;
|
|
24009
|
+
var ids = imgUsage[id_1];
|
|
24003
24010
|
if (ids) {
|
|
24004
24011
|
for (var j = 0; j < ids.length; j++) {
|
|
24005
|
-
var
|
|
24006
|
-
var tag = images[
|
|
24012
|
+
var id_2 = ids[j];
|
|
24013
|
+
var tag = images[id_2].renderLevel;
|
|
24007
24014
|
if (passRenderLevel(tag, renderLevel)) {
|
|
24008
|
-
usedImages[
|
|
24015
|
+
usedImages[id_2] = true;
|
|
24009
24016
|
}
|
|
24010
24017
|
}
|
|
24011
24018
|
}
|
|
@@ -24016,7 +24023,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24016
24023
|
return image.source;
|
|
24017
24024
|
}
|
|
24018
24025
|
else if (image instanceof HTMLImageElement ||
|
|
24019
|
-
image
|
|
24026
|
+
isCanvas(image)) {
|
|
24020
24027
|
return {
|
|
24021
24028
|
image: image,
|
|
24022
24029
|
sourceType: exports.TextureSourceType.image,
|
|
@@ -24053,6 +24060,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24053
24060
|
}
|
|
24054
24061
|
throw new Error('Invalid texture options');
|
|
24055
24062
|
}
|
|
24063
|
+
function isCanvas(canvas) {
|
|
24064
|
+
var _a;
|
|
24065
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24066
|
+
return typeof canvas === 'object' && canvas !== null && ((_a = canvas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24067
|
+
}
|
|
24056
24068
|
|
|
24057
24069
|
var CompVFXItem = /** @class */ (function (_super) {
|
|
24058
24070
|
__extends(CompVFXItem, _super);
|
|
@@ -26281,10 +26293,10 @@ var ThreeTexture = /** @class */ (function (_super) {
|
|
|
26281
26293
|
var texture = undefined;
|
|
26282
26294
|
this.sourceType = sourceType;
|
|
26283
26295
|
if (sourceType === exports.TextureSourceType.data) {
|
|
26284
|
-
var
|
|
26285
|
-
texture = new THREE__namespace.DataTexture(
|
|
26286
|
-
this.width =
|
|
26287
|
-
this.height =
|
|
26296
|
+
var data_1 = options.data;
|
|
26297
|
+
texture = new THREE__namespace.DataTexture(data_1.data, data_1.width, data_1.height, format, type, mapping, wrapS, wrapT, magFilter, minFilter);
|
|
26298
|
+
this.width = data_1.width;
|
|
26299
|
+
this.height = data_1.height;
|
|
26288
26300
|
}
|
|
26289
26301
|
else if (sourceType === exports.TextureSourceType.image) {
|
|
26290
26302
|
var image = options.image;
|
|
@@ -26316,10 +26328,10 @@ var ThreeTexture = /** @class */ (function (_super) {
|
|
|
26316
26328
|
texture = new THREE__namespace.VideoTexture(options.video, mapping, wrapS, wrapT, magFilter, minFilter, format, type);
|
|
26317
26329
|
}
|
|
26318
26330
|
else if (sourceType === exports.TextureSourceType.framebuffer) {
|
|
26319
|
-
var
|
|
26320
|
-
if (
|
|
26321
|
-
var width = (_a =
|
|
26322
|
-
var height = (_b =
|
|
26331
|
+
var data_2 = options.data;
|
|
26332
|
+
if (data_2) {
|
|
26333
|
+
var width = (_a = data_2.width) !== null && _a !== void 0 ? _a : 0;
|
|
26334
|
+
var height = (_b = data_2.height) !== null && _b !== void 0 ? _b : 0;
|
|
26323
26335
|
texture = new THREE__namespace.FramebufferTexture(width, height, format);
|
|
26324
26336
|
this.width = width;
|
|
26325
26337
|
this.height = height;
|
|
@@ -26455,11 +26467,11 @@ var ThreeGeometry = /** @class */ (function (_super) {
|
|
|
26455
26467
|
if (attributes[dataSource] === undefined) {
|
|
26456
26468
|
_this.setAttributeType(dataSource, attr, geometry, attributes, props.maxVertex);
|
|
26457
26469
|
}
|
|
26458
|
-
var size = attr.size, offset = attr.offset,
|
|
26470
|
+
var size = attr.size, offset = attr.offset, normalize_1 = attr.normalize;
|
|
26459
26471
|
var dataSourceAttribute = attributes[dataSource];
|
|
26460
26472
|
var buffer = dataSourceAttribute.buffer;
|
|
26461
26473
|
var dataLength = dataSourceAttribute.dataLength;
|
|
26462
|
-
var attribute = new THREE__namespace.InterleavedBufferAttribute(buffer, size, (offset !== null && offset !== void 0 ? offset : 0) / dataLength,
|
|
26474
|
+
var attribute = new THREE__namespace.InterleavedBufferAttribute(buffer, size, (offset !== null && offset !== void 0 ? offset : 0) / dataLength, normalize_1);
|
|
26463
26475
|
geometry.setAttribute(name, attribute);
|
|
26464
26476
|
attributes[name] = {
|
|
26465
26477
|
buffer: buffer,
|
|
@@ -26950,7 +26962,7 @@ Geometry.create = function (engine, options) {
|
|
|
26950
26962
|
Mesh.create = function (engine, props) {
|
|
26951
26963
|
return new ThreeMesh(engine, props);
|
|
26952
26964
|
};
|
|
26953
|
-
var version = "1.3.0
|
|
26965
|
+
var version = "1.3.0";
|
|
26954
26966
|
logger.info('THREEJS plugin version: ' + version);
|
|
26955
26967
|
|
|
26956
26968
|
exports.AbstractPlugin = AbstractPlugin;
|