@galacean/effects-core 2.0.0-alpha.16 → 2.0.0-alpha.18

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: v2.0.0-alpha.16
6
+ * Version: v2.0.0-alpha.18
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -324,7 +324,6 @@ function isSimulatorCellPhone() {
324
324
  }
325
325
  function isAlipayMiniApp() {
326
326
  var _my;
327
- // @ts-expect-error
328
327
  return typeof my !== 'undefined' && ((_my = my) == null ? void 0 : _my.renderTarget) === 'web';
329
328
  }
330
329
 
@@ -558,8 +557,8 @@ function noop() {}
558
557
  *
559
558
  * @static
560
559
  * @function isString
561
- * @param {object} obj - 要判断的对象
562
- * @return {boolean}
560
+ * @param obj - 要判断的对象
561
+ * @return
563
562
  */ function isString(obj) {
564
563
  return typeof obj === 'string';
565
564
  }
@@ -568,8 +567,8 @@ function noop() {}
568
567
  *
569
568
  * @static
570
569
  * @function isArray
571
- * @param {object} obj - 要判断的对象
572
- * @return {boolean}
570
+ * @param obj - 要判断的对象
571
+ * @return
573
572
  */ const isArray = Array.isArray || function(obj) {
574
573
  return Object.prototype.toString.call(obj) === '[object Array]';
575
574
  };
@@ -578,8 +577,8 @@ function noop() {}
578
577
  *
579
578
  * @static
580
579
  * @function isFunction
581
- * @param {object} obj - 要判断的对象
582
- * @return {boolean}
580
+ * @param obj - 要判断的对象
581
+ * @return
583
582
  */ function isFunction(obj) {
584
583
  return Object.prototype.toString.call(obj) === '[object Function]';
585
584
  }
@@ -588,8 +587,8 @@ function noop() {}
588
587
  *
589
588
  * @static
590
589
  * @function isObject
591
- * @param {object} obj - 要判断的对象
592
- * @return {boolean}
590
+ * @param obj - 要判断的对象
591
+ * @return
593
592
  */ function isObject(obj) {
594
593
  return Object.prototype.toString.call(obj) === '[object Object]';
595
594
  }
@@ -598,29 +597,16 @@ function isCanvas(canvas) {
598
597
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
599
598
  return typeof canvas === 'object' && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === 'CANVAS';
600
599
  }
601
- function deepClone(obj) {
602
- if (isArray(obj)) {
603
- return obj.map(deepClone);
604
- } else if (obj && typeof obj === 'object') {
605
- if (ArrayBuffer.isView(obj)) {
606
- return obj.slice();
607
- }
608
- const ret = {};
609
- const kas = Object.keys(obj);
610
- for(let i = 0; i < kas.length; i++){
611
- const key = kas[i];
612
- ret[key] = deepClone(obj[key]);
613
- }
614
- return ret;
615
- }
616
- return obj;
617
- }
618
- // TODO: 改名
619
- function random(min, max) {
600
+ /**
601
+ * 生成一个位于 min 和 max 之间的随机数
602
+ * @param min
603
+ * @param max
604
+ * @returns
605
+ */ function randomInRange(min, max) {
620
606
  return min + Math.random() * (max - min);
621
607
  }
622
608
  function throwDestroyedError() {
623
- throw Error('destroyed item cannot be used again');
609
+ throw new Error('Destroyed item cannot be used again.');
624
610
  }
625
611
  function generateGUID() {
626
612
  return v4().replace(/-/g, '');
@@ -3856,7 +3842,7 @@ var CameraClipMode;
3856
3842
  * 蒙版形状切分
3857
3843
  */ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
3858
3844
  /**
3859
- *直线路径
3845
+ * 直线路径
3860
3846
  */ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
3861
3847
  /**
3862
3848
  * 多色
@@ -4032,7 +4018,7 @@ var TextAlignment;
4032
4018
  (function(TextAlignment) {
4033
4019
  /**
4034
4020
  * text alignment starts from(x,y) to right direction
4035
- * 从(x,y)开始第一个字符,向右边延伸
4021
+ * 从 (x,y) 开始第一个字符,向右边延伸
4036
4022
  */ TextAlignment[TextAlignment["left"] = 0] = "left";
4037
4023
  /**
4038
4024
  * (x,y) is middle position of text, where (left + right)/2 =(x,y)
@@ -4040,7 +4026,7 @@ var TextAlignment;
4040
4026
  */ TextAlignment[TextAlignment["middle"] = 1] = "middle";
4041
4027
  /**
4042
4028
  * text alignment ends with(x,y) from left direction
4043
- * 从(x,y)结束最后一个字符,向左边延伸
4029
+ * 从 (x,y) 结束最后一个字符,向左边延伸
4044
4030
  */ TextAlignment[TextAlignment["right"] = 2] = "right";
4045
4031
  })(TextAlignment || (TextAlignment = {}));
