@galacean/effects-threejs 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 threejs plugin 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
  import * as THREE from 'three';
@@ -450,7 +450,6 @@ function isSimulatorCellPhone() {
450
450
  }
451
451
  function isAlipayMiniApp() {
452
452
  var _my;
453
- // @ts-expect-error
454
453
  return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
455
454
  }
456
455
 
@@ -706,8 +705,8 @@ function noop() {}
706
705
  *
707
706
  * @static
708
707
  * @function isString
709
- * @param {object} obj - 要判断的对象
710
- * @return {boolean}
708
+ * @param obj - 要判断的对象
709
+ * @return
711
710
  */ function isString(obj) {
712
711
  return typeof obj === "string";
713
712
  }
@@ -716,8 +715,8 @@ function noop() {}
716
715
  *
717
716
  * @static
718
717
  * @function isArray
719
- * @param {object} obj - 要判断的对象
720
- * @return {boolean}
718
+ * @param obj - 要判断的对象
719
+ * @return
721
720
  */ var isArray = Array.isArray || function(obj) {
722
721
  return Object.prototype.toString.call(obj) === "[object Array]";
723
722
  };
@@ -726,8 +725,8 @@ function noop() {}
726
725
  *
727
726
  * @static
728
727
  * @function isFunction
729
- * @param {object} obj - 要判断的对象
730
- * @return {boolean}
728
+ * @param obj - 要判断的对象
729
+ * @return
731
730
  */ function isFunction(obj) {
732
731
  return Object.prototype.toString.call(obj) === "[object Function]";
733
732
  }
@@ -736,8 +735,8 @@ function noop() {}
736
735
  *
737
736
  * @static
738
737
  * @function isObject
739
- * @param {object} obj - 要判断的对象
740
- * @return {boolean}
738
+ * @param obj - 要判断的对象
739
+ * @return
741
740
  */ function isObject(obj) {
742
741
  return Object.prototype.toString.call(obj) === "[object Object]";
743
742
  }
@@ -746,29 +745,16 @@ function isCanvas(canvas) {
746
745
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
747
746
  return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
748
747
  }
749
- function deepClone(obj) {
750
- if (isArray(obj)) {
751
- return obj.map(deepClone);
752
- } else if (obj && typeof obj === "object") {
753
- if (ArrayBuffer.isView(obj)) {
754
- return obj.slice();
755
- }
756
- var ret = {};
757
- var kas = Object.keys(obj);
758
- for(var i = 0; i < kas.length; i++){
759
- var key = kas[i];
760
- ret[key] = deepClone(obj[key]);
761
- }
762
- return ret;
763
- }
764
- return obj;
765
- }
766
- // TODO: 改名
767
- function random(min, max) {
748
+ /**
749
+ * 生成一个位于 min 和 max 之间的随机数
750
+ * @param min
751
+ * @param max
752
+ * @returns
753
+ */ function randomInRange(min, max) {
768
754
  return min + Math.random() * (max - min);
769
755
  }
770
756
  function throwDestroyedError() {
771
- throw Error("destroyed item cannot be used again");
757
+ throw new Error("Destroyed item cannot be used again.");
772
758
  }
773
759
  function generateGUID() {
774
760
  return v4().replace(/-/g, "");
@@ -4095,7 +4081,7 @@ var CameraClipMode;
4095
4081
  * 蒙版形状切分
4096
4082
  */ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
4097
4083
  /**
4098
- *直线路径
4084
+ * 直线路径
4099
4085
  */ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
4100
4086
  /**
4101
4087
  * 多色
@@ -4271,7 +4257,7 @@ var TextAlignment;
4271
4257
  (function(TextAlignment) {
4272
4258
  /**
4273
4259
  * text alignment starts from(x,y) to right direction
4274
- * 从(x,y)开始第一个字符,向右边延伸
4260
+ * 从 (x,y) 开始第一个字符,向右边延伸
4275
4261
  */ TextAlignment[TextAlignment["left"] = 0] = "left";
4276
4262
  /**
4277
4263
  * (x,y) is middle position of text, where (left + right)/2 =(x,y)
@@ -4279,7 +4265,7 @@ var TextAlignment;
4279
4265
  */ TextAlignment[TextAlignment["middle"] = 1] = "middle";
4280
4266
  /**
4281
4267
  * text alignment ends with(x,y) from left direction
4282
- * 从(x,y)结束最后一个字符,向左边延伸
4268
+ * 从 (x,y) 结束最后一个字符,向左边延伸
4283
4269
  */ TextAlignment[TextAlignment["right"] = 2] = "right";
4284
4270
  })(TextAlignment || (TextAlignment = {}));
