@galacean/effects-threejs 2.0.0-alpha.17 → 2.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.17
6
+ * Version: v2.0.0-alpha.19
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -264,12 +264,12 @@ function addItem(arr, value) {
264
264
  arr[index] = currentItem;
265
265
  }
266
266
  }
267
- function enlargeBuffer(typeArray, length, increase, maxSize) {
267
+ function enlargeBuffer(typeArray, length, maxSize, increase) {
268
268
  if (increase === void 0) increase = 1;
269
269
  var buffer = typeArray.buffer;
270
270
  if (buffer.byteLength < typeArray.BYTES_PER_ELEMENT * length) {
271
271
  var size = Math.ceil(length * increase);
272
- if (!isNaN(maxSize)) {
272
+ if (!Number.isNaN(maxSize)) {
273
273
  size = Math.min(size, maxSize);
274
274
  }
275
275
  var nbuffer = new ArrayBuffer(typeArray.BYTES_PER_ELEMENT * size);
@@ -754,7 +754,7 @@ function isCanvas(canvas) {
754
754
  return min + Math.random() * (max - min);
755
755
  }
756
756
  function throwDestroyedError() {
757
- throw Error("destroyed item cannot be used again");
757
+ throw new Error("Destroyed item cannot be used again.");
758
758
  }
759
759
  function generateGUID() {
760
760
  return v4().replace(/-/g, "");
@@ -790,6 +790,17 @@ function base64ToFile(base64, filename, contentType) {
790
790
  });
791
791
  return file;
792
792
  }
793
+ function applyMixins(derivedCtrl, baseCtrls) {
794
+ baseCtrls.forEach(function(baseCtrl) {
795
+ Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
796
+ var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
797
+ if (!propertyDescriptor) {
798
+ throw new Error("Cannot find property descriptor of class " + baseCtrl);
799
+ }
800
+ Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
801
+ });
802
+ });
803
+ }
793
804
 
794
805
  function _defineProperties(target, props) {
795
806
  for(var i = 0; i < props.length; i++){
@@ -4478,7 +4489,7 @@ var effectsClassStore = {};
4478
4489
  function effectsClass(className) {
4479
4490
  return function(target, context) {
4480
4491
  if (effectsClassStore[className]) {
4481
- console.warn("Class " + className + " 重复注册");
4492
+ console.warn("Class " + className + " is already registered.");
4482
4493
  }
4483
4494
  // TODO: three修改json dataType, 这边重复注册直接 return
4484
4495
  effectsClassStore[className] = target;
@@ -7346,8 +7357,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7346
7357
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7347
7358
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7348
7359
  var HELP_LINK = {
7349
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7350
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7360
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7361
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7351
7362
  };
7352
7363
 
7353
7364
  /**
@@ -7532,17 +7543,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[ShaderType.vertex] = {
7532
7543
  }, _obj$7);
7533
7544
  /**
7534
7545
  * 生成 shader,检测到 WebGL1 上下文会降级
7535
- * @param marcos - 宏定义数组
7546
+ * @param macros - 宏定义数组
7536
7547
  * @param shader - 原始 shader 文本
7537
7548
  * @param shaderType - shader 类型
7538
7549
  * @return 去除版本号的 shader 文本
7539
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7550
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7540
7551
  var ret = [];
7541
7552
  var header = "";
7542
7553
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7543
7554
  ret.push("#define GE_RUNTIME");
7544
- if (marcos) {
7545
- marcos.forEach(function(param) {
7555
+ if (macros) {
7556
+ macros.forEach(function(param) {
7546
7557
  var key = param[0], value = param[1];
7547
7558
  if (value === true) {
7548
7559
  ret.push("#define " + key);
@@ -7651,7 +7662,7 @@ function setBlendMode(material, blendMode) {
7651
7662
  ];
7652
7663
  break;
7653
7664
  default:
7654
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7665
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7655
7666
  }
7656
7667
  }
7657
7668
  function setSideMode(material, side) {
@@ -7697,7 +7708,7 @@ function setMaskMode(material, maskMode) {
7697
7708
  material.stencilTest = false;
7698
7709
  break;
7699
7710
  default:
7700
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7711
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7701
7712
  }
7702
7713
  }
7703
7714
 
@@ -7918,7 +7929,7 @@ function _loadImage() {
7918
7929
  }
7919
7930
  // 2. 非法类型
7920
7931
  if (!url) {
7921
- throw new Error("Invalid url type: " + JSON.stringify(source));
7932
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7922
7933
  }
7923
7934
  return [
7924
7935
  2,
@@ -8086,21 +8097,21 @@ function _loadMedia() {
8086
8097
  return _loadMedia.apply(this, arguments);
8087
8098
  }
8088
8099
 
8089
- function deserializeMipmapTexture(texOpts, bins) {
8100
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8090
8101
  return _deserializeMipmapTexture.apply(this, arguments);
8091
8102
  }
8092
8103
  function _deserializeMipmapTexture() {
8093
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8104
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8094
8105
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8095
8106
  return __generator(this, function(_state) {
8096
8107
  switch(_state.label){
8097
8108
  case 0:
8098
8109
  if (files === void 0) files = [];
8099
- if (!(texOpts.target === 34067)) return [
8110
+ if (!(textureOptions.target === 34067)) return [
8100
8111
  3,
8101
8112
  1
8102
8113
  ];
8103
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8114
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8104
8115
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8105
8116
  loadedMipmaps = [];
8106
8117
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8120,7 +8131,7 @@ function _deserializeMipmapTexture() {
8120
8131
  2,
8121
8132
  _extends({
8122
8133
  keepImageSource: false
8123
- }, texOpts, {
8134
+ }, textureOptions, {
8124
8135
  mipmaps: loadedMipmaps,
8125
8136
  sourceFrom: {
8126
8137
  target: target,
@@ -8131,7 +8142,7 @@ function _deserializeMipmapTexture() {
8131
8142
  ];
8132
8143
  case 1:
8133
8144
  // TODO: 补充测试用例
8134
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8145
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8135
8146
  jobs = mipmaps1.map(function(pointer) {
8136
8147
  return loadMipmapImage(pointer, bins);
8137
8148
  });
@@ -8146,7 +8157,7 @@ function _deserializeMipmapTexture() {
8146
8157
  2,
8147
8158
  _extends({
8148
8159
  keepImageSource: false
8149
- }, texOpts, {
8160
+ }, textureOptions, {
8150
8161
  mipmaps: loadedMipmaps1,
8151
8162
  sourceType: TextureSourceType.mipmaps,
8152
8163
  sourceFrom: {
@@ -8181,7 +8192,7 @@ function _loadMipmapImage() {
8181
8192
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8182
8193
  bin = bins[index];
8183
8194
  if (!bin) {
8184
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8195
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8185
8196
  }
8186
8197
  return [
8187
8198
  2,
@@ -8385,7 +8396,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8385
8396
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8386
8397
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8387
8398
  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) {
8388
- throw Error("texture missing KTX identifier");
8399
+ throw new Error("Texture missing KTX identifier.");
8389
8400
  }
8390
8401
  // load the reset of the header in native 32 bit uint
8391
8402
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8407,15 +8418,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8407
8418
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8408
8419
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8409
8420
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8410
- logger.warn("Only 2D textures currently supported");
8421
+ logger.warn("Only 2D textures currently supported.");
8411
8422
  return;
8412
8423
  }
8413
8424
  if (this.numberOfArrayElements !== 0) {
8414
- logger.warn("Texture arrays not currently supported");
8425
+ logger.warn("Texture arrays not currently supported.");
8415
8426
  return;
8416
8427
  }
8417
8428
  if (this.numberOfFaces !== facesExpected) {
8418
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8429
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8419
8430
  return;
8420
8431
  }
8421
8432
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8503,7 +8514,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8503
8514
  3
8504
8515
  ];
8505
8516
  case 2:
8506
- throw new Error("No source from");
8517
+ throw new Error("No source from.");
8507
8518
  case 3:
8508
8519
  return [
8509
8520
  2
@@ -8747,7 +8758,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8747
8758
  })
8748
8759
  ];
8749
8760
  case 17:
8750
- throw new Error("Invalid resource type: " + type);
8761
+ throw new Error("Invalid resource type: " + type + ".");
8751
8762
  }
8752
8763
  });
8753
8764
  })();
@@ -9678,19 +9689,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9678
9689
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9679
9690
  }
9680
9691
  if (x1 < 0) {
9681
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9692
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9682
9693
  x1 = 0;
9683
9694
  }
9684
9695
  if (x2 < 0) {
9685
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9696
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9686
9697
  x2 = 0;
9687
9698
  }
9688
9699
  if (x1 > 1) {
9689
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9700
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9690
9701
  x1 = 1;
9691
9702
  }
9692
9703
  if (x2 > 1) {
9693
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9704
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9694
9705
  x2 = 1;
9695
9706
  }
9696
9707
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9871,31 +9882,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9871
9882
  }
9872
9883
  var _proto = ValueGetter.prototype;
9873
9884
  _proto.onCreate = function onCreate(props) {
9874
- throw Error(NOT_IMPLEMENT);
9885
+ throw new Error(NOT_IMPLEMENT);
9875
9886
  };
9876
9887
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9877
- throw Error(NOT_IMPLEMENT);
9888
+ throw new Error(NOT_IMPLEMENT);
9878
9889
  };
9879
9890
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9880
- throw Error(NOT_IMPLEMENT);
9891
+ throw new Error(NOT_IMPLEMENT);
9881
9892
  };
9882
9893
  _proto.getValue = function getValue(time) {
9883
- throw Error(NOT_IMPLEMENT);
9894
+ throw new Error(NOT_IMPLEMENT);
9884
9895
  };
9885
9896
  _proto.getMaxTime = function getMaxTime() {
9886
- throw Error(NOT_IMPLEMENT);
9897
+ throw new Error(NOT_IMPLEMENT);
9887
9898
  };
9888
9899
  _proto.toUniform = function toUniform(meta) {
9889
- throw Error(NOT_IMPLEMENT);
9900
+ throw new Error(NOT_IMPLEMENT);
9890
9901
  };
9891
9902
  _proto.map = function map(func) {
9892
- throw Error(NOT_IMPLEMENT);
9903
+ throw new Error(NOT_IMPLEMENT);
9893
9904
  };
9894
9905
  _proto.scaleXCoord = function scaleXCoord(scale) {
9895
9906
  return this;
9896
9907
  };
9897
9908
  _proto.toData = function toData() {
9898
- throw Error(NOT_IMPLEMENT);
9909
+ throw new Error(NOT_IMPLEMENT);
9899
9910
  };
9900
9911
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9901
9912
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -9939,6 +9950,9 @@ var StaticValue = /*#__PURE__*/ function(ValueGetter) {
9939
9950
  this.value = func(val);
9940
9951
  return this;
9941
9952
  };
9953
+ _proto.getMaxTime = function getMaxTime() {
9954
+ return 0;
9955
+ };
9942
9956
  return StaticValue;
9943
9957
  }(ValueGetter);
9944
9958
  var RandomSetValue = /*#__PURE__*/ function(ValueGetter) {
@@ -10592,7 +10606,7 @@ function createValueGetter(args) {
10592
10606
  if (isFunction(map$1[args[0]])) {
10593
10607
  return map$1[args[0]](args[1]);
10594
10608
  } else {
10595
- throw new Error("ValueType: " + args[0] + " is not support");
10609
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10596
10610
  }
10597
10611
  }
10598
10612
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10736,7 +10750,7 @@ function createCopyShader(level, writeDepth) {
10736
10750
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10737
10751
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10738
10752
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
10739
- marcos: [
10753
+ macros: [
10740
10754
  [
10741
10755
  "WEBGL2",
10742
10756
  !!webgl2
@@ -10809,7 +10823,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10809
10823
  var refCount = this.textureRef[id];
10810
10824
  if (refCount <= 1) {
10811
10825
  if (refCount < 0) {
10812
- console.error("ref count < 0");
10826
+ console.error("Ref count < 0.");
10813
10827
  }
10814
10828
  var tex = this.textureCache[id];
10815
10829
  if (tex) {
@@ -11487,21 +11501,21 @@ var seed$7 = 1;
11487
11501
  return RenderPass;
11488
11502
  }();
11489
11503
 
11490
- 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;}";
11504
+ 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;}";
11491
11505
 
11492
11506
  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";
11493
11507
 
11494
11508
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11495
11509
 
11496
- var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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);}";
11510
+ 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);}";
11497
11511
 
11498
11512
  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.;}";
11499
11513
 
11500
11514
  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}";
11501
11515
 
11502
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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;}";
11516
+ 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;}";
11503
11517
 