4046
4032
  /**
@@ -4090,6 +4076,7 @@ var DataType;
4090
4076
  DataType["TimelineAsset"] = "TimelineAsset";
4091
4077
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4092
4078
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4079
+ DataType["BinaryAsset"] = "BinaryAsset";
4093
4080
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4094
4081
  DataType["MeshComponent"] = "MeshComponent";
4095
4082
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4098,6 +4085,7 @@ var DataType;
4098
4085
  DataType["ModelPluginComponent"] = "ModelPluginComponent";
4099
4086
  DataType["TreeComponent"] = "TreeComponent";
4100
4087
  DataType["AnimationComponent"] = "AnimationComponent";
4088
+ DataType["SpineComponent"] = "SpineComponent";
4101
4089
  // Non-EffectObject
4102
4090
  DataType["TimelineClip"] = "TimelineClip";
4103
4091
  })(DataType || (DataType = {}));
@@ -4185,11 +4173,11 @@ var VertexBufferSemantic;
4185
4173
  VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
4186
4174
  })(VertexBufferSemantic || (VertexBufferSemantic = {}));
4187
4175
 
4188
- class BuiltinObjectGUID {
4189
- }
4190
- BuiltinObjectGUID.WhiteTexture = 'whitetexture00000000000000000000';
4191
- BuiltinObjectGUID.PBRShader = 'pbr00000000000000000000000000000';
4192
- BuiltinObjectGUID.UnlitShader = 'unlit000000000000000000000000000';
4176
+ const BuiltinObjectGUID = {
4177
+ WhiteTexture: 'whitetexture00000000000000000000',
4178
+ PBRShader: 'pbr00000000000000000000000000000',
4179
+ UnlitShader: 'unlit000000000000000000000000000'
4180
+ };
4193
4181
 
4194
4182
  var index$1 = /*#__PURE__*/Object.freeze({
4195
4183
  __proto__: null,
@@ -4245,15 +4233,20 @@ var index$1 = /*#__PURE__*/Object.freeze({
4245
4233
  BuiltinObjectGUID: BuiltinObjectGUID
4246
4234
  });
4247
4235
 
4248
- const effectsClassStore = {};
4249
4236
  const decoratorInitialStore = {};
4250
4237
  const mergedStore = {};
4251
- function getDirectStore(target) {
4252
- const classKey = target.constructor.name;
4253
- if (!decoratorInitialStore[classKey]) {
4254
- decoratorInitialStore[classKey] = {};
4255
- }
4256
- return decoratorInitialStore[classKey];
4238
+ const effectsClassStore = {};
4239
+ function effectsClass(className) {
4240
+ return (target, context)=>{
4241
+ if (effectsClassStore[className]) {
4242
+ console.warn(`Class ${className} is already registered.`);
4243
+ }
4244
+ // TODO: three修改json dataType, 这边重复注册直接 return
4245
+ effectsClassStore[className] = target;
4246
+ };
4247
+ }
4248
+ function serialize(type, sourceName) {
4249
+ return generateSerializableMember(type, sourceName); // value member
4257
4250
  }
4258
4251
  function getMergedStore(target) {
4259
4252
  const classKey = target.constructor.name;
@@ -4278,34 +4271,32 @@ function getMergedStore(target) {
4278
4271
  }
4279
4272
  return store;
4280
4273
  }
4281
- function serialize(type, sourceName) {
4282
- return generateSerializableMember(type, sourceName); // value member
4283
- }
4284
- function effectsClass(className) {
4285
- return (target, context)=>{
4286
- if (effectsClassStore[className]) {
4287
- console.warn('Class ' + className + ' 重复注册');
4288
- }
4289
- //TODO: three修改json dataType, 这边重复注册直接 return
4290
- effectsClassStore[className] = target;
4291
- };
4292
- }
4293
4274
  function generateSerializableMember(type, sourceName) {
4294
4275
  return (target, propertyKey)=>{
4295
4276
  const classStore = getDirectStore(target);
4296
4277
  if (!classStore[propertyKey]) {
4297
4278
  classStore[propertyKey] = {
4298
- type: type,
4299
- sourceName: sourceName
4279
+ type,
4280
+ sourceName
4300
4281
  };
4301
4282
  }
4302
4283
  };
4303
4284
  }
4285
+ function getDirectStore(target) {
4286
+ const classKey = target.constructor.name;
4287
+ if (!decoratorInitialStore[classKey]) {
4288
+ decoratorInitialStore[classKey] = {};
4289
+ }
4290
+ return decoratorInitialStore[classKey];
4291
+ }
4304
4292
 
4305
4293
  /**
4306
4294
  * @since 2.0.0
4307
4295
  * @internal
4308
4296
  */ class EffectsObject {
4297
+ static is(obj) {
4298
+ return obj instanceof EffectsObject && 'guid' in obj;
4299
+ }
4309
4300
  getInstanceId() {
4310
4301
  return this.guid;
4311
4302
  }
@@ -4501,6 +4492,7 @@ __decorate([
4501
4492
  super(...args);
4502
4493
  this.started = false;
4503
4494
  this.materials = [];
4495
+ this._priority = 0;
4504
4496
  this._enabled = true;
4505
4497
  }
4506
4498
  }
@@ -7028,8 +7020,8 @@ const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = 'PRE_MAIN_COLOR_0';
7028
7020
  const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = 'PRE_MAIN_COLOR_SIZE_0';
7029
7021
  const PLAYER_OPTIONS_ENV_EDITOR = 'editor';
7030
7022
  const HELP_LINK = {
7031
- 'Filter not imported': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg',
7032
- 'Item duration can\'t be less than 0': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg'
7023
+ 'Item duration can\'t be less than 0': 'https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS',
7024
+ 'ValueType: 21/22 is not supported': 'https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b'
7033
7025
  };
7034
7026
 
7035
7027
  /**
@@ -7210,17 +7202,17 @@ const downgradeKeywords = {
7210
7202
  };
7211
7203
  /**
7212
7204
  * 生成 shader,检测到 WebGL1 上下文会降级
7213
- * @param marcos - 宏定义数组
7205
+ * @param macros - 宏定义数组
7214
7206
  * @param shader - 原始 shader 文本
7215
7207
  * @param shaderType - shader 类型
7216
7208
  * @return 去除版本号的 shader 文本
7217
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7209
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7218
7210
  const ret = [];
7219
7211
  let header = '';
7220
7212
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7221
7213
  ret.push('#define GE_RUNTIME');
7222
- if (marcos) {
7223
- marcos.forEach(([key, value])=>{
7214
+ if (macros) {
7215
+ macros.forEach(([key, value])=>{
7224
7216
  if (value === true) {
7225
7217
  ret.push(`#define ${key}`);
7226
7218
  } else if (Number.isFinite(value)) {
@@ -7331,7 +7323,7 @@ function setBlendMode(material, blendMode) {
7331
7323
  ];
7332
7324
  break;
7333
7325
  default:
7334
- console.warn(`blendMode ${blendMode} not in specification, please set blend params separately`);
7326
+ console.warn(`BlendMode ${blendMode} not in specification, please set blend params separately.`);
7335
7327
  }
7336
7328
  }
7337
7329
  function setSideMode(material, side) {
@@ -7377,7 +7369,7 @@ function setMaskMode(material, maskMode) {
7377
7369
  material.stencilTest = false;
7378
7370
  break;
7379
7371
  default:
7380
- console.warn(`maskMode ${maskMode} not in specification, please set stencil params seperately`);
7372
+ console.warn(`MaskMode ${maskMode} not in specification, please set stencil params seperately.`);
7381
7373
  }
7382
7374
  }
7383
7375
 
@@ -7549,7 +7541,7 @@ function _loadImage() {
7549
7541
  }
7550
7542
  // 2. 非法类型
7551
7543
  if (!url) {
7552
- throw new Error(`Invalid url type: ${JSON.stringify(source)}`);
7544
+ throw new Error(`Invalid url type: ${JSON.stringify(source)}.`);
7553
7545
  }
7554
7546
  return new Promise((resolve, reject)=>{
7555
7547
  const img = new Image();
@@ -7662,13 +7654,13 @@ function _loadMedia() {
7662
7654
  return _loadMedia.apply(this, arguments);
7663
7655
  }
7664
7656
 
7665
- function deserializeMipmapTexture(texOpts, bins) {
7657
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
7666
7658
  return _deserializeMipmapTexture.apply(this, arguments);
7667
7659
  }
7668
7660
  function _deserializeMipmapTexture() {
7669
- _deserializeMipmapTexture = _async_to_generator(function*(texOpts, bins, files = [], engine) {
7670
- if (texOpts.target === 34067) {
7671
- const { mipmaps, target } = texOpts;
7661
+ _deserializeMipmapTexture = _async_to_generator(function*(textureOptions, bins, engine, files = []) {
7662
+ if (textureOptions.target === 34067) {
7663
+ const { mipmaps, target } = textureOptions;
7672
7664
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
7673
7665
  const loadedMipmaps = [];
7674
7666
  for (const level of mipmaps){
@@ -7684,7 +7676,7 @@ function _deserializeMipmapTexture() {
7684
7676
  // const bin = files[mipmaps[0][0][1][0]].url;
7685
7677
  return _extends({
7686
7678
  keepImageSource: false
7687
- }, texOpts, {
7679
+ }, textureOptions, {
7688
7680
  mipmaps: loadedMipmaps,
7689
7681
  sourceFrom: {
7690
7682
  target,
@@ -7694,13 +7686,13 @@ function _deserializeMipmapTexture() {
7694
7686
  });
7695
7687
  } else {
7696
7688
  // TODO: 补充测试用例
7697
- const { mipmaps, target } = texOpts;
7689
+ const { mipmaps, target } = textureOptions;
7698
7690
  const jobs = mipmaps.map((pointer)=>loadMipmapImage(pointer, bins));
7699
7691
  const loadedMipmaps = yield Promise.all(jobs);
7700
7692
  const bin = files[mipmaps[0][1][0]].url;
7701
7693
  return _extends({
7702
7694
  keepImageSource: false
7703
- }, texOpts, {
7695
+ }, textureOptions, {
7704
7696
  mipmaps: loadedMipmaps,
7705
7697
  sourceType: TextureSourceType.mipmaps,
7706
7698
  sourceFrom: {
@@ -7725,7 +7717,7 @@ function _loadMipmapImage() {
7725
7717
  const [index, start, length] = pointer[1];
7726
7718
  const bin = bins[index];
7727
7719
  if (!bin) {
7728
- throw new Error(`invalid bin pointer: ${JSON.stringify(pointer)}`);
7720
+ throw new Error(`Invalid bin pointer: ${JSON.stringify(pointer)}.`);
7729
7721
  }
7730
7722
  return loadImage(new Blob([
7731
7723
  new Uint8Array(bin, start, length)
@@ -7924,7 +7916,7 @@ class KTXTexture {
7924
7916
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
7925
7917
  const identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
7926
7918
  if (identifier[0] !== 0xab || identifier[1] !== 0x4b || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 || identifier[6] !== 0x31 || identifier[7] !== 0xbb || identifier[8] !== 0x0d || identifier[9] !== 0x0a || identifier[10] !== 0x1a || identifier[11] !== 0x0a) {
7927
- throw Error('texture missing KTX identifier');
7919
+ throw new Error('Texture missing KTX identifier.');
7928
7920
  }
7929
7921
  // load the reset of the header in native 32 bit uint
7930
7922
  const dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -7946,15 +7938,15 @@ class KTXTexture {
7946
7938
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
7947
7939
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
7948
7940
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
7949
- logger.warn('Only 2D textures currently supported');
7941
+ logger.warn('Only 2D textures currently supported.');
7950
7942
  return;
7951
7943
  }
7952
7944
  if (this.numberOfArrayElements !== 0) {
7953
- logger.warn('Texture arrays not currently supported');
7945
+ logger.warn('Texture arrays not currently supported.');
7954
7946
  return;
7955
7947
  }
7956
7948
  if (this.numberOfFaces !== facesExpected) {
7957
- logger.warn('Number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);
7949
+ logger.warn(`Number of faces expected ${facesExpected}, but found ${this.numberOfFaces}.`);
7958
7950
  return;
7959
7951
  }
7960
7952
  // we now have a completely validated file, so could use existence of loadType as success
@@ -7994,7 +7986,7 @@ class TextureFactory {
7994
7986
  texture.updateSource(sourceOpts);
7995
7987
  _this.reloadPending[id] = false;
7996
7988
  } else {
7997
- throw new Error('No source from');
7989
+ throw new Error('No source from.');
7998
7990
  }
7999
7991
  })();
8000
7992
  }
@@ -8121,7 +8113,7 @@ class TextureFactory {
8121
8113
  });
8122
8114
  }
8123
8115
  }
8124
- throw new Error(`Invalid resource type: ${type}`);
8116
+ throw new Error(`Invalid resource type: ${type}.`);
8125
8117
  })();
8126
8118
  }
8127
8119
  loadMipmapImages(pointers, bin) {
@@ -8937,19 +8929,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
8937
8929
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
8938
8930
  }
8939
8931
  if (x1 < 0) {
8940
- console.error('invalid bezier points, x1 < 0', p0, p1, p2, p3);
8932
+ console.error('Invalid bezier points, x1 < 0', p0, p1, p2, p3);
8941
8933
  x1 = 0;
8942
8934
  }
8943
8935
  if (x2 < 0) {
8944
- console.error('invalid bezier points, x2 < 0', p0, p1, p2, p3);
8936
+ console.error('Invalid bezier points, x2 < 0', p0, p1, p2, p3);
8945
8937
  x2 = 0;
8946
8938
  }
8947
8939
  if (x1 > 1) {
8948
- console.error('invalid bezier points, x1 >= 1', p0, p1, p2, p3);
8940
+ console.error('Invalid bezier points, x1 >= 1', p0, p1, p2, p3);
8949
8941
  x1 = 1;
8950
8942
  }
8951
8943
  if (x2 > 1) {
8952
- console.error('invalid bezier points, x2 >= 1', p0, p1, p2, p3);
8944
+ console.error('Invalid bezier points, x2 >= 1', p0, p1, p2, p3);
8953
8945
  x2 = 1;
8954
8946
  }
8955
8947
  const str = ('bez_' + x1 + '_' + y1 + '_' + x2 + '_' + y2).replace(/\./g, 'p');
@@ -9133,31 +9125,31 @@ class ValueGetter {
9133
9125
  return halfFloat ? ret.data : ret;
9134
9126
  }
9135
9127
  onCreate(props) {
9136
- throw Error(NOT_IMPLEMENT);
9128
+ throw new Error(NOT_IMPLEMENT);
9137
9129
  }
9138
9130
  getIntegrateValue(t0, t1, timeScale = 1) {
9139
- throw Error(NOT_IMPLEMENT);
9131
+ throw new Error(NOT_IMPLEMENT);
9140
9132
  }
9141
9133
  getIntegrateByTime(t0, time) {
9142
- throw Error(NOT_IMPLEMENT);
9134
+ throw new Error(NOT_IMPLEMENT);
9143
9135
  }
9144
9136
  getValue(time) {
9145
- throw Error(NOT_IMPLEMENT);
9137
+ throw new Error(NOT_IMPLEMENT);
9146
9138
  }
9147
9139
  getMaxTime() {
9148
- throw Error(NOT_IMPLEMENT);
9140
+ throw new Error(NOT_IMPLEMENT);
9149
9141
  }
9150
9142
  toUniform(meta) {
9151
- throw Error(NOT_IMPLEMENT);
9143
+ throw new Error(NOT_IMPLEMENT);
9152
9144
  }
9153
9145
  map(func) {
9154
- throw Error(NOT_IMPLEMENT);
9146
+ throw new Error(NOT_IMPLEMENT);
9155
9147
  }
9156
9148
  scaleXCoord(scale) {
9157
9149
  return this;
9158
9150
  }
9159
9151
  toData() {
9160
- throw Error(NOT_IMPLEMENT);
9152
+ throw new Error(NOT_IMPLEMENT);
9161
9153
  }
9162
9154
  constructor(arg){
9163
9155
  this.onCreate(arg);
@@ -9209,7 +9201,7 @@ class RandomValue extends ValueGetter {
9209
9201
  this.max = props[1];
9210
9202
  }
9211
9203
  getValue(time) {
9212
- return random(this.min, this.max);
9204
+ return randomInRange(this.min, this.max);
9213
9205
  }
9214
9206
  toUniform() {
9215
9207
  return new Float32Array([
@@ -9789,7 +9781,7 @@ function createValueGetter(args) {
9789
9781
  if (isFunction(map$1[args[0]])) {
9790
9782
  return map$1[args[0]](args[1]);
9791
9783
  } else {
9792
- throw new Error(`ValueType: ${args[0]} is not support`);
9784
+ throw new Error(`ValueType: ${args[0]} is not supported, see ${HELP_LINK['ValueType: 21/22 is not supported']}.`);
9793
9785
  }
9794
9786
  }
9795
9787
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -9963,7 +9955,7 @@ function createCopyShader(level, writeDepth) {
9963
9955
  vertex: version + '\n' + COPY_VERTEX_SHADER,
9964
9956
  fragment: version + '\n' + COPY_FRAGMENT_SHADER,
9965
9957
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
9966
- marcos: [
9958
+ macros: [
9967
9959
  [
9968
9960
  'WEBGL2',
9969
9961
  !!webgl2
@@ -10027,7 +10019,7 @@ class PassTextureCache {
10027
10019
  const refCount = this.textureRef[id];
10028
10020
  if (refCount <= 1) {
10029
10021
  if (refCount < 0) {
10030
- console.error('ref count < 0');
10022
+ console.error('Ref count < 0.');
10031
10023
  }
10032
10024
  const tex = this.textureCache[id];
10033
10025
  if (tex) {
@@ -10641,21 +10633,21 @@ let seed$6 = 1;
10641
10633
  }
10642
10634
  }
10643
10635
 
10644
- var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
10636
+ var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
10645
10637
 
10646
10638
  var compatible_frag = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n";
10647
10639
 
10648
10640
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
10649
10641
 
10650
- var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
10642
+ var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
10651
10643
 
10652
10644
  var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}";
10653
10645
 
10654
10646
  var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
10655
10647
 
10656
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
10648
+ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
10657
10649
 
10658
- var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
10650
+ var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
10659
10651
 
10660
10652
  var particleVert = "#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
10661
10653
 
@@ -11802,20 +11794,20 @@ class GPUCapability {
11802
11794
  framebufferTexture2D(gl, target, index, textarget, texture) {
11803
11795
  const ext = this.drawBufferExtension;
11804
11796
  if (this.level === 1 && !ext && index > 0) {
11805
- throw new Error('draw multiple color buffers not available');
11797
+ throw new Error('Draw multiple color buffers not available.');
11806
11798
  }
11807
11799
  const attachment = ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : gl[`COLOR_ATTACHMENT${index}`];
11808
11800
  if (attachment) {
11809
11801
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
11810
11802
  } else {
11811
- console.error('invalid color attachment index: ' + index);
11803
+ console.error(`Invalid color attachment index: ${index}.`);
11812
11804
  }
11813
11805
  }
11814
11806
  drawBuffers(gl, bufferStates) {
11815
11807
  const ext = this.drawBufferExtension;
11816
11808
  if (this.level === 1 && !ext) {
11817
11809
  if (bufferStates.length > 1) {
11818
- throw Error('draw buffers not available');
11810
+ throw new Error('Draw buffers not available.');
11819
11811
  } else {
11820
11812
  return;
11821
11813
  }
@@ -12075,7 +12067,7 @@ class InteractMesh {
12075
12067
  }
12076
12068
  createMaterial(rendererOptions) {
12077
12069
  var _this_engine_renderer;
12078
- const marcos = [
12070
+ const macros = [
12079
12071
  [
12080
12072
  'ENV_EDITOR',
12081
12073
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12088,7 +12080,7 @@ class InteractMesh {
12088
12080
  fragment,
12089
12081
  glslVersion: GLSLVersion.GLSL1,
12090
12082
  cacheId: `${rendererOptions.cachePrefix}_effects_interact`,
12091
- marcos
12083
+ macros
12092
12084
  },
12093
12085
  uniformSemantics: {
12094
12086
  effects_MatrixVP: 'VIEWPROJECTION',
@@ -12353,16 +12345,12 @@ function shouldIgnoreBouncing(arg, mul) {
12353
12345
  }
12354
12346
 
12355
12347
  let maxSpriteMeshItemCount = 8;
12356
- let maxSpriteTextureCount = 8;
12357
12348
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
12358
- // 8 or 16
12359
- maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
12360
12349
  if (gpuCapability.maxVertexUniforms >= 256) {
12361
12350
  return maxSpriteMeshItemCount = 32;
12362
12351
  } else if (gpuCapability.maxVertexUniforms >= 128) {
12363
12352
  return maxSpriteMeshItemCount = 16;
12364
12353
  }
12365
- maxSpriteTextureCount = 8;
12366
12354
  }
12367
12355
  function getImageItemRenderInfo(item) {
12368
12356
  const { renderer } = item;
@@ -12380,27 +12368,11 @@ function getImageItemRenderInfo(item) {
12380
12368
  };
12381
12369
  }
12382
12370
  function spriteMeshShaderFromFilter(level, options) {
12383
- const { count = 2, env = '', ignoreBlend, wireframe } = options != null ? options : {};
12384
- const marcos = [
12385
- [
12386
- 'MAX_ITEM_COUNT',
12387
- count
12388
- ],
12389
- [
12390
- 'PRE_MULTIPLY_ALPHA',
12391
- false
12392
- ],
12371
+ const { env = '', wireframe } = options != null ? options : {};
12372
+ const macros = [
12393
12373
  [
12394
12374
  'ENV_EDITOR',
12395
12375
  env === PLAYER_OPTIONS_ENV_EDITOR
12396
- ],
12397
- [
12398
- 'USE_BLEND',
12399
- !ignoreBlend
12400
- ],
12401
- [
12402
- 'MAX_FRAG_TEX',
12403
- maxSpriteTextureCount >= 16 ? 16 : 8
12404
12376
  ]
12405
12377
  ];
12406
12378
  const fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -12409,7 +12381,7 @@ function spriteMeshShaderFromFilter(level, options) {
12409
12381
  fragment,
12410
12382
  vertex,
12411
12383
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
12412
- marcos,
12384
+ macros,
12413
12385
  shared: true
12414
12386
  };
12415
12387
  }
@@ -12419,7 +12391,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
12419
12391
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
12420
12392
  const { wireframe } = renderInfo;
12421
12393
  const shader = spriteMeshShaderFromFilter(level, {
12422
- count,
12423
12394
  wireframe,
12424
12395
  env
12425
12396
  });
@@ -12433,9 +12404,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
12433
12404
  function setMaxSpriteMeshItemCount(count) {
12434
12405
  maxSpriteMeshItemCount = count;
12435
12406
  }
12436
- function setSpriteMeshMaxFragmentTextures(count) {
12437
- maxSpriteTextureCount = count;
12438
- }
12439
12407
 
12440
12408
  const defRenderInfo = {
12441
12409
  blending: 0,
@@ -13779,7 +13747,7 @@ class Cone {
13779
13747
  // dir + [0,0,1]
13780
13748
  dir.z += 1;
13781
13749
  return {
13782
- position: position.multiply(random(0, 1)),
13750
+ position: position.multiply(randomInRange(0, 1)),
13783
13751
  direction: dir.normalize()
13784
13752
  };
13785
13753
  }
@@ -13791,7 +13759,7 @@ class Cone {
13791
13759
  }
13792
13760
  function getArcAngle(arc, arcMode, opt) {
13793
13761
  if (arcMode === ShapeArcMode.RANDOM) {
13794
- arc = random(0, arc);
13762
+ arc = randomInRange(0, arc);
13795
13763
  } else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
13796
13764
  const d = opt.index % (opt.total + 1);
13797
13765
  arc = arc / opt.total * d;
@@ -13823,8 +13791,8 @@ class Circle {
13823
13791
  }
13824
13792
  class Rectangle {
13825
13793
  generate(opt) {
13826
- const x = random(-this._d, this._d);
13827
- const y = random(-this._h, this._h);
13794
+ const x = randomInRange(-this._d, this._d);
13795
+ const y = randomInRange(-this._h, this._h);
13828
13796
  return {
13829
13797
  direction: new Vector3(0, 0, 1),
13830
13798
  position: new Vector3(x, y, 0)
@@ -13869,7 +13837,7 @@ class RectangleEdge {
13869
13837
  }
13870
13838
  class Edge {
13871
13839
  generate(options) {
13872
- const x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
13840
+ const x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : randomInRange(0, 1);
13873
13841
  return {
13874
13842
  direction: new Vector3(0, 1, 0),
13875
13843
  position: new Vector3(this._d * (x - 0.5), 0, 0)
@@ -13887,7 +13855,7 @@ class Donut {
13887
13855
  generate(opt) {
13888
13856
  const dradius = this.donutRadius;
13889
13857
  const center = this.radius - dradius;
13890
- const angle = random(0, Math.PI * 2);
13858
+ const angle = randomInRange(0, Math.PI * 2);
13891
13859
  const arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
13892
13860
  const rot = tempMat4$2.setFromRotationZ(arc);
13893
13861
  const direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
@@ -13907,7 +13875,7 @@ class Donut {
13907
13875
  const tempMat4$1 = new Matrix4();
13908
13876
  class Sphere {
13909
13877
  getHorizontalAngle() {
13910
- return random(-90, 90);
13878
+ return randomInRange(-90, 90);
13911
13879
  }
13912
13880
  generate(opt) {
13913
13881
  const rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
@@ -13929,7 +13897,7 @@ class Sphere {
13929
13897
  }
13930
13898
  class Hemisphere extends Sphere {
13931
13899
  getHorizontalAngle() {
13932
- return random(0, 90);
13900
+ return randomInRange(0, 90);
13933
13901
  }
13934
13902
  }
13935
13903
 
@@ -13999,7 +13967,7 @@ function createShape(shapeOptions) {
13999
13967
  const { type } = shapeOptions;
14000
13968
  const Ctrl = map[type];
14001
13969
  if (!Ctrl) {
14002
- throw Error('invalid shape:' + type);
13970
+ throw new Error(`Invalid shape: ${type}.`);
14003
13971
  }
14004
13972
  const ctrl = new Ctrl(options);
14005
13973
  if (type !== ShapeType.NONE) {
@@ -14968,7 +14936,7 @@ class TrailMesh {
14968
14936
  const uniformValues = {};
14969
14937
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
14970
14938
  const lookUpTexture = 0;
14971
- const marcos = [
14939
+ const macros = [
14972
14940
  [
14973
14941
  'ENABLE_VERTEX_TEXTURE',
14974
14942
  enableVertexTexture
@@ -14985,7 +14953,7 @@ class TrailMesh {
14985
14953
  const useAttributeTrailStart = maxTrailCount > 64;
14986
14954
  let shaderCacheId = 0;
14987
14955
  if (colorOverLifetime) {
14988
- marcos.push([
14956
+ macros.push([
14989
14957
  'COLOR_OVER_LIFETIME',
14990
14958
  true
14991
14959
  ]);
@@ -14993,7 +14961,7 @@ class TrailMesh {
14993
14961
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
14994
14962
  }
14995
14963
  if (colorOverTrail) {
14996
- marcos.push([
14964
+ macros.push([
14997
14965
  'COLOR_OVER_TRAIL',
14998
14966
  true
14999
14967
  ]);
@@ -15001,7 +14969,7 @@ class TrailMesh {
15001
14969
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15002
14970
  }
15003
14971
  if (useAttributeTrailStart) {
15004
- marcos.push([
14972
+ macros.push([
15005
14973
  'ATTR_TRAIL_START',
15006
14974
  1
15007
14975
  ]);
@@ -15011,7 +14979,7 @@ class TrailMesh {
15011
14979
  }
15012
14980
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15013
14981
  const uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15014
- marcos.push([
14982
+ macros.push([
15015
14983
  'VERT_CURVE_VALUE_COUNT',
15016
14984
  keyFrameMeta.index
15017
14985
  ], [
@@ -15030,7 +14998,7 @@ class TrailMesh {
15030
14998
  shader: {
15031
14999
  vertex,
15032
15000
  fragment,
15033
- marcos,
15001
+ macros,
15034
15002
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
15035
15003
  shared: true,
15036
15004
  name: `trail#${name}`,
@@ -15185,11 +15153,11 @@ function calculateDirection(prePoint, point, nextPoint) {
15185
15153
  }
15186
15154
  return dir.normalize().toArray();
15187
15155
  }
15188
- function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapability) {
15156
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env = '') {
15189
15157
  let shaderCacheId = 0;
15190
15158
  const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15191
15159
  const enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
15192
- const marcos = [
15160
+ const macros = [
15193
15161
  [
15194
15162
  'ENABLE_VERTEX_TEXTURE',
15195
15163
  enableVertexTexture
@@ -15205,14 +15173,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15205
15173
  ];
15206
15174
  const keyFrameMeta = createKeyFrameMeta();
15207
15175
  if (trails.colorOverLifetime) {
15208
- marcos.push([
15176
+ macros.push([
15209
15177
  'COLOR_OVER_LIFETIME',
15210
15178
  true
15211
15179
  ]);
15212
15180
  shaderCacheId |= 1;
15213
15181
  }
15214
15182
  if (trails.colorOverTrail) {
15215
- marcos.push([
15183
+ macros.push([
15216
15184
  'COLOR_OVER_TRAIL',
15217
15185
  true
15218
15186
  ]);
@@ -15220,7 +15188,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15220
15188
  }
15221
15189
  const useAttributeTrailStart = particleMaxCount > 64;
15222
15190
  if (useAttributeTrailStart) {
15223
- marcos.push([
15191
+ macros.push([
15224
15192
  'ATTR_TRAIL_START',
15225
15193
  1
15226
15194
  ]);
@@ -15228,7 +15196,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15228
15196
  }
15229
15197
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
15230
15198
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
15231
- marcos.push([
15199
+ macros.push([
15232
15200
  'VERT_CURVE_VALUE_COUNT',
15233
15201
  keyFrameMeta.index
15234
15202
  ], [
@@ -15238,7 +15206,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15238
15206
  return {
15239
15207
  vertex: trailVert,
15240
15208
  fragment: particleFrag,
15241
- marcos,
15209
+ macros,
15242
15210
  shared: true,
15243
15211
  name: 'trail#' + name,
15244
15212
  cacheId: `-t:+${shaderCacheId}+${keyFrameMeta.index}+${keyFrameMeta.max}`
@@ -15925,11 +15893,9 @@ class ParticleSystem extends Component {
15925
15893
  this.props = props;
15926
15894
  this.destroyed = false;
15927
15895
  const cachePrefix = '';
15928
- const options = props.options;
15929
- const positionOverLifetime = props.positionOverLifetime;
15930
- const shape = props.shape;
15931
- const gravityModifier = positionOverLifetime.gravityOverLifetime;
15932
- const gravity = ensureVec3(positionOverLifetime.gravity);
15896
+ const { options, positionOverLifetime = {}, shape } = props;
15897
+ const gravityModifier = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime;
15898
+ const gravity = ensureVec3(positionOverLifetime == null ? void 0 : positionOverLifetime.gravity);
15933
15899
  const _textureSheetAnimation = props.textureSheetAnimation;
15934
15900
  const textureSheetAnimation = _textureSheetAnimation ? {
15935
15901
  animationDelay: createValueGetter(_textureSheetAnimation.animationDelay || 0),
@@ -15940,7 +15906,7 @@ class ParticleSystem extends Component {
15940
15906
  row: _textureSheetAnimation.row,
15941
15907
  total: _textureSheetAnimation.total || _textureSheetAnimation.col * _textureSheetAnimation.row
15942
15908
  } : undefined;
15943
- const startTurbulence = !!(shape && shape.turbulenceX || shape.turbulenceY || shape.turbulenceZ);
15909
+ const startTurbulence = !!(shape && shape.turbulenceX || (shape == null ? void 0 : shape.turbulenceY) || (shape == null ? void 0 : shape.turbulenceZ));
15944
15910
  let turbulence;
15945
15911
  if (startTurbulence) {
15946
15912
  var _shape_turbulenceX, _shape_turbulenceY, _shape_turbulenceZ;
@@ -15971,7 +15937,7 @@ class ParticleSystem extends Component {
15971
15937
  }
15972
15938
  }
15973
15939
  let forceTarget;
15974
- if (positionOverLifetime.forceTarget) {
15940
+ if (positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget) {
15975
15941
  forceTarget = {
15976
15942
  target: positionOverLifetime.target || [
15977
15943
  0,
@@ -16551,15 +16517,12 @@ class ParticleMesh {
16551
16517
  const { speedOverLifetime, colorOverLifetime, linearVelOverLifetime, orbitalVelOverLifetime, sizeOverLifetime, rotationOverLifetime, sprite, gravityModifier, maxCount, textureFlip, useSprite, name, gravity, forceTarget, side, occlusion, anchor, blending, maskMode, mask, transparentOcclusion, meshSlots, renderMode = 0, diffuse = Texture.createWithData(engine) } = props;
16552
16518
  const { detail } = engine.gpuCapability;
16553
16519
  const { halfFloatTexture, maxVertexUniforms } = detail;
16554
- const marcos = [
16520
+ const macros = [
16521
+ // spec.RenderMode
16555
16522
  [
16556
16523
  'RENDER_MODE',
16557
16524
  +renderMode
16558
16525
  ],
16559
- [
16560
- 'PRE_MULTIPLY_ALPHA',
16561
- false
16562
- ],
16563
16526
  [
16564
16527
  'ENV_EDITOR',
16565
16528
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -16575,13 +16538,13 @@ class ParticleMesh {
16575
16538
  let useOrbitalVel;
16576
16539
  this.useSprite = useSprite;
16577
16540
  if (enableVertexTexture) {
16578
- marcos.push([
16541
+ macros.push([
16579
16542
  'ENABLE_VERTEX_TEXTURE',
16580
16543
  true
16581
16544
  ]);
16582
16545
  }
16583
16546
  if (speedOverLifetime) {
16584
- marcos.push([
16547
+ macros.push([
16585
16548
  'SPEED_OVER_LIFETIME',
16586
16549
  true
16587
16550
  ]);
@@ -16589,7 +16552,7 @@ class ParticleMesh {
16589
16552
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
16590
16553
  }
16591
16554
  if (sprite == null ? void 0 : sprite.animate) {
16592
- marcos.push([
16555
+ macros.push([
16593
16556
  'USE_SPRITE',
16594
16557
  true
16595
16558
  ]);
@@ -16603,7 +16566,7 @@ class ParticleMesh {
16603
16566
  this.useSprite = true;
16604
16567
  }
16605
16568
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
16606
- marcos.push([
16569
+ macros.push([
16607
16570
  'COLOR_OVER_LIFETIME',
16608
16571
  true
16609
16572
  ]);
@@ -16628,7 +16591,7 @@ class ParticleMesh {
16628
16591
  shaderCacheId |= 1 << 7 + i;
16629
16592
  linearVelOverLifetime.enabled = true;
16630
16593
  }
16631
- marcos.push([
16594
+ macros.push([
16632
16595
  `LINEAR_VEL_${pro.toUpperCase()}`,
16633
16596
  defL
16634
16597
  ]);
@@ -16639,13 +16602,13 @@ class ParticleMesh {
16639
16602
  useOrbitalVel = true;
16640
16603
  orbitalVelOverLifetime.enabled = true;
16641
16604
  }
16642
- marcos.push([
16605
+ macros.push([
16643
16606
  `ORB_VEL_${pro.toUpperCase()}`,
16644
16607
  defO
16645
16608
  ]);
16646
16609
  });
16647
16610
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
16648
- marcos.push([
16611
+ macros.push([
16649
16612
  'AS_LINEAR_MOVEMENT',
16650
16613
  true
16651
16614
  ]);
@@ -16653,7 +16616,7 @@ class ParticleMesh {
16653
16616
  }
16654
16617
  if (useOrbitalVel) {
16655
16618
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
16656
- marcos.push([
16619
+ macros.push([
16657
16620
  'AS_ORBITAL_MOVEMENT',
16658
16621
  true
16659
16622
  ]);
@@ -16668,7 +16631,7 @@ class ParticleMesh {
16668
16631
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
16669
16632
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
16670
16633
  var _sizeOverLifetime_y;
16671
- marcos.push([
16634
+ macros.push([
16672
16635
  'SIZE_Y_BY_LIFE',
16673
16636
  1
16674
16637
  ]);
@@ -16678,7 +16641,7 @@ class ParticleMesh {
16678
16641
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
16679
16642
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
16680
16643
  shaderCacheId |= 1 << 15;
16681
- marcos.push([
16644
+ macros.push([
16682
16645
  'ROT_Z_LIFETIME',
16683
16646
  1
16684
16647
  ]);
@@ -16686,7 +16649,7 @@ class ParticleMesh {
16686
16649
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
16687
16650
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
16688
16651
  shaderCacheId |= 1 << 16;
16689
- marcos.push([
16652
+ macros.push([
16690
16653
  'ROT_X_LIFETIME',
16691
16654
  1
16692
16655
  ]);
@@ -16694,13 +16657,13 @@ class ParticleMesh {
16694
16657
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
16695
16658
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
16696
16659
  shaderCacheId |= 1 << 17;
16697
- marcos.push([
16660
+ macros.push([
16698
16661
  'ROT_Y_LIFETIME',
16699
16662
  1
16700
16663
  ]);
16701
16664
  }
16702
16665
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
16703
- marcos.push([
16666
+ macros.push([
16704
16667
  'ROT_LIFETIME_AS_MOVEMENT',
16705
16668
  1
16706
16669
  ]);
@@ -16708,7 +16671,7 @@ class ParticleMesh {
16708
16671
  }
16709
16672
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
16710
16673
  if (forceTarget) {
16711
- marcos.push([
16674
+ macros.push([
16712
16675
  'FINAL_TARGET',
16713
16676
  true
16714
16677
  ]);
@@ -16754,7 +16717,7 @@ class ParticleMesh {
16754
16717
  fragmentKeyFrameMeta.index,
16755
16718
  fragmentKeyFrameMeta.max
16756
16719
  ].join('+');
16757
- marcos.push([
16720
+ macros.push([
16758
16721
  'VERT_CURVE_VALUE_COUNT',
16759
16722
  vertexKeyFrameMeta.index
16760
16723
  ], [
@@ -16776,7 +16739,7 @@ class ParticleMesh {
16776
16739
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
16777
16740
  shared: true,
16778
16741
  cacheId: shaderCache,
16779
- marcos,
16742
+ macros,
16780
16743
  name: `particle#${name}`
16781
16744
  };
16782
16745
  const mtlOptions = {
@@ -16853,7 +16816,7 @@ class ParticleMesh {
16853
16816
  res.length = 0;
16854
16817
  break;
16855
16818
  default:
16856
- console.warn(`uniform ${name}'s type not in typeMap`);
16819
+ console.warn(`Uniform ${name}'s type not in typeMap.`);
16857
16820
  }
16858
16821
  });
16859
16822
  material.setVector3('emissionColor', new Vector3(0, 0, 0));
@@ -16984,19 +16947,15 @@ function generateGeometryProps(maxVertex, useSprite, name) {
16984
16947
  maxVertex
16985
16948
  };
16986
16949
  }
16987
- function getParticleMeshShader(item, env = '', gpuCapability) {
16950
+ function getParticleMeshShader(item, gpuCapability, env = '') {
16988
16951
  var _props_renderer;
16989
16952
  const props = item.content;
16990
16953
  const renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
16991
- const marcos = [
16954
+ const macros = [
16992
16955
  [
16993
16956
  'RENDER_MODE',
16994
16957
  renderMode
16995
16958
  ],
16996
- [
16997
- 'PRE_MULTIPLY_ALPHA',
16998
- false
16999
- ],
17000
16959
  [
17001
16960
  'ENV_EDITOR',
17002
16961
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17011,13 +16970,13 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17011
16970
  let vertex_lookup_texture = 0;
17012
16971
  let shaderCacheId = 0;
17013
16972
  if (enableVertexTexture) {
17014
- marcos.push([
16973
+ macros.push([
17015
16974
  'ENABLE_VERTEX_TEXTURE',
17016
16975
  true
17017
16976
  ]);
17018
16977
  }
17019
16978
  if (speedOverLifetime) {
17020
- marcos.push([
16979
+ macros.push([
17021
16980
  'SPEED_OVER_LIFETIME',
17022
16981
  true
17023
16982
  ]);
@@ -17026,7 +16985,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17026
16985
  }
17027
16986
  const sprite = props.textureSheetAnimation;
17028
16987
  if (sprite && sprite.animate) {
17029
- marcos.push([
16988
+ macros.push([
17030
16989
  'USE_SPRITE',
17031
16990
  true
17032
16991
  ]);
@@ -17034,7 +16993,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17034
16993
  }
17035
16994
  const colorOverLifetime = props.colorOverLifetime;
17036
16995
  if (colorOverLifetime && colorOverLifetime.color) {
17037
- marcos.push([
16996
+ macros.push([
17038
16997
  'COLOR_OVER_LIFETIME',
17039
16998
  true
17040
16999
  ]);
@@ -17059,7 +17018,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17059
17018
  defL = 1;
17060
17019
  shaderCacheId |= 1 << 7 + i;
17061
17020
  }
17062
- marcos.push([
17021
+ macros.push([
17063
17022
  `LINEAR_VEL_${pro.toUpperCase()}`,
17064
17023
  defL
17065
17024
  ]);
@@ -17070,13 +17029,13 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17070
17029
  shaderCacheId |= 1 << 10 + i;
17071
17030
  useOrbitalVel = true;
17072
17031
  }
17073
- marcos.push([
17032
+ macros.push([
17074
17033
  `ORB_VEL_${pro.toUpperCase()}`,
17075
17034
  defO
17076
17035
  ]);
17077
17036
  });
17078
17037
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
17079
- marcos.push([
17038
+ macros.push([
17080
17039
  'AS_LINEAR_MOVEMENT',
17081
17040
  true
17082
17041
  ]);
@@ -17084,7 +17043,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17084
17043
  }
17085
17044
  if (useOrbitalVel) {
17086
17045
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
17087
- marcos.push([
17046
+ macros.push([
17088
17047
  'AS_ORBITAL_MOVEMENT',
17089
17048
  true
17090
17049
  ]);
@@ -17096,7 +17055,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17096
17055
  const separateAxes = sizeOverLifetime.separateAxes;
17097
17056
  if (separateAxes) {
17098
17057
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
17099
- marcos.push([
17058
+ macros.push([
17100
17059
  'SIZE_Y_BY_LIFE',
17101
17060
  1
17102
17061
  ]);
@@ -17111,7 +17070,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17111
17070
  if (rot.z) {
17112
17071
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
17113
17072
  shaderCacheId |= 1 << 15;
17114
- marcos.push([
17073
+ macros.push([
17115
17074
  'ROT_Z_LIFETIME',
17116
17075
  1
17117
17076
  ]);
@@ -17120,7 +17079,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17120
17079
  if (rot.x) {
17121
17080
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
17122
17081
  shaderCacheId |= 1 << 16;
17123
- marcos.push([
17082
+ macros.push([
17124
17083
  'ROT_X_LIFETIME',
17125
17084
  1
17126
17085
  ]);
@@ -17128,14 +17087,14 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17128
17087
  if (rot.y) {
17129
17088
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
17130
17089
  shaderCacheId |= 1 << 17;
17131
- marcos.push([
17090
+ macros.push([
17132
17091
  'ROT_Y_LIFETIME',
17133
17092
  1
17134
17093
  ]);
17135
17094
  }
17136
17095
  }
17137
17096
  if (rot == null ? void 0 : rot.asRotation) {
17138
- marcos.push([
17097
+ macros.push([
17139
17098
  'ROT_LIFETIME_AS_MOVEMENT',
17140
17099
  1
17141
17100
  ]);
@@ -17145,7 +17104,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17145
17104
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
17146
17105
  const forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
17147
17106
  if (forceOpt) {
17148
- marcos.push([
17107
+ macros.push([
17149
17108
  'FINAL_TARGET',
17150
17109
  true
17151
17110
  ]);
@@ -17186,10 +17145,10 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17186
17145
  vertex: `#define LOOKUP_TEXTURE_CURVE ${vertex_lookup_texture}\n${particleVert}`,
17187
17146
  shared: true,
17188
17147
  cacheId: shaderCache,
17189
- marcos,
17148
+ macros,
17190
17149
  name: `particle#${item.name}`
17191
17150
  };
17192
- marcos.push([
17151
+ macros.push([
17193
17152
  'VERT_CURVE_VALUE_COUNT',
17194
17153
  vertexKeyFrameMeta.index
17195
17154
  ], [
@@ -17214,11 +17173,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
17214
17173
  shaderIds[3] = maxVertex;
17215
17174
  shaderIds[5] = maxFrag;
17216
17175
  shader.cacheId = shaderIds.join('+');
17217
- if (!shader.marcos) {
17176
+ if (!shader.macros) {
17218
17177
  return;
17219
17178
  }
17220
- for(let i = 0; i < shader.marcos.length; i++){
17221
- const marco = shader.marcos[i];
17179
+ for(let i = 0; i < shader.macros.length; i++){
17180
+ const marco = shader.macros[i];
17222
17181
  if (marco[0] === 'VERT_CURVE_VALUE_COUNT') {
17223
17182
  marco[1] = maxVertex;
17224
17183
  } else if (marco[0] === 'FRAG_CURVE_VALUE_COUNT') {
@@ -17247,17 +17206,17 @@ class ParticleLoader extends AbstractPlugin {
17247
17206
  });
17248
17207
  });
17249
17208
  items.forEach((item)=>{
17250
- const { shader, fragment, vertex } = getParticleMeshShader(item, env, gpuCapability);
17209
+ const { shader, fragment, vertex } = getParticleMeshShader(item, gpuCapability, env);
17251
17210
  shaders.push(shader);
17252
17211
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
17253
17212
  maxVertexCount = Math.max(maxVertexCount, vertex);
17254
17213
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
17255
17214
  if (item.content.trails) {
17256
- const shader = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
17257
- var _shader_marcos;
17258
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, ShaderType.vertex, level);
17259
- var _shader_marcos1;
17260
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, ShaderType.fragment, level);
17215
+ const shader = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
17216
+ var _shader_macros;
17217
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
17218
+ var _shader_macros1;
17219
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
17261
17220
  shader.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
17262
17221
  shaderLibrary.addShader(shader);
17263
17222
  }
@@ -17269,10 +17228,10 @@ class ParticleLoader extends AbstractPlugin {
17269
17228
  } else {
17270
17229
  shader.glslVersion = GLSLVersion.GLSL1;
17271
17230
  }
17272
- var _shader_marcos;
17273
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, ShaderType.vertex, level);
17274
- var _shader_marcos1;
17275
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, ShaderType.fragment, level);
17231
+ var _shader_macros;
17232
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
17233
+ var _shader_macros1;
17234
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
17276
17235
  shaderLibrary.addShader(shader);
17277
17236
  });
17278
17237
  if (level === 2) {
@@ -17590,6 +17549,27 @@ class AnimationClipPlayable extends Playable {
17590
17549
  }
17591
17550
  }
17592
17551
 
17552
+ /**
17553
+ * @since 2.0.0
17554
+ * @internal
17555
+ */ class TimelineClip {
17556
+ toLocalTime(time) {
17557
+ let localTime = time - this.start;
17558
+ const duration = this.duration;
17559
+ if (localTime - duration > 0.001) {
17560
+ if (this.endBehaviour === ItemEndBehavior.loop) {
17561
+ localTime = localTime % duration;
17562
+ } else if (this.endBehaviour === ItemEndBehavior.freeze) {
17563
+ localTime = Math.min(duration, localTime);
17564
+ }
17565
+ }
17566
+ return localTime;
17567
+ }
17568
+ constructor(){
17569
+ this.start = 0;
17570
+ this.duration = 0;
17571
+ }
17572
+ }
17593
17573
  class TrackAsset extends PlayableAsset {
17594
17574
  /**
17595
17575
  * 重写该方法以获取自定义对象绑定
@@ -17670,7 +17650,7 @@ class TrackAsset extends PlayableAsset {
17670
17650
  }
17671
17651
  }
17672
17652
  __decorate([
17673
- serialize('TimelineClip')
17653
+ serialize(TimelineClip)
17674
17654
  ], TrackAsset.prototype, "clips", void 0);
17675
17655
  __decorate([
17676
17656
  serialize()
@@ -17683,27 +17663,6 @@ var TrackType;
17683
17663
  TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
17684
17664
  TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
17685
17665
  })(TrackType || (TrackType = {}));
17686
- class TimelineClip {
17687
- toLocalTime(time) {
17688
- let localTime = time - this.start;
17689
- const duration = this.duration;
17690
- if (localTime - duration > 0.001) {
17691
- if (this.endBehaviour === ItemEndBehavior.loop) {
17692
- localTime = localTime % duration;
17693
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
17694
- localTime = Math.min(duration, localTime);
17695
- }
17696
- }
17697
- return localTime;
17698
- }
17699
- constructor(){
17700
- this.start = 0;
17701
- this.duration = 0;
17702
- }
17703
- }
17704
- TimelineClip = __decorate([
17705
- effectsClass('TimelineClip')
17706
- ], TimelineClip);
17707
17666
  class RuntimeClip {
17708
17667
  set enable(value) {
17709
17668
  if (value) {
@@ -17778,10 +17737,6 @@ class ObjectBindingTrack extends TrackAsset {
17778
17737
  particleClip.endBehaviour = boundItem.endBehavior;
17779
17738
  }
17780
17739
  }
17781
- fromData(data) {
17782
- super.fromData(data);
17783
- this.data = data;
17784
- }
17785
17740
  }
17786
17741
  ObjectBindingTrack = __decorate([
17787
17742
  effectsClass('ObjectBindingTrack')
@@ -17967,7 +17922,6 @@ function compareTracks(a, b) {
17967
17922
  this.startTime = startTime;
17968
17923
  this.resolveBindings();
17969
17924
  this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
17970
- this.timelinePlayable.play();
17971
17925
  // 重播不销毁元素
17972
17926
  if (this.item.endBehavior !== ItemEndBehavior.destroy) {
17973
17927
  this.setReusable(true);
@@ -18023,7 +17977,7 @@ function compareTracks(a, b) {
18023
17977
  const refId = itemData.content.options.refId;
18024
17978
  const props = this.item.composition.refCompositionProps.get(refId);
18025
17979
  if (!props) {
18026
- throw new Error(`引用的Id: ${refId} 的预合成不存在`);
17980
+ throw new Error(`Referenced precomposition with Id: ${refId} does not exist.`);
18027
17981
  }
18028
17982
  // endBehaviour 类型需优化
18029
17983
  props.content = itemData.content;
@@ -18167,7 +18121,7 @@ function compareTracks(a, b) {
18167
18121
  class SubCompositionTrack extends TrackAsset {
18168
18122
  resolveBinding(parentBinding) {
18169
18123
  if (!(parentBinding instanceof VFXItem)) {
18170
- throw new Error('SubCompositionTrack needs to be set under the VFXItem track');
18124
+ throw new Error('SubCompositionTrack needs to be set under the VFXItem track.');
18171
18125
  }
18172
18126
  return parentBinding.getComponent(CompositionComponent);
18173
18127
  }
@@ -18351,7 +18305,6 @@ class CanvasPool {
18351
18305
  return this.elements.shift();
18352
18306
  }
18353
18307
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
18354
- // @ts-expect-error
18355
18308
  return window._createOffscreenCanvas(10, 10);
18356
18309
  } else {
18357
18310
  // in hongmeng system, create too many canvas will case render error
@@ -19175,7 +19128,6 @@ class VFXItem extends EffectsObject {
19175
19128
  this.parentId = parentId;
19176
19129
  this.duration = duration;
19177
19130
  this.endBehavior = endBehavior;
19178
- this.renderOrder = listIndex;
19179
19131
  //@ts-expect-error
19180
19132
  this.oldId = data.oldId;
19181
19133
  if (!data.content) {
@@ -19184,19 +19136,13 @@ class VFXItem extends EffectsObject {
19184
19136
  };
19185
19137
  }
19186
19138
  if (duration <= 0) {
19187
- throw Error(`Item duration can't be less than 0, see ${HELP_LINK['Item duration can\'t be less than 0']}`);
19188
- }
19189
- if (data.components) {
19190
- for (const component of data.components){
19191
- const newComponent = component;
19192
- this.components.push(newComponent);
19193
- if (newComponent instanceof RendererComponent) {
19194
- this.rendererComponents.push(newComponent);
19195
- } else if (newComponent instanceof ItemBehaviour) {
19196
- this.itemBehaviours.push(newComponent);
19197
- }
19198
- }
19139
+ throw new Error(`Item duration can't be less than 0, see ${HELP_LINK['Item duration can\'t be less than 0']}.`);
19140
+ }
19141
+ for (const component of this.components){
19142
+ component.onAttached();
19199
19143
  }
19144
+ // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
19145
+ this.renderOrder = listIndex;
19200
19146
  }
19201
19147
  toData() {
19202
19148
  var _this_parent;
@@ -19291,6 +19237,7 @@ class VFXItem extends EffectsObject {
19291
19237
  /**
19292
19238
  * 元素动画的速度
19293
19239
  */ this.speed = 1;
19240
+ this.listIndex = 0;
19294
19241
  this.name = 'VFXItem';
19295
19242
  this.transform.name = this.name;
19296
19243
  this.transform.engine = engine;
@@ -19299,6 +19246,9 @@ class VFXItem extends EffectsObject {
19299
19246
  }
19300
19247
  }
19301
19248
  }
19249
+ __decorate([
19250
+ serialize()
19251
+ ], VFXItem.prototype, "components", void 0);
19302
19252
  VFXItem = __decorate([
19303
19253
  effectsClass(DataType.VFXItemData)
19304
19254
  ], VFXItem);
@@ -19352,7 +19302,7 @@ var Item;
19352
19302
  pluginName = 'tree';
19353
19303
  break;
19354
19304
  default:
19355
- throw new Error('invalid vfx item type');
19305
+ throw new Error('Invalid vfx item type.');
19356
19306
  }
19357
19307
  }
19358
19308
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -19393,13 +19343,13 @@ class PluginSystem {
19393
19343
  createPluginItem(name, props, composition) {
19394
19344
  const CTRL = pluginCtrlMap[name];
19395
19345
  if (!CTRL) {
19396
- throw new Error(`plugin ${name} no registered constructor`);
19346
+ throw new Error(`The plugin '${name}' does not have a registered constructor.`);
19397
19347
  }
19398
19348
  const engine = composition.getEngine();
19399
19349
  const item = new CTRL(engine, props, composition);
19400
19350
  item.composition = composition;
19401
19351
  if (!(item instanceof VFXItem)) {
19402
- throw new Error(`plugin ${name} invalid constructor type`);
19352
+ throw new Error(`The plugin '${name}' invalid constructor type.`);
19403
19353
  }
19404
19354
  return item;
19405
19355
  }
@@ -19452,7 +19402,7 @@ class PluginSystem {
19452
19402
  this.plugins = Object.keys(loaders).map((name)=>{
19453
19403
  const CTRL = pluginLoaderMap[name];
19454
19404
  if (!CTRL) {
19455
- throw new Error(`plugin '${name}' not found.` + getPluginUsageInfo(name));
19405
+ throw new Error(`The plugin '${name}' not found.` + getPluginUsageInfo(name));
19456
19406
  }
19457
19407
  const loader = new CTRL();
19458
19408
  loader.name = name;
@@ -19494,20 +19444,20 @@ class SerializationHelper {
19494
19444
  if (value === undefined) {
19495
19445
  value = effectsObject[key];
19496
19446
  }
19497
- if (value instanceof EffectsObject) {
19498
- this.collectSerializableObject(value, res);
19499
- } else if (value instanceof Array) {
19447
+ if (EffectsObject.is(value)) {
19448
+ SerializationHelper.collectSerializableObject(value, res);
19449
+ } else if (isArray(value)) {
19500
19450
  for (const arrayValue of value){
19501
- if (arrayValue instanceof EffectsObject) {
19502
- this.collectSerializableObject(arrayValue, res);
19451
+ if (EffectsObject.is(arrayValue)) {
19452
+ SerializationHelper.collectSerializableObject(arrayValue, res);
19503
19453
  }
19504
19454
  }
19505
- } else if (value instanceof Object) {
19455
+ } else if (isObject(value)) {
19506
19456
  // 非 EffectsObject 对象只递归一层
19507
19457
  for (const objectKey of Object.keys(value)){
19508
19458
  const objectValue = value[objectKey];
19509
- if (objectValue instanceof EffectsObject) {
19510
- this.collectSerializableObject(objectValue, res);
19459
+ if (EffectsObject.is(objectValue)) {
19460
+ SerializationHelper.collectSerializableObject(objectValue, res);
19511
19461
  }
19512
19462
  }
19513
19463
  }
@@ -19542,17 +19492,17 @@ class SerializationHelper {
19542
19492
  if (typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' || SerializationHelper.checkTypedArray(value)) {
19543
19493
  // TODO json 数据避免传 typedArray
19544
19494
  serializedData[key] = value;
19545
- } else if (value instanceof Array) {
19495
+ } else if (isArray(value)) {
19546
19496
  if (!serializedData[key]) {
19547
19497
  serializedData[key] = [];
19548
19498
  }
19549
19499
  SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
19550
- } else if (value instanceof EffectsObject) {
19500
+ } else if (EffectsObject.is(value)) {
19551
19501
  // TODO 处理 EffectsObject 递归序列化
19552
19502
  serializedData[key] = {
19553
19503
  id: value.getInstanceId()
19554
19504
  };
19555
- } else if (value instanceof Object) {
19505
+ } else if (isObject(value)) {
19556
19506
  if (!serializedData[key]) {
19557
19507
  serializedData[key] = {};
19558
19508
  }
@@ -19565,17 +19515,17 @@ class SerializationHelper {
19565
19515
  if (typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' || SerializationHelper.checkTypedArray(value)) {
19566
19516
  // TODO json 数据避免传 typedArray
19567
19517
  serializedData[key] = value;
19568
- } else if (value instanceof Array) {
19518
+ } else if (isArray(value)) {
19569
19519
  if (!serializedData[key]) {
19570
19520
  serializedData[key] = [];
19571
19521
  }
19572
19522
  SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
19573
- } else if (value instanceof EffectsObject) {
19523
+ } else if (EffectsObject.is(value)) {
19574
19524
  // TODO 处理 EffectsObject 递归序列化
19575
19525
  serializedData[key] = {
19576
19526
  id: value.getInstanceId()
19577
19527
  };
19578
- } else if (value instanceof Object) {
19528
+ } else if (isObject(value)) {
19579
19529
  if (!serializedData[key]) {
19580
19530
  serializedData[key] = {};
19581
19531
  }
@@ -19635,24 +19585,24 @@ class SerializationHelper {
19635
19585
  static checkTypedArray(obj) {
19636
19586
  return obj instanceof Int8Array || obj instanceof Uint8Array || obj instanceof Uint8ClampedArray || obj instanceof Int16Array || obj instanceof Uint16Array || obj instanceof Int32Array || obj instanceof Uint32Array || obj instanceof Float32Array || obj instanceof Float64Array || obj instanceof ArrayBuffer;
19637
19587
  }
19588
+ // check value is { id: 7e69662e964e4892ae8933f24562395b }
19638
19589
  static checkDataPath(value) {
19639
- // check value is { id: 7e69662e964e4892ae8933f24562395b }
19640
- return value instanceof Object && Object.keys(value).length === 1 && value.id && value.id.length === 32;
19590
+ return !!(isObject(value) && Object.keys(value).length === 1 && 'id' in value && isString(value.id) && value.id.length === 32);
19641
19591
  }
19642
19592
  // TODO 测试函数,2.0 上线后移除
19643
19593
  static checkGLTFNode(value) {
19644
- return value instanceof Object && value.nodeIndex !== undefined && value.isJoint !== undefined;
19594
+ return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
19645
19595
  }
19646
19596
  static checkImageSource(value) {
19647
19597
  return isCanvas(value) || value instanceof HTMLImageElement;
19648
19598
  }
19649
19599
  static deserializeProperty(property, engine, level, type) {
19650
19600
  if (level > 14) {
19651
- console.error('序列化数据的内嵌对象层数大于上限');
19601
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19652
19602
  return;
19653
19603
  }
19654
19604
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
19655
- if (property instanceof Array) {
19605
+ if (isArray(property)) {
19656
19606
  const res = [];
19657
19607
  for (const value of property){
19658
19608
  res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
@@ -19661,16 +19611,14 @@ class SerializationHelper {
19661
19611
  // TODO json 数据避免传 typedArray
19662
19612
  } else if (SerializationHelper.checkDataPath(property)) {
19663
19613
  return engine.assetLoader.loadGUID(property.id);
19664
- } else if (property instanceof Object && property.constructor === Object) {
19614
+ } else if (isObject(property) && property.constructor === Object) {
19665
19615
  let res;
19666
19616
  if (type) {
19667
- const classConstructor = effectsClassStore[type];
19668
- res = new classConstructor();
19617
+ res = new type();
19669
19618
  } else {
19670
19619
  res = {};
19671
19620
  }
19672
19621
  for (const key of Object.keys(property)){
19673
- // @ts-expect-error
19674
19622
  res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
19675
19623
  }
19676
19624
  return res;
@@ -19681,10 +19629,10 @@ class SerializationHelper {
19681
19629
  static deserializePropertyAsync(property, engine, level, type) {
19682
19630
  return _async_to_generator(function*() {
19683
19631
  if (level > 14) {
19684
- console.error('序列化数据的内嵌对象层数大于上限');
19632
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19685
19633
  return;
19686
19634
  }
19687
- if (property instanceof Array) {
19635
+ if (isArray(property)) {
19688
19636
  const res = [];
19689
19637
  for (const value of property){
19690
19638
  res.push((yield SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)));
@@ -19694,16 +19642,14 @@ class SerializationHelper {
19694
19642
  } else if (SerializationHelper.checkDataPath(property)) {
19695
19643
  const res = yield engine.assetLoader.loadGUIDAsync(property.id);
19696
19644
  return res;
19697
- } else if (property instanceof Object && property.constructor === Object) {
19645
+ } else if (isObject(property) && property.constructor === Object) {
19698
19646
  let res;
19699
19647
  if (type) {
19700
- const classConstructor = effectsClassStore[type];
19701
- res = new classConstructor();
19648
+ res = new type();
19702
19649
  } else {
19703
19650
  res = {};
19704
19651
  }
19705
19652
  for (const key of Object.keys(property)){
19706
- // @ts-expect-error
19707
19653
  res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
19708
19654
  }
19709
19655
  return res;
@@ -19714,7 +19660,7 @@ class SerializationHelper {
19714
19660
  }
19715
19661
  static serializeObjectProperty(objectProperty, serializedData, level) {
19716
19662
  if (level > 14) {
19717
- console.error('序列化数据的内嵌对象层数大于上限');
19663
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19718
19664
  return;
19719
19665
  }
19720
19666
  if (!serializedData) {
@@ -19725,17 +19671,17 @@ class SerializationHelper {
19725
19671
  if (typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' || SerializationHelper.checkTypedArray(objectProperty)) {
19726
19672
  // TODO json 数据避免传 typedArray
19727
19673
  serializedData[key] = value;
19728
- } else if (value instanceof Array) {
19674
+ } else if (isArray(value)) {
19729
19675
  if (!serializedData[key]) {
19730
19676
  serializedData[key] = [];
19731
19677
  }
19732
19678
  SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
19733
- } else if (value instanceof EffectsObject) {
19679
+ } else if (EffectsObject.is(value)) {
19734
19680
  // TODO 处理 EffectsObject 递归序列化
19735
19681
  serializedData[key] = {
19736
19682
  id: value.getInstanceId()
19737
19683
  };
19738
- } else if (value instanceof Object) {
19684
+ } else if (isObject(value)) {
19739
19685
  if (!serializedData[key]) {
19740
19686
  serializedData[key] = {};
19741
19687
  }
@@ -19745,7 +19691,7 @@ class SerializationHelper {
19745
19691
  }
19746
19692
  static serializeArrayProperty(arrayProperty, serializedData, level) {
19747
19693
  if (level > 14) {
19748
- console.error('序列化数据的内嵌对象层数大于上限');
19694
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19749
19695
  return;
19750
19696
  }
19751
19697
  if (!serializedData) {
@@ -19756,17 +19702,17 @@ class SerializationHelper {
19756
19702
  if (typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' || SerializationHelper.checkTypedArray(arrayProperty)) {
19757
19703
  // TODO json 数据避免传 typedArray
19758
19704
  serializedData[i] = value;
19759
- } else if (value instanceof Array) {
19705
+ } else if (isArray(value)) {
19760
19706
  if (!serializedData[i]) {
19761
19707
  serializedData[i] = [];
19762
19708
  }
19763
- this.serializeArrayProperty(value, serializedData[i], level + 1);
19764
- } else if (value instanceof EffectsObject) {
19709
+ SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
19710
+ } else if (EffectsObject.is(value)) {
19765
19711
  // TODO 处理 EffectsObject 递归序列化
19766
19712
  serializedData[i] = {
19767
19713
  id: value.getInstanceId()
19768
19714
  };
19769
- } else if (value instanceof Object) {
19715
+ } else if (isObject(value)) {
19770
19716
  if (!serializedData[i]) {
19771
19717
  serializedData[i] = {};
19772
19718
  }
@@ -19787,7 +19733,7 @@ class SerializationHelper {
19787
19733
  let effectsObject;
19788
19734
  const effectsObjectData = this.findData(guid);
19789
19735
  if (!effectsObjectData) {
19790
- console.error('未找到 uuid: ' + guid + '的对象数据');
19736
+ console.error(`Object data with uuid: ${guid} not found.`);
19791
19737
  return undefined;
19792
19738
  }
19793
19739
  switch(effectsObjectData.dataType){
@@ -19809,7 +19755,7 @@ class SerializationHelper {
19809
19755
  }
19810
19756
  }
19811
19757
  if (!effectsObject) {
19812
- console.error('未找到 DataType: ' + effectsObjectData.dataType + '的构造函数');
19758
+ console.error(`Constructor for DataType: ${effectsObjectData.dataType} not found.`);
19813
19759
  return undefined;
19814
19760
  }
19815
19761
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -19828,12 +19774,12 @@ class SerializationHelper {
19828
19774
  const effectsObjectData = _this.findData(guid);
19829
19775
  if (!effectsObjectData) {
19830
19776
  if (!_this.engine.database) {
19831
- console.error('未找到 uuid: ' + guid + '的对象数据');
19777
+ console.error(`Object data with uuid: ${guid} not found.`);
19832
19778
  return undefined;
19833
19779
  }
19834
19780
  effectsObject = yield _this.engine.database.loadGUID(guid);
19835
19781
  if (!effectsObject) {
19836
- console.error('未找到 uuid: ' + guid + '的磁盘数据');
19782
+ console.error(`Disk data with uuid: ${guid} not found.`);
19837
19783
  return undefined;
19838
19784
  }
19839
19785
  _this.engine.addInstance(effectsObject);
@@ -19858,7 +19804,7 @@ class SerializationHelper {
19858
19804
  }
19859
19805
  }
19860
19806
  if (!effectsObject) {
19861
- console.error('未找到 DataType: ' + effectsObjectData.dataType + '的构造函数');
19807
+ console.error(`Constructor for DataType: ${effectsObjectData.dataType} not found.`);
19862
19808
  return undefined;
19863
19809
  }
19864
19810
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -20697,8 +20643,6 @@ function getStandardCameraContent(model) {
20697
20643
  /**
20698
20644
  * 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
20699
20645
  */ function version30Migration(json) {
20700
- var // 更正 spine 数据中的 images 属性
20701
- _json_spines;
20702
20646
  var // 兼容老版本数据中不存在textures的情况
20703
20647
  _result;
20704
20648
  const result = _extends({}, json, {
@@ -20708,7 +20652,8 @@ function getStandardCameraContent(model) {
20708
20652
  materials: [],
20709
20653
  shaders: [],
20710
20654
  geometries: [],
20711
- animations: []
20655
+ animations: [],
20656
+ miscs: []
20712
20657
  });
20713
20658
  // image数据添加 guid
20714
20659
  for (const image of result.images){
@@ -20737,17 +20682,10 @@ function getStandardCameraContent(model) {
20737
20682
  });
20738
20683
  }
20739
20684
  }
20740
- (_json_spines = json.spines) == null ? void 0 : _json_spines.forEach((spine)=>{
20741
- for(let i = 0; i < spine.images.length; i++){
20742
- var _json_textures_spine_images_i;
20743
- //@ts-expect-error
20744
- const textureId = (_json_textures_spine_images_i = json.textures[spine.images[i]]) == null ? void 0 : _json_textures_spine_images_i.id;
20745
- //@ts-expect-error
20746
- spine.images[i] = {
20747
- id: textureId
20748
- };
20749
- }
20750
- });
20685
+ // 处理老版本数据中 bins 没有 id 的情况
20686
+ if (json.bins) {
20687
+ convertBinaryAsset(json.bins, result);
20688
+ }
20751
20689
  const itemOldIdToGuidMap = {};
20752
20690
  const guidToItemMap = {};
20753
20691
  // 更正Composition.endBehavior
@@ -20968,6 +20906,10 @@ function getStandardCameraContent(model) {
20968
20906
  //@ts-expect-error
20969
20907
  item.type = 'orientation-transformer';
20970
20908
  }
20909
+ // Spine 元素转为 guid 索引
20910
+ if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
20911
+ convertSpineData(json.spines[item.content.options.spine], item.content, result);
20912
+ }
20971
20913
  // item 的 content 转为 component data 加入 JSONScene.components
20972
20914
  if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light || item.type === 'camera' || item.type === ItemType.tree || item.type === ItemType.interact || item.type === ItemType.camera || item.type === ItemType.text || item.type === ItemType.spine || item.type === 'editor-gizmo' || item.type === 'orientation-transformer') {
20973
20915
  item.components = [];
@@ -21211,27 +21153,55 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
21211
21153
  id: timelineAssetData.id
21212
21154
  };
21213
21155
  composition.sceneBindings = sceneBindings;
21214
- if (!jsonScene.animations) {
21215
- jsonScene.animations = [];
21216
- }
21217
- // @ts-expect-error
21218
- jsonScene.animations.push(timelineAssetData);
21156
+ jsonScene.miscs.push(timelineAssetData);
21219
21157
  for (const trackData of trackDatas){
21220
21158
  //@ts-expect-error
21221
- jsonScene.animations.push(trackData);
21159
+ jsonScene.miscs.push(trackData);
21222
21160
  }
21223
21161
  for (const playableAsset of playableAssetDatas){
21224
21162
  //@ts-expect-error
21225
- jsonScene.animations.push(playableAsset);
21163
+ jsonScene.miscs.push(playableAsset);
21226
21164
  }
21227
21165
  }
21166
+ function convertBinaryAsset(bins, jsonScene) {
21167
+ //@ts-expect-error
21168
+ jsonScene.bins = bins.map((bin)=>({
21169
+ url: bin.url,
21170
+ 'dataType': 'BinaryAsset',
21171
+ id: generateGUID()
21172
+ }));
21173
+ }
21174
+ function convertSpineData(resource, content, jsonScene) {
21175
+ //@ts-expect-error
21176
+ content.resource = {
21177
+ 'atlas': {
21178
+ 'bins': {
21179
+ //@ts-expect-error
21180
+ 'id': jsonScene.bins[resource.atlas[1][0]].id
21181
+ },
21182
+ 'source': resource.atlas[1].slice(1)
21183
+ },
21184
+ 'skeleton': {
21185
+ 'bins': {
21186
+ //@ts-expect-error
21187
+ 'id': jsonScene.bins[resource.skeleton[1][0]].id
21188
+ },
21189
+ 'source': resource.skeleton[1].slice(1)
21190
+ },
21191
+ 'skeletonType': resource.skeletonType,
21192
+ 'images': resource.images.map((i)=>({
21193
+ //@ts-expect-error
21194
+ id: jsonScene.textures[i].id
21195
+ }))
21196
+ };
21197
+ }
21228
21198
 
21229
21199
  const v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
21230
21200
  const standardVersion = /^(\d+)\.(\d+)$/;
21231
21201
  let reverseParticle = false;
21232
21202
  function getStandardJSON(json) {
21233
21203
  if (!json || typeof json !== 'object') {
21234
- throw Error('expect a json object');
21204
+ throw new Error('Invalid input: Expected a JSON object.');
21235
21205
  }
21236
21206
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
21237
21207
  version22Migration(json);
@@ -21252,7 +21222,7 @@ function getStandardJSON(json) {
21252
21222
  }
21253
21223
  return json;
21254
21224
  }
21255
- throw Error('invalid json version ' + json.version);
21225
+ throw new Error(`Invalid JSON version: ${json.version}.`);
21256
21226
  }
21257
21227
  let currentVersion = '1.0';
21258
21228
  function getStandardJSONFromV0(json) {
@@ -21338,7 +21308,7 @@ function getStandardImage(image, index, imageTags) {
21338
21308
  } else if (image && image.sourceType) {
21339
21309
  return image;
21340
21310
  }
21341
- throw Error('invalid image type');
21311
+ throw new Error('Invalid image type.');
21342
21312
  }
21343
21313
  function getStandardComposition(composition, opt = {}) {
21344
21314
  var _composition_meta;
@@ -21605,7 +21575,7 @@ function _combineImageTemplate() {
21605
21575
  image = url;
21606
21576
  }
21607
21577
  if (!image) {
21608
- throw new Error('image not provided.');
21578
+ throw new Error('Image not provided.');
21609
21579
  }
21610
21580
  if (!template) {
21611
21581
  return image;
@@ -21679,7 +21649,7 @@ let seed = 1;
21679
21649
  cancelLoading = true;
21680
21650
  _this.removeTimer(loadTimer);
21681
21651
  const totalTime = performance.now() - startTime;
21682
- reject(new Error(`Load time out: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}`));
21652
+ reject(new Error(`Load time out: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}.`));
21683
21653
  }, _this.timeout * 1000);
21684
21654
  _this.timers.push(loadTimer);
21685
21655
  });
@@ -21691,7 +21661,7 @@ let seed = 1;
21691
21661
  timeInfos.push(`[${label}: ${(performance.now() - st).toFixed(2)}]`);
21692
21662
  return result;
21693
21663
  } catch (e) {
21694
- throw new Error(`Load error in ${label}, ${e}`);
21664
+ throw new Error(`Load error in ${label}, ${e}.`);
21695
21665
  }
21696
21666
  }
21697
21667
  throw new Error('Load canceled.');
@@ -21762,7 +21732,7 @@ let seed = 1;
21762
21732
  yield hookTimeInfo('processPlugins', ()=>pluginSystem.loadResources(scene, _this.options));
21763
21733
  }
21764
21734
  const totalTime = performance.now() - startTime;
21765
- logger.info(`Load asset: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}`);
21735
+ logger.info(`Load asset: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}.`);
21766
21736
  window.clearTimeout(loadTimer);
21767
21737
  _this.removeTimer(loadTimer);
21768
21738
  scene.totalTime = totalTime;
@@ -21783,7 +21753,7 @@ let seed = 1;
21783
21753
  const shaderLibrary = renderer == null ? void 0 : renderer.getShaderLibrary();
21784
21754
  yield pluginSystem == null ? void 0 : pluginSystem.precompile(compositions, renderer, options);
21785
21755
  yield new Promise((resolve)=>{
21786
- shaderLibrary.compileAllShaders(()=>{
21756
+ shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(()=>{
21787
21757
  resolve(null);
21788
21758
  });
21789
21759
  });
@@ -21834,7 +21804,7 @@ let seed = 1;
21834
21804
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
21835
21805
  return _this.loadBins(new URL(bin.url, baseUrl).href);
21836
21806
  }
21837
- throw new Error(`Invalid bins source: ${JSON.stringify(bins)}`);
21807
+ throw new Error(`Invalid bins source: ${JSON.stringify(bins)}.`);
21838
21808
  });
21839
21809
  return Promise.all(jobs);
21840
21810
  })();
@@ -21851,7 +21821,7 @@ let seed = 1;
21851
21821
  if (font.fontURL && !AssetManager.fonts.has(font.fontFamily)) {
21852
21822
  if (!isValidFontFamily(font.fontFamily)) {
21853
21823
  // 在所有设备上提醒开发者
21854
- console.warn(`Risky font family: ${font.fontFamily}`);
21824
+ console.warn(`Risky font family: ${font.fontFamily}.`);
21855
21825
  }
21856
21826
  try {
21857
21827
  const url = new URL(font.fontURL, _this.baseUrl).href;
@@ -21863,7 +21833,7 @@ let seed = 1;
21863
21833
  AssetManager.fonts.add(font.fontFamily);
21864
21834
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21865
21835
  } catch (e) {
21866
- logger.warn(`Invalid font family or font source: ${JSON.stringify(font.fontURL)}`);
21836
+ logger.warn(`Invalid font family or font source: ${JSON.stringify(font.fontURL)}.`);
21867
21837
  }
21868
21838
  }
21869
21839
  }));
@@ -21905,7 +21875,7 @@ let seed = 1;
21905
21875
  }
21906
21876
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21907
21877
  } catch (e) {
21908
- throw new Error(`Failed to load. Check the template or if the URL is ${isVideo ? 'video' : 'image'} type, URL: ${url}, Error: ${e.message}`);
21878
+ throw new Error(`Failed to load. Check the template or if the URL is ${isVideo ? 'video' : 'image'} type, URL: ${url}, Error: ${e.message}.`);
21909
21879
  }
21910
21880
  }
21911
21881
  } else if ('compressed' in img && useCompressedTexture && compressedTexture) {
@@ -21954,9 +21924,9 @@ let seed = 1;
21954
21924
  }
21955
21925
  if ('mipmaps' in texOpts) {
21956
21926
  try {
21957
- return yield deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine);
21927
+ return yield deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins);
21958
21928
  } catch (e) {
21959
- throw new Error(`load texture ${idx} fails, error message: ${e}`);
21929
+ throw new Error(`Load texture ${idx} fails, error message: ${e}.`);
21960
21930
  }
21961
21931
  }
21962
21932
  const { source } = texOpts;
@@ -21973,7 +21943,7 @@ let seed = 1;
21973
21943
  tex.dataType = DataType.Texture;
21974
21944
  return tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts);
21975
21945
  }
21976
- throw new Error(`Invalid texture source: ${source}`);
21946
+ throw new Error(`Invalid texture source: ${source}.`);
21977
21947
  }));
21978
21948
  return Promise.all(jobs);
21979
21949
  })();
@@ -22084,7 +22054,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
22084
22054
  magFilter: glContext.NEAREST
22085
22055
  };
22086
22056
  }
22087
- throw new Error('Invalid texture options');
22057
+ throw new Error('Invalid texture options.');
22088
22058
  }
22089
22059
 
22090
22060
  const tmpScale = new Vector3(1, 1, 1);
@@ -22391,7 +22361,7 @@ let listOrder = 0;
22391
22361
  if (itemProps.type === ItemType.composition) {
22392
22362
  const refId = sourceItemData.content.options.refId;
22393
22363
  if (!this.refCompositions.get(refId)) {
22394
- throw new Error('Invalid Ref Composition id: ' + refId);
22364
+ throw new Error(`Invalid ref composition id: ${refId}.`);
22395
22365
  }
22396
22366
  const ref = this.getContent(this.refCompositions.get(refId));
22397
22367
  if (!this.refCompositionProps.has(refId)) {
@@ -22485,7 +22455,7 @@ let listOrder = 0;
22485
22455
  const { jsonScene, renderLevel, textureOptions, pluginSystem, totalTime } = scene;
22486
22456
  const { compositions, imgUsage, compositionId } = jsonScene;
22487
22457
  if (!textureOptions) {
22488
- throw new Error('scene.textures expected');
22458
+ throw new Error('scene.textures expected.');
22489
22459
  }
22490
22460
  const cachedTextures = textureOptions;
22491
22461
  for (const comp of compositions){
@@ -22496,7 +22466,7 @@ let listOrder = 0;
22496
22466
  }
22497
22467
  }
22498
22468
  if (!this.composition) {
22499
- throw new Error('Invalid composition id: ' + compositionId);
22469
+ throw new Error(`Invalid composition id: ${compositionId}.`);
22500
22470
  }
22501
22471
  this.jsonScene = jsonScene;
22502
22472
  this.renderLevel = renderLevel;
@@ -22866,7 +22836,7 @@ let listOrder = 0;
22866
22836
  }
22867
22837
  parent.children.push(item);
22868
22838
  } else {
22869
- throw Error('元素引用了不存在的元素,请检查数据');
22839
+ throw new Error('The element references a non-existent element, please check the data.');
22870
22840
  }
22871
22841
  }
22872
22842
  }
@@ -23097,7 +23067,7 @@ let listOrder = 0;
23097
23067
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
23098
23068
  */ translateByPixel(x, y) {
23099
23069
  if (!this.renderer) {
23100
- console.warn('Can not translate position when container not assigned');
23070
+ console.warn('Renderer not assigned. Operation aborted.');
23101
23071
  return;
23102
23072
  }
23103
23073
  this.rootItem.translateByPixel(x, y);
@@ -23111,7 +23081,7 @@ let listOrder = 0;
23111
23081
  * @param y - y 坐标
23112
23082
  */ setPositionByPixel(x, y) {
23113
23083
  if (!this.renderer) {
23114
- console.warn('Can not setPosition when container not assigned');
23084
+ console.warn('Renderer not assigned. Operation aborted.');
23115
23085
  return;
23116
23086
  }
23117
23087
  this.rootItem.setPositionByPixel(x, y);
@@ -23198,11 +23168,11 @@ let listOrder = 0;
23198
23168
  /**
23199
23169
  * 销毁状态位
23200
23170
  */ this.destroyed = false;
23171
+ this.postLoaders = [];
23201
23172
  /**
23202
23173
  * 合成暂停/播放 标识
23203
23174
  */ this.paused = false;
23204
23175
  this.lastVideoUpdateTime = 0;
23205
- this.postLoaders = [];
23206
23176
  const { reusable = false, speed = 1, baseRenderOrder = 0, renderer, onPlayerPause, onMessageItem, onEnd, event, width, height } = props;
23207
23177
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
23208
23178
  scene.jsonScene.imgUsage = undefined;
@@ -23287,7 +23257,7 @@ let listOrder = 0;
23287
23257
  }
23288
23258
  addPackageDatas(scene) {
23289
23259
  const { jsonScene, textureOptions = [] } = scene;
23290
- const { items = [], materials = [], shaders = [], geometries = [], components = [], animations = [], bins = [] } = jsonScene;
23260
+ const { items = [], materials = [], shaders = [], geometries = [], components = [], animations = [], bins = [], miscs = [] } = jsonScene;
23291
23261
  for (const vfxItemData of items){
23292
23262
  this.addEffectsObjectData(vfxItemData);
23293
23263
  }
@@ -23306,6 +23276,9 @@ let listOrder = 0;
23306
23276
  for (const animationData of animations){
23307
23277
  this.addEffectsObjectData(animationData);
23308
23278
  }
23279
+ for (const miscData of miscs){
23280
+ this.addEffectsObjectData(miscData);
23281
+ }
23309
23282
  for(let i = 0; i < bins.length; i++){
23310
23283
  const binaryData = bins[i];
23311
23284
  const binaryBuffer = scene.bins[i];
@@ -23423,7 +23396,7 @@ let listOrder = 0;
23423
23396
  info.push(`Tex ${this.textures.length}`);
23424
23397
  }
23425
23398
  if (info.length > 0) {
23426
- logger.warn(`Release GPU memory: ${info.join(', ')}`);
23399
+ logger.warn(`Release GPU memory: ${info.join(', ')}.`);
23427
23400
  }
23428
23401
  this.renderPasses.forEach((pass)=>pass.dispose());
23429
23402
  this.meshes.forEach((mesh)=>mesh.dispose());
@@ -23548,7 +23521,7 @@ let listOrder = 0;
23548
23521
  * @param ticker - 定时器类
23549
23522
  */ add(ticker) {
23550
23523
  if (typeof ticker !== 'function') {
23551
- throw new Error('Ticker: The tick object must implement the tick method.');
23524
+ throw new Error('The tick object must implement the tick method.');
23552
23525
  }
23553
23526
  this.tickers.push(ticker);
23554
23527
  }
@@ -23579,5 +23552,5 @@ registerPlugin('particle', ParticleLoader, VFXItem, true);
23579
23552
  registerPlugin('cal', CalculateLoader, VFXItem, true);
23580
23553
  registerPlugin('interact', InteractLoader, VFXItem, true);
23581
23554
 
23582
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, 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, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, vertexFormatType2GLType };
23555
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, 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, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, vertexFormatType2GLType };
23583
23556
  //# sourceMappingURL=index.mjs.map