@galacean/effects-core 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.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.3.0-alpha.0
6
+ * Version: v1.3.0
7
7
  */
8
8
 
9
9
  /******************************************************************************
@@ -682,7 +682,7 @@ function asserts(condition, msg) {
682
682
  * Name: @galacean/effects-specification
683
683
  * Description: Galacean Effects JSON Specification
684
684
  * Author: Ant Group CO., Ltd.
685
- * Version: v1.1.0-alpha.0
685
+ * Version: v1.1.0
686
686
  */
687
687
 
688
688
  /*********************************************/
@@ -7126,9 +7126,9 @@ var Float16ArrayWrapper = /** @class */ (function () {
7126
7126
  this.data = new Uint16Array(num);
7127
7127
  }
7128
7128
  else if (num && typeof num === 'object' && Number.isInteger(num.length)) {
7129
- var data = this.data = new Uint16Array(num.length);
7130
- for (var i = 0; i < data.length; i++) {
7131
- data[i] = toHalf(num[i]);
7129
+ var data_1 = this.data = new Uint16Array(num.length);
7130
+ for (var i = 0; i < data_1.length; i++) {
7131
+ data_1[i] = toHalf(num[i]);
7132
7132
  }
7133
7133
  }
7134
7134
  }
@@ -7501,9 +7501,9 @@ var CurveValue = /** @class */ (function (_super) {
7501
7501
  CurveValue.getAllData = function (meta, halfFloat) {
7502
7502
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
7503
7503
  for (var i = 0, cursor = 0, curves = meta.curves; i < curves.length; i++) {
7504
- var data = curves[i].toData();
7505
- ret.set(data, cursor);
7506
- cursor += data.length;
7504
+ var data_1 = curves[i].toData();
7505
+ ret.set(data_1, cursor);
7506
+ cursor += data_1.length;
7507
7507
  }
7508
7508
  return halfFloat ? ret.data : ret;
7509
7509
  };
@@ -7512,17 +7512,17 @@ var CurveValue = /** @class */ (function (_super) {
7512
7512
  var max = -Infinity;
7513
7513
  //formatted number
7514
7514
  if (Number.isFinite(props[0]) && Number.isFinite(props[1])) {
7515
- var keys = [];
7515
+ var keys_1 = [];
7516
7516
  for (var i = 2; i < props.length; i++) {
7517
7517
  // FIXME
7518
- keys.push(props[i].slice(0, 4));
7518
+ keys_1.push(props[i].slice(0, 4));
7519
7519
  }
7520
- this.keys = keys;
7520
+ this.keys = keys_1;
7521
7521
  this.min = props[0];
7522
7522
  this.dist = props[1] - props[0];
7523
7523
  }
7524
7524
  else {
7525
- var keys = props.map(function (item) {
7525
+ var keys_2 = props.map(function (item) {
7526
7526
  if (isArray(item)) {
7527
7527
  min = Math.min(min, item[1]);
7528
7528
  max = Math.max(max, item[1]);
@@ -7537,22 +7537,22 @@ var CurveValue = /** @class */ (function (_super) {
7537
7537
  throw new Error('invalid keyframe');
7538
7538
  });
7539
7539
  var dist = max - min;
7540
- this.keys = keys;
7540
+ this.keys = keys_2;
7541
7541
  if (dist !== 0) {
7542
- for (var i = 0; i < keys.length; i++) {
7543
- var key = keys[i];
7542
+ for (var i = 0; i < keys_2.length; i++) {
7543
+ var key = keys_2[i];
7544
7544
  key[1] = (key[1] - min) / dist;
7545
7545
  }
7546
7546
  }
7547
- var key0 = keys[0];
7547
+ var key0 = keys_2[0];
7548
7548
  if (key0[0] > 0) {
7549
7549
  key0[2] = 0;
7550
- keys.unshift([0, key0[1], 0, 0]);
7550
+ keys_2.unshift([0, key0[1], 0, 0]);
7551
7551
  }
7552
- var key1 = keys[keys.length - 1];
7552
+ var key1 = keys_2[keys_2.length - 1];
7553
7553
  if (key1[0] < 1) {
7554
7554
  key1[3] = 0;
7555
- keys.push([1, key1[1], 0, 0]);
7555
+ keys_2.push([1, key1[1], 0, 0]);
7556
7556
  }
7557
7557
  this.min = min;
7558
7558
  this.dist = dist;
@@ -7927,14 +7927,14 @@ function curveValueIntegrateByTime(t1, keyframe0, keyframe1) {
7927
7927
  function getKeyFrameMetaByRawValue(meta, value) {
7928
7928
  if (value) {
7929
7929
  var type = value[0];
7930
- var keys = value[1];
7930
+ var keys_3 = value[1];
7931
7931
  if (type === ValueType$1.CURVE) {
7932
- meta.curves.push(keys);
7933
- var keyLen = keys.length;
7934
- if (keys[0][0] > 0) {
7932
+ meta.curves.push(keys_3);
7933
+ var keyLen = keys_3.length;
7934
+ if (keys_3[0][0] > 0) {
7935
7935
  keyLen++;
7936
7936
  }
7937
- if (keys[keys.length - 1][0] < 1) {
7937
+ if (keys_3[keys_3.length - 1][0] < 1) {
7938
7938
  keyLen++;
7939
7939
  }
7940
7940
  meta.index += keyLen;
@@ -7942,19 +7942,19 @@ function getKeyFrameMetaByRawValue(meta, value) {
7942
7942
  meta.curveCount += keyLen;
7943
7943
  }
7944
7944
  else if (type === ValueType$1.LINE) {
7945
- var keyLen = keys.length;
7946
- if (keyLen === 2 && keys[0][0] === 0 && keys[1][0] === 1) {
7945
+ var keyLen = keys_3.length;
7946
+ if (keyLen === 2 && keys_3[0][0] === 0 && keys_3[1][0] === 1) {
7947
7947
  return;
7948
7948
  }
7949
- if (keys[0][0] > 0) {
7949
+ if (keys_3[0][0] > 0) {
7950
7950
  keyLen++;
7951
7951
  }
7952
- if (keys[keys.length - 1][0] < 1) {
7952
+ if (keys_3[keys_3.length - 1][0] < 1) {
7953
7953
  keyLen++;
7954
7954
  }
7955
7955
  var uniformCount = Math.ceil(keyLen / 2);
7956
7956
  meta.lineSegCount += uniformCount;
7957
- meta.curves.push(keys);
7957
+ meta.curves.push(keys_3);
7958
7958
  meta.index += uniformCount;
7959
7959
  meta.max = Math.max(meta.max, uniformCount);
7960
7960
  }
@@ -9254,10 +9254,10 @@ var VFXItem = /** @class */ (function () {
9254
9254
  };
9255
9255
  VFXItem.prototype.translateByPixel = function (x, y) {
9256
9256
  if (this.composition) {
9257
+ // @ts-expect-error
9258
+ var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
9257
9259
  var z = this.transform.getWorldPosition().z;
9258
- var _a = this.composition.camera.getInverseVPRatio(z), rx = _a.x, ry = _a.y;
9259
- var width = this.composition.renderer.getWidth() / 2;
9260
- var height = this.composition.renderer.getHeight() / 2;
9260
+ var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
9261
9261
  this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
9262
9262
  }
9263
9263
  };
@@ -10435,9 +10435,9 @@ var KTXTexture = /** @class */ (function () {
10435
10435
  for (var level = 0; level < mipmapCount; level++) {
10436
10436
  var imageSize = new Int32Array(this.arrayBuffer, this.baseOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps
10437
10437
  for (var face = 0; face < this.numberOfFaces; face++) {
10438
- var data = new Uint8Array(this.arrayBuffer, this.baseOffset + dataOffset + 4, imageSize);
10438
+ var data_1 = new Uint8Array(this.arrayBuffer, this.baseOffset + dataOffset + 4, imageSize);
10439
10439
  mipmaps.push({
10440
- data: data,
10440
+ data: data_1,
10441
10441
  width: width,
10442
10442
  height: height,
10443
10443
  });
@@ -13148,9 +13148,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
13148
13148
  this.handleDragMove(this.dragEvent, this.bouncingArg);
13149
13149
  }
13150
13150
  };
13151
- InteractVFXItem.prototype.onItemRemoved = function (composition) {
13151
+ InteractVFXItem.prototype.onEnd = function () {
13152
+ if (this.composition) {
13153
+ this.composition.removeInteractiveItem(this, this.ui.options.type);
13154
+ }
13155
+ };
13156
+ InteractVFXItem.prototype.onItemRemoved = function () {
13152
13157
  var _a;
13153
- composition.removeInteractiveItem(this, this.ui.options.type);
13154
13158
  this.clickable = false;
13155
13159
  (_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
13156
13160
  this.endDragTarget();
@@ -13262,16 +13266,16 @@ var InteractVFXItem = /** @class */ (function (_super) {
13262
13266
  var nx = position[0] - width;
13263
13267
  var ny = position[1] - height;
13264
13268
  if (options.dxRange) {
13265
- var _d = __read$3(options.dxRange, 2), min = _d[0], max = _d[1];
13266
- nx = clamp$1(nx, min, max);
13267
- if (nx !== min && nx !== max && min !== max) {
13269
+ var _d = __read$3(options.dxRange, 2), min_1 = _d[0], max_1 = _d[1];
13270
+ nx = clamp$1(nx, min_1, max_1);
13271
+ if (nx !== min_1 && nx !== max_1 && min_1 !== max_1) {
13268
13272
  (_a = event.origin) === null || _a === void 0 ? void 0 : _a.preventDefault();
13269
13273
  }
13270
13274
  }
13271
13275
  if (options.dyRange) {
13272
- var _e = __read$3(options.dyRange, 2), min = _e[0], max = _e[1];
13273
- ny = clamp$1(ny, min, max);
13274
- if (ny !== min && ny !== max && min !== max) {
13276
+ var _e = __read$3(options.dyRange, 2), min_2 = _e[0], max_2 = _e[1];
13277
+ ny = clamp$1(ny, min_2, max_2);
13278
+ if (ny !== min_2 && ny !== max_2 && min_2 !== max_2) {
13275
13279
  (_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
13276
13280
  }
13277
13281
  }
@@ -13385,11 +13389,11 @@ var SpriteMesh = /** @class */ (function () {
13385
13389
  var item = items[i];
13386
13390
  var texture = item === null || item === void 0 ? void 0 : item.renderer.texture;
13387
13391
  var textureIndex = texture ? textures.indexOf(texture) : -1;
13388
- var data = this.getItemInitData(item, i, pointCount, textureIndex);
13389
- aPointLen += data.aPoint.length;
13390
- indexLen += data.index.length;
13391
- datas.push(data);
13392
- pointCount += data.aPoint.length / 6;
13392
+ var data_1 = this.getItemInitData(item, i, pointCount, textureIndex);
13393
+ aPointLen += data_1.aPoint.length;
13394
+ indexLen += data_1.index.length;
13395
+ datas.push(data_1);
13396
+ pointCount += data_1.aPoint.length / 6;
13393
13397
  this.updateItem(item, true);
13394
13398
  }
13395
13399
  var bundle = {
@@ -13401,10 +13405,10 @@ var SpriteMesh = /** @class */ (function () {
13401
13405
  index: 0,
13402
13406
  };
13403
13407
  var _loop_1 = function (i) {
13404
- var data = datas[i];
13408
+ var data_2 = datas[i];
13405
13409
  Object.keys(bundle).forEach(function (name) {
13406
13410
  var arr = bundle[name];
13407
- var ta = data[name];
13411
+ var ta = data_2[name];
13408
13412
  arr.set(ta, cursor[name]);
13409
13413
  cursor[name] += ta.length;
13410
13414
  });
@@ -13671,14 +13675,14 @@ var SpriteMesh = /** @class */ (function () {
13671
13675
  for (var y = 0; y < row; y++) {
13672
13676
  var base = (y * 2 + x) * 4;
13673
13677
  // @ts-expect-error
13674
- var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
13675
- var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
13678
+ var split_1 = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y * 2 + x];
13679
+ var texOffset = split_1[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
13676
13680
  var dw = ((x + x + 1) / col - 1) / 2;
13677
13681
  var dh = ((y + y + 1) / row - 1) / 2;
13678
- var tox = split[0];
13679
- var toy = split[1];
13680
- var tsx = split[4] ? split[3] : split[2];
13681
- var tsy = split[4] ? split[2] : split[3];
13682
+ var tox = split_1[0];
13683
+ var toy = split_1[1];
13684
+ var tsx = split_1[4] ? split_1[3] : split_1[2];
13685
+ var tsy = split_1[4] ? split_1[2] : split_1[3];
13682
13686
  var origin_1 = [
13683
13687
  originData[0] / col + dw,
13684
13688
  originData[1] / row + dh,
@@ -13775,13 +13779,13 @@ function generateFeatureTexture(engine, feather) {
13775
13779
  }
13776
13780
  else {
13777
13781
  var len = 128;
13778
- var data = new Uint8Array(len);
13782
+ var data_3 = new Uint8Array(len);
13779
13783
  for (var i = 0, s = len - 1; i < len; i++) {
13780
13784
  var p = i / s;
13781
13785
  var val = feather.getValue(p);
13782
- data[i] = Math.round(val * 255);
13786
+ data_3[i] = Math.round(val * 255);
13783
13787
  }
13784
- tex = Texture.createWithData(engine, { width: len, height: 1, data: data }, {
13788
+ tex = Texture.createWithData(engine, { width: len, height: 1, data: data_3 }, {
13785
13789
  name: 'feather',
13786
13790
  format: glContext.LUMINANCE,
13787
13791
  minFilter: glContext.LINEAR,
@@ -13939,22 +13943,22 @@ var SpriteGroup = /** @class */ (function () {
13939
13943
  * 需要则添加到meshToModify数组
13940
13944
  */
13941
13945
  for (var i = 0; i < splits.length; i++) {
13942
- var split = splits[i];
13946
+ var split_1 = splits[i];
13943
13947
  // @ts-expect-error
13944
- var spriteMesh = split.spriteMesh;
13945
- if (split.items.length === 0) {
13948
+ var spriteMesh = split_1.spriteMesh;
13949
+ if (split_1.items.length === 0) {
13946
13950
  throw new Error('split not combined');
13947
13951
  }
13948
- if (split.dirty) {
13949
- var priority = split.indexStart;
13952
+ if (split_1.dirty) {
13953
+ var priority = split_1.indexStart;
13950
13954
  if (spriteMesh.mesh.priority !== priority) {
13951
13955
  spriteMesh.mesh.priority = priority;
13952
13956
  meshToModify.push(spriteMesh.mesh);
13953
13957
  }
13954
- spriteMesh.setItems(split.items.map(function (item) { return item.content; }));
13958
+ spriteMesh.setItems(split_1.items.map(function (item) { return item.content; }));
13955
13959
  }
13956
13960
  spriteMesh.applyChange();
13957
- split.dirty = false;
13961
+ split_1.dirty = false;
13958
13962
  }
13959
13963
  /**
13960
13964
  * 有需要移除的meshSplit 则废弃对应的mesh 保留material
@@ -13962,8 +13966,8 @@ var SpriteGroup = /** @class */ (function () {
13962
13966
  */
13963
13967
  if (splitsToRemove.length) {
13964
13968
  for (var i = 0; i < splitsToRemove.length; i++) {
13965
- var split = splitsToRemove[i];
13966
- var sp = split.spriteMesh;
13969
+ var split_2 = splitsToRemove[i];
13970
+ var sp = split_2.spriteMesh;
13967
13971
  // @ts-expect-error
13968
13972
  var mesh = sp.mesh;
13969
13973
  mesh.dispose({ material: { textures: DestroyOptions.keep } });
@@ -14080,7 +14084,7 @@ var SpriteGroup = /** @class */ (function () {
14080
14084
  addItemWithOrder(items, item, itemSortProperty);
14081
14085
  if (isSprite(item)) {
14082
14086
  var content = item.createContent();
14083
- var split = {
14087
+ var split_4 = {
14084
14088
  indexStart: item.listIndex,
14085
14089
  indexEnd: item.listIndex,
14086
14090
  items: [item],
@@ -14088,21 +14092,21 @@ var SpriteGroup = /** @class */ (function () {
14088
14092
  cacheId: content.renderInfo.cacheId,
14089
14093
  textures: [item.content.renderer.texture],
14090
14094
  };
14091
- splits.unshift(split);
14092
- return [split];
14095
+ splits.unshift(split_4);
14096
+ return [split_4];
14093
14097
  }
14094
14098
  return [];
14095
14099
  }
14096
14100
  var _loop_2 = function (i) {
14097
- var split = splits[i];
14101
+ var split_5 = splits[i];
14098
14102
  var listIndex = item.listIndex;
14099
14103
  if (isSprite(item)) {
14100
14104
  // @ts-expect-error
14101
- if (listIndex <= split.indexEnd) {
14105
+ if (listIndex <= split_5.indexEnd) {
14102
14106
  addItemWithOrder(items, item, itemSortProperty);
14103
14107
  var itemIndex_1 = items.indexOf(item);
14104
- var indexStart = Math.min(itemIndex_1, items.indexOf(split.items[0]));
14105
- var indexEnd = Math.max(itemIndex_1, items.indexOf(split.items[split.items.length - 1]));
14108
+ var indexStart = Math.min(itemIndex_1, items.indexOf(split_5.items[0]));
14109
+ var indexEnd = Math.max(itemIndex_1, items.indexOf(split_5.items[split_5.items.length - 1]));
14106
14110
  var neoSplits_1 = this_2.getMeshSplits(items, indexStart, indexEnd);
14107
14111
  var neoSplitIndex_1 = neoSplits_1.findIndex(function (split) { return split.items.includes(item); });
14108
14112
  if (neoSplits_1.length === 2) {
@@ -14110,14 +14114,14 @@ var SpriteGroup = /** @class */ (function () {
14110
14114
  //1 or 0
14111
14115
  Object.keys(neoSplits_1[1 - neoSplitIndex_1]).forEach(function (key) {
14112
14116
  // @ts-expect-error
14113
- split[key] = neoSplits_1[1 - neoSplitIndex_1][key];
14117
+ split_5[key] = neoSplits_1[1 - neoSplitIndex_1][key];
14114
14118
  });
14115
14119
  return { value: [neoSplits_1[neoSplitIndex_1]] };
14116
14120
  }
14117
14121
  else if (neoSplits_1.length === 3) {
14118
14122
  Object.keys(neoSplits_1[0]).forEach(function (key) {
14119
14123
  // @ts-expect-error
14120
- split[key] = neoSplits_1[0][key];
14124
+ split_5[key] = neoSplits_1[0][key];
14121
14125
  });
14122
14126
  splits.splice(i + 1, 0, neoSplits_1[1], neoSplits_1[2]);
14123
14127
  if (neoSplitIndex_1 !== 1) {
@@ -14131,25 +14135,25 @@ var SpriteGroup = /** @class */ (function () {
14131
14135
  //todo add case
14132
14136
  Object.keys(neoSplits_1[0]).forEach(function (key) {
14133
14137
  // @ts-expect-error
14134
- split[key] = neoSplits_1[0][key];
14138
+ split_5[key] = neoSplits_1[0][key];
14135
14139
  });
14136
14140
  return { value: [] };
14137
14141
  }
14138
14142
  }
14139
14143
  else {
14140
- if (listIndex < split.indexStart || listIndex === split.indexEnd) {
14144
+ if (listIndex < split_5.indexStart || listIndex === split_5.indexEnd) {
14141
14145
  addItemWithOrder(items, item, itemSortProperty);
14142
14146
  return { value: [] };
14143
14147
  // @ts-expect-error
14144
14148
  }
14145
- else if (listIndex < split.indexEnd) {
14149
+ else if (listIndex < split_5.indexEnd) {
14146
14150
  addItemWithOrder(items, item, itemSortProperty);
14147
- var lastItem = split.items[split.items.length - 1];
14151
+ var lastItem = split_5.items[split_5.items.length - 1];
14148
14152
  var endIndex = items.indexOf(lastItem);
14149
- var neoSplits_2 = this_2.getMeshSplits(items, items.indexOf(split.items[0]), endIndex);
14153
+ var neoSplits_2 = this_2.getMeshSplits(items, items.indexOf(split_5.items[0]), endIndex);
14150
14154
  Object.keys(neoSplits_2[0]).forEach(function (key) {
14151
14155
  // @ts-expect-error
14152
- split[key] = neoSplits_2[0][key];
14156
+ split_5[key] = neoSplits_2[0][key];
14153
14157
  });
14154
14158
  if (neoSplits_2.length === 2) {
14155
14159
  splits.splice(i + 1, 0, neoSplits_2[1]);
@@ -14210,10 +14214,10 @@ var SpriteGroup = /** @class */ (function () {
14210
14214
  * 遍历this.meshSplits,找到元素的listIndex在split的indexStart和indexEnd范围内的第一个meshSplit
14211
14215
  */
14212
14216
  for (var i = 0; i < splits.length; i++) {
14213
- var split = splits[i];
14217
+ var split_6 = splits[i];
14214
14218
  // @ts-expect-error
14215
- if (split.indexStart <= item.listIndex && split.indexEnd >= item.listIndex) {
14216
- targetSplit = split;
14219
+ if (split_6.indexStart <= item.listIndex && split_6.indexEnd >= item.listIndex) {
14220
+ targetSplit = split_6;
14217
14221
  targetSplitIndex = i;
14218
14222
  break;
14219
14223
  }
@@ -14323,8 +14327,8 @@ var SpriteGroup = /** @class */ (function () {
14323
14327
  // FIXME: 可选性
14324
14328
  var targetSplitIndex = void 0;
14325
14329
  for (var i = 0; i < splits.length; i++) {
14326
- var split = splits[i];
14327
- if (split.items.includes(item)) {
14330
+ var split_7 = splits[i];
14331
+ if (split_7.items.includes(item)) {
14328
14332
  targetSplitIndex = i;
14329
14333
  break;
14330
14334
  }
@@ -14942,7 +14946,6 @@ var SpriteItem = /** @class */ (function (_super) {
14942
14946
  ret.texOffset = [0, 0, 1, 1];
14943
14947
  }
14944
14948
  ret.visible = this.vfxItem.contentVisible;
14945
- // 图层元素作为父节点时,除了k的大小变换,自身的尺寸也需要传递给子元素,子元素可以通过startSize读取
14946
14949
  ret.startSize = this.startSize;
14947
14950
  return ret;
14948
14951
  };
@@ -15040,7 +15043,9 @@ var SpriteVFXItem = /** @class */ (function (_super) {
15040
15043
  };
15041
15044
  SpriteVFXItem.prototype.doCreateContent = function (composition) {
15042
15045
  var emptyTexture = composition.getRendererOptions().emptyTexture;
15043
- return new SpriteItem(this.sprite, { emptyTexture: emptyTexture }, this);
15046
+ var content = new SpriteItem(this.sprite, { emptyTexture: emptyTexture }, this);
15047
+ content.getRenderData(0, true);
15048
+ return content;
15044
15049
  };
15045
15050
  SpriteVFXItem.prototype.createWireframeMesh = function (item, color) {
15046
15051
  var spMesh = new SpriteMesh(this.composition.getEngine(), __assign$1({ wireframe: true }, item.renderInfo), this.composition);
@@ -15474,10 +15479,10 @@ var ParticleMesh = /** @class */ (function () {
15474
15479
  var index = geometry.getIndexData();
15475
15480
  for (var i = 0; i < names.length; i++) {
15476
15481
  var name_1 = names[i];
15477
- var data = geometry.getAttributeData(name_1);
15478
- if (data) {
15482
+ var data_1 = geometry.getAttributeData(name_1);
15483
+ if (data_1) {
15479
15484
  // @ts-expect-error
15480
- geometry.setAttributeData(name_1, new data.constructor(0));
15485
+ geometry.setAttributeData(name_1, new data_1.constructor(0));
15481
15486
  }
15482
15487
  }
15483
15488
  // @ts-expect-error
@@ -16852,10 +16857,10 @@ function getGeometryTriangles(geometry, options) {
16852
16857
  var segment = segments[i];
16853
16858
  var p0 = points[i];
16854
16859
  var p1 = points[i + 1] || points[0];
16855
- var keys = segment;
16860
+ var keys_1 = segment;
16856
16861
  var point = [0, 0];
16857
- for (var j = 0; j < keys.length - 1; j++) {
16858
- var key = keys[j];
16862
+ for (var j = 0; j < keys_1.length - 1; j++) {
16863
+ var key = keys_1[j];
16859
16864
  getBezier2DValue(point, key, p0, p1, p0[4], p0[5], p1[2], p1[3]);
16860
16865
  setPoint(point[0], point[1]);
16861
16866
  }
@@ -16914,11 +16919,11 @@ function getGeometryByShape(shape, uvTransform) {
16914
16919
  var index = 0;
16915
16920
  for (var i = 0; i < geometries.length; i++) {
16916
16921
  var geometry = geometries[i];
16917
- var data = getGeometryTriangles(geometry, { indexBase: indexBase, uvTransform: uvTransform });
16918
- indexBase += data.aPoint.length / 5;
16919
- datas.push(data);
16920
- aPoint += data.aPoint.length;
16921
- index += data.index.length;
16922
+ var data_1 = getGeometryTriangles(geometry, { indexBase: indexBase, uvTransform: uvTransform });
16923
+ indexBase += data_1.aPoint.length / 5;
16924
+ datas.push(data_1);
16925
+ aPoint += data_1.aPoint.length;
16926
+ index += data_1.index.length;
16922
16927
  }
16923
16928
  if (datas.length === 1) {
16924
16929
  return datas[0];
@@ -16927,11 +16932,11 @@ function getGeometryByShape(shape, uvTransform) {
16927
16932
  var indexData = new Uint16Array(index);
16928
16933
  // @ts-expect-error
16929
16934
  for (var i = 0, pointIndex = 0, idx = 0; i < datas[i]; i++) {
16930
- var data = datas[i];
16931
- aPointData.set(data.aPoint, pointIndex);
16932
- pointIndex += data.aPoint.length;
16933
- indexData.set(data.index, idx);
16934
- idx += data.index.length;
16935
+ var data_2 = datas[i];
16936
+ aPointData.set(data_2.aPoint, pointIndex);
16937
+ pointIndex += data_2.aPoint.length;
16938
+ indexData.set(data_2.index, idx);
16939
+ idx += data_2.index.length;
16935
16940
  }
16936
16941
  return {
16937
16942
  aPoint: aPointData,
@@ -17242,10 +17247,10 @@ var TrailMesh = /** @class */ (function () {
17242
17247
  var pointCountPerTrail = this.pointCountPerTrail;
17243
17248
  if (index >= 0 && index < pointCountPerTrail) {
17244
17249
  var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
17245
- var data = this.geometry.getAttributeData('aColor');
17246
- out.x = data[startIndex];
17247
- out.y = data[1 + startIndex];
17248
- out.z = data[2 + startIndex];
17250
+ var data_1 = this.geometry.getAttributeData('aColor');
17251
+ out.x = data_1[startIndex];
17252
+ out.y = data_1[1 + startIndex];
17253
+ out.z = data_1[2 + startIndex];
17249
17254
  return out;
17250
17255
  }
17251
17256
  };
@@ -18651,14 +18656,14 @@ var TextMesh = /** @class */ (function (_super) {
18651
18656
  for (var y_1 = 0; y_1 < row; y_1++) {
18652
18657
  var base = (y_1 * 2 + x_1) * 4;
18653
18658
  // @ts-expect-error
18654
- var split = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y_1 * 2 + x_1];
18655
- var texOffset = split[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
18659
+ var split_1 = textureSheetAnimation ? [0, 0, 1, 1, splits[0][4]] : splits[y_1 * 2 + x_1];
18660
+ var texOffset = split_1[4] ? [0, 0, 1, 0, 0, 1, 1, 1] : [0, 1, 0, 0, 1, 1, 1, 0];
18656
18661
  var dw = ((x_1 + x_1 + 1) / col - 1) / 2;
18657
18662
  var dh = ((y_1 + y_1 + 1) / row - 1) / 2;
18658
- var tox = split[0];
18659
- var toy = split[1];
18660
- var tsx = split[4] ? split[3] : split[2];
18661
- var tsy = split[4] ? split[2] : split[3];
18663
+ var tox = split_1[0];
18664
+ var toy = split_1[1];
18665
+ var tsx = split_1[4] ? split_1[3] : split_1[2];
18666
+ var tsy = split_1[4] ? split_1[2] : split_1[3];
18662
18667
  var origin_1 = [
18663
18668
  originData[0] / col + dw,
18664
18669
  originData[1] / row + dh,
@@ -21378,8 +21383,9 @@ var Camera = /** @class */ (function () {
21378
21383
  Camera.prototype.getInverseVPRatio = function (z) {
21379
21384
  var pos = new Vector3(0, 0, z);
21380
21385
  var mat = this.getViewProjectionMatrix();
21381
- var nz = pos.applyMatrix(mat).z;
21382
- return new Vector3(1, 1, nz).applyMatrix(mat);
21386
+ var inverseVP = this.getInverseViewProjectionMatrix();
21387
+ var nz = mat.projectPoint(pos).z;
21388
+ return inverseVP.projectPoint(new Vector3(1, 1, nz));
21383
21389
  };
21384
21390
  /**
21385
21391
  * 设置相机的旋转四元数
@@ -21391,7 +21397,6 @@ var Camera = /** @class */ (function () {
21391
21397
  this.dirty = true;
21392
21398
  }
21393
21399
  else {
21394
- this.options.quat;
21395
21400
  if (!this.options.quat.equals(value)) {
21396
21401
  this.options.quat.copyFrom(value);
21397
21402
  this.dirty = true;
@@ -21568,7 +21573,7 @@ var filters = {
21568
21573
  * Name: @galacean/effects-specification
21569
21574
  * Description: Galacean Effects JSON Specification
21570
21575
  * Author: Ant Group CO., Ltd.
21571
- * Version: v1.1.0-alpha.0
21576
+ * Version: v1.1.0
21572
21577
  */
21573
21578
 
21574
21579
  /*********************************************/
@@ -23338,13 +23343,13 @@ var CompositionSourceManager = /** @class */ (function () {
23338
23343
  if (renderContent.renderer) {
23339
23344
  renderContent.renderer = _this.changeTex(renderContent.renderer);
23340
23345
  _this.processMask(renderContent.renderer);
23341
- var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
23346
+ var split_1 = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
23342
23347
  if (Number.isInteger(renderContent.renderer.shape)) {
23343
23348
  // TODO: scene.shapes 类型问题?
23344
- renderContent.renderer.shape = getGeometryByShape((_a = _this.jsonScene) === null || _a === void 0 ? void 0 : _a.shapes[renderContent.renderer.shape], split);
23349
+ renderContent.renderer.shape = getGeometryByShape((_a = _this.jsonScene) === null || _a === void 0 ? void 0 : _a.shapes[renderContent.renderer.shape], split_1);
23345
23350
  }
23346
23351
  else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
23347
- renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
23352
+ renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split_1);
23348
23353
  }
23349
23354
  }
23350
23355
  else {
@@ -23356,14 +23361,14 @@ var CompositionSourceManager = /** @class */ (function () {
23356
23361
  if (renderContent.filter) {
23357
23362
  renderContent.filter = __assign$1({}, renderContent.filter);
23358
23363
  }
23359
- var name_1 = item.name, _b = item.delay, delay = _b === void 0 ? 0 : _b, id = item.id, parentId = item.parentId, duration = item.duration, endBehavior = item.endBehavior, pluginName = item.pluginName, pn = item.pn, transform = item.transform;
23364
+ 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;
23360
23365
  // FIXME: specification 下定义的 Item 不存在 refCount 类型定义
23361
23366
  // @ts-expect-error
23362
23367
  var refCount = item.refCount;
23363
23368
  var _c = _this.jsonScene.plugins, plugins = _c === void 0 ? [] : _c;
23364
23369
  option.name = name_1;
23365
23370
  option.delay = delay;
23366
- option.id = id;
23371
+ option.id = id_1;
23367
23372
  if (parentId) {
23368
23373
  option.parentId = parentId;
23369
23374
  }
@@ -23731,16 +23736,17 @@ var AssetManager = /** @class */ (function () {
23731
23736
  };
23732
23737
  AssetManager.prototype.processBins = function (bins) {
23733
23738
  return __awaiter(this, void 0, void 0, function () {
23734
- var renderLevel, jobs;
23739
+ var renderLevel, baseUrl, jobs;
23735
23740
  var _this = this;
23736
23741
  return __generator(this, function (_a) {
23737
23742
  renderLevel = this.options.renderLevel;
23743
+ baseUrl = this.baseUrl;
23738
23744
  jobs = bins.map(function (bin) {
23739
23745
  if (bin instanceof ArrayBuffer) {
23740
23746
  return bin;
23741
23747
  }
23742
23748
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23743
- return _this.loadBins(bin.url);
23749
+ return _this.loadBins(new URL(bin.url, baseUrl).href);
23744
23750
  }
23745
23751
  throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
23746
23752
  });
@@ -23758,13 +23764,14 @@ var AssetManager = /** @class */ (function () {
23758
23764
  return [2 /*return*/];
23759
23765
  }
23760
23766
  jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
23761
- var fontFace;
23767
+ var url, fontFace;
23762
23768
  var _a;
23763
23769
  return __generator(this, function (_b) {
23764
23770
  switch (_b.label) {
23765
23771
  case 0:
23766
23772
  if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
23767
- fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + font.fontURL + ')');
23773
+ url = new URL(font.fontURL, this.baseUrl).href;
23774
+ fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
23768
23775
  _b.label = 1;
23769
23776
  case 1:
23770
23777
  _b.trys.push([1, 3, , 4]);
@@ -23777,7 +23784,7 @@ var AssetManager = /** @class */ (function () {
23777
23784
  return [3 /*break*/, 4];
23778
23785
  case 3:
23779
23786
  _b.sent();
23780
- logger.warn("Invalid fonts source: ".concat(JSON.stringify(font.fontURL)));
23787
+ logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
23781
23788
  return [3 /*break*/, 4];
23782
23789
  case 4: return [2 /*return*/];
23783
23790
  }
@@ -23972,14 +23979,14 @@ var AssetManager = /** @class */ (function () {
23972
23979
  }());
23973
23980
  function fixOldImageUsage(usedImages, compositions, imgUsage, images, renderLevel) {
23974
23981
  for (var i = 0; i < compositions.length; i++) {
23975
- var id = compositions[i].id;
23976
- var ids = imgUsage[id];
23982
+ var id_1 = compositions[i].id;
23983
+ var ids = imgUsage[id_1];
23977
23984
  if (ids) {
23978
23985
  for (var j = 0; j < ids.length; j++) {
23979
- var id_1 = ids[j];
23980
- var tag = images[id_1].renderLevel;
23986
+ var id_2 = ids[j];
23987
+ var tag = images[id_2].renderLevel;
23981
23988
  if (passRenderLevel(tag, renderLevel)) {
23982
- usedImages[id_1] = true;
23989
+ usedImages[id_2] = true;
23983
23990
  }
23984
23991
  }
23985
23992
  }
@@ -23990,7 +23997,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23990
23997
  return image.source;
23991
23998
  }
23992
23999
  else if (image instanceof HTMLImageElement ||
23993
- image instanceof HTMLCanvasElement) {
24000
+ isCanvas(image)) {
23994
24001
  return {
23995
24002
  image: image,
23996
24003
  sourceType: TextureSourceType.image,
@@ -24027,6 +24034,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
24027
24034
  }
24028
24035
  throw new Error('Invalid texture options');
24029
24036
  }
24037
+ function isCanvas(canvas) {
24038
+ var _a;
24039
+ // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
24040
+ return typeof canvas === 'object' && canvas !== null && ((_a = canvas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
24041
+ }
24030
24042
 
24031
24043
  var CompVFXItem = /** @class */ (function (_super) {
24032
24044
  __extends(CompVFXItem, _super);