@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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.16
6
+ * Version: v2.0.0-alpha.18
7
7
  */
8
8
 
9
9
  'use strict';
@@ -474,7 +474,6 @@ function isSimulatorCellPhone() {
474
474
  }
475
475
  function isAlipayMiniApp() {
476
476
  var _my;
477
- // @ts-expect-error
478
477
  return typeof my !== "undefined" && ((_my = my) == null ? void 0 : _my.renderTarget) === "web";
479
478
  }
480
479
 
@@ -730,8 +729,8 @@ function noop() {}
730
729
  *
731
730
  * @static
732
731
  * @function isString
733
- * @param {object} obj - 要判断的对象
734
- * @return {boolean}
732
+ * @param obj - 要判断的对象
733
+ * @return
735
734
  */ function isString(obj) {
736
735
  return typeof obj === "string";
737
736
  }
@@ -740,8 +739,8 @@ function noop() {}
740
739
  *
741
740
  * @static
742
741
  * @function isArray
743
- * @param {object} obj - 要判断的对象
744
- * @return {boolean}
742
+ * @param obj - 要判断的对象
743
+ * @return
745
744
  */ var isArray = Array.isArray || function(obj) {
746
745
  return Object.prototype.toString.call(obj) === "[object Array]";
747
746
  };
@@ -750,8 +749,8 @@ function noop() {}
750
749
  *
751
750
  * @static
752
751
  * @function isFunction
753
- * @param {object} obj - 要判断的对象
754
- * @return {boolean}
752
+ * @param obj - 要判断的对象
753
+ * @return
755
754
  */ function isFunction(obj) {
756
755
  return Object.prototype.toString.call(obj) === "[object Function]";
757
756
  }
@@ -760,8 +759,8 @@ function noop() {}
760
759
  *
761
760
  * @static
762
761
  * @function isObject
763
- * @param {object} obj - 要判断的对象
764
- * @return {boolean}
762
+ * @param obj - 要判断的对象
763
+ * @return
765
764
  */ function isObject(obj) {
766
765
  return Object.prototype.toString.call(obj) === "[object Object]";
767
766
  }
@@ -770,29 +769,16 @@ function isCanvas(canvas) {
770
769
  // 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
771
770
  return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
772
771
  }
773
- function deepClone(obj) {
774
- if (isArray(obj)) {
775
- return obj.map(deepClone);
776
- } else if (obj && typeof obj === "object") {
777
- if (ArrayBuffer.isView(obj)) {
778
- return obj.slice();
779
- }
780
- var ret = {};
781
- var kas = Object.keys(obj);
782
- for(var i = 0; i < kas.length; i++){
783
- var key = kas[i];
784
- ret[key] = deepClone(obj[key]);
785
- }
786
- return ret;
787
- }
788
- return obj;
789
- }
790
- // TODO: 改名
791
- function random(min, max) {
772
+ /**
773
+ * 生成一个位于 min 和 max 之间的随机数
774
+ * @param min
775
+ * @param max
776
+ * @returns
777
+ */ function randomInRange(min, max) {
792
778
  return min + Math.random() * (max - min);
793
779
  }
794
780
  function throwDestroyedError() {
795
- throw Error("destroyed item cannot be used again");
781
+ throw new Error("Destroyed item cannot be used again.");
796
782
  }
797
783
  function generateGUID() {
798
784
  return v4().replace(/-/g, "");
@@ -4119,7 +4105,7 @@ var CameraClipMode;
4119
4105
  * 蒙版形状切分
4120
4106
  */ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
4121
4107
  /**
4122
- *直线路径
4108
+ * 直线路径
4123
4109
  */ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
4124
4110
  /**
4125
4111
  * 多色
@@ -4295,7 +4281,7 @@ var TextAlignment;
4295
4281
  (function(TextAlignment) {
4296
4282
  /**
4297
4283
  * text alignment starts from(x,y) to right direction
4298
- * 从(x,y)开始第一个字符,向右边延伸
4284
+ * 从 (x,y) 开始第一个字符,向右边延伸
4299
4285
  */ TextAlignment[TextAlignment["left"] = 0] = "left";
4300
4286
  /**
4301
4287
  * (x,y) is middle position of text, where (left + right)/2 =(x,y)
@@ -4303,7 +4289,7 @@ var TextAlignment;
4303
4289
  */ TextAlignment[TextAlignment["middle"] = 1] = "middle";
4304
4290
  /**
4305
4291
  * text alignment ends with(x,y) from left direction
4306
- * 从(x,y)结束最后一个字符,向左边延伸
4292
+ * 从 (x,y) 结束最后一个字符,向左边延伸
4307
4293
  */ TextAlignment[TextAlignment["right"] = 2] = "right";
4308
4294
  })(TextAlignment || (TextAlignment = {}));