11504
- var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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";
11518
+ 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";
11505
11519
 
11506
11520
  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}}";
11507
11521
 
@@ -12695,20 +12709,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12695
12709
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12696
12710
  var ext = this.drawBufferExtension;
12697
12711
  if (this.level === 1 && !ext && index > 0) {
12698
- throw new Error("draw multiple color buffers not available");
12712
+ throw new Error("Draw multiple color buffers not available.");
12699
12713
  }
12700
12714
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12701
12715
  if (attachment) {
12702
12716
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12703
12717
  } else {
12704
- console.error("invalid color attachment index: " + index);
12718
+ console.error("Invalid color attachment index: " + index + ".");
12705
12719
  }
12706
12720
  };
12707
12721
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12708
12722
  var ext = this.drawBufferExtension;
12709
12723
  if (this.level === 1 && !ext) {
12710
12724
  if (bufferStates.length > 1) {
12711
- throw Error("draw buffers not available");
12725
+ throw new Error("Draw buffers not available.");
12712
12726
  } else {
12713
12727
  return;
12714
12728
  }
@@ -12945,7 +12959,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12945
12959
  };
12946
12960
  _proto.createMaterial = function createMaterial(rendererOptions) {
12947
12961
  var _this_engine_renderer;
12948
- var marcos = [
12962
+ var macros = [
12949
12963
  [
12950
12964
  "ENV_EDITOR",
12951
12965
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12958,7 +12972,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12958
12972
  fragment: fragment,
12959
12973
  glslVersion: GLSLVersion.GLSL1,
12960
12974
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12961
- marcos: marcos
12975
+ macros: macros
12962
12976
  },
12963
12977
  uniformSemantics: {
12964
12978
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13224,16 +13238,12 @@ function shouldIgnoreBouncing(arg, mul) {
13224
13238
  }
13225
13239
 
13226
13240
  var maxSpriteMeshItemCount = 8;
13227
- var maxSpriteTextureCount = 8;
13228
13241
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13229
- // 8 or 16
13230
- maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13231
13242
  if (gpuCapability.maxVertexUniforms >= 256) {
13232
13243
  return maxSpriteMeshItemCount = 32;
13233
13244
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13234
13245
  return maxSpriteMeshItemCount = 16;
13235
13246
  }
13236
- maxSpriteTextureCount = 8;
13237
13247
  }
13238
13248
  function getImageItemRenderInfo(item) {
13239
13249
  var renderer = item.renderer;
@@ -13251,27 +13261,11 @@ function getImageItemRenderInfo(item) {
13251
13261
  };
13252
13262
  }
13253
13263
  function spriteMeshShaderFromFilter(level, options) {
13254
- 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;
13255
- var marcos = [
13256
- [
13257
- "MAX_ITEM_COUNT",
13258
- count
13259
- ],
13260
- [
13261
- "PRE_MULTIPLY_ALPHA",
13262
- false
13263
- ],
13264
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13265
+ var macros = [
13264
13266
  [
13265
13267
  "ENV_EDITOR",
13266
13268
  env === PLAYER_OPTIONS_ENV_EDITOR
13267
- ],
13268
- [
13269
- "USE_BLEND",
13270
- !ignoreBlend
13271
- ],
13272
- [
13273
- "MAX_FRAG_TEX",
13274
- maxSpriteTextureCount >= 16 ? 16 : 8
13275
13269
  ]
13276
13270
  ];
13277
13271
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13280,7 +13274,7 @@ function spriteMeshShaderFromFilter(level, options) {
13280
13274
  fragment: fragment,
13281
13275
  vertex: vertex,
13282
13276
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
13283
- marcos: marcos,
13277
+ macros: macros,
13284
13278
  shared: true
13285
13279
  };
13286
13280
  }
@@ -13290,7 +13284,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13290
13284
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13291
13285
  var wireframe = renderInfo.wireframe;
13292
13286
  var shader = spriteMeshShaderFromFilter(level, {
13293
- count: count,
13294
13287
  wireframe: wireframe,
13295
13288
  env: env
13296
13289
  });
@@ -13304,9 +13297,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13304
13297
  function setMaxSpriteMeshItemCount(count) {
13305
13298
  maxSpriteMeshItemCount = count;
13306
13299
  }
13307
- function setSpriteMeshMaxFragmentTextures(count) {
13308
- maxSpriteTextureCount = count;
13309
- }
13310
13300
 
13311
13301
  var defRenderInfo = {
13312
13302
  blending: 0,
@@ -14939,7 +14929,7 @@ function createShape(shapeOptions) {
14939
14929
  var type = shapeOptions.type;
14940
14930
  var Ctrl = map[type];
14941
14931
  if (!Ctrl) {
14942
- throw Error("invalid shape:" + type);
14932
+ throw new Error("Invalid shape: " + type + ".");
14943
14933
  }
14944
14934
  var ctrl = new Ctrl(options);
14945
14935
  if (type !== ShapeType.NONE) {
@@ -15769,7 +15759,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15769
15759
  var uniformValues = {};
15770
15760
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15771
15761
  var lookUpTexture = 0;
15772
- var marcos = [
15762
+ var macros = [
15773
15763
  [
15774
15764
  "ENABLE_VERTEX_TEXTURE",
15775
15765
  enableVertexTexture
@@ -15786,7 +15776,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15786
15776
  var useAttributeTrailStart = maxTrailCount > 64;
15787
15777
  var shaderCacheId = 0;
15788
15778
  if (colorOverLifetime) {
15789
- marcos.push([
15779
+ macros.push([
15790
15780
  "COLOR_OVER_LIFETIME",
15791
15781
  true
15792
15782
  ]);
@@ -15794,7 +15784,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15794
15784
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15795
15785
  }
15796
15786
  if (colorOverTrail) {
15797
- marcos.push([
15787
+ macros.push([
15798
15788
  "COLOR_OVER_TRAIL",
15799
15789
  true
15800
15790
  ]);
@@ -15802,7 +15792,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15802
15792
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15803
15793
  }
15804
15794
  if (useAttributeTrailStart) {
15805
- marcos.push([
15795
+ macros.push([
15806
15796
  "ATTR_TRAIL_START",
15807
15797
  1
15808
15798
  ]);
@@ -15812,7 +15802,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15812
15802
  }
15813
15803
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15814
15804
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15815
- marcos.push([
15805
+ macros.push([
15816
15806
  "VERT_CURVE_VALUE_COUNT",
15817
15807
  keyFrameMeta.index
15818
15808
  ], [
@@ -15831,7 +15821,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15831
15821
  shader: {
15832
15822
  vertex: vertex,
15833
15823
  fragment: fragment,
15834
- marcos: marcos,
15824
+ macros: macros,
15835
15825
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
15836
15826
  shared: true,
15837
15827
  name: "trail#" + name,
@@ -16134,12 +16124,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16134
16124
  }
16135
16125
  return dir.normalize().toArray();
16136
16126
  }
16137
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16127
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16138
16128
  if (env === void 0) env = "";
16139
16129
  var shaderCacheId = 0;
16140
16130
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16141
16131
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16142
- var marcos = [
16132
+ var macros = [
16143
16133
  [
16144
16134
  "ENABLE_VERTEX_TEXTURE",
16145
16135
  enableVertexTexture
@@ -16155,14 +16145,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16155
16145
  ];
16156
16146
  var keyFrameMeta = createKeyFrameMeta();
16157
16147
  if (trails.colorOverLifetime) {
16158
- marcos.push([
16148
+ macros.push([
16159
16149
  "COLOR_OVER_LIFETIME",
16160
16150
  true
16161
16151
  ]);
16162
16152
  shaderCacheId |= 1;
16163
16153
  }
16164
16154
  if (trails.colorOverTrail) {
16165
- marcos.push([
16155
+ macros.push([
16166
16156
  "COLOR_OVER_TRAIL",
16167
16157
  true
16168
16158
  ]);
@@ -16170,7 +16160,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16170
16160
  }
16171
16161
  var useAttributeTrailStart = particleMaxCount > 64;
16172
16162
  if (useAttributeTrailStart) {
16173
- marcos.push([
16163
+ macros.push([
16174
16164
  "ATTR_TRAIL_START",
16175
16165
  1
16176
16166
  ]);
@@ -16178,7 +16168,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16178
16168
  }
16179
16169
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16180
16170
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16181
- marcos.push([
16171
+ macros.push([
16182
16172
  "VERT_CURVE_VALUE_COUNT",
16183
16173
  keyFrameMeta.index
16184
16174
  ], [
@@ -16188,7 +16178,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16188
16178
  return {
16189
16179
  vertex: trailVert,
16190
16180
  fragment: particleFrag,
16191
- marcos: marcos,
16181
+ macros: macros,
16192
16182
  shared: true,
16193
16183
  name: "trail#" + name,
16194
16184
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -17267,7 +17257,10 @@ function randomArrItem(arr, keepArr) {
17267
17257
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17268
17258
  _inherits(ParticleBehaviourPlayable, Playable);
17269
17259
  function ParticleBehaviourPlayable() {
17270
- return Playable.apply(this, arguments);
17260
+ var _this;
17261
+ _this = Playable.apply(this, arguments) || this;
17262
+ _this.lastTime = 0;
17263
+ return _this;
17271
17264
  }
17272
17265
  var _proto = ParticleBehaviourPlayable.prototype;
17273
17266
  _proto.start = function start(context) {
@@ -17291,8 +17284,14 @@ function randomArrItem(arr, keepArr) {
17291
17284
  // TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
17292
17285
  // particleSystem.setParentTransform(parentItem.transform);
17293
17286
  particleSystem.setVisible(true);
17294
- particleSystem.onUpdate(context.deltaTime);
17287
+ var deltaTime = context.deltaTime;
17288
+ // 直接用 this.lastTime - this.time 获取 deltaTime 会有精度问题
17289
+ if (this.lastTime === this.time) {
17290
+ deltaTime = 0;
17291
+ }
17292
+ particleSystem.onUpdate(deltaTime);
17295
17293
  }
17294
+ this.lastTime = this.time;
17296
17295
  };
17297
17296
  return ParticleBehaviourPlayable;
17298
17297
  }(Playable);
@@ -17348,15 +17347,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17348
17347
  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;
17349
17348
  var detail = engine.gpuCapability.detail;
17350
17349
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17351
- var marcos = [
17350
+ var macros = [
17351
+ // spec.RenderMode
17352
17352
  [
17353
17353
  "RENDER_MODE",
17354
17354
  +renderMode
17355
17355
  ],
17356
- [
17357
- "PRE_MULTIPLY_ALPHA",
17358
- false
17359
- ],
17360
17356
  [
17361
17357
  "ENV_EDITOR",
17362
17358
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17372,13 +17368,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17372
17368
  var useOrbitalVel;
17373
17369
  this.useSprite = useSprite;
17374
17370
  if (enableVertexTexture) {
17375
- marcos.push([
17371
+ macros.push([
17376
17372
  "ENABLE_VERTEX_TEXTURE",
17377
17373
  true
17378
17374
  ]);
17379
17375
  }
17380
17376
  if (speedOverLifetime) {
17381
- marcos.push([
17377
+ macros.push([
17382
17378
  "SPEED_OVER_LIFETIME",
17383
17379
  true
17384
17380
  ]);
@@ -17386,7 +17382,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17386
17382
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17387
17383
  }
17388
17384
  if (sprite == null ? void 0 : sprite.animate) {
17389
- marcos.push([
17385
+ macros.push([
17390
17386
  "USE_SPRITE",
17391
17387
  true
17392
17388
  ]);
@@ -17400,7 +17396,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17400
17396
  this.useSprite = true;
17401
17397
  }
17402
17398
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17403
- marcos.push([
17399
+ macros.push([
17404
17400
  "COLOR_OVER_LIFETIME",
17405
17401
  true
17406
17402
  ]);
@@ -17425,7 +17421,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17425
17421
  shaderCacheId |= 1 << 7 + i;
17426
17422
  linearVelOverLifetime.enabled = true;
17427
17423
  }
17428
- marcos.push([
17424
+ macros.push([
17429
17425
  "LINEAR_VEL_" + pro.toUpperCase(),
17430
17426
  defL
17431
17427
  ]);
@@ -17436,13 +17432,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17436
17432
  useOrbitalVel = true;
17437
17433
  orbitalVelOverLifetime.enabled = true;
17438
17434
  }
17439
- marcos.push([
17435
+ macros.push([
17440
17436
  "ORB_VEL_" + pro.toUpperCase(),
17441
17437
  defO
17442
17438
  ]);
17443
17439
  });
17444
17440
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17445
- marcos.push([
17441
+ macros.push([
17446
17442
  "AS_LINEAR_MOVEMENT",
17447
17443
  true
17448
17444
  ]);
@@ -17450,7 +17446,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17450
17446
  }
17451
17447
  if (useOrbitalVel) {
17452
17448
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17453
- marcos.push([
17449
+ macros.push([
17454
17450
  "AS_ORBITAL_MOVEMENT",
17455
17451
  true
17456
17452
  ]);
@@ -17465,7 +17461,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17465
17461
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17466
17462
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17467
17463
  var _sizeOverLifetime_y;
17468
- marcos.push([
17464
+ macros.push([
17469
17465
  "SIZE_Y_BY_LIFE",
17470
17466
  1
17471
17467
  ]);
@@ -17475,7 +17471,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17475
17471
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17476
17472
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17477
17473
  shaderCacheId |= 1 << 15;
17478
- marcos.push([
17474
+ macros.push([
17479
17475
  "ROT_Z_LIFETIME",
17480
17476
  1
17481
17477
  ]);
@@ -17483,7 +17479,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17483
17479
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17484
17480
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17485
17481
  shaderCacheId |= 1 << 16;
17486
- marcos.push([
17482
+ macros.push([
17487
17483
  "ROT_X_LIFETIME",
17488
17484
  1
17489
17485
  ]);
@@ -17491,13 +17487,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17491
17487
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17492
17488
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17493
17489
  shaderCacheId |= 1 << 17;
17494
- marcos.push([
17490
+ macros.push([
17495
17491
  "ROT_Y_LIFETIME",
17496
17492
  1
17497
17493
  ]);
17498
17494
  }
17499
17495
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17500
- marcos.push([
17496
+ macros.push([
17501
17497
  "ROT_LIFETIME_AS_MOVEMENT",
17502
17498
  1
17503
17499
  ]);
@@ -17505,7 +17501,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17505
17501
  }
17506
17502
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17507
17503
  if (forceTarget) {
17508
- marcos.push([
17504
+ macros.push([
17509
17505
  "FINAL_TARGET",
17510
17506
  true
17511
17507
  ]);
@@ -17551,7 +17547,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17551
17547
  fragmentKeyFrameMeta.index,
17552
17548
  fragmentKeyFrameMeta.max
17553
17549
  ].join("+");
17554
- marcos.push([
17550
+ macros.push([
17555
17551
  "VERT_CURVE_VALUE_COUNT",
17556
17552
  vertexKeyFrameMeta.index
17557
17553
  ], [
@@ -17573,7 +17569,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17573
17569
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
17574
17570
  shared: true,
17575
17571
  cacheId: shaderCache,
17576
- marcos: marcos,
17572
+ macros: macros,
17577
17573
  name: "particle#" + name
17578
17574
  };
17579
17575
  var mtlOptions = {
@@ -17650,7 +17646,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17650
17646
  res.length = 0;
17651
17647
  break;
17652
17648
  default:
17653
- console.warn("uniform " + name + "'s type not in typeMap");
17649
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17654
17650
  }
17655
17651
  });
17656
17652
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -17876,7 +17872,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17876
17872
  }));
17877
17873
  if (increaseBuffer) {
17878
17874
  var baseIndexData = geometry.getIndexData();
17879
- var idx = enlargeBuffer(baseIndexData, particleCount * 6, inc, maxCount * 6);
17875
+ var idx = enlargeBuffer(baseIndexData, particleCount * 6, maxCount * 6, inc);
17880
17876
  idx.set(indexData, index * 6);
17881
17877
  geometry.setIndexData(idx);
17882
17878
  this.maxParticleBufferCount = idx.length / 6;
@@ -17888,7 +17884,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17888
17884
  var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
17889
17885
  if (increaseBuffer) {
17890
17886
  var baseData = geometry.getAttributeData(name);
17891
- var geoData = enlargeBuffer(baseData, vertexCount * attrSize, inc, maxCount * 4 * attrSize);
17887
+ var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
17892
17888
  geoData.set(data, data.length * index);
17893
17889
  geometry.setAttributeData(name, geoData);
17894
17890
  } else {
@@ -17986,20 +17982,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
17986
17982
  maxVertex: maxVertex
17987
17983
  };
17988
17984
  }
17989
- function getParticleMeshShader(item, env, gpuCapability) {
17985
+ function getParticleMeshShader(item, gpuCapability, env) {
17990
17986
  if (env === void 0) env = "";
17991
17987
  var _props_renderer;
17992
17988
  var props = item.content;
17993
17989
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
17994
- var marcos = [
17990
+ var macros = [
17995
17991
  [
17996
17992
  "RENDER_MODE",
17997
17993
  renderMode
17998
17994
  ],
17999
- [
18000
- "PRE_MULTIPLY_ALPHA",
18001
- false
18002
- ],
18003
17995
  [
18004
17996
  "ENV_EDITOR",
18005
17997
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18014,13 +18006,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18014
18006
  var vertex_lookup_texture = 0;
18015
18007
  var shaderCacheId = 0;
18016
18008
  if (enableVertexTexture) {
18017
- marcos.push([
18009
+ macros.push([
18018
18010
  "ENABLE_VERTEX_TEXTURE",
18019
18011
  true
18020
18012
  ]);
18021
18013
  }
18022
18014
  if (speedOverLifetime) {
18023
- marcos.push([
18015
+ macros.push([
18024
18016
  "SPEED_OVER_LIFETIME",
18025
18017
  true
18026
18018
  ]);
@@ -18029,7 +18021,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18029
18021
  }
18030
18022
  var sprite = props.textureSheetAnimation;
18031
18023
  if (sprite && sprite.animate) {
18032
- marcos.push([
18024
+ macros.push([
18033
18025
  "USE_SPRITE",
18034
18026
  true
18035
18027
  ]);
@@ -18037,7 +18029,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18037
18029
  }
18038
18030
  var colorOverLifetime = props.colorOverLifetime;
18039
18031
  if (colorOverLifetime && colorOverLifetime.color) {
18040
- marcos.push([
18032
+ macros.push([
18041
18033
  "COLOR_OVER_LIFETIME",
18042
18034
  true
18043
18035
  ]);
@@ -18062,7 +18054,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18062
18054
  defL = 1;
18063
18055
  shaderCacheId |= 1 << 7 + i;
18064
18056
  }
18065
- marcos.push([
18057
+ macros.push([
18066
18058
  "LINEAR_VEL_" + pro.toUpperCase(),
18067
18059
  defL
18068
18060
  ]);
@@ -18073,13 +18065,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18073
18065
  shaderCacheId |= 1 << 10 + i;
18074
18066
  useOrbitalVel = true;
18075
18067
  }
18076
- marcos.push([
18068
+ macros.push([
18077
18069
  "ORB_VEL_" + pro.toUpperCase(),
18078
18070
  defO
18079
18071
  ]);
18080
18072
  });
18081
18073
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18082
- marcos.push([
18074
+ macros.push([
18083
18075
  "AS_LINEAR_MOVEMENT",
18084
18076
  true
18085
18077
  ]);
@@ -18087,7 +18079,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18087
18079
  }
18088
18080
  if (useOrbitalVel) {
18089
18081
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18090
- marcos.push([
18082
+ macros.push([
18091
18083
  "AS_ORBITAL_MOVEMENT",
18092
18084
  true
18093
18085
  ]);
@@ -18099,7 +18091,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18099
18091
  var separateAxes = sizeOverLifetime.separateAxes;
18100
18092
  if (separateAxes) {
18101
18093
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18102
- marcos.push([
18094
+ macros.push([
18103
18095
  "SIZE_Y_BY_LIFE",
18104
18096
  1
18105
18097
  ]);
@@ -18114,7 +18106,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18114
18106
  if (rot.z) {
18115
18107
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18116
18108
  shaderCacheId |= 1 << 15;
18117
- marcos.push([
18109
+ macros.push([
18118
18110
  "ROT_Z_LIFETIME",
18119
18111
  1
18120
18112
  ]);
@@ -18123,7 +18115,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18123
18115
  if (rot.x) {
18124
18116
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18125
18117
  shaderCacheId |= 1 << 16;
18126
- marcos.push([
18118
+ macros.push([
18127
18119
  "ROT_X_LIFETIME",
18128
18120
  1
18129
18121
  ]);
@@ -18131,14 +18123,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18131
18123
  if (rot.y) {
18132
18124
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18133
18125
  shaderCacheId |= 1 << 17;
18134
- marcos.push([
18126
+ macros.push([
18135
18127
  "ROT_Y_LIFETIME",
18136
18128
  1
18137
18129
  ]);
18138
18130
  }
18139
18131
  }
18140
18132
  if (rot == null ? void 0 : rot.asRotation) {
18141
- marcos.push([
18133
+ macros.push([
18142
18134
  "ROT_LIFETIME_AS_MOVEMENT",
18143
18135
  1
18144
18136
  ]);
@@ -18148,7 +18140,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18148
18140
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18149
18141
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18150
18142
  if (forceOpt) {
18151
- marcos.push([
18143
+ macros.push([
18152
18144
  "FINAL_TARGET",
18153
18145
  true
18154
18146
  ]);
@@ -18189,10 +18181,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18189
18181
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18190
18182
  shared: true,
18191
18183
  cacheId: shaderCache,
18192
- marcos: marcos,
18184
+ macros: macros,
18193
18185
  name: "particle#" + item.name
18194
18186
  };
18195
- marcos.push([
18187
+ macros.push([
18196
18188
  "VERT_CURVE_VALUE_COUNT",
18197
18189
  vertexKeyFrameMeta.index
18198
18190
  ], [
@@ -18217,11 +18209,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18217
18209
  shaderIds[3] = maxVertex;
18218
18210
  shaderIds[5] = maxFrag;
18219
18211
  shader.cacheId = shaderIds.join("+");
18220
- if (!shader.marcos) {
18212
+ if (!shader.macros) {
18221
18213
  return;
18222
18214
  }
18223
- for(var i = 0; i < shader.marcos.length; i++){
18224
- var marco = shader.marcos[i];
18215
+ for(var i = 0; i < shader.macros.length; i++){
18216
+ var marco = shader.macros[i];
18225
18217
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18226
18218
  marco[1] = maxVertex;
18227
18219
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18254,17 +18246,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18254
18246
  });
18255
18247
  });
18256
18248
  items.forEach(function(item) {
18257
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18249
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18258
18250
  shaders.push(shader);
18259
18251
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18260
18252
  maxVertexCount = Math.max(maxVertexCount, vertex);
18261
18253
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18262
18254
  if (item.content.trails) {
18263
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18264
- var _shader_marcos;
18265
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, ShaderType.vertex, level);
18266
- var _shader_marcos1;
18267
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, ShaderType.fragment, level);
18255
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18256
+ var _shader_macros;
18257
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
18258
+ var _shader_macros1;
18259
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
18268
18260
  shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
18269
18261
  shaderLibrary.addShader(shader1);
18270
18262
  }
@@ -18276,10 +18268,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18276
18268
  } else {
18277
18269
  shader.glslVersion = GLSLVersion.GLSL1;
18278
18270
  }
18279
- var _shader_marcos;
18280
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, ShaderType.vertex, level);
18281
- var _shader_marcos1;
18282
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, ShaderType.fragment, level);
18271
+ var _shader_macros;
18272
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
18273
+ var _shader_macros1;
18274
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
18283
18275
  shaderLibrary.addShader(shader);
18284
18276
  });
18285
18277
  if (level === 2) {
@@ -18546,6 +18538,7 @@ var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18546
18538
  function AnimationClip() {
18547
18539
  var _this;
18548
18540
  _this = EffectsObject.apply(this, arguments) || this;
18541
+ _this.duration = 0;
18549
18542
  _this.positionCurves = [];
18550
18543
  _this.rotationCurves = [];
18551
18544
  _this.scaleCurves = [];
@@ -18590,6 +18583,7 @@ var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18590
18583
  path: positionCurveData.path,
18591
18584
  keyFrames: createValueGetter(positionCurveData.keyFrames)
18592
18585
  };
18586
+ this.duration = Math.max(this.duration, curve.keyFrames.getMaxTime());
18593
18587
  this.positionCurves.push(curve);
18594
18588
  }
18595
18589
  for(var _iterator1 = _create_for_of_iterator_helper_loose(data.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
@@ -18598,6 +18592,7 @@ var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18598
18592
  path: rotationCurveData.path,
18599
18593
  keyFrames: createValueGetter(rotationCurveData.keyFrames)
18600
18594
  };
18595
+ this.duration = Math.max(this.duration, curve1.keyFrames.getMaxTime());
18601
18596
  this.rotationCurves.push(curve1);
18602
18597
  }
18603
18598
  for(var _iterator2 = _create_for_of_iterator_helper_loose(data.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
@@ -18606,6 +18601,7 @@ var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18606
18601
  path: scaleCurvesData.path,
18607
18602
  keyFrames: createValueGetter(scaleCurvesData.keyFrames)
18608
18603
  };
18604
+ this.duration = Math.max(this.duration, curve2.keyFrames.getMaxTime());
18609
18605
  this.scaleCurves.push(curve2);
18610
18606
  }
18611
18607
  for(var _iterator3 = _create_for_of_iterator_helper_loose(data.floatCurves), _step3; !(_step3 = _iterator3()).done;){
@@ -18616,6 +18612,7 @@ var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18616
18612
  property: floatCurveData.property,
18617
18613
  className: floatCurveData.className
18618
18614
  };
18615
+ this.duration = Math.max(this.duration, curve3.keyFrames.getMaxTime());
18619
18616
  this.floatCurves.push(curve3);
18620
18617
  }
18621
18618
  };
@@ -18791,6 +18788,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18791
18788
  this.playable = clipPlayable;
18792
18789
  this.parentMixer = parentMixer;
18793
18790
  this.track = track;
18791
+ if (_instanceof1(this.track.binding, VFXItem)) {
18792
+ this.particleSystem = this.track.binding.getComponent(ParticleSystem);
18793
+ }
18794
18794
  }
18795
18795
  var _proto = RuntimeClip.prototype;
18796
18796
  _proto.evaluateAt = function evaluateAt(localTime) {
@@ -18800,8 +18800,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
18800
18800
  var started = false;
18801
18801
  var boundItem = this.track.binding;
18802
18802
  if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18803
- var _boundItem_getComponent;
18804
- if (VFXItem.isParticle(boundItem) && !((_boundItem_getComponent = boundItem.getComponent(ParticleSystem)) == null ? void 0 : _boundItem_getComponent.destroyed)) {
18803
+ if (VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18805
18804
  weight = 1.0;
18806
18805
  } else {
18807
18806
  weight = 0.0;
@@ -19167,7 +19166,7 @@ function compareTracks(a, b) {
19167
19166
  var refId = itemData.content.options.refId;
19168
19167
  var props = this.item.composition.refCompositionProps.get(refId);
19169
19168
  if (!props) {
19170
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19169
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19171
19170
  }
19172
19171
  // endBehaviour 类型需优化
19173
19172
  props.content = itemData.content;
@@ -19320,7 +19319,7 @@ var SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19320
19319
  var _proto = SubCompositionTrack.prototype;
19321
19320
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19322
19321
  if (!_instanceof1(parentBinding, VFXItem)) {
19323
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19322
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19324
19323
  }
19325
19324
  return parentBinding.getComponent(CompositionComponent);
19326
19325
  };
@@ -19575,14 +19574,41 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19575
19574
  return _possible_constructor_return(_this);
19576
19575
  }
19577
19576
  var options = props.options;
19578
- _this.textStyle = new TextStyle(options);
19579
- _this.textLayout = new TextLayout(options);
19580
- _this.text = options.text;
19581
- // Text
19577
+ _this.updateWithOptions(options);
19582
19578
  _this.updateTexture();
19583
19579
  return _this;
19584
19580
  }
19585
19581
  var _proto = TextComponent.prototype;
19582
+ _proto.update = function update(dt) {
19583
+ SpriteComponent.prototype.update.call(this, dt);
19584
+ this.updateTexture();
19585
+ };
19586
+ _proto.fromData = function fromData(data) {
19587
+ SpriteComponent.prototype.fromData.call(this, data);
19588
+ var options = data.options;
19589
+ this.updateWithOptions(options);
19590
+ // Text
19591
+ this.updateTexture();
19592
+ };
19593
+ _proto.updateWithOptions = function updateWithOptions(options) {
19594
+ // OVERRIDE by mixins
19595
+ };
19596
+ _proto.updateTexture = function updateTexture(flipY) {
19597
+ // OVERRIDE by mixins
19598
+ };
19599
+ return TextComponent;
19600
+ }(SpriteComponent);
19601
+ TextComponent = __decorate([
19602
+ effectsClass(DataType.TextComponent)
19603
+ ], TextComponent);
19604
+ var TextComponentBase = /*#__PURE__*/ function() {
19605
+ function TextComponentBase() {}
19606
+ var _proto = TextComponentBase.prototype;
19607
+ _proto.updateWithOptions = function updateWithOptions(options) {
19608
+ this.textStyle = new TextStyle(options);
19609
+ this.textLayout = new TextLayout(options);
19610
+ this.text = options.text;
19611
+ };
19586
19612
  /**
19587
19613
  * 设置字号大小
19588
19614
  * @param value - 字号
@@ -19752,14 +19778,11 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19752
19778
  this.textStyle.fontScale = value;
19753
19779
  this.isDirty = true;
19754
19780
  };
19755
- _proto.update = function update(dt) {
19756
- SpriteComponent.prototype.update.call(this, dt);
19757
- this.updateTexture();
19758
- };
19759
19781
  /**
19760
19782
  * 更新文本
19761
19783
  * @returns
19762
- */ _proto.updateTexture = function updateTexture() {
19784
+ */ _proto.updateTexture = function updateTexture(flipY) {
19785
+ if (flipY === void 0) flipY = true;
19763
19786
  if (!this.isDirty || !this.context || !this.canvas) {
19764
19787
  return;
19765
19788
  }
@@ -19777,6 +19800,10 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19777
19800
  context.clearRect(0, 0, width, this.canvas.height);
19778
19801
  // fix bug 1/255
19779
19802
  context.fillStyle = "rgba(255, 255, 255, 0.0039)";
19803
+ if (!flipY) {
19804
+ context.translate(0, height);
19805
+ context.scale(1, -1);
19806
+ }
19780
19807
  context.fillRect(0, 0, width, this.canvas.height);
19781
19808
  style.fontDesc = this.getFontDesc();
19782
19809
  context.font = style.fontDesc;
@@ -19789,7 +19816,7 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19789
19816
  // 文本颜色
19790
19817
  context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
19791
19818
  var charsInfo = [];
19792
- // /3 为了和编辑器行为保持一致
19819
+ // /3 是为了和编辑器行为保持一致
19793
19820
  var offsetY = (lineHeight - fontSize) / 3;
19794
19821
  var x = 0;
19795
19822
  var y = layout.getOffsetY(style) + offsetY;
@@ -19843,7 +19870,7 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19843
19870
  width: imageData.width,
19844
19871
  height: imageData.height
19845
19872
  }, {
19846
- flipY: true,
19873
+ flipY: flipY,
19847
19874
  magFilter: glContext.LINEAR,
19848
19875
  minFilter: glContext.LINEAR,
19849
19876
  wrapS: glContext.CLAMP_TO_EDGE,
@@ -19851,50 +19878,47 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19851
19878
  }));
19852
19879
  this.isDirty = false;
19853
19880
  };
19854
- _proto.fromData = function fromData(data) {
19855
- SpriteComponent.prototype.fromData.call(this, data);
19856
- var options = data.options;
19857
- this.textStyle = new TextStyle(options);
19858
- this.textLayout = new TextLayout(options);
19859
- this.text = options.text;
19860
- // Text
19861
- this.updateTexture();
19862
- };
19863
19881
  _proto.getFontDesc = function getFontDesc() {
19864
- var textStyle = this.textStyle;
19865
- var fontDesc = "" + (textStyle.fontSize * textStyle.fontScale).toString() + "px ";
19866
- if (!DEFAULT_FONTS.includes(textStyle.fontFamily)) {
19867
- fontDesc += '"' + textStyle.fontFamily + '"';
19882
+ var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontScale = _this_textStyle.fontScale, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
19883
+ var fontDesc = "" + (fontSize * fontScale).toString() + "px ";
19884
+ if (!DEFAULT_FONTS.includes(fontFamily)) {
19885
+ fontDesc += '"' + fontFamily + '"';
19868
19886
  } else {
19869
- fontDesc += textStyle.fontFamily;
19887
+ fontDesc += fontFamily;
19870
19888
  }
19871
- if (textStyle.textWeight !== TextWeight.normal) {
19872
- fontDesc = textStyle.textWeight + " " + fontDesc;
19889
+ if (textWeight !== TextWeight.normal) {
19890
+ fontDesc = textWeight + " " + fontDesc;
19873
19891
  }
19874
- if (textStyle.fontStyle !== FontStyle.normal) {
19875
- fontDesc = textStyle.fontStyle + " " + fontDesc;
19892
+ if (fontStyle !== FontStyle.normal) {
19893
+ fontDesc = fontStyle + " " + fontDesc;
19876
19894
  }
19877
19895
  return fontDesc;
19878
19896
  };
19879
19897
  _proto.setupOutline = function setupOutline() {
19880
19898
  var context = this.context;
19881
- var style = this.textStyle;
19882
- context.strokeStyle = "rgba(" + style.outlineColor[0] * 255 + ", " + style.outlineColor[1] * 255 + ", " + style.outlineColor[2] * 255 + ", " + style.outlineColor[3] + ")";
19883
- context.lineWidth = style.outlineWidth * 2;
19899
+ var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, outlineWidth = _this_textStyle.outlineWidth;
19900
+ var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
19901
+ if (context) {
19902
+ context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
19903
+ context.lineWidth = outlineWidth * 2;
19904
+ }
19884
19905
  };
19885
19906
  _proto.setupShadow = function setupShadow() {
19886
19907
  var context = this.context;
19887
- var style = this.textStyle;
19888
- context.shadowColor = "rgba(" + style.shadowColor[0] * 255 + ", " + style.shadowColor[1] * 255 + ", " + style.shadowColor[2] * 255 + ", " + style.shadowColor[3] + ")";
19889
- context.shadowBlur = style.shadowBlur;
19890
- context.shadowOffsetX = style.shadowOffsetX;
19891
- context.shadowOffsetY = -style.shadowOffsetY;
19908
+ var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
19909
+ var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
19910
+ if (context) {
19911
+ context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
19912
+ context.shadowBlur = shadowBlur;
19913
+ context.shadowOffsetX = shadowOffsetX;
19914
+ context.shadowOffsetY = -shadowOffsetY;
19915
+ }
19892
19916
  };
19893
- return TextComponent;
19894
- }(SpriteComponent);
19895
- TextComponent = __decorate([
19896
- effectsClass(DataType.TextComponent)
19897
- ], TextComponent);
19917
+ return TextComponentBase;
19918
+ }();
19919
+ applyMixins(TextComponent, [
19920
+ TextComponentBase
19921
+ ]);
19898
19922
 
19899
19923
  // TODO: 注册必须用
19900
19924
  var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
@@ -20123,8 +20147,8 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20123
20147
  * @param classConstructor - 要添加的组件类型
20124
20148
  */ _proto.addComponent = function addComponent(classConstructor) {
20125
20149
  var newComponent = new classConstructor(this.engine);
20126
- newComponent.item = this;
20127
20150
  this.components.push(newComponent);
20151
+ newComponent.item = this;
20128
20152
  newComponent.onAttached();
20129
20153
  return newComponent;
20130
20154
  };
@@ -20375,10 +20399,11 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20375
20399
  };
20376
20400
  }
20377
20401
  if (duration <= 0) {
20378
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20402
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20379
20403
  }
20380
20404
  for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20381
20405
  var component = _step.value;
20406
+ component.item = this;
20382
20407
  component.onAttached();
20383
20408
  }
20384
20409
  // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
@@ -20569,7 +20594,7 @@ var Item;
20569
20594
  pluginName = "tree";
20570
20595
  break;
20571
20596
  default:
20572
- throw new Error("invalid vfx item type");
20597
+ throw new Error("Invalid vfx item type.");
20573
20598
  }
20574
20599
  }
20575
20600
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20613,7 +20638,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20613
20638
  this.plugins = Object.keys(loaders).map(function(name) {
20614
20639
  var CTRL = pluginLoaderMap[name];
20615
20640
  if (!CTRL) {
20616
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20641
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20617
20642
  }
20618
20643
  var loader = new CTRL();
20619
20644
  loader.name = name;
@@ -20641,13 +20666,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20641
20666
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20642
20667
  var CTRL = pluginCtrlMap[name];
20643
20668
  if (!CTRL) {
20644
- throw new Error("plugin " + name + " no registered constructor");
20669
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20645
20670
  }
20646
20671
  var engine = composition.getEngine();
20647
20672
  var item = new CTRL(engine, props, composition);
20648
20673
  item.composition = composition;
20649
20674
  if (!_instanceof1(item, VFXItem)) {
20650
- throw new Error("plugin " + name + " invalid constructor type");
20675
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20651
20676
  }
20652
20677
  return item;
20653
20678
  };
@@ -20957,7 +20982,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20957
20982
  };
20958
20983
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
20959
20984
  if (level > 14) {
20960
- console.error("序列化数据的内嵌对象层数大于上限");
20985
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20961
20986
  return;
20962
20987
  }
20963
20988
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
@@ -20994,7 +21019,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20994
21019
  switch(_state.label){
20995
21020
  case 0:
20996
21021
  if (level > 14) {
20997
- console.error("序列化数据的内嵌对象层数大于上限");
21022
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20998
21023
  return [
20999
21024
  2
21000
21025
  ];
@@ -21078,7 +21103,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21078
21103
  };
21079
21104
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21080
21105
  if (level > 14) {
21081
- console.error("序列化数据的内嵌对象层数大于上限");
21106
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21082
21107
  return;
21083
21108
  }
21084
21109
  if (!serializedData) {
@@ -21110,7 +21135,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21110
21135
  };
21111
21136
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21112
21137
  if (level > 14) {
21113
- console.error("序列化数据的内嵌对象层数大于上限");
21138
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21114
21139
  return;
21115
21140
  }
21116
21141
  if (!serializedData) {
@@ -21157,7 +21182,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21157
21182
  var effectsObject;
21158
21183
  var effectsObjectData = this.findData(guid);
21159
21184
  if (!effectsObjectData) {
21160
- console.error("未找到 uuid: " + guid + "的对象数据");
21185
+ console.error("Object data with uuid: " + guid + " not found.");
21161
21186
  return undefined;
21162
21187
  }
21163
21188
  switch(effectsObjectData.dataType){
@@ -21179,7 +21204,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21179
21204
  }
21180
21205
  }
21181
21206
  if (!effectsObject) {
21182
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21207
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21183
21208
  return undefined;
21184
21209
  }
21185
21210
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21207,7 +21232,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21207
21232
  2
21208
21233
  ];
21209
21234
  if (!_this.engine.database) {
21210
- console.error("未找到 uuid: " + guid + "的对象数据");
21235
+ console.error("Object data with uuid: " + guid + " not found.");
21211
21236
  return [
21212
21237
  2,
21213
21238
  undefined
@@ -21220,7 +21245,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21220
21245
  case 1:
21221
21246
  effectsObject = _state.sent();
21222
21247
  if (!effectsObject) {
21223
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21248
+ console.error("Disk data with uuid: " + guid + " not found.");
21224
21249
  return [
21225
21250
  2,
21226
21251
  undefined
@@ -21251,7 +21276,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21251
21276
  }
21252
21277
  }
21253
21278
  if (!effectsObject) {
21254
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21279
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21255
21280
  return [
21256
21281
  2,
21257
21282
  undefined
@@ -22683,7 +22708,7 @@ var standardVersion = /^(\d+)\.(\d+)$/;
22683
22708
  var reverseParticle = false;
22684
22709
  function getStandardJSON(json) {
22685
22710
  if (!json || typeof json !== "object") {
22686
- throw Error("expect a json object");
22711
+ throw new Error("Invalid input: Expected a JSON object.");
22687
22712
  }
22688
22713
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22689
22714
  version22Migration(json);
@@ -22704,7 +22729,7 @@ function getStandardJSON(json) {
22704
22729
  }
22705
22730
  return json;
22706
22731
  }
22707
- throw Error("invalid json version " + json.version);
22732
+ throw new Error("Invalid JSON version: " + json.version + ".");
22708
22733
  }
22709
22734
  var currentVersion = "1.0";
22710
22735
  function getStandardJSONFromV0(json) {
@@ -22796,7 +22821,7 @@ function getStandardImage(image, index, imageTags) {
22796
22821
  } else if (image && image.sourceType) {
22797
22822
  return image;
22798
22823
  }
22799
- throw Error("invalid image type");
22824
+ throw new Error("Invalid image type.");
22800
22825
  }
22801
22826
  function getStandardComposition(composition, opt) {
22802
22827
  if (opt === void 0) opt = {};
@@ -23080,7 +23105,7 @@ function _combineImageTemplate() {
23080
23105
  _state.label = 3;
23081
23106
  case 3:
23082
23107
  if (!image) {
23083
- throw new Error("image not provided.");
23108
+ throw new Error("Image not provided.");
23084
23109
  }
23085
23110
  if (!template) {
23086
23111
  return [
@@ -23198,7 +23223,7 @@ var seed$1 = 1;
23198
23223
  cancelLoading = true;
23199
23224
  _this.removeTimer(loadTimer);
23200
23225
  var totalTime = performance.now() - startTime;
23201
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23226
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23202
23227
  }, _this.timeout * 1000);
23203
23228
  _this.timers.push(loadTimer);
23204
23229
  });
@@ -23233,7 +23258,7 @@ var seed$1 = 1;
23233
23258
  ];
23234
23259
  case 3:
23235
23260
  e = _state.sent();
23236
- throw new Error("Load error in " + label + ", " + e);
23261
+ throw new Error("Load error in " + label + ", " + e + ".");
23237
23262
  case 4:
23238
23263
  throw new Error("Load canceled.");
23239
23264
  }
@@ -23332,12 +23357,13 @@ var seed$1 = 1;
23332
23357
  ];
23333
23358
  case 8:
23334
23359
  _ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
23335
- for(i2 = 0; i2 < images1.length; i2++){
23336
- // FIXME: 2024.05.29 如果 renderer 为空,这里会抛异常
23337
- imageAsset = new ImageAsset(renderer.engine);
23338
- imageAsset.data = loadedImages[i2];
23339
- imageAsset.setInstanceId(images1[i2].id);
23340
- renderer == null ? void 0 : renderer.engine.addInstance(imageAsset);
23360
+ if (renderer) {
23361
+ for(i2 = 0; i2 < images1.length; i2++){
23362
+ imageAsset = new ImageAsset(renderer.engine);
23363
+ imageAsset.data = loadedImages[i2];
23364
+ imageAsset.setInstanceId(images1[i2].id);
23365
+ renderer.engine.addInstance(imageAsset);
23366
+ }
23341
23367
  }
23342
23368
  return [
23343
23369
  4,
@@ -23379,7 +23405,7 @@ var seed$1 = 1;
23379
23405
  _state.label = 12;
23380
23406
  case 12:
23381
23407
  totalTime = performance.now() - startTime;
23382
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23408
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23383
23409
  window.clearTimeout(loadTimer);
23384
23410
  _this.removeTimer(loadTimer);
23385
23411
  scene.totalTime = totalTime;
@@ -23497,7 +23523,7 @@ var seed$1 = 1;
23497
23523
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23498
23524
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23499
23525
  }
23500
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23526
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23501
23527
  });
23502
23528
  return [
23503
23529
  2,
@@ -23528,7 +23554,7 @@ var seed$1 = 1;
23528
23554
  ];
23529
23555
  if (!isValidFontFamily(font.fontFamily)) {
23530
23556
  // 在所有设备上提醒开发者
23531
- console.warn("Risky font family: " + font.fontFamily);
23557
+ console.warn("Risky font family: " + font.fontFamily + ".");
23532
23558
  }
23533
23559
  _state.label = 1;
23534
23560
  case 1:
@@ -23555,7 +23581,7 @@ var seed$1 = 1;
23555
23581
  ];
23556
23582
  case 3:
23557
23583
  _state.sent();
23558
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23584
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23559
23585
  return [
23560
23586
  3,
23561
23587
  4
@@ -23651,7 +23677,7 @@ var seed$1 = 1;
23651
23677
  ];
23652
23678
  case 6:
23653
23679
  e = _state.sent();
23654
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23680
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23655
23681
  case 7:
23656
23682
  return [
23657
23683
  3,
@@ -23750,7 +23776,7 @@ var seed$1 = 1;
23750
23776
  ]);
23751
23777
  return [
23752
23778
  4,
23753
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23779
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23754
23780
  ];
23755
23781
  case 2:
23756
23782
  return [
@@ -23759,7 +23785,7 @@ var seed$1 = 1;
23759
23785
  ];
23760
23786
  case 3:
23761
23787
  e = _state.sent();
23762
- throw new Error("load texture " + idx + " fails, error message: " + e);
23788
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23763
23789
  case 4:
23764
23790
  source = texOpts.source;
23765
23791
  if (!isObject(source)) return [
@@ -23794,7 +23820,7 @@ var seed$1 = 1;
23794
23820
  tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23795
23821
  ];
23796
23822
  }
23797
- throw new Error("Invalid texture source: " + source);
23823
+ throw new Error("Invalid texture source: " + source + ".");
23798
23824
  }
23799
23825
  });
23800
23826
  }));
@@ -23912,7 +23938,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23912
23938
  magFilter: glContext.NEAREST
23913
23939
  };
23914
23940
  }
23915
- throw new Error("Invalid texture options");
23941
+ throw new Error("Invalid texture options.");
23916
23942
  }
23917
23943
 
23918
23944
  var tmpScale = new Vector3(1, 1, 1);
@@ -24204,7 +24230,7 @@ var listOrder = 0;
24204
24230
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24205
24231
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24206
24232
  if (!textureOptions) {
24207
- throw new Error("scene.textures expected");
24233
+ throw new Error("scene.textures expected.");
24208
24234
  }
24209
24235
  var cachedTextures = textureOptions;
24210
24236
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24216,7 +24242,7 @@ var listOrder = 0;
24216
24242
  }
24217
24243
  }
24218
24244
  if (!this.composition) {
24219
- throw new Error("Invalid composition id: " + compositionId);
24245
+ throw new Error("Invalid composition id: " + compositionId + ".");
24220
24246
  }
24221
24247
  this.jsonScene = jsonScene;
24222
24248
  this.renderLevel = renderLevel;
@@ -24278,7 +24304,7 @@ var listOrder = 0;
24278
24304
  if (itemProps.type === ItemType.composition) {
24279
24305
  var refId = sourceItemData.content.options.refId;
24280
24306
  if (!this.refCompositions.get(refId)) {
24281
- throw new Error("Invalid Ref Composition id: " + refId);
24307
+ throw new Error("Invalid ref composition id: " + refId + ".");
24282
24308
  }
24283
24309
  var ref = this.getContent(this.refCompositions.get(refId));
24284
24310
  if (!this.refCompositionProps.has(refId)) {
@@ -24391,11 +24417,11 @@ var listOrder = 0;
24391
24417
  /**
24392
24418
  * 销毁状态位
24393
24419
  */ this.destroyed = false;
24420
+ this.postLoaders = [];
24394
24421
  /**
24395
24422
  * 合成暂停/播放 标识
24396
24423
  */ this.paused = false;
24397
24424
  this.lastVideoUpdateTime = 0;
24398
- this.postLoaders = [];
24399
24425
  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;
24400
24426
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24401
24427
  scene.jsonScene.imgUsage = undefined;
@@ -24794,7 +24820,7 @@ var listOrder = 0;
24794
24820
  }
24795
24821
  parent.children.push(item1);
24796
24822
  } else {
24797
- throw Error("元素引用了不存在的元素,请检查数据");
24823
+ throw new Error("The element references a non-existent element, please check the data.");
24798
24824
  }
24799
24825
  }
24800
24826
  }
@@ -25043,7 +25069,7 @@ var listOrder = 0;
25043
25069
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25044
25070
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25045
25071
  if (!this.renderer) {
25046
- console.warn("Can not translate position when container not assigned");
25072
+ console.warn("Renderer not assigned. Operation aborted.");
25047
25073
  return;
25048
25074
  }
25049
25075
  this.rootItem.translateByPixel(x, y);
@@ -25057,7 +25083,7 @@ var listOrder = 0;
25057
25083
  * @param y - y 坐标
25058
25084
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25059
25085
  if (!this.renderer) {
25060
- console.warn("Can not setPosition when container not assigned");
25086
+ console.warn("Renderer not assigned. Operation aborted.");
25061
25087
  return;
25062
25088
  }
25063
25089
  this.rootItem.setPositionByPixel(x, y);
@@ -25412,7 +25438,7 @@ var listOrder = 0;
25412
25438
  info.push("Tex " + this.textures.length);
25413
25439
  }
25414
25440
  if (info.length > 0) {
25415
- logger.warn("Release GPU memory: " + info.join(", "));
25441
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25416
25442
  }
25417
25443
  this.renderPasses.forEach(function(pass) {
25418
25444
  return pass.dispose();
@@ -25548,7 +25574,7 @@ var listOrder = 0;
25548
25574
  * @param ticker - 定时器类
25549
25575
  */ _proto.add = function add(ticker) {
25550
25576
  if (typeof ticker !== "function") {
25551
- throw new Error("Ticker: The tick object must implement the tick method.");
25577
+ throw new Error("The tick object must implement the tick method.");
25552
25578
  }
25553
25579
  this.tickers.push(ticker);
25554
25580
  };
@@ -25587,6 +25613,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
25587
25613
  registerPlugin("particle", ParticleLoader, VFXItem, true);
25588
25614
  registerPlugin("cal", CalculateLoader, VFXItem, true);
25589
25615
  registerPlugin("interact", InteractLoader, VFXItem, true);
25616
+ var version$1 = "2.0.0-alpha.19";
25617
+ logger.info("Core version: " + version$1 + ".");
25590
25618
 
25591
25619
  var _obj;
25592
25620
  /**
@@ -25724,8 +25752,8 @@ var _obj3;
25724
25752
  1
25725
25753
  ]);
25726
25754
  _this.material = new THREE.RawShaderMaterial({
25727
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25728
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25755
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25756
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25729
25757
  alphaToCoverage: false,
25730
25758
  depthFunc: THREE.LessDepth,
25731
25759
  polygonOffsetFactor: THREE.ZeroFactor,
@@ -26713,7 +26741,7 @@ var seed = 1;
26713
26741
  texture.flipY = !!flipY;
26714
26742
  return texture;
26715
26743
  }
26716
- throw new Error("使用未知的数据类型创建纹理");
26744
+ throw new Error("Create a texture using an unknown data type.");
26717
26745
  };
26718
26746
  /**
26719
26747
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -27007,7 +27035,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
27007
27035
  }
27008
27036
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
27009
27037
  composition.statistic.firstFrameTime = firstFrameTime;
27010
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
27038
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
27011
27039
  _this.compositions.push(composition);
27012
27040
  return [
27013
27041
  2,
@@ -27173,8 +27201,8 @@ setMaxSpriteMeshItemCount(8);
27173
27201
  */ Mesh.create = function(engine, props) {
27174
27202
  return new ThreeMesh(engine, props);
27175
27203
  };
27176
- var version = "2.0.0-alpha.17";
27177
- logger.info("THREEJS plugin version: " + version);
27204
+ var version = "2.0.0-alpha.19";
27205
+ logger.info("THREEJS plugin version: " + version + ".");
27178
27206
 
27179
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27207
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27180
27208
  //# sourceMappingURL=index.mjs.map