4285
4271
  /**
@@ -4329,6 +4315,7 @@ var DataType;
4329
4315
  DataType["TimelineAsset"] = "TimelineAsset";
4330
4316
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4331
4317
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4318
+ DataType["BinaryAsset"] = "BinaryAsset";
4332
4319
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4333
4320
  DataType["MeshComponent"] = "MeshComponent";
4334
4321
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4337,6 +4324,7 @@ var DataType;
4337
4324
  DataType["ModelPluginComponent"] = "ModelPluginComponent";
4338
4325
  DataType["TreeComponent"] = "TreeComponent";
4339
4326
  DataType["AnimationComponent"] = "AnimationComponent";
4327
+ DataType["SpineComponent"] = "SpineComponent";
4340
4328
  // Non-EffectObject
4341
4329
  DataType["TimelineClip"] = "TimelineClip";
4342
4330
  })(DataType || (DataType = {}));
@@ -4424,11 +4412,11 @@ var VertexBufferSemantic;
4424
4412
  VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
4425
4413
  })(VertexBufferSemantic || (VertexBufferSemantic = {}));
4426
4414
 
4427
- var BuiltinObjectGUID = function BuiltinObjectGUID() {
4415
+ var BuiltinObjectGUID = {
4416
+ WhiteTexture: "whitetexture00000000000000000000",
4417
+ PBRShader: "pbr00000000000000000000000000000",
4418
+ UnlitShader: "unlit000000000000000000000000000"
4428
4419
  };
4429
- BuiltinObjectGUID.WhiteTexture = "whitetexture00000000000000000000";
4430
- BuiltinObjectGUID.PBRShader = "pbr00000000000000000000000000000";
4431
- BuiltinObjectGUID.UnlitShader = "unlit000000000000000000000000000";
4432
4420
 
4433
4421
  var index$1 = /*#__PURE__*/Object.freeze({
4434
4422
  __proto__: null,
@@ -4484,15 +4472,20 @@ var index$1 = /*#__PURE__*/Object.freeze({
4484
4472
  BuiltinObjectGUID: BuiltinObjectGUID
4485
4473
  });
4486
4474
 
4487
- var effectsClassStore = {};
4488
4475
  var decoratorInitialStore = {};
4489
4476
  var mergedStore = {};
4490
- function getDirectStore(target) {
4491
- var classKey = target.constructor.name;
4492
- if (!decoratorInitialStore[classKey]) {
4493
- decoratorInitialStore[classKey] = {};
4494
- }
4495
- return decoratorInitialStore[classKey];
4477
+ var effectsClassStore = {};
4478
+ function effectsClass(className) {
4479
+ return function(target, context) {
4480
+ if (effectsClassStore[className]) {
4481
+ console.warn("Class " + className + " is already registered.");
4482
+ }
4483
+ // TODO: three修改json dataType, 这边重复注册直接 return
4484
+ effectsClassStore[className] = target;
4485
+ };
4486
+ }
4487
+ function serialize(type, sourceName) {
4488
+ return generateSerializableMember(type, sourceName); // value member
4496
4489
  }
4497
4490
  function getMergedStore(target) {
4498
4491
  var classKey = target.constructor.name;
@@ -4517,18 +4510,6 @@ function getMergedStore(target) {
4517
4510
  }
4518
4511
  return store;
4519
4512
  }
4520
- function serialize(type, sourceName) {
4521
- return generateSerializableMember(type, sourceName); // value member
4522
- }
4523
- function effectsClass(className) {
4524
- return function(target, context) {
4525
- if (effectsClassStore[className]) {
4526
- console.warn("Class " + className + " 重复注册");
4527
- }
4528
- //TODO: three修改json dataType, 这边重复注册直接 return
4529
- effectsClassStore[className] = target;
4530
- };
4531
- }
4532
4513
  function generateSerializableMember(type, sourceName) {
4533
4514
  return function(target, propertyKey) {
4534
4515
  var classStore = getDirectStore(target);
@@ -4540,6 +4521,13 @@ function generateSerializableMember(type, sourceName) {
4540
4521
  }
4541
4522
  };
4542
4523
  }
4524
+ function getDirectStore(target) {
4525
+ var classKey = target.constructor.name;
4526
+ if (!decoratorInitialStore[classKey]) {
4527
+ decoratorInitialStore[classKey] = {};
4528
+ }
4529
+ return decoratorInitialStore[classKey];
4530
+ }
4543
4531
 
4544
4532
  /**
4545
4533
  * @since 2.0.0
@@ -4571,6 +4559,9 @@ function generateSerializableMember(type, sourceName) {
4571
4559
  }
4572
4560
  };
4573
4561
  _proto.dispose = function dispose() {};
4562
+ EffectsObject.is = function is(obj) {
4563
+ return _instanceof1(obj, EffectsObject) && "guid" in obj;
4564
+ };
4574
4565
  return EffectsObject;
4575
4566
  }();
4576
4567
  __decorate([
@@ -4723,6 +4714,7 @@ __decorate([
4723
4714
  _this = Component.apply(this, arguments) || this;
4724
4715
  _this.started = false;
4725
4716
  _this.materials = [];
4717
+ _this._priority = 0;
4726
4718
  _this._enabled = true;
4727
4719
  return _this;
4728
4720
  }
@@ -7354,8 +7346,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7354
7346
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7355
7347
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7356
7348
  var HELP_LINK = {
7357
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7358
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7349
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7350
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7359
7351
  };
7360
7352
 
7361
7353
  /**
@@ -7540,17 +7532,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[ShaderType.vertex] = {
7540
7532
  }, _obj$7);
7541
7533
  /**
7542
7534
  * 生成 shader,检测到 WebGL1 上下文会降级
7543
- * @param marcos - 宏定义数组
7535
+ * @param macros - 宏定义数组
7544
7536
  * @param shader - 原始 shader 文本
7545
7537
  * @param shaderType - shader 类型
7546
7538
  * @return 去除版本号的 shader 文本
7547
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7539
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7548
7540
  var ret = [];
7549
7541
  var header = "";
7550
7542
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7551
7543
  ret.push("#define GE_RUNTIME");
7552
- if (marcos) {
7553
- marcos.forEach(function(param) {
7544
+ if (macros) {
7545
+ macros.forEach(function(param) {
7554
7546
  var key = param[0], value = param[1];
7555
7547
  if (value === true) {
7556
7548
  ret.push("#define " + key);
@@ -7659,7 +7651,7 @@ function setBlendMode(material, blendMode) {
7659
7651
  ];
7660
7652
  break;
7661
7653
  default:
7662
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7654
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7663
7655
  }
7664
7656
  }
7665
7657
  function setSideMode(material, side) {
@@ -7705,7 +7697,7 @@ function setMaskMode(material, maskMode) {
7705
7697
  material.stencilTest = false;
7706
7698
  break;
7707
7699
  default:
7708
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7700
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7709
7701
  }
7710
7702
  }
7711
7703
 
@@ -7926,7 +7918,7 @@ function _loadImage() {
7926
7918
  }
7927
7919
  // 2. 非法类型
7928
7920
  if (!url) {
7929
- throw new Error("Invalid url type: " + JSON.stringify(source));
7921
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7930
7922
  }
7931
7923
  return [
7932
7924
  2,
@@ -8094,21 +8086,21 @@ function _loadMedia() {
8094
8086
  return _loadMedia.apply(this, arguments);
8095
8087
  }
8096
8088
 
8097
- function deserializeMipmapTexture(texOpts, bins) {
8089
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8098
8090
  return _deserializeMipmapTexture.apply(this, arguments);
8099
8091
  }
8100
8092
  function _deserializeMipmapTexture() {
8101
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8093
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8102
8094
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8103
8095
  return __generator(this, function(_state) {
8104
8096
  switch(_state.label){
8105
8097
  case 0:
8106
8098
  if (files === void 0) files = [];
8107
- if (!(texOpts.target === 34067)) return [
8099
+ if (!(textureOptions.target === 34067)) return [
8108
8100
  3,
8109
8101
  1
8110
8102
  ];
8111
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8103
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8112
8104
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8113
8105
  loadedMipmaps = [];
8114
8106
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8128,7 +8120,7 @@ function _deserializeMipmapTexture() {
8128
8120
  2,
8129
8121
  _extends({
8130
8122
  keepImageSource: false
8131
- }, texOpts, {
8123
+ }, textureOptions, {
8132
8124
  mipmaps: loadedMipmaps,
8133
8125
  sourceFrom: {
8134
8126
  target: target,
@@ -8139,7 +8131,7 @@ function _deserializeMipmapTexture() {
8139
8131
  ];
8140
8132
  case 1:
8141
8133
  // TODO: 补充测试用例
8142
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8134
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8143
8135
  jobs = mipmaps1.map(function(pointer) {
8144
8136
  return loadMipmapImage(pointer, bins);
8145
8137
  });
@@ -8154,7 +8146,7 @@ function _deserializeMipmapTexture() {
8154
8146
  2,
8155
8147
  _extends({
8156
8148
  keepImageSource: false
8157
- }, texOpts, {
8149
+ }, textureOptions, {
8158
8150
  mipmaps: loadedMipmaps1,
8159
8151
  sourceType: TextureSourceType.mipmaps,
8160
8152
  sourceFrom: {
@@ -8189,7 +8181,7 @@ function _loadMipmapImage() {
8189
8181
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8190
8182
  bin = bins[index];
8191
8183
  if (!bin) {
8192
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8184
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8193
8185
  }
8194
8186
  return [
8195
8187
  2,
@@ -8393,7 +8385,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8393
8385
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8394
8386
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8395
8387
  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) {
8396
- throw Error("texture missing KTX identifier");
8388
+ throw new Error("Texture missing KTX identifier.");
8397
8389
  }
8398
8390
  // load the reset of the header in native 32 bit uint
8399
8391
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8415,15 +8407,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8415
8407
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8416
8408
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8417
8409
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8418
- logger.warn("Only 2D textures currently supported");
8410
+ logger.warn("Only 2D textures currently supported.");
8419
8411
  return;
8420
8412
  }
8421
8413
  if (this.numberOfArrayElements !== 0) {
8422
- logger.warn("Texture arrays not currently supported");
8414
+ logger.warn("Texture arrays not currently supported.");
8423
8415
  return;
8424
8416
  }
8425
8417
  if (this.numberOfFaces !== facesExpected) {
8426
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8418
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8427
8419
  return;
8428
8420
  }
8429
8421
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8511,7 +8503,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8511
8503
  3
8512
8504
  ];
8513
8505
  case 2:
8514
- throw new Error("No source from");
8506
+ throw new Error("No source from.");
8515
8507
  case 3:
8516
8508
  return [
8517
8509
  2
@@ -8755,7 +8747,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8755
8747
  })
8756
8748
  ];
8757
8749
  case 17:
8758
- throw new Error("Invalid resource type: " + type);
8750
+ throw new Error("Invalid resource type: " + type + ".");
8759
8751
  }
8760
8752
  });
8761
8753
  })();
@@ -9686,19 +9678,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9686
9678
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9687
9679
  }
9688
9680
  if (x1 < 0) {
9689
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9681
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9690
9682
  x1 = 0;
9691
9683
  }
9692
9684
  if (x2 < 0) {
9693
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9685
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9694
9686
  x2 = 0;
9695
9687
  }
9696
9688
  if (x1 > 1) {
9697
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9689
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9698
9690
  x1 = 1;
9699
9691
  }
9700
9692
  if (x2 > 1) {
9701
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9693
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9702
9694
  x2 = 1;
9703
9695
  }
9704
9696
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9879,31 +9871,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9879
9871
  }
9880
9872
  var _proto = ValueGetter.prototype;
9881
9873
  _proto.onCreate = function onCreate(props) {
9882
- throw Error(NOT_IMPLEMENT);
9874
+ throw new Error(NOT_IMPLEMENT);
9883
9875
  };
9884
9876
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9885
- throw Error(NOT_IMPLEMENT);
9877
+ throw new Error(NOT_IMPLEMENT);
9886
9878
  };
9887
9879
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9888
- throw Error(NOT_IMPLEMENT);
9880
+ throw new Error(NOT_IMPLEMENT);
9889
9881
  };
9890
9882
  _proto.getValue = function getValue(time) {
9891
- throw Error(NOT_IMPLEMENT);
9883
+ throw new Error(NOT_IMPLEMENT);
9892
9884
  };
9893
9885
  _proto.getMaxTime = function getMaxTime() {
9894
- throw Error(NOT_IMPLEMENT);
9886
+ throw new Error(NOT_IMPLEMENT);
9895
9887
  };
9896
9888
  _proto.toUniform = function toUniform(meta) {
9897
- throw Error(NOT_IMPLEMENT);
9889
+ throw new Error(NOT_IMPLEMENT);
9898
9890
  };
9899
9891
  _proto.map = function map(func) {
9900
- throw Error(NOT_IMPLEMENT);
9892
+ throw new Error(NOT_IMPLEMENT);
9901
9893
  };
9902
9894
  _proto.scaleXCoord = function scaleXCoord(scale) {
9903
9895
  return this;
9904
9896
  };
9905
9897
  _proto.toData = function toData() {
9906
- throw Error(NOT_IMPLEMENT);
9898
+ throw new Error(NOT_IMPLEMENT);
9907
9899
  };
9908
9900
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9909
9901
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -9979,7 +9971,7 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
9979
9971
  this.max = props[1];
9980
9972
  };
9981
9973
  _proto.getValue = function getValue(time) {
9982
- return random(this.min, this.max);
9974
+ return randomInRange(this.min, this.max);
9983
9975
  };
9984
9976
  _proto.toUniform = function toUniform() {
9985
9977
  return new Float32Array([
@@ -10600,7 +10592,7 @@ function createValueGetter(args) {
10600
10592
  if (isFunction(map$1[args[0]])) {
10601
10593
  return map$1[args[0]](args[1]);
10602
10594
  } else {
10603
- throw new Error("ValueType: " + args[0] + " is not support");
10595
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10604
10596
  }
10605
10597
  }
10606
10598
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10744,7 +10736,7 @@ function createCopyShader(level, writeDepth) {
10744
10736
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10745
10737
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10746
10738
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
10747
- marcos: [
10739
+ macros: [
10748
10740
  [
10749
10741
  "WEBGL2",
10750
10742
  !!webgl2
@@ -10817,7 +10809,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10817
10809
  var refCount = this.textureRef[id];
10818
10810
  if (refCount <= 1) {
10819
10811
  if (refCount < 0) {
10820
- console.error("ref count < 0");
10812
+ console.error("Ref count < 0.");
10821
10813
  }
10822
10814
  var tex = this.textureCache[id];
10823
10815
  if (tex) {
@@ -11495,21 +11487,21 @@ var seed$7 = 1;
11495
11487
  return RenderPass;
11496
11488
  }();
11497
11489
 
11498
- 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;}";
11490
+ 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;}";
11499
11491
 
11500
11492
  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";
11501
11493
 
11502
11494
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11503
11495
 
11504
- 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);}";
11496
+ 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);}";
11505
11497
 
11506
11498
  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.;}";
11507
11499
 
11508
11500
  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}";
11509
11501
 
11510
- 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;}";
11502
+ 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;}";
11511
11503
 
11512
- 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";
11504
+ 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";
11513
11505
 
11514
11506
  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}}";
11515
11507
 
@@ -12703,20 +12695,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12703
12695
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12704
12696
  var ext = this.drawBufferExtension;
12705
12697
  if (this.level === 1 && !ext && index > 0) {
12706
- throw new Error("draw multiple color buffers not available");
12698
+ throw new Error("Draw multiple color buffers not available.");
12707
12699
  }
12708
12700
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12709
12701
  if (attachment) {
12710
12702
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12711
12703
  } else {
12712
- console.error("invalid color attachment index: " + index);
12704
+ console.error("Invalid color attachment index: " + index + ".");
12713
12705
  }
12714
12706
  };
12715
12707
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12716
12708
  var ext = this.drawBufferExtension;
12717
12709
  if (this.level === 1 && !ext) {
12718
12710
  if (bufferStates.length > 1) {
12719
- throw Error("draw buffers not available");
12711
+ throw new Error("Draw buffers not available.");
12720
12712
  } else {
12721
12713
  return;
12722
12714
  }
@@ -12953,7 +12945,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12953
12945
  };
12954
12946
  _proto.createMaterial = function createMaterial(rendererOptions) {
12955
12947
  var _this_engine_renderer;
12956
- var marcos = [
12948
+ var macros = [
12957
12949
  [
12958
12950
  "ENV_EDITOR",
12959
12951
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12966,7 +12958,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12966
12958
  fragment: fragment,
12967
12959
  glslVersion: GLSLVersion.GLSL1,
12968
12960
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12969
- marcos: marcos
12961
+ macros: macros
12970
12962
  },
12971
12963
  uniformSemantics: {
12972
12964
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13232,16 +13224,12 @@ function shouldIgnoreBouncing(arg, mul) {
13232
13224
  }
13233
13225
 
13234
13226
  var maxSpriteMeshItemCount = 8;
13235
- var maxSpriteTextureCount = 8;
13236
13227
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13237
- // 8 or 16
13238
- maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13239
13228
  if (gpuCapability.maxVertexUniforms >= 256) {
13240
13229
  return maxSpriteMeshItemCount = 32;
13241
13230
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13242
13231
  return maxSpriteMeshItemCount = 16;
13243
13232
  }
13244
- maxSpriteTextureCount = 8;
13245
13233
  }
13246
13234
  function getImageItemRenderInfo(item) {
13247
13235
  var renderer = item.renderer;
@@ -13259,27 +13247,11 @@ function getImageItemRenderInfo(item) {
13259
13247
  };
13260
13248
  }
13261
13249
  function spriteMeshShaderFromFilter(level, options) {
13262
- var _ref = options != null ? options : {}, _ref_count = _ref.count, count = _ref_count === void 0 ? 2 : _ref_count, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, ignoreBlend = _ref.ignoreBlend, wireframe = _ref.wireframe;
13263
- var marcos = [
13264
- [
13265
- "MAX_ITEM_COUNT",
13266
- count
13267
- ],
13268
- [
13269
- "PRE_MULTIPLY_ALPHA",
13270
- false
13271
- ],
13250
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13251
+ var macros = [
13272
13252
  [
13273
13253
  "ENV_EDITOR",
13274
13254
  env === PLAYER_OPTIONS_ENV_EDITOR
13275
- ],
13276
- [
13277
- "USE_BLEND",
13278
- !ignoreBlend
13279
- ],
13280
- [
13281
- "MAX_FRAG_TEX",
13282
- maxSpriteTextureCount >= 16 ? 16 : 8
13283
13255
  ]
13284
13256
  ];
13285
13257
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13288,7 +13260,7 @@ function spriteMeshShaderFromFilter(level, options) {
13288
13260
  fragment: fragment,
13289
13261
  vertex: vertex,
13290
13262
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
13291
- marcos: marcos,
13263
+ macros: macros,
13292
13264
  shared: true
13293
13265
  };
13294
13266
  }
@@ -13298,7 +13270,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13298
13270
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13299
13271
  var wireframe = renderInfo.wireframe;
13300
13272
  var shader = spriteMeshShaderFromFilter(level, {
13301
- count: count,
13302
13273
  wireframe: wireframe,
13303
13274
  env: env
13304
13275
  });
@@ -13312,9 +13283,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13312
13283
  function setMaxSpriteMeshItemCount(count) {
13313
13284
  maxSpriteMeshItemCount = count;
13314
13285
  }
13315
- function setSpriteMeshMaxFragmentTextures(count) {
13316
- maxSpriteTextureCount = count;
13317
- }
13318
13286
 
13319
13287
  var defRenderInfo = {
13320
13288
  blending: 0,
@@ -14715,7 +14683,7 @@ var Cone = /*#__PURE__*/ function() {
14715
14683
  // dir + [0,0,1]
14716
14684
  dir.z += 1;
14717
14685
  return {
14718
- position: position.multiply(random(0, 1)),
14686
+ position: position.multiply(randomInRange(0, 1)),
14719
14687
  direction: dir.normalize()
14720
14688
  };
14721
14689
  };
@@ -14723,7 +14691,7 @@ var Cone = /*#__PURE__*/ function() {
14723
14691
  }();
14724
14692
  function getArcAngle(arc, arcMode, opt) {
14725
14693
  if (arcMode === ShapeArcMode.RANDOM) {
14726
- arc = random(0, arc);
14694
+ arc = randomInRange(0, arc);
14727
14695
  } else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
14728
14696
  var d = opt.index % (opt.total + 1);
14729
14697
  arc = arc / opt.total * d;
@@ -14763,8 +14731,8 @@ var Rectangle = /*#__PURE__*/ function() {
14763
14731
  }
14764
14732
  var _proto = Rectangle.prototype;
14765
14733
  _proto.generate = function generate(opt) {
14766
- var x = random(-this._d, this._d);
14767
- var y = random(-this._h, this._h);
14734
+ var x = randomInRange(-this._d, this._d);
14735
+ var y = randomInRange(-this._h, this._h);
14768
14736
  return {
14769
14737
  direction: new Vector3(0, 0, 1),
14770
14738
  position: new Vector3(x, y, 0)
@@ -14814,7 +14782,7 @@ var Edge = /*#__PURE__*/ function() {
14814
14782
  }
14815
14783
  var _proto = Edge.prototype;
14816
14784
  _proto.generate = function generate(options) {
14817
- var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
14785
+ var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : randomInRange(0, 1);
14818
14786
  return {
14819
14787
  direction: new Vector3(0, 1, 0),
14820
14788
  position: new Vector3(this._d * (x - 0.5), 0, 0)
@@ -14835,7 +14803,7 @@ var Donut = /*#__PURE__*/ function() {
14835
14803
  _proto.generate = function generate(opt) {
14836
14804
  var dradius = this.donutRadius;
14837
14805
  var center = this.radius - dradius;
14838
- var angle = random(0, Math.PI * 2);
14806
+ var angle = randomInRange(0, Math.PI * 2);
14839
14807
  var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
14840
14808
  var rot = tempMat4$2.setFromRotationZ(arc);
14841
14809
  var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
@@ -14858,7 +14826,7 @@ var Sphere = /*#__PURE__*/ function() {
14858
14826
  }
14859
14827
  var _proto = Sphere.prototype;
14860
14828
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14861
- return random(-90, 90);
14829
+ return randomInRange(-90, 90);
14862
14830
  };
14863
14831
  _proto.generate = function generate(opt) {
14864
14832
  var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
@@ -14881,7 +14849,7 @@ var Hemisphere = /*#__PURE__*/ function(Sphere) {
14881
14849
  }
14882
14850
  var _proto = Hemisphere.prototype;
14883
14851
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14884
- return random(0, 90);
14852
+ return randomInRange(0, 90);
14885
14853
  };
14886
14854
  return Hemisphere;
14887
14855
  }(Sphere);
@@ -14947,7 +14915,7 @@ function createShape(shapeOptions) {
14947
14915
  var type = shapeOptions.type;
14948
14916
  var Ctrl = map[type];
14949
14917
  if (!Ctrl) {
14950
- throw Error("invalid shape:" + type);
14918
+ throw new Error("Invalid shape: " + type + ".");
14951
14919
  }
14952
14920
  var ctrl = new Ctrl(options);
14953
14921
  if (type !== ShapeType.NONE) {
@@ -15777,7 +15745,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15777
15745
  var uniformValues = {};
15778
15746
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15779
15747
  var lookUpTexture = 0;
15780
- var marcos = [
15748
+ var macros = [
15781
15749
  [
15782
15750
  "ENABLE_VERTEX_TEXTURE",
15783
15751
  enableVertexTexture
@@ -15794,7 +15762,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15794
15762
  var useAttributeTrailStart = maxTrailCount > 64;
15795
15763
  var shaderCacheId = 0;
15796
15764
  if (colorOverLifetime) {
15797
- marcos.push([
15765
+ macros.push([
15798
15766
  "COLOR_OVER_LIFETIME",
15799
15767
  true
15800
15768
  ]);
@@ -15802,7 +15770,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15802
15770
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15803
15771
  }
15804
15772
  if (colorOverTrail) {
15805
- marcos.push([
15773
+ macros.push([
15806
15774
  "COLOR_OVER_TRAIL",
15807
15775
  true
15808
15776
  ]);
@@ -15810,7 +15778,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15810
15778
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15811
15779
  }
15812
15780
  if (useAttributeTrailStart) {
15813
- marcos.push([
15781
+ macros.push([
15814
15782
  "ATTR_TRAIL_START",
15815
15783
  1
15816
15784
  ]);
@@ -15820,7 +15788,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15820
15788
  }
15821
15789
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15822
15790
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15823
- marcos.push([
15791
+ macros.push([
15824
15792
  "VERT_CURVE_VALUE_COUNT",
15825
15793
  keyFrameMeta.index
15826
15794
  ], [
@@ -15839,7 +15807,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15839
15807
  shader: {
15840
15808
  vertex: vertex,
15841
15809
  fragment: fragment,
15842
- marcos: marcos,
15810
+ macros: macros,
15843
15811
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
15844
15812
  shared: true,
15845
15813
  name: "trail#" + name,
@@ -16142,12 +16110,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16142
16110
  }
16143
16111
  return dir.normalize().toArray();
16144
16112
  }
16145
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16113
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16146
16114
  if (env === void 0) env = "";
16147
16115
  var shaderCacheId = 0;
16148
16116
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16149
16117
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16150
- var marcos = [
16118
+ var macros = [
16151
16119
  [
16152
16120
  "ENABLE_VERTEX_TEXTURE",
16153
16121
  enableVertexTexture
@@ -16163,14 +16131,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16163
16131
  ];
16164
16132
  var keyFrameMeta = createKeyFrameMeta();
16165
16133
  if (trails.colorOverLifetime) {
16166
- marcos.push([
16134
+ macros.push([
16167
16135
  "COLOR_OVER_LIFETIME",
16168
16136
  true
16169
16137
  ]);
16170
16138
  shaderCacheId |= 1;
16171
16139
  }
16172
16140
  if (trails.colorOverTrail) {
16173
- marcos.push([
16141
+ macros.push([
16174
16142
  "COLOR_OVER_TRAIL",
16175
16143
  true
16176
16144
  ]);
@@ -16178,7 +16146,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16178
16146
  }
16179
16147
  var useAttributeTrailStart = particleMaxCount > 64;
16180
16148
  if (useAttributeTrailStart) {
16181
- marcos.push([
16149
+ macros.push([
16182
16150
  "ATTR_TRAIL_START",
16183
16151
  1
16184
16152
  ]);
@@ -16186,7 +16154,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16186
16154
  }
16187
16155
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16188
16156
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16189
- marcos.push([
16157
+ macros.push([
16190
16158
  "VERT_CURVE_VALUE_COUNT",
16191
16159
  keyFrameMeta.index
16192
16160
  ], [
@@ -16196,7 +16164,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16196
16164
  return {
16197
16165
  vertex: trailVert,
16198
16166
  fragment: particleFrag,
16199
- marcos: marcos,
16167
+ macros: macros,
16200
16168
  shared: true,
16201
16169
  name: "trail#" + name,
16202
16170
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -16919,11 +16887,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16919
16887
  this.props = props;
16920
16888
  this.destroyed = false;
16921
16889
  var cachePrefix = "";
16922
- var options = props.options;
16923
- var positionOverLifetime = props.positionOverLifetime;
16924
- var shape = props.shape;
16925
- var gravityModifier = positionOverLifetime.gravityOverLifetime;
16926
- var gravity = ensureVec3(positionOverLifetime.gravity);
16890
+ var options = props.options, _props_positionOverLifetime = props.positionOverLifetime, positionOverLifetime = _props_positionOverLifetime === void 0 ? {} : _props_positionOverLifetime, shape = props.shape;
16891
+ var gravityModifier = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime;
16892
+ var gravity = ensureVec3(positionOverLifetime == null ? void 0 : positionOverLifetime.gravity);
16927
16893
  var _textureSheetAnimation = props.textureSheetAnimation;
16928
16894
  var textureSheetAnimation = _textureSheetAnimation ? {
16929
16895
  animationDelay: createValueGetter(_textureSheetAnimation.animationDelay || 0),
@@ -16934,7 +16900,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16934
16900
  row: _textureSheetAnimation.row,
16935
16901
  total: _textureSheetAnimation.total || _textureSheetAnimation.col * _textureSheetAnimation.row
16936
16902
  } : undefined;
16937
- var startTurbulence = !!(shape && shape.turbulenceX || shape.turbulenceY || shape.turbulenceZ);
16903
+ var startTurbulence = !!(shape && shape.turbulenceX || (shape == null ? void 0 : shape.turbulenceY) || (shape == null ? void 0 : shape.turbulenceZ));
16938
16904
  var turbulence;
16939
16905
  if (startTurbulence) {
16940
16906
  var _shape_turbulenceX, _shape_turbulenceY, _shape_turbulenceZ;
@@ -16967,7 +16933,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16967
16933
  }
16968
16934
  }
16969
16935
  var forceTarget;
16970
- if (positionOverLifetime.forceTarget) {
16936
+ if (positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget) {
16971
16937
  forceTarget = {
16972
16938
  target: positionOverLifetime.target || [
16973
16939
  0,
@@ -17358,15 +17324,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17358
17324
  var speedOverLifetime = props.speedOverLifetime, colorOverLifetime = props.colorOverLifetime, linearVelOverLifetime = props.linearVelOverLifetime, orbitalVelOverLifetime = props.orbitalVelOverLifetime, sizeOverLifetime = props.sizeOverLifetime, rotationOverLifetime = props.rotationOverLifetime, sprite = props.sprite, gravityModifier = props.gravityModifier, maxCount = props.maxCount, textureFlip = props.textureFlip, useSprite = props.useSprite, name = props.name, gravity = props.gravity, forceTarget = props.forceTarget, side = props.side, occlusion = props.occlusion, anchor = props.anchor, blending = props.blending, maskMode = props.maskMode, mask = props.mask, transparentOcclusion = props.transparentOcclusion, meshSlots = props.meshSlots, _props_renderMode = props.renderMode, renderMode = _props_renderMode === void 0 ? 0 : _props_renderMode, _props_diffuse = props.diffuse, diffuse = _props_diffuse === void 0 ? Texture.createWithData(engine) : _props_diffuse;
17359
17325
  var detail = engine.gpuCapability.detail;
17360
17326
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17361
- var marcos = [
17327
+ var macros = [
17328
+ // spec.RenderMode
17362
17329
  [
17363
17330
  "RENDER_MODE",
17364
17331
  +renderMode
17365
17332
  ],
17366
- [
17367
- "PRE_MULTIPLY_ALPHA",
17368
- false
17369
- ],
17370
17333
  [
17371
17334
  "ENV_EDITOR",
17372
17335
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17382,13 +17345,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17382
17345
  var useOrbitalVel;
17383
17346
  this.useSprite = useSprite;
17384
17347
  if (enableVertexTexture) {
17385
- marcos.push([
17348
+ macros.push([
17386
17349
  "ENABLE_VERTEX_TEXTURE",
17387
17350
  true
17388
17351
  ]);
17389
17352
  }
17390
17353
  if (speedOverLifetime) {
17391
- marcos.push([
17354
+ macros.push([
17392
17355
  "SPEED_OVER_LIFETIME",
17393
17356
  true
17394
17357
  ]);
@@ -17396,7 +17359,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17396
17359
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17397
17360
  }
17398
17361
  if (sprite == null ? void 0 : sprite.animate) {
17399
- marcos.push([
17362
+ macros.push([
17400
17363
  "USE_SPRITE",
17401
17364
  true
17402
17365
  ]);
@@ -17410,7 +17373,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17410
17373
  this.useSprite = true;
17411
17374
  }
17412
17375
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17413
- marcos.push([
17376
+ macros.push([
17414
17377
  "COLOR_OVER_LIFETIME",
17415
17378
  true
17416
17379
  ]);
@@ -17435,7 +17398,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17435
17398
  shaderCacheId |= 1 << 7 + i;
17436
17399
  linearVelOverLifetime.enabled = true;
17437
17400
  }
17438
- marcos.push([
17401
+ macros.push([
17439
17402
  "LINEAR_VEL_" + pro.toUpperCase(),
17440
17403
  defL
17441
17404
  ]);
@@ -17446,13 +17409,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17446
17409
  useOrbitalVel = true;
17447
17410
  orbitalVelOverLifetime.enabled = true;
17448
17411
  }
17449
- marcos.push([
17412
+ macros.push([
17450
17413
  "ORB_VEL_" + pro.toUpperCase(),
17451
17414
  defO
17452
17415
  ]);
17453
17416
  });
17454
17417
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17455
- marcos.push([
17418
+ macros.push([
17456
17419
  "AS_LINEAR_MOVEMENT",
17457
17420
  true
17458
17421
  ]);
@@ -17460,7 +17423,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17460
17423
  }
17461
17424
  if (useOrbitalVel) {
17462
17425
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17463
- marcos.push([
17426
+ macros.push([
17464
17427
  "AS_ORBITAL_MOVEMENT",
17465
17428
  true
17466
17429
  ]);
@@ -17475,7 +17438,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17475
17438
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17476
17439
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17477
17440
  var _sizeOverLifetime_y;
17478
- marcos.push([
17441
+ macros.push([
17479
17442
  "SIZE_Y_BY_LIFE",
17480
17443
  1
17481
17444
  ]);
@@ -17485,7 +17448,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17485
17448
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17486
17449
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17487
17450
  shaderCacheId |= 1 << 15;
17488
- marcos.push([
17451
+ macros.push([
17489
17452
  "ROT_Z_LIFETIME",
17490
17453
  1
17491
17454
  ]);
@@ -17493,7 +17456,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17493
17456
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17494
17457
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17495
17458
  shaderCacheId |= 1 << 16;
17496
- marcos.push([
17459
+ macros.push([
17497
17460
  "ROT_X_LIFETIME",
17498
17461
  1
17499
17462
  ]);
@@ -17501,13 +17464,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17501
17464
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17502
17465
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17503
17466
  shaderCacheId |= 1 << 17;
17504
- marcos.push([
17467
+ macros.push([
17505
17468
  "ROT_Y_LIFETIME",
17506
17469
  1
17507
17470
  ]);
17508
17471
  }
17509
17472
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17510
- marcos.push([
17473
+ macros.push([
17511
17474
  "ROT_LIFETIME_AS_MOVEMENT",
17512
17475
  1
17513
17476
  ]);
@@ -17515,7 +17478,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17515
17478
  }
17516
17479
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17517
17480
  if (forceTarget) {
17518
- marcos.push([
17481
+ macros.push([
17519
17482
  "FINAL_TARGET",
17520
17483
  true
17521
17484
  ]);
@@ -17561,7 +17524,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17561
17524
  fragmentKeyFrameMeta.index,
17562
17525
  fragmentKeyFrameMeta.max
17563
17526
  ].join("+");
17564
- marcos.push([
17527
+ macros.push([
17565
17528
  "VERT_CURVE_VALUE_COUNT",
17566
17529
  vertexKeyFrameMeta.index
17567
17530
  ], [
@@ -17583,7 +17546,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17583
17546
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
17584
17547
  shared: true,
17585
17548
  cacheId: shaderCache,
17586
- marcos: marcos,
17549
+ macros: macros,
17587
17550
  name: "particle#" + name
17588
17551
  };
17589
17552
  var mtlOptions = {
@@ -17660,7 +17623,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17660
17623
  res.length = 0;
17661
17624
  break;
17662
17625
  default:
17663
- console.warn("uniform " + name + "'s type not in typeMap");
17626
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17664
17627
  }
17665
17628
  });
17666
17629
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -17996,20 +17959,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
17996
17959
  maxVertex: maxVertex
17997
17960
  };
17998
17961
  }
17999
- function getParticleMeshShader(item, env, gpuCapability) {
17962
+ function getParticleMeshShader(item, gpuCapability, env) {
18000
17963
  if (env === void 0) env = "";
18001
17964
  var _props_renderer;
18002
17965
  var props = item.content;
18003
17966
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
18004
- var marcos = [
17967
+ var macros = [
18005
17968
  [
18006
17969
  "RENDER_MODE",
18007
17970
  renderMode
18008
17971
  ],
18009
- [
18010
- "PRE_MULTIPLY_ALPHA",
18011
- false
18012
- ],
18013
17972
  [
18014
17973
  "ENV_EDITOR",
18015
17974
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18024,13 +17983,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18024
17983
  var vertex_lookup_texture = 0;
18025
17984
  var shaderCacheId = 0;
18026
17985
  if (enableVertexTexture) {
18027
- marcos.push([
17986
+ macros.push([
18028
17987
  "ENABLE_VERTEX_TEXTURE",
18029
17988
  true
18030
17989
  ]);
18031
17990
  }
18032
17991
  if (speedOverLifetime) {
18033
- marcos.push([
17992
+ macros.push([
18034
17993
  "SPEED_OVER_LIFETIME",
18035
17994
  true
18036
17995
  ]);
@@ -18039,7 +17998,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18039
17998
  }
18040
17999
  var sprite = props.textureSheetAnimation;
18041
18000
  if (sprite && sprite.animate) {
18042
- marcos.push([
18001
+ macros.push([
18043
18002
  "USE_SPRITE",
18044
18003
  true
18045
18004
  ]);
@@ -18047,7 +18006,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18047
18006
  }
18048
18007
  var colorOverLifetime = props.colorOverLifetime;
18049
18008
  if (colorOverLifetime && colorOverLifetime.color) {
18050
- marcos.push([
18009
+ macros.push([
18051
18010
  "COLOR_OVER_LIFETIME",
18052
18011
  true
18053
18012
  ]);
@@ -18072,7 +18031,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18072
18031
  defL = 1;
18073
18032
  shaderCacheId |= 1 << 7 + i;
18074
18033
  }
18075
- marcos.push([
18034
+ macros.push([
18076
18035
  "LINEAR_VEL_" + pro.toUpperCase(),
18077
18036
  defL
18078
18037
  ]);
@@ -18083,13 +18042,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18083
18042
  shaderCacheId |= 1 << 10 + i;
18084
18043
  useOrbitalVel = true;
18085
18044
  }
18086
- marcos.push([
18045
+ macros.push([
18087
18046
  "ORB_VEL_" + pro.toUpperCase(),
18088
18047
  defO
18089
18048
  ]);
18090
18049
  });
18091
18050
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18092
- marcos.push([
18051
+ macros.push([
18093
18052
  "AS_LINEAR_MOVEMENT",
18094
18053
  true
18095
18054
  ]);
@@ -18097,7 +18056,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18097
18056
  }
18098
18057
  if (useOrbitalVel) {
18099
18058
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18100
- marcos.push([
18059
+ macros.push([
18101
18060
  "AS_ORBITAL_MOVEMENT",
18102
18061
  true
18103
18062
  ]);
@@ -18109,7 +18068,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18109
18068
  var separateAxes = sizeOverLifetime.separateAxes;
18110
18069
  if (separateAxes) {
18111
18070
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18112
- marcos.push([
18071
+ macros.push([
18113
18072
  "SIZE_Y_BY_LIFE",
18114
18073
  1
18115
18074
  ]);
@@ -18124,7 +18083,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18124
18083
  if (rot.z) {
18125
18084
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18126
18085
  shaderCacheId |= 1 << 15;
18127
- marcos.push([
18086
+ macros.push([
18128
18087
  "ROT_Z_LIFETIME",
18129
18088
  1
18130
18089
  ]);
@@ -18133,7 +18092,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18133
18092
  if (rot.x) {
18134
18093
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18135
18094
  shaderCacheId |= 1 << 16;
18136
- marcos.push([
18095
+ macros.push([
18137
18096
  "ROT_X_LIFETIME",
18138
18097
  1
18139
18098
  ]);
@@ -18141,14 +18100,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18141
18100
  if (rot.y) {
18142
18101
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18143
18102
  shaderCacheId |= 1 << 17;
18144
- marcos.push([
18103
+ macros.push([
18145
18104
  "ROT_Y_LIFETIME",
18146
18105
  1
18147
18106
  ]);
18148
18107
  }
18149
18108
  }
18150
18109
  if (rot == null ? void 0 : rot.asRotation) {
18151
- marcos.push([
18110
+ macros.push([
18152
18111
  "ROT_LIFETIME_AS_MOVEMENT",
18153
18112
  1
18154
18113
  ]);
@@ -18158,7 +18117,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18158
18117
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18159
18118
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18160
18119
  if (forceOpt) {
18161
- marcos.push([
18120
+ macros.push([
18162
18121
  "FINAL_TARGET",
18163
18122
  true
18164
18123
  ]);
@@ -18199,10 +18158,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18199
18158
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18200
18159
  shared: true,
18201
18160
  cacheId: shaderCache,
18202
- marcos: marcos,
18161
+ macros: macros,
18203
18162
  name: "particle#" + item.name
18204
18163
  };
18205
- marcos.push([
18164
+ macros.push([
18206
18165
  "VERT_CURVE_VALUE_COUNT",
18207
18166
  vertexKeyFrameMeta.index
18208
18167
  ], [
@@ -18227,11 +18186,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18227
18186
  shaderIds[3] = maxVertex;
18228
18187
  shaderIds[5] = maxFrag;
18229
18188
  shader.cacheId = shaderIds.join("+");
18230
- if (!shader.marcos) {
18189
+ if (!shader.macros) {
18231
18190
  return;
18232
18191
  }
18233
- for(var i = 0; i < shader.marcos.length; i++){
18234
- var marco = shader.marcos[i];
18192
+ for(var i = 0; i < shader.macros.length; i++){
18193
+ var marco = shader.macros[i];
18235
18194
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18236
18195
  marco[1] = maxVertex;
18237
18196
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18264,17 +18223,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18264
18223
  });
18265
18224
  });
18266
18225
  items.forEach(function(item) {
18267
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18226
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18268
18227
  shaders.push(shader);
18269
18228
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18270
18229
  maxVertexCount = Math.max(maxVertexCount, vertex);
18271
18230
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18272
18231
  if (item.content.trails) {
18273
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18274
- var _shader_marcos;
18275
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, ShaderType.vertex, level);
18276
- var _shader_marcos1;
18277
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, ShaderType.fragment, level);
18232
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18233
+ var _shader_macros;
18234
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
18235
+ var _shader_macros1;
18236
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
18278
18237
  shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
18279
18238
  shaderLibrary.addShader(shader1);
18280
18239
  }
@@ -18286,10 +18245,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18286
18245
  } else {
18287
18246
  shader.glslVersion = GLSLVersion.GLSL1;
18288
18247
  }
18289
- var _shader_marcos;
18290
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, ShaderType.vertex, level);
18291
- var _shader_marcos1;
18292
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, ShaderType.fragment, level);
18248
+ var _shader_macros;
18249
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
18250
+ var _shader_macros1;
18251
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
18293
18252
  shaderLibrary.addShader(shader);
18294
18253
  });
18295
18254
  if (level === 2) {
@@ -18671,6 +18630,29 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18671
18630
  return AnimationClipPlayable;
18672
18631
  }(Playable);
18673
18632
 
18633
+ /**
18634
+ * @since 2.0.0
18635
+ * @internal
18636
+ */ var TimelineClip = /*#__PURE__*/ function() {
18637
+ function TimelineClip() {
18638
+ this.start = 0;
18639
+ this.duration = 0;
18640
+ }
18641
+ var _proto = TimelineClip.prototype;
18642
+ _proto.toLocalTime = function toLocalTime(time) {
18643
+ var localTime = time - this.start;
18644
+ var duration = this.duration;
18645
+ if (localTime - duration > 0.001) {
18646
+ if (this.endBehaviour === ItemEndBehavior.loop) {
18647
+ localTime = localTime % duration;
18648
+ } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18649
+ localTime = Math.min(duration, localTime);
18650
+ }
18651
+ }
18652
+ return localTime;
18653
+ };
18654
+ return TimelineClip;
18655
+ }();
18674
18656
  var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18675
18657
  _inherits(TrackAsset, PlayableAsset);
18676
18658
  function TrackAsset() {
@@ -18759,7 +18741,7 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18759
18741
  return TrackAsset;
18760
18742
  }(PlayableAsset);
18761
18743
  __decorate([
18762
- serialize("TimelineClip")
18744
+ serialize(TimelineClip)
18763
18745
  ], TrackAsset.prototype, "clips", void 0);
18764
18746
  __decorate([
18765
18747
  serialize()
@@ -18772,29 +18754,6 @@ var TrackType;
18772
18754
  TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
18773
18755
  TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
18774
18756
  })(TrackType || (TrackType = {}));
18775
- var TimelineClip = /*#__PURE__*/ function() {
18776
- function TimelineClip() {
18777
- this.start = 0;
18778
- this.duration = 0;
18779
- }
18780
- var _proto = TimelineClip.prototype;
18781
- _proto.toLocalTime = function toLocalTime(time) {
18782
- var localTime = time - this.start;
18783
- var duration = this.duration;
18784
- if (localTime - duration > 0.001) {
18785
- if (this.endBehaviour === ItemEndBehavior.loop) {
18786
- localTime = localTime % duration;
18787
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18788
- localTime = Math.min(duration, localTime);
18789
- }
18790
- }
18791
- return localTime;
18792
- };
18793
- return TimelineClip;
18794
- }();
18795
- TimelineClip = __decorate([
18796
- effectsClass("TimelineClip")
18797
- ], TimelineClip);
18798
18757
  var RuntimeClip = /*#__PURE__*/ function() {
18799
18758
  function RuntimeClip(clip, clipPlayable, parentMixer, track) {
18800
18759
  this.clip = clip;
@@ -18881,10 +18840,6 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18881
18840
  particleClip.endBehaviour = boundItem.endBehavior;
18882
18841
  }
18883
18842
  };
18884
- _proto.fromData = function fromData(data) {
18885
- TrackAsset1.prototype.fromData.call(this, data);
18886
- this.data = data;
18887
- };
18888
18843
  return ObjectBindingTrack;
18889
18844
  }(TrackAsset);
18890
18845
  ObjectBindingTrack = __decorate([
@@ -19124,7 +19079,6 @@ function compareTracks(a, b) {
19124
19079
  this.startTime = startTime;
19125
19080
  this.resolveBindings();
19126
19081
  this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
19127
- this.timelinePlayable.play();
19128
19082
  // 重播不销毁元素
19129
19083
  if (this.item.endBehavior !== ItemEndBehavior.destroy) {
19130
19084
  this.setReusable(true);
@@ -19182,7 +19136,7 @@ function compareTracks(a, b) {
19182
19136
  var refId = itemData.content.options.refId;
19183
19137
  var props = this.item.composition.refCompositionProps.get(refId);
19184
19138
  if (!props) {
19185
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19139
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19186
19140
  }
19187
19141
  // endBehaviour 类型需优化
19188
19142
  props.content = itemData.content;
@@ -19335,7 +19289,7 @@ var SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19335
19289
  var _proto = SubCompositionTrack.prototype;
19336
19290
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19337
19291
  if (!_instanceof1(parentBinding, VFXItem)) {
19338
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19292
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19339
19293
  }
19340
19294
  return parentBinding.getComponent(CompositionComponent);
19341
19295
  };
@@ -19543,7 +19497,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19543
19497
  return this.elements.shift();
19544
19498
  }
19545
19499
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19546
- // @ts-expect-error
19547
19500
  return window._createOffscreenCanvas(10, 10);
19548
19501
  } else {
19549
19502
  // in hongmeng system, create too many canvas will case render error
@@ -20112,6 +20065,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20112
20065
  /**
20113
20066
  * 元素动画的速度
20114
20067
  */ _this.speed = 1;
20068
+ _this.listIndex = 0;
20115
20069
  _this.name = "VFXItem";
20116
20070
  _this.transform.name = _this.name;
20117
20071
  _this.transform.engine = engine;
@@ -20382,7 +20336,6 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20382
20336
  this.parentId = parentId;
20383
20337
  this.duration = duration;
20384
20338
  this.endBehavior = endBehavior;
20385
- this.renderOrder = listIndex;
20386
20339
  //@ts-expect-error
20387
20340
  this.oldId = data.oldId;
20388
20341
  if (!data.content) {
@@ -20391,20 +20344,14 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20391
20344
  };
20392
20345
  }
20393
20346
  if (duration <= 0) {
20394
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20347
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20395
20348
  }
20396
- if (data.components) {
20397
- for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
20398
- var component = _step.value;
20399
- var newComponent = component;
20400
- this.components.push(newComponent);
20401
- if (_instanceof1(newComponent, RendererComponent)) {
20402
- this.rendererComponents.push(newComponent);
20403
- } else if (_instanceof1(newComponent, ItemBehaviour)) {
20404
- this.itemBehaviours.push(newComponent);
20405
- }
20406
- }
20349
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20350
+ var component = _step.value;
20351
+ component.onAttached();
20407
20352
  }
20353
+ // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
20354
+ this.renderOrder = listIndex;
20408
20355
  };
20409
20356
  _proto.toData = function toData() {
20410
20357
  var _this_parent;
@@ -20535,6 +20482,9 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20535
20482
  ]);
20536
20483
  return VFXItem;
20537
20484
  }(EffectsObject);
20485
+ __decorate([
20486
+ serialize()
20487
+ ], VFXItem.prototype, "components", void 0);
20538
20488
  VFXItem = __decorate([
20539
20489
  effectsClass(DataType.VFXItemData)
20540
20490
  ], VFXItem);
@@ -20588,7 +20538,7 @@ var Item;
20588
20538
  pluginName = "tree";
20589
20539
  break;
20590
20540
  default:
20591
- throw new Error("invalid vfx item type");
20541
+ throw new Error("Invalid vfx item type.");
20592
20542
  }
20593
20543
  }
20594
20544
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20632,7 +20582,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20632
20582
  this.plugins = Object.keys(loaders).map(function(name) {
20633
20583
  var CTRL = pluginLoaderMap[name];
20634
20584
  if (!CTRL) {
20635
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20585
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20636
20586
  }
20637
20587
  var loader = new CTRL();
20638
20588
  loader.name = name;
@@ -20660,13 +20610,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20660
20610
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20661
20611
  var CTRL = pluginCtrlMap[name];
20662
20612
  if (!CTRL) {
20663
- throw new Error("plugin " + name + " no registered constructor");
20613
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20664
20614
  }
20665
20615
  var engine = composition.getEngine();
20666
20616
  var item = new CTRL(engine, props, composition);
20667
20617
  item.composition = composition;
20668
20618
  if (!_instanceof1(item, VFXItem)) {
20669
- throw new Error("plugin " + name + " invalid constructor type");
20619
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20670
20620
  }
20671
20621
  return item;
20672
20622
  };
@@ -20764,22 +20714,22 @@ var SerializationHelper = /*#__PURE__*/ function() {
20764
20714
  if (value === undefined) {
20765
20715
  value = effectsObject[key];
20766
20716
  }
20767
- if (_instanceof1(value, EffectsObject)) {
20768
- this.collectSerializableObject(value, res);
20769
- } else if (_instanceof1(value, Array)) {
20717
+ if (EffectsObject.is(value)) {
20718
+ SerializationHelper.collectSerializableObject(value, res);
20719
+ } else if (isArray(value)) {
20770
20720
  for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
20771
20721
  var arrayValue = _step1.value;
20772
- if (_instanceof1(arrayValue, EffectsObject)) {
20773
- this.collectSerializableObject(arrayValue, res);
20722
+ if (EffectsObject.is(arrayValue)) {
20723
+ SerializationHelper.collectSerializableObject(arrayValue, res);
20774
20724
  }
20775
20725
  }
20776
- } else if (_instanceof1(value, Object)) {
20726
+ } else if (isObject(value)) {
20777
20727
  // 非 EffectsObject 对象只递归一层
20778
20728
  for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
20779
20729
  var objectKey = _step2.value;
20780
20730
  var objectValue = value[objectKey];
20781
- if (_instanceof1(objectValue, EffectsObject)) {
20782
- this.collectSerializableObject(objectValue, res);
20731
+ if (EffectsObject.is(objectValue)) {
20732
+ SerializationHelper.collectSerializableObject(objectValue, res);
20783
20733
  }
20784
20734
  }
20785
20735
  }
@@ -20816,17 +20766,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20816
20766
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
20817
20767
  // TODO json 数据避免传 typedArray
20818
20768
  serializedData[key] = value;
20819
- } else if (_instanceof1(value, Array)) {
20769
+ } else if (isArray(value)) {
20820
20770
  if (!serializedData[key]) {
20821
20771
  serializedData[key] = [];
20822
20772
  }
20823
20773
  SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
20824
- } else if (_instanceof1(value, EffectsObject)) {
20774
+ } else if (EffectsObject.is(value)) {
20825
20775
  // TODO 处理 EffectsObject 递归序列化
20826
20776
  serializedData[key] = {
20827
20777
  id: value.getInstanceId()
20828
20778
  };
20829
- } else if (_instanceof1(value, Object)) {
20779
+ } else if (isObject(value)) {
20830
20780
  if (!serializedData[key]) {
20831
20781
  serializedData[key] = {};
20832
20782
  }
@@ -20840,17 +20790,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20840
20790
  if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
20841
20791
  // TODO json 数据避免传 typedArray
20842
20792
  serializedData[key1] = value1;
20843
- } else if (_instanceof1(value1, Array)) {
20793
+ } else if (isArray(value1)) {
20844
20794
  if (!serializedData[key1]) {
20845
20795
  serializedData[key1] = [];
20846
20796
  }
20847
20797
  SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
20848
- } else if (_instanceof1(value1, EffectsObject)) {
20798
+ } else if (EffectsObject.is(value1)) {
20849
20799
  // TODO 处理 EffectsObject 递归序列化
20850
20800
  serializedData[key1] = {
20851
20801
  id: value1.getInstanceId()
20852
20802
  };
20853
- } else if (_instanceof1(value1, Object)) {
20803
+ } else if (isObject(value1)) {
20854
20804
  if (!serializedData[key1]) {
20855
20805
  serializedData[key1] = {};
20856
20806
  }
@@ -20963,24 +20913,24 @@ var SerializationHelper = /*#__PURE__*/ function() {
20963
20913
  SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
20964
20914
  return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
20965
20915
  };
20916
+ // check value is { id: 7e69662e964e4892ae8933f24562395b }
20966
20917
  SerializationHelper.checkDataPath = function checkDataPath(value) {
20967
- // check value is { id: 7e69662e964e4892ae8933f24562395b }
20968
- return _instanceof1(value, Object) && Object.keys(value).length === 1 && value.id && value.id.length === 32;
20918
+ return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
20969
20919
  };
20970
20920
  // TODO 测试函数,2.0 上线后移除
20971
20921
  SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
20972
- return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20922
+ return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20973
20923
  };
20974
20924
  SerializationHelper.checkImageSource = function checkImageSource(value) {
20975
20925
  return isCanvas(value) || _instanceof1(value, HTMLImageElement);
20976
20926
  };
20977
20927
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
20978
20928
  if (level > 14) {
20979
- console.error("序列化数据的内嵌对象层数大于上限");
20929
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20980
20930
  return;
20981
20931
  }
20982
20932
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
20983
- if (_instanceof1(property, Array)) {
20933
+ if (isArray(property)) {
20984
20934
  var res = [];
20985
20935
  for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
20986
20936
  var value = _step.value;
@@ -20990,17 +20940,15 @@ var SerializationHelper = /*#__PURE__*/ function() {
20990
20940
  // TODO json 数据避免传 typedArray
20991
20941
  } else if (SerializationHelper.checkDataPath(property)) {
20992
20942
  return engine.assetLoader.loadGUID(property.id);
20993
- } else if (_instanceof1(property, Object) && property.constructor === Object) {
20943
+ } else if (isObject(property) && property.constructor === Object) {
20994
20944
  var res1;
20995
20945
  if (type) {
20996
- var classConstructor = effectsClassStore[type];
20997
- res1 = new classConstructor();
20946
+ res1 = new type();
20998
20947
  } else {
20999
20948
  res1 = {};
21000
20949
  }
21001
20950
  for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
21002
20951
  var key = _step1.value;
21003
- // @ts-expect-error
21004
20952
  res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21005
20953
  }
21006
20954
  return res1;
@@ -21010,17 +20958,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21010
20958
  };
21011
20959
  SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
21012
20960
  return _async_to_generator(function() {
21013
- var res, _iterator, _step, value, _, res1, res2, classConstructor, _iterator1, _step1, key;
20961
+ var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
21014
20962
  return __generator(this, function(_state) {
21015
20963
  switch(_state.label){
21016
20964
  case 0:
21017
20965
  if (level > 14) {
21018
- console.error("序列化数据的内嵌对象层数大于上限");
20966
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21019
20967
  return [
21020
20968
  2
21021
20969
  ];
21022
20970
  }
21023
- if (!_instanceof1(property, Array)) return [
20971
+ if (!isArray(property)) return [
21024
20972
  3,
21025
20973
  5
21026
20974
  ];
@@ -21069,16 +21017,14 @@ var SerializationHelper = /*#__PURE__*/ function() {
21069
21017
  res1
21070
21018
  ];
21071
21019
  case 7:
21072
- if (_instanceof1(property, Object) && property.constructor === Object) {
21020
+ if (isObject(property) && property.constructor === Object) {
21073
21021
  if (type) {
21074
- classConstructor = effectsClassStore[type];
21075
- res2 = new classConstructor();
21022
+ res2 = new type();
21076
21023
  } else {
21077
21024
  res2 = {};
21078
21025
  }
21079
21026
  for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
21080
21027
  key = _step1.value;
21081
- // @ts-expect-error
21082
21028
  res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21083
21029
  }
21084
21030
  return [
@@ -21101,7 +21047,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21101
21047
  };
21102
21048
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21103
21049
  if (level > 14) {
21104
- console.error("序列化数据的内嵌对象层数大于上限");
21050
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21105
21051
  return;
21106
21052
  }
21107
21053
  if (!serializedData) {
@@ -21113,17 +21059,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21113
21059
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
21114
21060
  // TODO json 数据避免传 typedArray
21115
21061
  serializedData[key] = value;
21116
- } else if (_instanceof1(value, Array)) {
21062
+ } else if (isArray(value)) {
21117
21063
  if (!serializedData[key]) {
21118
21064
  serializedData[key] = [];
21119
21065
  }
21120
21066
  SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
21121
- } else if (_instanceof1(value, EffectsObject)) {
21067
+ } else if (EffectsObject.is(value)) {
21122
21068
  // TODO 处理 EffectsObject 递归序列化
21123
21069
  serializedData[key] = {
21124
21070
  id: value.getInstanceId()
21125
21071
  };
21126
- } else if (_instanceof1(value, Object)) {
21072
+ } else if (isObject(value)) {
21127
21073
  if (!serializedData[key]) {
21128
21074
  serializedData[key] = {};
21129
21075
  }
@@ -21133,7 +21079,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21133
21079
  };
21134
21080
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21135
21081
  if (level > 14) {
21136
- console.error("序列化数据的内嵌对象层数大于上限");
21082
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21137
21083
  return;
21138
21084
  }
21139
21085
  if (!serializedData) {
@@ -21144,17 +21090,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21144
21090
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
21145
21091
  // TODO json 数据避免传 typedArray
21146
21092
  serializedData[i] = value;
21147
- } else if (_instanceof1(value, Array)) {
21093
+ } else if (isArray(value)) {
21148
21094
  if (!serializedData[i]) {
21149
21095
  serializedData[i] = [];
21150
21096
  }
21151
- this.serializeArrayProperty(value, serializedData[i], level + 1);
21152
- } else if (_instanceof1(value, EffectsObject)) {
21097
+ SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
21098
+ } else if (EffectsObject.is(value)) {
21153
21099
  // TODO 处理 EffectsObject 递归序列化
21154
21100
  serializedData[i] = {
21155
21101
  id: value.getInstanceId()
21156
21102
  };
21157
- } else if (_instanceof1(value, Object)) {
21103
+ } else if (isObject(value)) {
21158
21104
  if (!serializedData[i]) {
21159
21105
  serializedData[i] = {};
21160
21106
  }
@@ -21180,7 +21126,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21180
21126
  var effectsObject;
21181
21127
  var effectsObjectData = this.findData(guid);
21182
21128
  if (!effectsObjectData) {
21183
- console.error("未找到 uuid: " + guid + "的对象数据");
21129
+ console.error("Object data with uuid: " + guid + " not found.");
21184
21130
  return undefined;
21185
21131
  }
21186
21132
  switch(effectsObjectData.dataType){
@@ -21202,7 +21148,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21202
21148
  }
21203
21149
  }
21204
21150
  if (!effectsObject) {
21205
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21151
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21206
21152
  return undefined;
21207
21153
  }
21208
21154
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21230,7 +21176,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21230
21176
  2
21231
21177
  ];
21232
21178
  if (!_this.engine.database) {
21233
- console.error("未找到 uuid: " + guid + "的对象数据");
21179
+ console.error("Object data with uuid: " + guid + " not found.");
21234
21180
  return [
21235
21181
  2,
21236
21182
  undefined
@@ -21243,7 +21189,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21243
21189
  case 1:
21244
21190
  effectsObject = _state.sent();
21245
21191
  if (!effectsObject) {
21246
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21192
+ console.error("Disk data with uuid: " + guid + " not found.");
21247
21193
  return [
21248
21194
  2,
21249
21195
  undefined
@@ -21274,7 +21220,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21274
21220
  }
21275
21221
  }
21276
21222
  if (!effectsObject) {
21277
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21223
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21278
21224
  return [
21279
21225
  2,
21280
21226
  undefined
@@ -22194,8 +22140,6 @@ function getStandardCameraContent(model) {
22194
22140
  // 生成时间轴数据
22195
22141
  convertTimelineAsset(compositionData, guidToItemMap, result);
22196
22142
  };
22197
- var // 更正 spine 数据中的 images 属性
22198
- _json_spines;
22199
22143
  var // 兼容老版本数据中不存在textures的情况
22200
22144
  _result;
22201
22145
  var result = _extends({}, json, {
@@ -22205,7 +22149,8 @@ function getStandardCameraContent(model) {
22205
22149
  materials: [],
22206
22150
  shaders: [],
22207
22151
  geometries: [],
22208
- animations: []
22152
+ animations: [],
22153
+ miscs: []
22209
22154
  });
22210
22155
  // image数据添加 guid
22211
22156
  for(var _iterator = _create_for_of_iterator_helper_loose(result.images), _step; !(_step = _iterator()).done;){
@@ -22235,17 +22180,10 @@ function getStandardCameraContent(model) {
22235
22180
  });
22236
22181
  }
22237
22182
  }
22238
- (_json_spines = json.spines) == null ? void 0 : _json_spines.forEach(function(spine) {
22239
- for(var i = 0; i < spine.images.length; i++){
22240
- var _json_textures_spine_images_i;
22241
- //@ts-expect-error
22242
- var textureId = (_json_textures_spine_images_i = json.textures[spine.images[i]]) == null ? void 0 : _json_textures_spine_images_i.id;
22243
- //@ts-expect-error
22244
- spine.images[i] = {
22245
- id: textureId
22246
- };
22247
- }
22248
- });
22183
+ // 处理老版本数据中 bins 没有 id 的情况
22184
+ if (json.bins) {
22185
+ convertBinaryAsset(json.bins, result);
22186
+ }
22249
22187
  var itemOldIdToGuidMap = {};
22250
22188
  var guidToItemMap = {};
22251
22189
  // 更正Composition.endBehavior
@@ -22409,6 +22347,10 @@ function getStandardCameraContent(model) {
22409
22347
  //@ts-expect-error
22410
22348
  item.type = "orientation-transformer";
22411
22349
  }
22350
+ // Spine 元素转为 guid 索引
22351
+ if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22352
+ convertSpineData(json.spines[item.content.options.spine], item.content, result);
22353
+ }
22412
22354
  // item 的 content 转为 component data 加入 JSONScene.components
22413
22355
  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") {
22414
22356
  item.components = [];
@@ -22656,29 +22598,61 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22656
22598
  id: timelineAssetData.id
22657
22599
  };
22658
22600
  composition.sceneBindings = sceneBindings;
22659
- if (!jsonScene.animations) {
22660
- jsonScene.animations = [];
22661
- }
22662
- // @ts-expect-error
22663
- jsonScene.animations.push(timelineAssetData);
22601
+ jsonScene.miscs.push(timelineAssetData);
22664
22602
  for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
22665
22603
  var trackData1 = _step2.value;
22666
22604
  //@ts-expect-error
22667
- jsonScene.animations.push(trackData1);
22605
+ jsonScene.miscs.push(trackData1);
22668
22606
  }
22669
22607
  for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
22670
22608
  var playableAsset = _step3.value;
22671
22609
  //@ts-expect-error
22672
- jsonScene.animations.push(playableAsset);
22610
+ jsonScene.miscs.push(playableAsset);
22673
22611
  }
22674
22612
  }
22613
+ function convertBinaryAsset(bins, jsonScene) {
22614
+ //@ts-expect-error
22615
+ jsonScene.bins = bins.map(function(bin) {
22616
+ return {
22617
+ url: bin.url,
22618
+ "dataType": "BinaryAsset",
22619
+ id: generateGUID()
22620
+ };
22621
+ });
22622
+ }
22623
+ function convertSpineData(resource, content, jsonScene) {
22624
+ //@ts-expect-error
22625
+ content.resource = {
22626
+ "atlas": {
22627
+ "bins": {
22628
+ //@ts-expect-error
22629
+ "id": jsonScene.bins[resource.atlas[1][0]].id
22630
+ },
22631
+ "source": resource.atlas[1].slice(1)
22632
+ },
22633
+ "skeleton": {
22634
+ "bins": {
22635
+ //@ts-expect-error
22636
+ "id": jsonScene.bins[resource.skeleton[1][0]].id
22637
+ },
22638
+ "source": resource.skeleton[1].slice(1)
22639
+ },
22640
+ "skeletonType": resource.skeletonType,
22641
+ "images": resource.images.map(function(i) {
22642
+ return {
22643
+ //@ts-expect-error
22644
+ id: jsonScene.textures[i].id
22645
+ };
22646
+ })
22647
+ };
22648
+ }
22675
22649
 
22676
22650
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
22677
22651
  var standardVersion = /^(\d+)\.(\d+)$/;
22678
22652
  var reverseParticle = false;
22679
22653
  function getStandardJSON(json) {
22680
22654
  if (!json || typeof json !== "object") {
22681
- throw Error("expect a json object");
22655
+ throw new Error("Invalid input: Expected a JSON object.");
22682
22656
  }
22683
22657
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22684
22658
  version22Migration(json);
@@ -22699,7 +22673,7 @@ function getStandardJSON(json) {
22699
22673
  }
22700
22674
  return json;
22701
22675
  }
22702
- throw Error("invalid json version " + json.version);
22676
+ throw new Error("Invalid JSON version: " + json.version + ".");
22703
22677
  }
22704
22678
  var currentVersion = "1.0";
22705
22679
  function getStandardJSONFromV0(json) {
@@ -22791,7 +22765,7 @@ function getStandardImage(image, index, imageTags) {
22791
22765
  } else if (image && image.sourceType) {
22792
22766
  return image;
22793
22767
  }
22794
- throw Error("invalid image type");
22768
+ throw new Error("Invalid image type.");
22795
22769
  }
22796
22770
  function getStandardComposition(composition, opt) {
22797
22771
  if (opt === void 0) opt = {};
@@ -23075,7 +23049,7 @@ function _combineImageTemplate() {
23075
23049
  _state.label = 3;
23076
23050
  case 3:
23077
23051
  if (!image) {
23078
- throw new Error("image not provided.");
23052
+ throw new Error("Image not provided.");
23079
23053
  }
23080
23054
  if (!template) {
23081
23055
  return [
@@ -23193,7 +23167,7 @@ var seed$1 = 1;
23193
23167
  cancelLoading = true;
23194
23168
  _this.removeTimer(loadTimer);
23195
23169
  var totalTime = performance.now() - startTime;
23196
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23170
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23197
23171
  }, _this.timeout * 1000);
23198
23172
  _this.timers.push(loadTimer);
23199
23173
  });
@@ -23228,7 +23202,7 @@ var seed$1 = 1;
23228
23202
  ];
23229
23203
  case 3:
23230
23204
  e = _state.sent();
23231
- throw new Error("Load error in " + label + ", " + e);
23205
+ throw new Error("Load error in " + label + ", " + e + ".");
23232
23206
  case 4:
23233
23207
  throw new Error("Load canceled.");
23234
23208
  }
@@ -23374,7 +23348,7 @@ var seed$1 = 1;
23374
23348
  _state.label = 12;
23375
23349
  case 12:
23376
23350
  totalTime = performance.now() - startTime;
23377
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23351
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23378
23352
  window.clearTimeout(loadTimer);
23379
23353
  _this.removeTimer(loadTimer);
23380
23354
  scene.totalTime = totalTime;
@@ -23417,7 +23391,7 @@ var seed$1 = 1;
23417
23391
  return [
23418
23392
  4,
23419
23393
  new Promise(function(resolve) {
23420
- shaderLibrary.compileAllShaders(function() {
23394
+ shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
23421
23395
  resolve(null);
23422
23396
  });
23423
23397
  })
@@ -23492,7 +23466,7 @@ var seed$1 = 1;
23492
23466
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23493
23467
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23494
23468
  }
23495
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23469
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23496
23470
  });
23497
23471
  return [
23498
23472
  2,
@@ -23523,7 +23497,7 @@ var seed$1 = 1;
23523
23497
  ];
23524
23498
  if (!isValidFontFamily(font.fontFamily)) {
23525
23499
  // 在所有设备上提醒开发者
23526
- console.warn("Risky font family: " + font.fontFamily);
23500
+ console.warn("Risky font family: " + font.fontFamily + ".");
23527
23501
  }
23528
23502
  _state.label = 1;
23529
23503
  case 1:
@@ -23550,7 +23524,7 @@ var seed$1 = 1;
23550
23524
  ];
23551
23525
  case 3:
23552
23526
  _state.sent();
23553
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23527
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23554
23528
  return [
23555
23529
  3,
23556
23530
  4
@@ -23646,7 +23620,7 @@ var seed$1 = 1;
23646
23620
  ];
23647
23621
  case 6:
23648
23622
  e = _state.sent();
23649
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23623
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23650
23624
  case 7:
23651
23625
  return [
23652
23626
  3,
@@ -23745,7 +23719,7 @@ var seed$1 = 1;
23745
23719
  ]);
23746
23720
  return [
23747
23721
  4,
23748
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23722
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23749
23723
  ];
23750
23724
  case 2:
23751
23725
  return [
@@ -23754,7 +23728,7 @@ var seed$1 = 1;
23754
23728
  ];
23755
23729
  case 3:
23756
23730
  e = _state.sent();
23757
- throw new Error("load texture " + idx + " fails, error message: " + e);
23731
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23758
23732
  case 4:
23759
23733
  source = texOpts.source;
23760
23734
  if (!isObject(source)) return [
@@ -23789,7 +23763,7 @@ var seed$1 = 1;
23789
23763
  tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23790
23764
  ];
23791
23765
  }
23792
- throw new Error("Invalid texture source: " + source);
23766
+ throw new Error("Invalid texture source: " + source + ".");
23793
23767
  }
23794
23768
  });
23795
23769
  }));
@@ -23907,7 +23881,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23907
23881
  magFilter: glContext.NEAREST
23908
23882
  };
23909
23883
  }
23910
- throw new Error("Invalid texture options");
23884
+ throw new Error("Invalid texture options.");
23911
23885
  }
23912
23886
 
23913
23887
  var tmpScale = new Vector3(1, 1, 1);
@@ -24199,7 +24173,7 @@ var listOrder = 0;
24199
24173
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24200
24174
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24201
24175
  if (!textureOptions) {
24202
- throw new Error("scene.textures expected");
24176
+ throw new Error("scene.textures expected.");
24203
24177
  }
24204
24178
  var cachedTextures = textureOptions;
24205
24179
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24211,7 +24185,7 @@ var listOrder = 0;
24211
24185
  }
24212
24186
  }
24213
24187
  if (!this.composition) {
24214
- throw new Error("Invalid composition id: " + compositionId);
24188
+ throw new Error("Invalid composition id: " + compositionId + ".");
24215
24189
  }
24216
24190
  this.jsonScene = jsonScene;
24217
24191
  this.renderLevel = renderLevel;
@@ -24273,7 +24247,7 @@ var listOrder = 0;
24273
24247
  if (itemProps.type === ItemType.composition) {
24274
24248
  var refId = sourceItemData.content.options.refId;
24275
24249
  if (!this.refCompositions.get(refId)) {
24276
- throw new Error("Invalid Ref Composition id: " + refId);
24250
+ throw new Error("Invalid ref composition id: " + refId + ".");
24277
24251
  }
24278
24252
  var ref = this.getContent(this.refCompositions.get(refId));
24279
24253
  if (!this.refCompositionProps.has(refId)) {
@@ -24386,11 +24360,11 @@ var listOrder = 0;
24386
24360
  /**
24387
24361
  * 销毁状态位
24388
24362
  */ this.destroyed = false;
24363
+ this.postLoaders = [];
24389
24364
  /**
24390
24365
  * 合成暂停/播放 标识
24391
24366
  */ this.paused = false;
24392
24367
  this.lastVideoUpdateTime = 0;
24393
- this.postLoaders = [];
24394
24368
  var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, onPlayerPause = props.onPlayerPause, onMessageItem = props.onMessageItem, onEnd = props.onEnd, event = props.event, width = props.width, height = props.height;
24395
24369
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24396
24370
  scene.jsonScene.imgUsage = undefined;
@@ -24789,7 +24763,7 @@ var listOrder = 0;
24789
24763
  }
24790
24764
  parent.children.push(item1);
24791
24765
  } else {
24792
- throw Error("元素引用了不存在的元素,请检查数据");
24766
+ throw new Error("The element references a non-existent element, please check the data.");
24793
24767
  }
24794
24768
  }
24795
24769
  }
@@ -25038,7 +25012,7 @@ var listOrder = 0;
25038
25012
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25039
25013
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25040
25014
  if (!this.renderer) {
25041
- console.warn("Can not translate position when container not assigned");
25015
+ console.warn("Renderer not assigned. Operation aborted.");
25042
25016
  return;
25043
25017
  }
25044
25018
  this.rootItem.translateByPixel(x, y);
@@ -25052,7 +25026,7 @@ var listOrder = 0;
25052
25026
  * @param y - y 坐标
25053
25027
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25054
25028
  if (!this.renderer) {
25055
- console.warn("Can not setPosition when container not assigned");
25029
+ console.warn("Renderer not assigned. Operation aborted.");
25056
25030
  return;
25057
25031
  }
25058
25032
  this.rootItem.setPositionByPixel(x, y);
@@ -25231,7 +25205,7 @@ var listOrder = 0;
25231
25205
  };
25232
25206
  _proto.addPackageDatas = function addPackageDatas(scene) {
25233
25207
  var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
25234
- var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins;
25208
+ var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, _jsonScene_miscs = jsonScene.miscs, miscs = _jsonScene_miscs === void 0 ? [] : _jsonScene_miscs;
25235
25209
  for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
25236
25210
  var vfxItemData = _step.value;
25237
25211
  this.addEffectsObjectData(vfxItemData);
@@ -25256,6 +25230,10 @@ var listOrder = 0;
25256
25230
  var animationData = _step5.value;
25257
25231
  this.addEffectsObjectData(animationData);
25258
25232
  }
25233
+ for(var _iterator6 = _create_for_of_iterator_helper_loose(miscs), _step6; !(_step6 = _iterator6()).done;){
25234
+ var miscData = _step6.value;
25235
+ this.addEffectsObjectData(miscData);
25236
+ }
25259
25237
  for(var i = 0; i < bins.length; i++){
25260
25238
  var binaryData = bins[i];
25261
25239
  var binaryBuffer = scene.bins[i];
@@ -25267,8 +25245,8 @@ var listOrder = 0;
25267
25245
  this.addEffectsObjectData(binaryData);
25268
25246
  }
25269
25247
  }
25270
- for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
25271
- var textureData = _step6.value;
25248
+ for(var _iterator7 = _create_for_of_iterator_helper_loose(textureOptions), _step7; !(_step7 = _iterator7()).done;){
25249
+ var textureData = _step7.value;
25272
25250
  this.addEffectsObjectData(textureData);
25273
25251
  }
25274
25252
  };
@@ -25403,7 +25381,7 @@ var listOrder = 0;
25403
25381
  info.push("Tex " + this.textures.length);
25404
25382
  }
25405
25383
  if (info.length > 0) {
25406
- logger.warn("Release GPU memory: " + info.join(", "));
25384
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25407
25385
  }
25408
25386
  this.renderPasses.forEach(function(pass) {
25409
25387
  return pass.dispose();
@@ -25539,7 +25517,7 @@ var listOrder = 0;
25539
25517
  * @param ticker - 定时器类
25540
25518
  */ _proto.add = function add(ticker) {
25541
25519
  if (typeof ticker !== "function") {
25542
- throw new Error("Ticker: The tick object must implement the tick method.");
25520
+ throw new Error("The tick object must implement the tick method.");
25543
25521
  }
25544
25522
  this.tickers.push(ticker);
25545
25523
  };
@@ -25715,8 +25693,8 @@ var _obj3;
25715
25693
  1
25716
25694
  ]);
25717
25695
  _this.material = new THREE.RawShaderMaterial({
25718
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25719
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25696
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25697
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25720
25698
  alphaToCoverage: false,
25721
25699
  depthFunc: THREE.LessDepth,
25722
25700
  polygonOffsetFactor: THREE.ZeroFactor,
@@ -26636,6 +26614,14 @@ var seed = 1;
26636
26614
  */ _proto.dispose = function dispose() {
26637
26615
  this.texture.dispose();
26638
26616
  };
26617
+ /**
26618
+ * 通过图层设置创建贴图
26619
+ * @param data - 图层设置
26620
+ */ _proto.fromData = function fromData(data) {
26621
+ Texture.prototype.fromData.call(this, data);
26622
+ this.texture = this.createTextureByType(data);
26623
+ this.texture.needsUpdate = true;
26624
+ };
26639
26625
  _proto.createTextureByType = function createTextureByType(options) {
26640
26626
  var assembleOptions = this.assembleOptions(options);
26641
26627
  // TODO renderer.getMaxAnisotropy() 查询最大各向异性
@@ -26696,7 +26682,7 @@ var seed = 1;
26696
26682
  texture.flipY = !!flipY;
26697
26683
  return texture;
26698
26684
  }
26699
- throw new Error("使用未知的数据类型创建纹理");
26685
+ throw new Error("Create a texture using an unknown data type.");
26700
26686
  };
26701
26687
  /**
26702
26688
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -26990,7 +26976,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
26990
26976
  }
26991
26977
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
26992
26978
  composition.statistic.firstFrameTime = firstFrameTime;
26993
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
26979
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
26994
26980
  _this.compositions.push(composition);
26995
26981
  return [
26996
26982
  2,
@@ -27156,8 +27142,8 @@ setMaxSpriteMeshItemCount(8);
27156
27142
  */ Mesh.create = function(engine, props) {
27157
27143
  return new ThreeMesh(engine, props);
27158
27144
  };
27159
- var version = "2.0.0-alpha.16";
27160
- logger.info("THREEJS plugin version: " + version);
27145
+ var version = "2.0.0-alpha.18";
27146
+ logger.info("THREEJS plugin version: " + version + ".");
27161
27147
 
27162
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27148
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27163
27149
  //# sourceMappingURL=index.mjs.map