4309
4295
  /**
@@ -4353,6 +4339,7 @@ var DataType;
4353
4339
  DataType["TimelineAsset"] = "TimelineAsset";
4354
4340
  DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
4355
4341
  DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
4342
+ DataType["BinaryAsset"] = "BinaryAsset";
4356
4343
  // FIXME: 先完成ECS的场景转换,后面移到spec中
4357
4344
  DataType["MeshComponent"] = "MeshComponent";
4358
4345
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -4361,6 +4348,7 @@ var DataType;
4361
4348
  DataType["ModelPluginComponent"] = "ModelPluginComponent";
4362
4349
  DataType["TreeComponent"] = "TreeComponent";
4363
4350
  DataType["AnimationComponent"] = "AnimationComponent";
4351
+ DataType["SpineComponent"] = "SpineComponent";
4364
4352
  // Non-EffectObject
4365
4353
  DataType["TimelineClip"] = "TimelineClip";
4366
4354
  })(DataType || (DataType = {}));
@@ -4448,11 +4436,11 @@ var VertexBufferSemantic;
4448
4436
  VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
4449
4437
  })(VertexBufferSemantic || (VertexBufferSemantic = {}));
4450
4438
 
4451
- var BuiltinObjectGUID = function BuiltinObjectGUID() {
4439
+ var BuiltinObjectGUID = {
4440
+ WhiteTexture: "whitetexture00000000000000000000",
4441
+ PBRShader: "pbr00000000000000000000000000000",
4442
+ UnlitShader: "unlit000000000000000000000000000"
4452
4443
  };
4453
- BuiltinObjectGUID.WhiteTexture = "whitetexture00000000000000000000";
4454
- BuiltinObjectGUID.PBRShader = "pbr00000000000000000000000000000";
4455
- BuiltinObjectGUID.UnlitShader = "unlit000000000000000000000000000";
4456
4444
 
4457
4445
  var index$1 = /*#__PURE__*/Object.freeze({
4458
4446
  __proto__: null,
@@ -4508,15 +4496,20 @@ var index$1 = /*#__PURE__*/Object.freeze({
4508
4496
  BuiltinObjectGUID: BuiltinObjectGUID
4509
4497
  });
4510
4498
 
4511
- var effectsClassStore = {};
4512
4499
  var decoratorInitialStore = {};
4513
4500
  var mergedStore = {};
4514
- function getDirectStore(target) {
4515
- var classKey = target.constructor.name;
4516
- if (!decoratorInitialStore[classKey]) {
4517
- decoratorInitialStore[classKey] = {};
4518
- }
4519
- return decoratorInitialStore[classKey];
4501
+ var effectsClassStore = {};
4502
+ function effectsClass(className) {
4503
+ return function(target, context) {
4504
+ if (effectsClassStore[className]) {
4505
+ console.warn("Class " + className + " is already registered.");
4506
+ }
4507
+ // TODO: three修改json dataType, 这边重复注册直接 return
4508
+ effectsClassStore[className] = target;
4509
+ };
4510
+ }
4511
+ function serialize(type, sourceName) {
4512
+ return generateSerializableMember(type, sourceName); // value member
4520
4513
  }
4521
4514
  function getMergedStore(target) {
4522
4515
  var classKey = target.constructor.name;
@@ -4541,18 +4534,6 @@ function getMergedStore(target) {
4541
4534
  }
4542
4535
  return store;
4543
4536
  }
4544
- function serialize(type, sourceName) {
4545
- return generateSerializableMember(type, sourceName); // value member
4546
- }
4547
- function effectsClass(className) {
4548
- return function(target, context) {
4549
- if (effectsClassStore[className]) {
4550
- console.warn("Class " + className + " 重复注册");
4551
- }
4552
- //TODO: three修改json dataType, 这边重复注册直接 return
4553
- effectsClassStore[className] = target;
4554
- };
4555
- }
4556
4537
  function generateSerializableMember(type, sourceName) {
4557
4538
  return function(target, propertyKey) {
4558
4539
  var classStore = getDirectStore(target);
@@ -4564,6 +4545,13 @@ function generateSerializableMember(type, sourceName) {
4564
4545
  }
4565
4546
  };
4566
4547
  }
4548
+ function getDirectStore(target) {
4549
+ var classKey = target.constructor.name;
4550
+ if (!decoratorInitialStore[classKey]) {
4551
+ decoratorInitialStore[classKey] = {};
4552
+ }
4553
+ return decoratorInitialStore[classKey];
4554
+ }
4567
4555
 
4568
4556
  /**
4569
4557
  * @since 2.0.0
@@ -4595,6 +4583,9 @@ function generateSerializableMember(type, sourceName) {
4595
4583
  }
4596
4584
  };
4597
4585
  _proto.dispose = function dispose() {};
4586
+ EffectsObject.is = function is(obj) {
4587
+ return _instanceof1(obj, EffectsObject) && "guid" in obj;
4588
+ };
4598
4589
  return EffectsObject;
4599
4590
  }();
4600
4591
  __decorate([
@@ -4747,6 +4738,7 @@ __decorate([
4747
4738
  _this = Component.apply(this, arguments) || this;
4748
4739
  _this.started = false;
4749
4740
  _this.materials = [];
4741
+ _this._priority = 0;
4750
4742
  _this._enabled = true;
4751
4743
  return _this;
4752
4744
  }
@@ -7378,8 +7370,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7378
7370
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7379
7371
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7380
7372
  var HELP_LINK = {
7381
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7382
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7373
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7374
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7383
7375
  };
7384
7376
 
7385
7377
  /**
@@ -7564,17 +7556,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[exports.ShaderType.vertex] = {
7564
7556
  }, _obj$7);
7565
7557
  /**
7566
7558
  * 生成 shader,检测到 WebGL1 上下文会降级
7567
- * @param marcos - 宏定义数组
7559
+ * @param macros - 宏定义数组
7568
7560
  * @param shader - 原始 shader 文本
7569
7561
  * @param shaderType - shader 类型
7570
7562
  * @return 去除版本号的 shader 文本
7571
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7563
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7572
7564
  var ret = [];
7573
7565
  var header = "";
7574
7566
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7575
7567
  ret.push("#define GE_RUNTIME");
7576
- if (marcos) {
7577
- marcos.forEach(function(param) {
7568
+ if (macros) {
7569
+ macros.forEach(function(param) {
7578
7570
  var key = param[0], value = param[1];
7579
7571
  if (value === true) {
7580
7572
  ret.push("#define " + key);
@@ -7683,7 +7675,7 @@ function setBlendMode(material, blendMode) {
7683
7675
  ];
7684
7676
  break;
7685
7677
  default:
7686
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7678
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7687
7679
  }
7688
7680
  }
7689
7681
  function setSideMode(material, side) {
@@ -7729,7 +7721,7 @@ function setMaskMode(material, maskMode) {
7729
7721
  material.stencilTest = false;
7730
7722
  break;
7731
7723
  default:
7732
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7724
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7733
7725
  }
7734
7726
  }
7735
7727
 
@@ -7950,7 +7942,7 @@ function _loadImage() {
7950
7942
  }
7951
7943
  // 2. 非法类型
7952
7944
  if (!url) {
7953
- throw new Error("Invalid url type: " + JSON.stringify(source));
7945
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7954
7946
  }
7955
7947
  return [
7956
7948
  2,
@@ -8118,21 +8110,21 @@ function _loadMedia() {
8118
8110
  return _loadMedia.apply(this, arguments);
8119
8111
  }
8120
8112
 
8121
- function deserializeMipmapTexture(texOpts, bins) {
8113
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8122
8114
  return _deserializeMipmapTexture.apply(this, arguments);
8123
8115
  }
8124
8116
  function _deserializeMipmapTexture() {
8125
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8117
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8126
8118
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8127
8119
  return __generator(this, function(_state) {
8128
8120
  switch(_state.label){
8129
8121
  case 0:
8130
8122
  if (files === void 0) files = [];
8131
- if (!(texOpts.target === 34067)) return [
8123
+ if (!(textureOptions.target === 34067)) return [
8132
8124
  3,
8133
8125
  1
8134
8126
  ];
8135
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8127
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8136
8128
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8137
8129
  loadedMipmaps = [];
8138
8130
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8152,7 +8144,7 @@ function _deserializeMipmapTexture() {
8152
8144
  2,
8153
8145
  _extends({
8154
8146
  keepImageSource: false
8155
- }, texOpts, {
8147
+ }, textureOptions, {
8156
8148
  mipmaps: loadedMipmaps,
8157
8149
  sourceFrom: {
8158
8150
  target: target,
@@ -8163,7 +8155,7 @@ function _deserializeMipmapTexture() {
8163
8155
  ];
8164
8156
  case 1:
8165
8157
  // TODO: 补充测试用例
8166
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8158
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8167
8159
  jobs = mipmaps1.map(function(pointer) {
8168
8160
  return loadMipmapImage(pointer, bins);
8169
8161
  });
@@ -8178,7 +8170,7 @@ function _deserializeMipmapTexture() {
8178
8170
  2,
8179
8171
  _extends({
8180
8172
  keepImageSource: false
8181
- }, texOpts, {
8173
+ }, textureOptions, {
8182
8174
  mipmaps: loadedMipmaps1,
8183
8175
  sourceType: exports.TextureSourceType.mipmaps,
8184
8176
  sourceFrom: {
@@ -8213,7 +8205,7 @@ function _loadMipmapImage() {
8213
8205
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8214
8206
  bin = bins[index];
8215
8207
  if (!bin) {
8216
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8208
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8217
8209
  }
8218
8210
  return [
8219
8211
  2,
@@ -8417,7 +8409,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8417
8409
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8418
8410
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8419
8411
  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) {
8420
- throw Error("texture missing KTX identifier");
8412
+ throw new Error("Texture missing KTX identifier.");
8421
8413
  }
8422
8414
  // load the reset of the header in native 32 bit uint
8423
8415
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8439,15 +8431,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8439
8431
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8440
8432
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8441
8433
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8442
- logger.warn("Only 2D textures currently supported");
8434
+ logger.warn("Only 2D textures currently supported.");
8443
8435
  return;
8444
8436
  }
8445
8437
  if (this.numberOfArrayElements !== 0) {
8446
- logger.warn("Texture arrays not currently supported");
8438
+ logger.warn("Texture arrays not currently supported.");
8447
8439
  return;
8448
8440
  }
8449
8441
  if (this.numberOfFaces !== facesExpected) {
8450
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8442
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8451
8443
  return;
8452
8444
  }
8453
8445
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8535,7 +8527,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8535
8527
  3
8536
8528
  ];
8537
8529
  case 2:
8538
- throw new Error("No source from");
8530
+ throw new Error("No source from.");
8539
8531
  case 3:
8540
8532
  return [
8541
8533
  2
@@ -8779,7 +8771,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8779
8771
  })
8780
8772
  ];
8781
8773
  case 17:
8782
- throw new Error("Invalid resource type: " + type);
8774
+ throw new Error("Invalid resource type: " + type + ".");
8783
8775
  }
8784
8776
  });
8785
8777
  })();
@@ -9710,19 +9702,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9710
9702
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9711
9703
  }
9712
9704
  if (x1 < 0) {
9713
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9705
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9714
9706
  x1 = 0;
9715
9707
  }
9716
9708
  if (x2 < 0) {
9717
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9709
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9718
9710
  x2 = 0;
9719
9711
  }
9720
9712
  if (x1 > 1) {
9721
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9713
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9722
9714
  x1 = 1;
9723
9715
  }
9724
9716
  if (x2 > 1) {
9725
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9717
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9726
9718
  x2 = 1;
9727
9719
  }
9728
9720
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9903,31 +9895,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9903
9895
  }
9904
9896
  var _proto = ValueGetter.prototype;
9905
9897
  _proto.onCreate = function onCreate(props) {
9906
- throw Error(NOT_IMPLEMENT);
9898
+ throw new Error(NOT_IMPLEMENT);
9907
9899
  };
9908
9900
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9909
- throw Error(NOT_IMPLEMENT);
9901
+ throw new Error(NOT_IMPLEMENT);
9910
9902
  };
9911
9903
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9912
- throw Error(NOT_IMPLEMENT);
9904
+ throw new Error(NOT_IMPLEMENT);
9913
9905
  };
9914
9906
  _proto.getValue = function getValue(time) {
9915
- throw Error(NOT_IMPLEMENT);
9907
+ throw new Error(NOT_IMPLEMENT);
9916
9908
  };
9917
9909
  _proto.getMaxTime = function getMaxTime() {
9918
- throw Error(NOT_IMPLEMENT);
9910
+ throw new Error(NOT_IMPLEMENT);
9919
9911
  };
9920
9912
  _proto.toUniform = function toUniform(meta) {
9921
- throw Error(NOT_IMPLEMENT);
9913
+ throw new Error(NOT_IMPLEMENT);
9922
9914
  };
9923
9915
  _proto.map = function map(func) {
9924
- throw Error(NOT_IMPLEMENT);
9916
+ throw new Error(NOT_IMPLEMENT);
9925
9917
  };
9926
9918
  _proto.scaleXCoord = function scaleXCoord(scale) {
9927
9919
  return this;
9928
9920
  };
9929
9921
  _proto.toData = function toData() {
9930
- throw Error(NOT_IMPLEMENT);
9922
+ throw new Error(NOT_IMPLEMENT);
9931
9923
  };
9932
9924
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9933
9925
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -10003,7 +9995,7 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
10003
9995
  this.max = props[1];
10004
9996
  };
10005
9997
  _proto.getValue = function getValue(time) {
10006
- return random(this.min, this.max);
9998
+ return randomInRange(this.min, this.max);
10007
9999
  };
10008
10000
  _proto.toUniform = function toUniform() {
10009
10001
  return new Float32Array([
@@ -10624,7 +10616,7 @@ function createValueGetter(args) {
10624
10616
  if (isFunction(map$1[args[0]])) {
10625
10617
  return map$1[args[0]](args[1]);
10626
10618
  } else {
10627
- throw new Error("ValueType: " + args[0] + " is not support");
10619
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10628
10620
  }
10629
10621
  }
10630
10622
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10768,7 +10760,7 @@ function createCopyShader(level, writeDepth) {
10768
10760
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10769
10761
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10770
10762
  glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
10771
- marcos: [
10763
+ macros: [
10772
10764
  [
10773
10765
  "WEBGL2",
10774
10766
  !!webgl2
@@ -10841,7 +10833,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10841
10833
  var refCount = this.textureRef[id];
10842
10834
  if (refCount <= 1) {
10843
10835
  if (refCount < 0) {
10844
- console.error("ref count < 0");
10836
+ console.error("Ref count < 0.");
10845
10837
  }
10846
10838
  var tex = this.textureCache[id];
10847
10839
  if (tex) {
@@ -11519,21 +11511,21 @@ var seed$7 = 1;
11519
11511
  return RenderPass;
11520
11512
  }();
11521
11513
 
11522
- 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;}";
11514
+ 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;}";
11523
11515
 
11524
11516
  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";
11525
11517
 
11526
11518
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11527
11519
 
11528
- 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);}";
11520
+ 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);}";
11529
11521
 
11530
11522
  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.;}";
11531
11523
 
11532
11524
  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}";
11533
11525
 
11534
- 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;}";
11526
+ 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;}";
11535
11527
 
11536
- 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";
11528
+ 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";
11537
11529
 
11538
11530
  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}}";
11539
11531
 
@@ -12727,20 +12719,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12727
12719
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12728
12720
  var ext = this.drawBufferExtension;
12729
12721
  if (this.level === 1 && !ext && index > 0) {
12730
- throw new Error("draw multiple color buffers not available");
12722
+ throw new Error("Draw multiple color buffers not available.");
12731
12723
  }
12732
12724
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12733
12725
  if (attachment) {
12734
12726
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12735
12727
  } else {
12736
- console.error("invalid color attachment index: " + index);
12728
+ console.error("Invalid color attachment index: " + index + ".");
12737
12729
  }
12738
12730
  };
12739
12731
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12740
12732
  var ext = this.drawBufferExtension;
12741
12733
  if (this.level === 1 && !ext) {
12742
12734
  if (bufferStates.length > 1) {
12743
- throw Error("draw buffers not available");
12735
+ throw new Error("Draw buffers not available.");
12744
12736
  } else {
12745
12737
  return;
12746
12738
  }
@@ -12977,7 +12969,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12977
12969
  };
12978
12970
  _proto.createMaterial = function createMaterial(rendererOptions) {
12979
12971
  var _this_engine_renderer;
12980
- var marcos = [
12972
+ var macros = [
12981
12973
  [
12982
12974
  "ENV_EDITOR",
12983
12975
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12990,7 +12982,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12990
12982
  fragment: fragment,
12991
12983
  glslVersion: exports.GLSLVersion.GLSL1,
12992
12984
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12993
- marcos: marcos
12985
+ macros: macros
12994
12986
  },
12995
12987
  uniformSemantics: {
12996
12988
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13256,16 +13248,12 @@ function shouldIgnoreBouncing(arg, mul) {
13256
13248
  }
13257
13249
 
13258
13250
  exports.maxSpriteMeshItemCount = 8;
13259
- exports.maxSpriteTextureCount = 8;
13260
13251
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13261
- // 8 or 16
13262
- exports.maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13263
13252
  if (gpuCapability.maxVertexUniforms >= 256) {
13264
13253
  return exports.maxSpriteMeshItemCount = 32;
13265
13254
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13266
13255
  return exports.maxSpriteMeshItemCount = 16;
13267
13256
  }
13268
- exports.maxSpriteTextureCount = 8;
13269
13257
  }
13270
13258
  function getImageItemRenderInfo(item) {
13271
13259
  var renderer = item.renderer;
@@ -13283,27 +13271,11 @@ function getImageItemRenderInfo(item) {
13283
13271
  };
13284
13272
  }
13285
13273
  function spriteMeshShaderFromFilter(level, options) {
13286
- 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;
13287
- var marcos = [
13288
- [
13289
- "MAX_ITEM_COUNT",
13290
- count
13291
- ],
13292
- [
13293
- "PRE_MULTIPLY_ALPHA",
13294
- false
13295
- ],
13274
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13275
+ var macros = [
13296
13276
  [
13297
13277
  "ENV_EDITOR",
13298
13278
  env === PLAYER_OPTIONS_ENV_EDITOR
13299
- ],
13300
- [
13301
- "USE_BLEND",
13302
- !ignoreBlend
13303
- ],
13304
- [
13305
- "MAX_FRAG_TEX",
13306
- exports.maxSpriteTextureCount >= 16 ? 16 : 8
13307
13279
  ]
13308
13280
  ];
13309
13281
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13312,7 +13284,7 @@ function spriteMeshShaderFromFilter(level, options) {
13312
13284
  fragment: fragment,
13313
13285
  vertex: vertex,
13314
13286
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
13315
- marcos: marcos,
13287
+ macros: macros,
13316
13288
  shared: true
13317
13289
  };
13318
13290
  }
@@ -13322,7 +13294,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13322
13294
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13323
13295
  var wireframe = renderInfo.wireframe;
13324
13296
  var shader = spriteMeshShaderFromFilter(level, {
13325
- count: count,
13326
13297
  wireframe: wireframe,
13327
13298
  env: env
13328
13299
  });
@@ -13336,9 +13307,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13336
13307
  function setMaxSpriteMeshItemCount(count) {
13337
13308
  exports.maxSpriteMeshItemCount = count;
13338
13309
  }
13339
- function setSpriteMeshMaxFragmentTextures(count) {
13340
- exports.maxSpriteTextureCount = count;
13341
- }
13342
13310
 
13343
13311
  var defRenderInfo = {
13344
13312
  blending: 0,
@@ -14739,7 +14707,7 @@ var Cone = /*#__PURE__*/ function() {
14739
14707
  // dir + [0,0,1]
14740
14708
  dir.z += 1;
14741
14709
  return {
14742
- position: position.multiply(random(0, 1)),
14710
+ position: position.multiply(randomInRange(0, 1)),
14743
14711
  direction: dir.normalize()
14744
14712
  };
14745
14713
  };
@@ -14747,7 +14715,7 @@ var Cone = /*#__PURE__*/ function() {
14747
14715
  }();
14748
14716
  function getArcAngle(arc, arcMode, opt) {
14749
14717
  if (arcMode === ShapeArcMode.RANDOM) {
14750
- arc = random(0, arc);
14718
+ arc = randomInRange(0, arc);
14751
14719
  } else if (arcMode === ShapeArcMode.UNIDIRECTIONAL_CYCLE) {
14752
14720
  var d = opt.index % (opt.total + 1);
14753
14721
  arc = arc / opt.total * d;
@@ -14787,8 +14755,8 @@ var Rectangle = /*#__PURE__*/ function() {
14787
14755
  }
14788
14756
  var _proto = Rectangle.prototype;
14789
14757
  _proto.generate = function generate(opt) {
14790
- var x = random(-this._d, this._d);
14791
- var y = random(-this._h, this._h);
14758
+ var x = randomInRange(-this._d, this._d);
14759
+ var y = randomInRange(-this._h, this._h);
14792
14760
  return {
14793
14761
  direction: new Vector3(0, 0, 1),
14794
14762
  position: new Vector3(x, y, 0)
@@ -14838,7 +14806,7 @@ var Edge = /*#__PURE__*/ function() {
14838
14806
  }
14839
14807
  var _proto = Edge.prototype;
14840
14808
  _proto.generate = function generate(options) {
14841
- var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : random(0, 1);
14809
+ var x = this.arcMode === ShapeArcMode.UNIFORM_BURST ? options.burstIndex % options.burstCount / (options.burstCount - 1) : randomInRange(0, 1);
14842
14810
  return {
14843
14811
  direction: new Vector3(0, 1, 0),
14844
14812
  position: new Vector3(this._d * (x - 0.5), 0, 0)
@@ -14859,7 +14827,7 @@ var Donut = /*#__PURE__*/ function() {
14859
14827
  _proto.generate = function generate(opt) {
14860
14828
  var dradius = this.donutRadius;
14861
14829
  var center = this.radius - dradius;
14862
- var angle = random(0, Math.PI * 2);
14830
+ var angle = randomInRange(0, Math.PI * 2);
14863
14831
  var arc = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
14864
14832
  var rot = tempMat4$2.setFromRotationZ(arc);
14865
14833
  var direction = new Vector3(Math.cos(angle), Math.sin(angle), 0);
@@ -14882,7 +14850,7 @@ var Sphere = /*#__PURE__*/ function() {
14882
14850
  }
14883
14851
  var _proto = Sphere.prototype;
14884
14852
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14885
- return random(-90, 90);
14853
+ return randomInRange(-90, 90);
14886
14854
  };
14887
14855
  _proto.generate = function generate(opt) {
14888
14856
  var rz = getArcAngle(this.arc, this.arcMode, opt) * DEG2RAD;
@@ -14905,7 +14873,7 @@ var Hemisphere = /*#__PURE__*/ function(Sphere) {
14905
14873
  }
14906
14874
  var _proto = Hemisphere.prototype;
14907
14875
  _proto.getHorizontalAngle = function getHorizontalAngle() {
14908
- return random(0, 90);
14876
+ return randomInRange(0, 90);
14909
14877
  };
14910
14878
  return Hemisphere;
14911
14879
  }(Sphere);
@@ -14971,7 +14939,7 @@ function createShape(shapeOptions) {
14971
14939
  var type = shapeOptions.type;
14972
14940
  var Ctrl = map[type];
14973
14941
  if (!Ctrl) {
14974
- throw Error("invalid shape:" + type);
14942
+ throw new Error("Invalid shape: " + type + ".");
14975
14943
  }
14976
14944
  var ctrl = new Ctrl(options);
14977
14945
  if (type !== ShapeType.NONE) {
@@ -15801,7 +15769,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15801
15769
  var uniformValues = {};
15802
15770
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15803
15771
  var lookUpTexture = 0;
15804
- var marcos = [
15772
+ var macros = [
15805
15773
  [
15806
15774
  "ENABLE_VERTEX_TEXTURE",
15807
15775
  enableVertexTexture
@@ -15818,7 +15786,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15818
15786
  var useAttributeTrailStart = maxTrailCount > 64;
15819
15787
  var shaderCacheId = 0;
15820
15788
  if (colorOverLifetime) {
15821
- marcos.push([
15789
+ macros.push([
15822
15790
  "COLOR_OVER_LIFETIME",
15823
15791
  true
15824
15792
  ]);
@@ -15826,7 +15794,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15826
15794
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15827
15795
  }
15828
15796
  if (colorOverTrail) {
15829
- marcos.push([
15797
+ macros.push([
15830
15798
  "COLOR_OVER_TRAIL",
15831
15799
  true
15832
15800
  ]);
@@ -15834,7 +15802,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15834
15802
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15835
15803
  }
15836
15804
  if (useAttributeTrailStart) {
15837
- marcos.push([
15805
+ macros.push([
15838
15806
  "ATTR_TRAIL_START",
15839
15807
  1
15840
15808
  ]);
@@ -15844,7 +15812,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15844
15812
  }
15845
15813
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15846
15814
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15847
- marcos.push([
15815
+ macros.push([
15848
15816
  "VERT_CURVE_VALUE_COUNT",
15849
15817
  keyFrameMeta.index
15850
15818
  ], [
@@ -15863,7 +15831,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15863
15831
  shader: {
15864
15832
  vertex: vertex,
15865
15833
  fragment: fragment,
15866
- marcos: marcos,
15834
+ macros: macros,
15867
15835
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
15868
15836
  shared: true,
15869
15837
  name: "trail#" + name,
@@ -16166,12 +16134,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16166
16134
  }
16167
16135
  return dir.normalize().toArray();
16168
16136
  }
16169
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16137
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16170
16138
  if (env === void 0) env = "";
16171
16139
  var shaderCacheId = 0;
16172
16140
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16173
16141
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16174
- var marcos = [
16142
+ var macros = [
16175
16143
  [
16176
16144
  "ENABLE_VERTEX_TEXTURE",
16177
16145
  enableVertexTexture
@@ -16187,14 +16155,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16187
16155
  ];
16188
16156
  var keyFrameMeta = createKeyFrameMeta();
16189
16157
  if (trails.colorOverLifetime) {
16190
- marcos.push([
16158
+ macros.push([
16191
16159
  "COLOR_OVER_LIFETIME",
16192
16160
  true
16193
16161
  ]);
16194
16162
  shaderCacheId |= 1;
16195
16163
  }
16196
16164
  if (trails.colorOverTrail) {
16197
- marcos.push([
16165
+ macros.push([
16198
16166
  "COLOR_OVER_TRAIL",
16199
16167
  true
16200
16168
  ]);
@@ -16202,7 +16170,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16202
16170
  }
16203
16171
  var useAttributeTrailStart = particleMaxCount > 64;
16204
16172
  if (useAttributeTrailStart) {
16205
- marcos.push([
16173
+ macros.push([
16206
16174
  "ATTR_TRAIL_START",
16207
16175
  1
16208
16176
  ]);
@@ -16210,7 +16178,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16210
16178
  }
16211
16179
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16212
16180
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16213
- marcos.push([
16181
+ macros.push([
16214
16182
  "VERT_CURVE_VALUE_COUNT",
16215
16183
  keyFrameMeta.index
16216
16184
  ], [
@@ -16220,7 +16188,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16220
16188
  return {
16221
16189
  vertex: trailVert,
16222
16190
  fragment: particleFrag,
16223
- marcos: marcos,
16191
+ macros: macros,
16224
16192
  shared: true,
16225
16193
  name: "trail#" + name,
16226
16194
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -16943,11 +16911,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16943
16911
  this.props = props;
16944
16912
  this.destroyed = false;
16945
16913
  var cachePrefix = "";
16946
- var options = props.options;
16947
- var positionOverLifetime = props.positionOverLifetime;
16948
- var shape = props.shape;
16949
- var gravityModifier = positionOverLifetime.gravityOverLifetime;
16950
- var gravity = ensureVec3(positionOverLifetime.gravity);
16914
+ var options = props.options, _props_positionOverLifetime = props.positionOverLifetime, positionOverLifetime = _props_positionOverLifetime === void 0 ? {} : _props_positionOverLifetime, shape = props.shape;
16915
+ var gravityModifier = positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime;
16916
+ var gravity = ensureVec3(positionOverLifetime == null ? void 0 : positionOverLifetime.gravity);
16951
16917
  var _textureSheetAnimation = props.textureSheetAnimation;
16952
16918
  var textureSheetAnimation = _textureSheetAnimation ? {
16953
16919
  animationDelay: createValueGetter(_textureSheetAnimation.animationDelay || 0),
@@ -16958,7 +16924,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16958
16924
  row: _textureSheetAnimation.row,
16959
16925
  total: _textureSheetAnimation.total || _textureSheetAnimation.col * _textureSheetAnimation.row
16960
16926
  } : undefined;
16961
- var startTurbulence = !!(shape && shape.turbulenceX || shape.turbulenceY || shape.turbulenceZ);
16927
+ var startTurbulence = !!(shape && shape.turbulenceX || (shape == null ? void 0 : shape.turbulenceY) || (shape == null ? void 0 : shape.turbulenceZ));
16962
16928
  var turbulence;
16963
16929
  if (startTurbulence) {
16964
16930
  var _shape_turbulenceX, _shape_turbulenceY, _shape_turbulenceZ;
@@ -16991,7 +16957,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16991
16957
  }
16992
16958
  }
16993
16959
  var forceTarget;
16994
- if (positionOverLifetime.forceTarget) {
16960
+ if (positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget) {
16995
16961
  forceTarget = {
16996
16962
  target: positionOverLifetime.target || [
16997
16963
  0,
@@ -17382,15 +17348,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17382
17348
  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;
17383
17349
  var detail = engine.gpuCapability.detail;
17384
17350
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17385
- var marcos = [
17351
+ var macros = [
17352
+ // spec.RenderMode
17386
17353
  [
17387
17354
  "RENDER_MODE",
17388
17355
  +renderMode
17389
17356
  ],
17390
- [
17391
- "PRE_MULTIPLY_ALPHA",
17392
- false
17393
- ],
17394
17357
  [
17395
17358
  "ENV_EDITOR",
17396
17359
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17406,13 +17369,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17406
17369
  var useOrbitalVel;
17407
17370
  this.useSprite = useSprite;
17408
17371
  if (enableVertexTexture) {
17409
- marcos.push([
17372
+ macros.push([
17410
17373
  "ENABLE_VERTEX_TEXTURE",
17411
17374
  true
17412
17375
  ]);
17413
17376
  }
17414
17377
  if (speedOverLifetime) {
17415
- marcos.push([
17378
+ macros.push([
17416
17379
  "SPEED_OVER_LIFETIME",
17417
17380
  true
17418
17381
  ]);
@@ -17420,7 +17383,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17420
17383
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17421
17384
  }
17422
17385
  if (sprite == null ? void 0 : sprite.animate) {
17423
- marcos.push([
17386
+ macros.push([
17424
17387
  "USE_SPRITE",
17425
17388
  true
17426
17389
  ]);
@@ -17434,7 +17397,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17434
17397
  this.useSprite = true;
17435
17398
  }
17436
17399
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17437
- marcos.push([
17400
+ macros.push([
17438
17401
  "COLOR_OVER_LIFETIME",
17439
17402
  true
17440
17403
  ]);
@@ -17459,7 +17422,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17459
17422
  shaderCacheId |= 1 << 7 + i;
17460
17423
  linearVelOverLifetime.enabled = true;
17461
17424
  }
17462
- marcos.push([
17425
+ macros.push([
17463
17426
  "LINEAR_VEL_" + pro.toUpperCase(),
17464
17427
  defL
17465
17428
  ]);
@@ -17470,13 +17433,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17470
17433
  useOrbitalVel = true;
17471
17434
  orbitalVelOverLifetime.enabled = true;
17472
17435
  }
17473
- marcos.push([
17436
+ macros.push([
17474
17437
  "ORB_VEL_" + pro.toUpperCase(),
17475
17438
  defO
17476
17439
  ]);
17477
17440
  });
17478
17441
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17479
- marcos.push([
17442
+ macros.push([
17480
17443
  "AS_LINEAR_MOVEMENT",
17481
17444
  true
17482
17445
  ]);
@@ -17484,7 +17447,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17484
17447
  }
17485
17448
  if (useOrbitalVel) {
17486
17449
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17487
- marcos.push([
17450
+ macros.push([
17488
17451
  "AS_ORBITAL_MOVEMENT",
17489
17452
  true
17490
17453
  ]);
@@ -17499,7 +17462,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17499
17462
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17500
17463
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17501
17464
  var _sizeOverLifetime_y;
17502
- marcos.push([
17465
+ macros.push([
17503
17466
  "SIZE_Y_BY_LIFE",
17504
17467
  1
17505
17468
  ]);
@@ -17509,7 +17472,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17509
17472
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17510
17473
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17511
17474
  shaderCacheId |= 1 << 15;
17512
- marcos.push([
17475
+ macros.push([
17513
17476
  "ROT_Z_LIFETIME",
17514
17477
  1
17515
17478
  ]);
@@ -17517,7 +17480,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17517
17480
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17518
17481
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17519
17482
  shaderCacheId |= 1 << 16;
17520
- marcos.push([
17483
+ macros.push([
17521
17484
  "ROT_X_LIFETIME",
17522
17485
  1
17523
17486
  ]);
@@ -17525,13 +17488,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17525
17488
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17526
17489
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17527
17490
  shaderCacheId |= 1 << 17;
17528
- marcos.push([
17491
+ macros.push([
17529
17492
  "ROT_Y_LIFETIME",
17530
17493
  1
17531
17494
  ]);
17532
17495
  }
17533
17496
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17534
- marcos.push([
17497
+ macros.push([
17535
17498
  "ROT_LIFETIME_AS_MOVEMENT",
17536
17499
  1
17537
17500
  ]);
@@ -17539,7 +17502,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17539
17502
  }
17540
17503
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17541
17504
  if (forceTarget) {
17542
- marcos.push([
17505
+ macros.push([
17543
17506
  "FINAL_TARGET",
17544
17507
  true
17545
17508
  ]);
@@ -17585,7 +17548,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17585
17548
  fragmentKeyFrameMeta.index,
17586
17549
  fragmentKeyFrameMeta.max
17587
17550
  ].join("+");
17588
- marcos.push([
17551
+ macros.push([
17589
17552
  "VERT_CURVE_VALUE_COUNT",
17590
17553
  vertexKeyFrameMeta.index
17591
17554
  ], [
@@ -17607,7 +17570,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17607
17570
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
17608
17571
  shared: true,
17609
17572
  cacheId: shaderCache,
17610
- marcos: marcos,
17573
+ macros: macros,
17611
17574
  name: "particle#" + name
17612
17575
  };
17613
17576
  var mtlOptions = {
@@ -17684,7 +17647,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17684
17647
  res.length = 0;
17685
17648
  break;
17686
17649
  default:
17687
- console.warn("uniform " + name + "'s type not in typeMap");
17650
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17688
17651
  }
17689
17652
  });
17690
17653
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -18020,20 +17983,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
18020
17983
  maxVertex: maxVertex
18021
17984
  };
18022
17985
  }
18023
- function getParticleMeshShader(item, env, gpuCapability) {
17986
+ function getParticleMeshShader(item, gpuCapability, env) {
18024
17987
  if (env === void 0) env = "";
18025
17988
  var _props_renderer;
18026
17989
  var props = item.content;
18027
17990
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
18028
- var marcos = [
17991
+ var macros = [
18029
17992
  [
18030
17993
  "RENDER_MODE",
18031
17994
  renderMode
18032
17995
  ],
18033
- [
18034
- "PRE_MULTIPLY_ALPHA",
18035
- false
18036
- ],
18037
17996
  [
18038
17997
  "ENV_EDITOR",
18039
17998
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18048,13 +18007,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18048
18007
  var vertex_lookup_texture = 0;
18049
18008
  var shaderCacheId = 0;
18050
18009
  if (enableVertexTexture) {
18051
- marcos.push([
18010
+ macros.push([
18052
18011
  "ENABLE_VERTEX_TEXTURE",
18053
18012
  true
18054
18013
  ]);
18055
18014
  }
18056
18015
  if (speedOverLifetime) {
18057
- marcos.push([
18016
+ macros.push([
18058
18017
  "SPEED_OVER_LIFETIME",
18059
18018
  true
18060
18019
  ]);
@@ -18063,7 +18022,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18063
18022
  }
18064
18023
  var sprite = props.textureSheetAnimation;
18065
18024
  if (sprite && sprite.animate) {
18066
- marcos.push([
18025
+ macros.push([
18067
18026
  "USE_SPRITE",
18068
18027
  true
18069
18028
  ]);
@@ -18071,7 +18030,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18071
18030
  }
18072
18031
  var colorOverLifetime = props.colorOverLifetime;
18073
18032
  if (colorOverLifetime && colorOverLifetime.color) {
18074
- marcos.push([
18033
+ macros.push([
18075
18034
  "COLOR_OVER_LIFETIME",
18076
18035
  true
18077
18036
  ]);
@@ -18096,7 +18055,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18096
18055
  defL = 1;
18097
18056
  shaderCacheId |= 1 << 7 + i;
18098
18057
  }
18099
- marcos.push([
18058
+ macros.push([
18100
18059
  "LINEAR_VEL_" + pro.toUpperCase(),
18101
18060
  defL
18102
18061
  ]);
@@ -18107,13 +18066,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18107
18066
  shaderCacheId |= 1 << 10 + i;
18108
18067
  useOrbitalVel = true;
18109
18068
  }
18110
- marcos.push([
18069
+ macros.push([
18111
18070
  "ORB_VEL_" + pro.toUpperCase(),
18112
18071
  defO
18113
18072
  ]);
18114
18073
  });
18115
18074
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18116
- marcos.push([
18075
+ macros.push([
18117
18076
  "AS_LINEAR_MOVEMENT",
18118
18077
  true
18119
18078
  ]);
@@ -18121,7 +18080,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18121
18080
  }
18122
18081
  if (useOrbitalVel) {
18123
18082
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18124
- marcos.push([
18083
+ macros.push([
18125
18084
  "AS_ORBITAL_MOVEMENT",
18126
18085
  true
18127
18086
  ]);
@@ -18133,7 +18092,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18133
18092
  var separateAxes = sizeOverLifetime.separateAxes;
18134
18093
  if (separateAxes) {
18135
18094
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18136
- marcos.push([
18095
+ macros.push([
18137
18096
  "SIZE_Y_BY_LIFE",
18138
18097
  1
18139
18098
  ]);
@@ -18148,7 +18107,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18148
18107
  if (rot.z) {
18149
18108
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18150
18109
  shaderCacheId |= 1 << 15;
18151
- marcos.push([
18110
+ macros.push([
18152
18111
  "ROT_Z_LIFETIME",
18153
18112
  1
18154
18113
  ]);
@@ -18157,7 +18116,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18157
18116
  if (rot.x) {
18158
18117
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18159
18118
  shaderCacheId |= 1 << 16;
18160
- marcos.push([
18119
+ macros.push([
18161
18120
  "ROT_X_LIFETIME",
18162
18121
  1
18163
18122
  ]);
@@ -18165,14 +18124,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18165
18124
  if (rot.y) {
18166
18125
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18167
18126
  shaderCacheId |= 1 << 17;
18168
- marcos.push([
18127
+ macros.push([
18169
18128
  "ROT_Y_LIFETIME",
18170
18129
  1
18171
18130
  ]);
18172
18131
  }
18173
18132
  }
18174
18133
  if (rot == null ? void 0 : rot.asRotation) {
18175
- marcos.push([
18134
+ macros.push([
18176
18135
  "ROT_LIFETIME_AS_MOVEMENT",
18177
18136
  1
18178
18137
  ]);
@@ -18182,7 +18141,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18182
18141
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18183
18142
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18184
18143
  if (forceOpt) {
18185
- marcos.push([
18144
+ macros.push([
18186
18145
  "FINAL_TARGET",
18187
18146
  true
18188
18147
  ]);
@@ -18223,10 +18182,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18223
18182
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18224
18183
  shared: true,
18225
18184
  cacheId: shaderCache,
18226
- marcos: marcos,
18185
+ macros: macros,
18227
18186
  name: "particle#" + item.name
18228
18187
  };
18229
- marcos.push([
18188
+ macros.push([
18230
18189
  "VERT_CURVE_VALUE_COUNT",
18231
18190
  vertexKeyFrameMeta.index
18232
18191
  ], [
@@ -18251,11 +18210,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18251
18210
  shaderIds[3] = maxVertex;
18252
18211
  shaderIds[5] = maxFrag;
18253
18212
  shader.cacheId = shaderIds.join("+");
18254
- if (!shader.marcos) {
18213
+ if (!shader.macros) {
18255
18214
  return;
18256
18215
  }
18257
- for(var i = 0; i < shader.marcos.length; i++){
18258
- var marco = shader.marcos[i];
18216
+ for(var i = 0; i < shader.macros.length; i++){
18217
+ var marco = shader.macros[i];
18259
18218
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18260
18219
  marco[1] = maxVertex;
18261
18220
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18288,17 +18247,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18288
18247
  });
18289
18248
  });
18290
18249
  items.forEach(function(item) {
18291
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18250
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18292
18251
  shaders.push(shader);
18293
18252
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18294
18253
  maxVertexCount = Math.max(maxVertexCount, vertex);
18295
18254
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18296
18255
  if (item.content.trails) {
18297
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18298
- var _shader_marcos;
18299
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, exports.ShaderType.vertex, level);
18300
- var _shader_marcos1;
18301
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18256
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18257
+ var _shader_macros;
18258
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, exports.ShaderType.vertex, level);
18259
+ var _shader_macros1;
18260
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18302
18261
  shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
18303
18262
  shaderLibrary.addShader(shader1);
18304
18263
  }
@@ -18310,10 +18269,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18310
18269
  } else {
18311
18270
  shader.glslVersion = exports.GLSLVersion.GLSL1;
18312
18271
  }
18313
- var _shader_marcos;
18314
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, exports.ShaderType.vertex, level);
18315
- var _shader_marcos1;
18316
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, exports.ShaderType.fragment, level);
18272
+ var _shader_macros;
18273
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
18274
+ var _shader_macros1;
18275
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
18317
18276
  shaderLibrary.addShader(shader);
18318
18277
  });
18319
18278
  if (level === 2) {
@@ -18695,6 +18654,29 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18695
18654
  return AnimationClipPlayable;
18696
18655
  }(Playable);
18697
18656
 
18657
+ /**
18658
+ * @since 2.0.0
18659
+ * @internal
18660
+ */ var TimelineClip = /*#__PURE__*/ function() {
18661
+ function TimelineClip() {
18662
+ this.start = 0;
18663
+ this.duration = 0;
18664
+ }
18665
+ var _proto = TimelineClip.prototype;
18666
+ _proto.toLocalTime = function toLocalTime(time) {
18667
+ var localTime = time - this.start;
18668
+ var duration = this.duration;
18669
+ if (localTime - duration > 0.001) {
18670
+ if (this.endBehaviour === ItemEndBehavior.loop) {
18671
+ localTime = localTime % duration;
18672
+ } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18673
+ localTime = Math.min(duration, localTime);
18674
+ }
18675
+ }
18676
+ return localTime;
18677
+ };
18678
+ return TimelineClip;
18679
+ }();
18698
18680
  exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18699
18681
  _inherits(TrackAsset, PlayableAsset);
18700
18682
  function TrackAsset() {
@@ -18756,7 +18738,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18756
18738
  this.children.push(child);
18757
18739
  };
18758
18740
  _proto.createClip = function createClip(classConstructor, name) {
18759
- var newClip = new exports.TimelineClip();
18741
+ var newClip = new TimelineClip();
18760
18742
  newClip.asset = new classConstructor(this.engine);
18761
18743
  newClip.name = name ? name : "TimelineClip" + newClip.id;
18762
18744
  this.addClip(newClip);
@@ -18783,7 +18765,7 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
18783
18765
  return TrackAsset;
18784
18766
  }(PlayableAsset);
18785
18767
  __decorate([
18786
- serialize("TimelineClip")
18768
+ serialize(TimelineClip)
18787
18769
  ], exports.TrackAsset.prototype, "clips", void 0);
18788
18770
  __decorate([
18789
18771
  serialize()
@@ -18796,29 +18778,6 @@ exports.TrackType = void 0;
18796
18778
  TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
18797
18779
  TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
18798
18780
  })(exports.TrackType || (exports.TrackType = {}));
18799
- exports.TimelineClip = /*#__PURE__*/ function() {
18800
- function TimelineClip() {
18801
- this.start = 0;
18802
- this.duration = 0;
18803
- }
18804
- var _proto = TimelineClip.prototype;
18805
- _proto.toLocalTime = function toLocalTime(time) {
18806
- var localTime = time - this.start;
18807
- var duration = this.duration;
18808
- if (localTime - duration > 0.001) {
18809
- if (this.endBehaviour === ItemEndBehavior.loop) {
18810
- localTime = localTime % duration;
18811
- } else if (this.endBehaviour === ItemEndBehavior.freeze) {
18812
- localTime = Math.min(duration, localTime);
18813
- }
18814
- }
18815
- return localTime;
18816
- };
18817
- return TimelineClip;
18818
- }();
18819
- exports.TimelineClip = __decorate([
18820
- effectsClass("TimelineClip")
18821
- ], exports.TimelineClip);
18822
18781
  var RuntimeClip = /*#__PURE__*/ function() {
18823
18782
  function RuntimeClip(clip, clipPlayable, parentMixer, track) {
18824
18783
  this.clip = clip;
@@ -18905,10 +18864,6 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
18905
18864
  particleClip.endBehaviour = boundItem.endBehavior;
18906
18865
  }
18907
18866
  };
18908
- _proto.fromData = function fromData(data) {
18909
- TrackAsset1.prototype.fromData.call(this, data);
18910
- this.data = data;
18911
- };
18912
18867
  return ObjectBindingTrack;
18913
18868
  }(exports.TrackAsset);
18914
18869
  exports.ObjectBindingTrack = __decorate([
@@ -19148,7 +19103,6 @@ function compareTracks(a, b) {
19148
19103
  this.startTime = startTime;
19149
19104
  this.resolveBindings();
19150
19105
  this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
19151
- this.timelinePlayable.play();
19152
19106
  // 重播不销毁元素
19153
19107
  if (this.item.endBehavior !== ItemEndBehavior.destroy) {
19154
19108
  this.setReusable(true);
@@ -19206,7 +19160,7 @@ function compareTracks(a, b) {
19206
19160
  var refId = itemData.content.options.refId;
19207
19161
  var props = this.item.composition.refCompositionProps.get(refId);
19208
19162
  if (!props) {
19209
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19163
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19210
19164
  }
19211
19165
  // endBehaviour 类型需优化
19212
19166
  props.content = itemData.content;
@@ -19359,7 +19313,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19359
19313
  var _proto = SubCompositionTrack.prototype;
19360
19314
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19361
19315
  if (!_instanceof1(parentBinding, exports.VFXItem)) {
19362
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19316
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19363
19317
  }
19364
19318
  return parentBinding.getComponent(CompositionComponent);
19365
19319
  };
@@ -19567,7 +19521,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19567
19521
  return this.elements.shift();
19568
19522
  }
19569
19523
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19570
- // @ts-expect-error
19571
19524
  return window._createOffscreenCanvas(10, 10);
19572
19525
  } else {
19573
19526
  // in hongmeng system, create too many canvas will case render error
@@ -20136,6 +20089,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20136
20089
  /**
20137
20090
  * 元素动画的速度
20138
20091
  */ _this.speed = 1;
20092
+ _this.listIndex = 0;
20139
20093
  _this.name = "VFXItem";
20140
20094
  _this.transform.name = _this.name;
20141
20095
  _this.transform.engine = engine;
@@ -20406,7 +20360,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20406
20360
  this.parentId = parentId;
20407
20361
  this.duration = duration;
20408
20362
  this.endBehavior = endBehavior;
20409
- this.renderOrder = listIndex;
20410
20363
  //@ts-expect-error
20411
20364
  this.oldId = data.oldId;
20412
20365
  if (!data.content) {
@@ -20415,20 +20368,14 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20415
20368
  };
20416
20369
  }
20417
20370
  if (duration <= 0) {
20418
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20371
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20419
20372
  }
20420
- if (data.components) {
20421
- for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
20422
- var component = _step.value;
20423
- var newComponent = component;
20424
- this.components.push(newComponent);
20425
- if (_instanceof1(newComponent, RendererComponent)) {
20426
- this.rendererComponents.push(newComponent);
20427
- } else if (_instanceof1(newComponent, ItemBehaviour)) {
20428
- this.itemBehaviours.push(newComponent);
20429
- }
20430
- }
20373
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20374
+ var component = _step.value;
20375
+ component.onAttached();
20431
20376
  }
20377
+ // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
20378
+ this.renderOrder = listIndex;
20432
20379
  };
20433
20380
  _proto.toData = function toData() {
20434
20381
  var _this_parent;
@@ -20559,6 +20506,9 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20559
20506
  ]);
20560
20507
  return VFXItem;
20561
20508
  }(EffectsObject);
20509
+ __decorate([
20510
+ serialize()
20511
+ ], exports.VFXItem.prototype, "components", void 0);
20562
20512
  exports.VFXItem = __decorate([
20563
20513
  effectsClass(DataType.VFXItemData)
20564
20514
  ], exports.VFXItem);
@@ -20612,7 +20562,7 @@ exports.Item = void 0;
20612
20562
  pluginName = "tree";
20613
20563
  break;
20614
20564
  default:
20615
- throw new Error("invalid vfx item type");
20565
+ throw new Error("Invalid vfx item type.");
20616
20566
  }
20617
20567
  }
20618
20568
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20656,7 +20606,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20656
20606
  this.plugins = Object.keys(loaders).map(function(name) {
20657
20607
  var CTRL = pluginLoaderMap[name];
20658
20608
  if (!CTRL) {
20659
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20609
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20660
20610
  }
20661
20611
  var loader = new CTRL();
20662
20612
  loader.name = name;
@@ -20684,13 +20634,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20684
20634
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20685
20635
  var CTRL = pluginCtrlMap[name];
20686
20636
  if (!CTRL) {
20687
- throw new Error("plugin " + name + " no registered constructor");
20637
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20688
20638
  }
20689
20639
  var engine = composition.getEngine();
20690
20640
  var item = new CTRL(engine, props, composition);
20691
20641
  item.composition = composition;
20692
20642
  if (!_instanceof1(item, exports.VFXItem)) {
20693
- throw new Error("plugin " + name + " invalid constructor type");
20643
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20694
20644
  }
20695
20645
  return item;
20696
20646
  };
@@ -20788,22 +20738,22 @@ var SerializationHelper = /*#__PURE__*/ function() {
20788
20738
  if (value === undefined) {
20789
20739
  value = effectsObject[key];
20790
20740
  }
20791
- if (_instanceof1(value, EffectsObject)) {
20792
- this.collectSerializableObject(value, res);
20793
- } else if (_instanceof1(value, Array)) {
20741
+ if (EffectsObject.is(value)) {
20742
+ SerializationHelper.collectSerializableObject(value, res);
20743
+ } else if (isArray(value)) {
20794
20744
  for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
20795
20745
  var arrayValue = _step1.value;
20796
- if (_instanceof1(arrayValue, EffectsObject)) {
20797
- this.collectSerializableObject(arrayValue, res);
20746
+ if (EffectsObject.is(arrayValue)) {
20747
+ SerializationHelper.collectSerializableObject(arrayValue, res);
20798
20748
  }
20799
20749
  }
20800
- } else if (_instanceof1(value, Object)) {
20750
+ } else if (isObject(value)) {
20801
20751
  // 非 EffectsObject 对象只递归一层
20802
20752
  for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
20803
20753
  var objectKey = _step2.value;
20804
20754
  var objectValue = value[objectKey];
20805
- if (_instanceof1(objectValue, EffectsObject)) {
20806
- this.collectSerializableObject(objectValue, res);
20755
+ if (EffectsObject.is(objectValue)) {
20756
+ SerializationHelper.collectSerializableObject(objectValue, res);
20807
20757
  }
20808
20758
  }
20809
20759
  }
@@ -20840,17 +20790,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20840
20790
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
20841
20791
  // TODO json 数据避免传 typedArray
20842
20792
  serializedData[key] = value;
20843
- } else if (_instanceof1(value, Array)) {
20793
+ } else if (isArray(value)) {
20844
20794
  if (!serializedData[key]) {
20845
20795
  serializedData[key] = [];
20846
20796
  }
20847
20797
  SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
20848
- } else if (_instanceof1(value, EffectsObject)) {
20798
+ } else if (EffectsObject.is(value)) {
20849
20799
  // TODO 处理 EffectsObject 递归序列化
20850
20800
  serializedData[key] = {
20851
20801
  id: value.getInstanceId()
20852
20802
  };
20853
- } else if (_instanceof1(value, Object)) {
20803
+ } else if (isObject(value)) {
20854
20804
  if (!serializedData[key]) {
20855
20805
  serializedData[key] = {};
20856
20806
  }
@@ -20864,17 +20814,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
20864
20814
  if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
20865
20815
  // TODO json 数据避免传 typedArray
20866
20816
  serializedData[key1] = value1;
20867
- } else if (_instanceof1(value1, Array)) {
20817
+ } else if (isArray(value1)) {
20868
20818
  if (!serializedData[key1]) {
20869
20819
  serializedData[key1] = [];
20870
20820
  }
20871
20821
  SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
20872
- } else if (_instanceof1(value1, EffectsObject)) {
20822
+ } else if (EffectsObject.is(value1)) {
20873
20823
  // TODO 处理 EffectsObject 递归序列化
20874
20824
  serializedData[key1] = {
20875
20825
  id: value1.getInstanceId()
20876
20826
  };
20877
- } else if (_instanceof1(value1, Object)) {
20827
+ } else if (isObject(value1)) {
20878
20828
  if (!serializedData[key1]) {
20879
20829
  serializedData[key1] = {};
20880
20830
  }
@@ -20987,24 +20937,24 @@ var SerializationHelper = /*#__PURE__*/ function() {
20987
20937
  SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
20988
20938
  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);
20989
20939
  };
20940
+ // check value is { id: 7e69662e964e4892ae8933f24562395b }
20990
20941
  SerializationHelper.checkDataPath = function checkDataPath(value) {
20991
- // check value is { id: 7e69662e964e4892ae8933f24562395b }
20992
- return _instanceof1(value, Object) && Object.keys(value).length === 1 && value.id && value.id.length === 32;
20942
+ return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
20993
20943
  };
20994
20944
  // TODO 测试函数,2.0 上线后移除
20995
20945
  SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
20996
- return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20946
+ return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
20997
20947
  };
20998
20948
  SerializationHelper.checkImageSource = function checkImageSource(value) {
20999
20949
  return isCanvas(value) || _instanceof1(value, HTMLImageElement);
21000
20950
  };
21001
20951
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
21002
20952
  if (level > 14) {
21003
- console.error("序列化数据的内嵌对象层数大于上限");
20953
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21004
20954
  return;
21005
20955
  }
21006
20956
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
21007
- if (_instanceof1(property, Array)) {
20957
+ if (isArray(property)) {
21008
20958
  var res = [];
21009
20959
  for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
21010
20960
  var value = _step.value;
@@ -21014,17 +20964,15 @@ var SerializationHelper = /*#__PURE__*/ function() {
21014
20964
  // TODO json 数据避免传 typedArray
21015
20965
  } else if (SerializationHelper.checkDataPath(property)) {
21016
20966
  return engine.assetLoader.loadGUID(property.id);
21017
- } else if (_instanceof1(property, Object) && property.constructor === Object) {
20967
+ } else if (isObject(property) && property.constructor === Object) {
21018
20968
  var res1;
21019
20969
  if (type) {
21020
- var classConstructor = effectsClassStore[type];
21021
- res1 = new classConstructor();
20970
+ res1 = new type();
21022
20971
  } else {
21023
20972
  res1 = {};
21024
20973
  }
21025
20974
  for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
21026
20975
  var key = _step1.value;
21027
- // @ts-expect-error
21028
20976
  res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21029
20977
  }
21030
20978
  return res1;
@@ -21034,17 +20982,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21034
20982
  };
21035
20983
  SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
21036
20984
  return _async_to_generator(function() {
21037
- var res, _iterator, _step, value, _, res1, res2, classConstructor, _iterator1, _step1, key;
20985
+ var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
21038
20986
  return __generator(this, function(_state) {
21039
20987
  switch(_state.label){
21040
20988
  case 0:
21041
20989
  if (level > 14) {
21042
- console.error("序列化数据的内嵌对象层数大于上限");
20990
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21043
20991
  return [
21044
20992
  2
21045
20993
  ];
21046
20994
  }
21047
- if (!_instanceof1(property, Array)) return [
20995
+ if (!isArray(property)) return [
21048
20996
  3,
21049
20997
  5
21050
20998
  ];
@@ -21093,16 +21041,14 @@ var SerializationHelper = /*#__PURE__*/ function() {
21093
21041
  res1
21094
21042
  ];
21095
21043
  case 7:
21096
- if (_instanceof1(property, Object) && property.constructor === Object) {
21044
+ if (isObject(property) && property.constructor === Object) {
21097
21045
  if (type) {
21098
- classConstructor = effectsClassStore[type];
21099
- res2 = new classConstructor();
21046
+ res2 = new type();
21100
21047
  } else {
21101
21048
  res2 = {};
21102
21049
  }
21103
21050
  for(_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)); !(_step1 = _iterator1()).done;){
21104
21051
  key = _step1.value;
21105
- // @ts-expect-error
21106
21052
  res2[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
21107
21053
  }
21108
21054
  return [
@@ -21125,7 +21071,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21125
21071
  };
21126
21072
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21127
21073
  if (level > 14) {
21128
- console.error("序列化数据的内嵌对象层数大于上限");
21074
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21129
21075
  return;
21130
21076
  }
21131
21077
  if (!serializedData) {
@@ -21137,17 +21083,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21137
21083
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
21138
21084
  // TODO json 数据避免传 typedArray
21139
21085
  serializedData[key] = value;
21140
- } else if (_instanceof1(value, Array)) {
21086
+ } else if (isArray(value)) {
21141
21087
  if (!serializedData[key]) {
21142
21088
  serializedData[key] = [];
21143
21089
  }
21144
21090
  SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
21145
- } else if (_instanceof1(value, EffectsObject)) {
21091
+ } else if (EffectsObject.is(value)) {
21146
21092
  // TODO 处理 EffectsObject 递归序列化
21147
21093
  serializedData[key] = {
21148
21094
  id: value.getInstanceId()
21149
21095
  };
21150
- } else if (_instanceof1(value, Object)) {
21096
+ } else if (isObject(value)) {
21151
21097
  if (!serializedData[key]) {
21152
21098
  serializedData[key] = {};
21153
21099
  }
@@ -21157,7 +21103,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21157
21103
  };
21158
21104
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21159
21105
  if (level > 14) {
21160
- console.error("序列化数据的内嵌对象层数大于上限");
21106
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21161
21107
  return;
21162
21108
  }
21163
21109
  if (!serializedData) {
@@ -21168,17 +21114,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
21168
21114
  if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
21169
21115
  // TODO json 数据避免传 typedArray
21170
21116
  serializedData[i] = value;
21171
- } else if (_instanceof1(value, Array)) {
21117
+ } else if (isArray(value)) {
21172
21118
  if (!serializedData[i]) {
21173
21119
  serializedData[i] = [];
21174
21120
  }
21175
- this.serializeArrayProperty(value, serializedData[i], level + 1);
21176
- } else if (_instanceof1(value, EffectsObject)) {
21121
+ SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
21122
+ } else if (EffectsObject.is(value)) {
21177
21123
  // TODO 处理 EffectsObject 递归序列化
21178
21124
  serializedData[i] = {
21179
21125
  id: value.getInstanceId()
21180
21126
  };
21181
- } else if (_instanceof1(value, Object)) {
21127
+ } else if (isObject(value)) {
21182
21128
  if (!serializedData[i]) {
21183
21129
  serializedData[i] = {};
21184
21130
  }
@@ -21204,7 +21150,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21204
21150
  var effectsObject;
21205
21151
  var effectsObjectData = this.findData(guid);
21206
21152
  if (!effectsObjectData) {
21207
- console.error("未找到 uuid: " + guid + "的对象数据");
21153
+ console.error("Object data with uuid: " + guid + " not found.");
21208
21154
  return undefined;
21209
21155
  }
21210
21156
  switch(effectsObjectData.dataType){
@@ -21226,7 +21172,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21226
21172
  }
21227
21173
  }
21228
21174
  if (!effectsObject) {
21229
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21175
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21230
21176
  return undefined;
21231
21177
  }
21232
21178
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21254,7 +21200,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21254
21200
  2
21255
21201
  ];
21256
21202
  if (!_this.engine.database) {
21257
- console.error("未找到 uuid: " + guid + "的对象数据");
21203
+ console.error("Object data with uuid: " + guid + " not found.");
21258
21204
  return [
21259
21205
  2,
21260
21206
  undefined
@@ -21267,7 +21213,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21267
21213
  case 1:
21268
21214
  effectsObject = _state.sent();
21269
21215
  if (!effectsObject) {
21270
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21216
+ console.error("Disk data with uuid: " + guid + " not found.");
21271
21217
  return [
21272
21218
  2,
21273
21219
  undefined
@@ -21298,7 +21244,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21298
21244
  }
21299
21245
  }
21300
21246
  if (!effectsObject) {
21301
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21247
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21302
21248
  return [
21303
21249
  2,
21304
21250
  undefined
@@ -22218,8 +22164,6 @@ function getStandardCameraContent(model) {
22218
22164
  // 生成时间轴数据
22219
22165
  convertTimelineAsset(compositionData, guidToItemMap, result);
22220
22166
  };
22221
- var // 更正 spine 数据中的 images 属性
22222
- _json_spines;
22223
22167
  var // 兼容老版本数据中不存在textures的情况
22224
22168
  _result;
22225
22169
  var result = _extends({}, json, {
@@ -22229,7 +22173,8 @@ function getStandardCameraContent(model) {
22229
22173
  materials: [],
22230
22174
  shaders: [],
22231
22175
  geometries: [],
22232
- animations: []
22176
+ animations: [],
22177
+ miscs: []
22233
22178
  });
22234
22179
  // image数据添加 guid
22235
22180
  for(var _iterator = _create_for_of_iterator_helper_loose(result.images), _step; !(_step = _iterator()).done;){
@@ -22259,17 +22204,10 @@ function getStandardCameraContent(model) {
22259
22204
  });
22260
22205
  }
22261
22206
  }
22262
- (_json_spines = json.spines) == null ? void 0 : _json_spines.forEach(function(spine) {
22263
- for(var i = 0; i < spine.images.length; i++){
22264
- var _json_textures_spine_images_i;
22265
- //@ts-expect-error
22266
- var textureId = (_json_textures_spine_images_i = json.textures[spine.images[i]]) == null ? void 0 : _json_textures_spine_images_i.id;
22267
- //@ts-expect-error
22268
- spine.images[i] = {
22269
- id: textureId
22270
- };
22271
- }
22272
- });
22207
+ // 处理老版本数据中 bins 没有 id 的情况
22208
+ if (json.bins) {
22209
+ convertBinaryAsset(json.bins, result);
22210
+ }
22273
22211
  var itemOldIdToGuidMap = {};
22274
22212
  var guidToItemMap = {};
22275
22213
  // 更正Composition.endBehavior
@@ -22433,6 +22371,10 @@ function getStandardCameraContent(model) {
22433
22371
  //@ts-expect-error
22434
22372
  item.type = "orientation-transformer";
22435
22373
  }
22374
+ // Spine 元素转为 guid 索引
22375
+ if (item.type === ItemType.spine && json.spines && json.spines.length !== 0) {
22376
+ convertSpineData(json.spines[item.content.options.spine], item.content, result);
22377
+ }
22436
22378
  // item 的 content 转为 component data 加入 JSONScene.components
22437
22379
  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") {
22438
22380
  item.components = [];
@@ -22680,29 +22622,61 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22680
22622
  id: timelineAssetData.id
22681
22623
  };
22682
22624
  composition.sceneBindings = sceneBindings;
22683
- if (!jsonScene.animations) {
22684
- jsonScene.animations = [];
22685
- }
22686
- // @ts-expect-error
22687
- jsonScene.animations.push(timelineAssetData);
22625
+ jsonScene.miscs.push(timelineAssetData);
22688
22626
  for(var _iterator2 = _create_for_of_iterator_helper_loose(trackDatas), _step2; !(_step2 = _iterator2()).done;){
22689
22627
  var trackData1 = _step2.value;
22690
22628
  //@ts-expect-error
22691
- jsonScene.animations.push(trackData1);
22629
+ jsonScene.miscs.push(trackData1);
22692
22630
  }
22693
22631
  for(var _iterator3 = _create_for_of_iterator_helper_loose(playableAssetDatas), _step3; !(_step3 = _iterator3()).done;){
22694
22632
  var playableAsset = _step3.value;
22695
22633
  //@ts-expect-error
22696
- jsonScene.animations.push(playableAsset);
22634
+ jsonScene.miscs.push(playableAsset);
22697
22635
  }
22698
22636
  }
22637
+ function convertBinaryAsset(bins, jsonScene) {
22638
+ //@ts-expect-error
22639
+ jsonScene.bins = bins.map(function(bin) {
22640
+ return {
22641
+ url: bin.url,
22642
+ "dataType": "BinaryAsset",
22643
+ id: generateGUID()
22644
+ };
22645
+ });
22646
+ }
22647
+ function convertSpineData(resource, content, jsonScene) {
22648
+ //@ts-expect-error
22649
+ content.resource = {
22650
+ "atlas": {
22651
+ "bins": {
22652
+ //@ts-expect-error
22653
+ "id": jsonScene.bins[resource.atlas[1][0]].id
22654
+ },
22655
+ "source": resource.atlas[1].slice(1)
22656
+ },
22657
+ "skeleton": {
22658
+ "bins": {
22659
+ //@ts-expect-error
22660
+ "id": jsonScene.bins[resource.skeleton[1][0]].id
22661
+ },
22662
+ "source": resource.skeleton[1].slice(1)
22663
+ },
22664
+ "skeletonType": resource.skeletonType,
22665
+ "images": resource.images.map(function(i) {
22666
+ return {
22667
+ //@ts-expect-error
22668
+ id: jsonScene.textures[i].id
22669
+ };
22670
+ })
22671
+ };
22672
+ }
22699
22673
 
22700
22674
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
22701
22675
  var standardVersion = /^(\d+)\.(\d+)$/;
22702
22676
  var reverseParticle = false;
22703
22677
  function getStandardJSON(json) {
22704
22678
  if (!json || typeof json !== "object") {
22705
- throw Error("expect a json object");
22679
+ throw new Error("Invalid input: Expected a JSON object.");
22706
22680
  }
22707
22681
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22708
22682
  version22Migration(json);
@@ -22723,7 +22697,7 @@ function getStandardJSON(json) {
22723
22697
  }
22724
22698
  return json;
22725
22699
  }
22726
- throw Error("invalid json version " + json.version);
22700
+ throw new Error("Invalid JSON version: " + json.version + ".");
22727
22701
  }
22728
22702
  var currentVersion = "1.0";
22729
22703
  function getStandardJSONFromV0(json) {
@@ -22815,7 +22789,7 @@ function getStandardImage(image, index, imageTags) {
22815
22789
  } else if (image && image.sourceType) {
22816
22790
  return image;
22817
22791
  }
22818
- throw Error("invalid image type");
22792
+ throw new Error("Invalid image type.");
22819
22793
  }
22820
22794
  function getStandardComposition(composition, opt) {
22821
22795
  if (opt === void 0) opt = {};
@@ -23099,7 +23073,7 @@ function _combineImageTemplate() {
23099
23073
  _state.label = 3;
23100
23074
  case 3:
23101
23075
  if (!image) {
23102
- throw new Error("image not provided.");
23076
+ throw new Error("Image not provided.");
23103
23077
  }
23104
23078
  if (!template) {
23105
23079
  return [
@@ -23217,7 +23191,7 @@ var seed$1 = 1;
23217
23191
  cancelLoading = true;
23218
23192
  _this.removeTimer(loadTimer);
23219
23193
  var totalTime = performance.now() - startTime;
23220
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23194
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23221
23195
  }, _this.timeout * 1000);
23222
23196
  _this.timers.push(loadTimer);
23223
23197
  });
@@ -23252,7 +23226,7 @@ var seed$1 = 1;
23252
23226
  ];
23253
23227
  case 3:
23254
23228
  e = _state.sent();
23255
- throw new Error("Load error in " + label + ", " + e);
23229
+ throw new Error("Load error in " + label + ", " + e + ".");
23256
23230
  case 4:
23257
23231
  throw new Error("Load canceled.");
23258
23232
  }
@@ -23398,7 +23372,7 @@ var seed$1 = 1;
23398
23372
  _state.label = 12;
23399
23373
  case 12:
23400
23374
  totalTime = performance.now() - startTime;
23401
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23375
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23402
23376
  window.clearTimeout(loadTimer);
23403
23377
  _this.removeTimer(loadTimer);
23404
23378
  scene.totalTime = totalTime;
@@ -23441,7 +23415,7 @@ var seed$1 = 1;
23441
23415
  return [
23442
23416
  4,
23443
23417
  new Promise(function(resolve) {
23444
- shaderLibrary.compileAllShaders(function() {
23418
+ shaderLibrary == null ? void 0 : shaderLibrary.compileAllShaders(function() {
23445
23419
  resolve(null);
23446
23420
  });
23447
23421
  })
@@ -23516,7 +23490,7 @@ var seed$1 = 1;
23516
23490
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23517
23491
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23518
23492
  }
23519
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23493
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23520
23494
  });
23521
23495
  return [
23522
23496
  2,
@@ -23547,7 +23521,7 @@ var seed$1 = 1;
23547
23521
  ];
23548
23522
  if (!isValidFontFamily(font.fontFamily)) {
23549
23523
  // 在所有设备上提醒开发者
23550
- console.warn("Risky font family: " + font.fontFamily);
23524
+ console.warn("Risky font family: " + font.fontFamily + ".");
23551
23525
  }
23552
23526
  _state.label = 1;
23553
23527
  case 1:
@@ -23574,7 +23548,7 @@ var seed$1 = 1;
23574
23548
  ];
23575
23549
  case 3:
23576
23550
  _state.sent();
23577
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23551
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23578
23552
  return [
23579
23553
  3,
23580
23554
  4
@@ -23670,7 +23644,7 @@ var seed$1 = 1;
23670
23644
  ];
23671
23645
  case 6:
23672
23646
  e = _state.sent();
23673
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23647
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23674
23648
  case 7:
23675
23649
  return [
23676
23650
  3,
@@ -23769,7 +23743,7 @@ var seed$1 = 1;
23769
23743
  ]);
23770
23744
  return [
23771
23745
  4,
23772
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23746
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23773
23747
  ];
23774
23748
  case 2:
23775
23749
  return [
@@ -23778,7 +23752,7 @@ var seed$1 = 1;
23778
23752
  ];
23779
23753
  case 3:
23780
23754
  e = _state.sent();
23781
- throw new Error("load texture " + idx + " fails, error message: " + e);
23755
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23782
23756
  case 4:
23783
23757
  source = texOpts.source;
23784
23758
  if (!isObject(source)) return [
@@ -23813,7 +23787,7 @@ var seed$1 = 1;
23813
23787
  tex.sourceType === exports.TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23814
23788
  ];
23815
23789
  }
23816
- throw new Error("Invalid texture source: " + source);
23790
+ throw new Error("Invalid texture source: " + source + ".");
23817
23791
  }
23818
23792
  });
23819
23793
  }));
@@ -23931,7 +23905,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23931
23905
  magFilter: glContext.NEAREST
23932
23906
  };
23933
23907
  }
23934
- throw new Error("Invalid texture options");
23908
+ throw new Error("Invalid texture options.");
23935
23909
  }
23936
23910
 
23937
23911
  var tmpScale = new Vector3(1, 1, 1);
@@ -24223,7 +24197,7 @@ var listOrder = 0;
24223
24197
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24224
24198
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24225
24199
  if (!textureOptions) {
24226
- throw new Error("scene.textures expected");
24200
+ throw new Error("scene.textures expected.");
24227
24201
  }
24228
24202
  var cachedTextures = textureOptions;
24229
24203
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24235,7 +24209,7 @@ var listOrder = 0;
24235
24209
  }
24236
24210
  }
24237
24211
  if (!this.composition) {
24238
- throw new Error("Invalid composition id: " + compositionId);
24212
+ throw new Error("Invalid composition id: " + compositionId + ".");
24239
24213
  }
24240
24214
  this.jsonScene = jsonScene;
24241
24215
  this.renderLevel = renderLevel;
@@ -24297,7 +24271,7 @@ var listOrder = 0;
24297
24271
  if (itemProps.type === ItemType.composition) {
24298
24272
  var refId = sourceItemData.content.options.refId;
24299
24273
  if (!this.refCompositions.get(refId)) {
24300
- throw new Error("Invalid Ref Composition id: " + refId);
24274
+ throw new Error("Invalid ref composition id: " + refId + ".");
24301
24275
  }
24302
24276
  var ref = this.getContent(this.refCompositions.get(refId));
24303
24277
  if (!this.refCompositionProps.has(refId)) {
@@ -24410,11 +24384,11 @@ var listOrder = 0;
24410
24384
  /**
24411
24385
  * 销毁状态位
24412
24386
  */ this.destroyed = false;
24387
+ this.postLoaders = [];
24413
24388
  /**
24414
24389
  * 合成暂停/播放 标识
24415
24390
  */ this.paused = false;
24416
24391
  this.lastVideoUpdateTime = 0;
24417
- this.postLoaders = [];
24418
24392
  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;
24419
24393
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24420
24394
  scene.jsonScene.imgUsage = undefined;
@@ -24813,7 +24787,7 @@ var listOrder = 0;
24813
24787
  }
24814
24788
  parent.children.push(item1);
24815
24789
  } else {
24816
- throw Error("元素引用了不存在的元素,请检查数据");
24790
+ throw new Error("The element references a non-existent element, please check the data.");
24817
24791
  }
24818
24792
  }
24819
24793
  }
@@ -25062,7 +25036,7 @@ var listOrder = 0;
25062
25036
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25063
25037
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25064
25038
  if (!this.renderer) {
25065
- console.warn("Can not translate position when container not assigned");
25039
+ console.warn("Renderer not assigned. Operation aborted.");
25066
25040
  return;
25067
25041
  }
25068
25042
  this.rootItem.translateByPixel(x, y);
@@ -25076,7 +25050,7 @@ var listOrder = 0;
25076
25050
  * @param y - y 坐标
25077
25051
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25078
25052
  if (!this.renderer) {
25079
- console.warn("Can not setPosition when container not assigned");
25053
+ console.warn("Renderer not assigned. Operation aborted.");
25080
25054
  return;
25081
25055
  }
25082
25056
  this.rootItem.setPositionByPixel(x, y);
@@ -25255,7 +25229,7 @@ var listOrder = 0;
25255
25229
  };
25256
25230
  _proto.addPackageDatas = function addPackageDatas(scene) {
25257
25231
  var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
25258
- 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;
25232
+ 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;
25259
25233
  for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
25260
25234
  var vfxItemData = _step.value;
25261
25235
  this.addEffectsObjectData(vfxItemData);
@@ -25280,6 +25254,10 @@ var listOrder = 0;
25280
25254
  var animationData = _step5.value;
25281
25255
  this.addEffectsObjectData(animationData);
25282
25256
  }
25257
+ for(var _iterator6 = _create_for_of_iterator_helper_loose(miscs), _step6; !(_step6 = _iterator6()).done;){
25258
+ var miscData = _step6.value;
25259
+ this.addEffectsObjectData(miscData);
25260
+ }
25283
25261
  for(var i = 0; i < bins.length; i++){
25284
25262
  var binaryData = bins[i];
25285
25263
  var binaryBuffer = scene.bins[i];
@@ -25291,8 +25269,8 @@ var listOrder = 0;
25291
25269
  this.addEffectsObjectData(binaryData);
25292
25270
  }
25293
25271
  }
25294
- for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
25295
- var textureData = _step6.value;
25272
+ for(var _iterator7 = _create_for_of_iterator_helper_loose(textureOptions), _step7; !(_step7 = _iterator7()).done;){
25273
+ var textureData = _step7.value;
25296
25274
  this.addEffectsObjectData(textureData);
25297
25275
  }
25298
25276
  };
@@ -25427,7 +25405,7 @@ var listOrder = 0;
25427
25405
  info.push("Tex " + this.textures.length);
25428
25406
  }
25429
25407
  if (info.length > 0) {
25430
- logger.warn("Release GPU memory: " + info.join(", "));
25408
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25431
25409
  }
25432
25410
  this.renderPasses.forEach(function(pass) {
25433
25411
  return pass.dispose();
@@ -25563,7 +25541,7 @@ var listOrder = 0;
25563
25541
  * @param ticker - 定时器类
25564
25542
  */ _proto.add = function add(ticker) {
25565
25543
  if (typeof ticker !== "function") {
25566
- throw new Error("Ticker: The tick object must implement the tick method.");
25544
+ throw new Error("The tick object must implement the tick method.");
25567
25545
  }
25568
25546
  this.tickers.push(ticker);
25569
25547
  };
@@ -25739,8 +25717,8 @@ var _obj3;
25739
25717
  1
25740
25718
  ]);
25741
25719
  _this.material = new THREE__namespace.RawShaderMaterial({
25742
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25743
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25720
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25721
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25744
25722
  alphaToCoverage: false,
25745
25723
  depthFunc: THREE__namespace.LessDepth,
25746
25724
  polygonOffsetFactor: THREE__namespace.ZeroFactor,
@@ -26660,6 +26638,14 @@ var seed = 1;
26660
26638
  */ _proto.dispose = function dispose() {
26661
26639
  this.texture.dispose();
26662
26640
  };
26641
+ /**
26642
+ * 通过图层设置创建贴图
26643
+ * @param data - 图层设置
26644
+ */ _proto.fromData = function fromData(data) {
26645
+ Texture.prototype.fromData.call(this, data);
26646
+ this.texture = this.createTextureByType(data);
26647
+ this.texture.needsUpdate = true;
26648
+ };
26663
26649
  _proto.createTextureByType = function createTextureByType(options) {
26664
26650
  var assembleOptions = this.assembleOptions(options);
26665
26651
  // TODO renderer.getMaxAnisotropy() 查询最大各向异性
@@ -26720,7 +26706,7 @@ var seed = 1;
26720
26706
  texture.flipY = !!flipY;
26721
26707
  return texture;
26722
26708
  }
26723
- throw new Error("使用未知的数据类型创建纹理");
26709
+ throw new Error("Create a texture using an unknown data type.");
26724
26710
  };
26725
26711
  /**
26726
26712
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -27014,7 +27000,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
27014
27000
  }
27015
27001
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
27016
27002
  composition.statistic.firstFrameTime = firstFrameTime;
27017
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
27003
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
27018
27004
  _this.compositions.push(composition);
27019
27005
  return [
27020
27006
  2,
@@ -27180,8 +27166,8 @@ setMaxSpriteMeshItemCount(8);
27180
27166
  */ Mesh.create = function(engine, props) {
27181
27167
  return new ThreeMesh(engine, props);
27182
27168
  };
27183
- var version = "2.0.0-alpha.16";
27184
- logger.info("THREEJS plugin version: " + version);
27169
+ var version = "2.0.0-alpha.18";
27170
+ logger.info("THREEJS plugin version: " + version + ".");
27185
27171
 
27186
27172
  exports.AbstractPlugin = AbstractPlugin;
27187
27173
  exports.ActivationPlayable = ActivationPlayable;
@@ -27273,7 +27259,9 @@ exports.SpriteLoader = SpriteLoader;
27273
27259
  exports.StaticValue = StaticValue;
27274
27260
  exports.TEMPLATE_USE_OFFSCREEN_CANVAS = TEMPLATE_USE_OFFSCREEN_CANVAS;
27275
27261
  exports.TEXTURE_UNIFORM_MAP = TEXTURE_UNIFORM_MAP;
27262
+ exports.TextLayout = TextLayout;
27276
27263
  exports.TextLoader = TextLoader;
27264
+ exports.TextStyle = TextStyle;
27277
27265
  exports.Texture = Texture;
27278
27266
  exports.TextureFactory = TextureFactory;
27279
27267
  exports.ThreeComposition = ThreeComposition;
@@ -27282,6 +27270,7 @@ exports.ThreeEngine = ThreeEngine;
27282
27270
  exports.ThreeMaterial = ThreeMaterial;
27283
27271
  exports.ThreeTexture = ThreeTexture;
27284
27272
  exports.Ticker = Ticker;
27273
+ exports.TimelineClip = TimelineClip;
27285
27274
  exports.TimelinePlayable = TimelinePlayable;
27286
27275
  exports.TrackSortWrapper = TrackSortWrapper;
27287
27276
  exports.Transform = Transform;
@@ -27305,12 +27294,11 @@ exports.compatibleVert = compatible_vert;
27305
27294
  exports.createCopyShader = createCopyShader;
27306
27295
  exports.createGLContext = createGLContext;
27307
27296
  exports.createKeyFrameMeta = createKeyFrameMeta;
27308
- exports.createShaderWithMarcos = createShaderWithMarcos;
27297
+ exports.createShaderWithMacros = createShaderWithMacros;
27309
27298
  exports.createShape = createShape;
27310
27299
  exports.createVFXItem = createVFXItem;
27311
27300
  exports.createValueGetter = createValueGetter;
27312
27301
  exports.decimalEqual = decimalEqual;
27313
- exports.deepClone = deepClone;
27314
27302
  exports.defaultGlobalVolume = defaultGlobalVolume;
27315
27303
  exports.defaultPlugins = defaultPlugins;
27316
27304
  exports.deserializeMipmapTexture = deserializeMipmapTexture;
@@ -27397,7 +27385,7 @@ exports.particleUniformTypeMap = particleUniformTypeMap;
27397
27385
  exports.particleVert = particleVert;
27398
27386
  exports.pluginLoaderMap = pluginLoaderMap;
27399
27387
  exports.pointOnLine = pointOnLine;
27400
- exports.random = random;
27388
+ exports.randomInRange = randomInRange;
27401
27389
  exports.registerPlugin = registerPlugin;
27402
27390
  exports.removeItem = removeItem;
27403
27391
  exports.rotateVec2 = rotateVec2;
@@ -27410,7 +27398,6 @@ exports.setMaskMode = setMaskMode;
27410
27398
  exports.setMaxSpriteMeshItemCount = setMaxSpriteMeshItemCount;
27411
27399
  exports.setRayFromCamera = setRayFromCamera;
27412
27400
  exports.setSideMode = setSideMode;
27413
- exports.setSpriteMeshMaxFragmentTextures = setSpriteMeshMaxFragmentTextures;
27414
27401
  exports.setSpriteMeshMaxItemCountByGPU = setSpriteMeshMaxItemCountByGPU;
27415
27402
  exports.setUniformValue = setUniformValue;
27416
27403
  exports.sortByOrder = sortByOrder;