@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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.17
6
+ * Version: v2.0.0-alpha.19
7
7
  */
8
8
 
9
9
  'use strict';
@@ -288,12 +288,12 @@ function addItem(arr, value) {
288
288
  arr[index] = currentItem;
289
289
  }
290
290
  }
291
- function enlargeBuffer(typeArray, length, increase, maxSize) {
291
+ function enlargeBuffer(typeArray, length, maxSize, increase) {
292
292
  if (increase === void 0) increase = 1;
293
293
  var buffer = typeArray.buffer;
294
294
  if (buffer.byteLength < typeArray.BYTES_PER_ELEMENT * length) {
295
295
  var size = Math.ceil(length * increase);
296
- if (!isNaN(maxSize)) {
296
+ if (!Number.isNaN(maxSize)) {
297
297
  size = Math.min(size, maxSize);
298
298
  }
299
299
  var nbuffer = new ArrayBuffer(typeArray.BYTES_PER_ELEMENT * size);
@@ -778,7 +778,7 @@ function isCanvas(canvas) {
778
778
  return min + Math.random() * (max - min);
779
779
  }
780
780
  function throwDestroyedError() {
781
- throw Error("destroyed item cannot be used again");
781
+ throw new Error("Destroyed item cannot be used again.");
782
782
  }
783
783
  function generateGUID() {
784
784
  return v4().replace(/-/g, "");
@@ -814,6 +814,17 @@ function base64ToFile(base64, filename, contentType) {
814
814
  });
815
815
  return file;
816
816
  }
817
+ function applyMixins(derivedCtrl, baseCtrls) {
818
+ baseCtrls.forEach(function(baseCtrl) {
819
+ Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
820
+ var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
821
+ if (!propertyDescriptor) {
822
+ throw new Error("Cannot find property descriptor of class " + baseCtrl);
823
+ }
824
+ Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
825
+ });
826
+ });
827
+ }
817
828
 
818
829
  function _defineProperties(target, props) {
819
830
  for(var i = 0; i < props.length; i++){
@@ -4502,7 +4513,7 @@ var effectsClassStore = {};
4502
4513
  function effectsClass(className) {
4503
4514
  return function(target, context) {
4504
4515
  if (effectsClassStore[className]) {
4505
- console.warn("Class " + className + " 重复注册");
4516
+ console.warn("Class " + className + " is already registered.");
4506
4517
  }
4507
4518
  // TODO: three修改json dataType, 这边重复注册直接 return
4508
4519
  effectsClassStore[className] = target;
@@ -7370,8 +7381,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7370
7381
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7371
7382
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7372
7383
  var HELP_LINK = {
7373
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7374
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7384
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7385
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7375
7386
  };
7376
7387
 
7377
7388
  /**
@@ -7556,17 +7567,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[exports.ShaderType.vertex] = {
7556
7567
  }, _obj$7);
7557
7568
  /**
7558
7569
  * 生成 shader,检测到 WebGL1 上下文会降级
7559
- * @param marcos - 宏定义数组
7570
+ * @param macros - 宏定义数组
7560
7571
  * @param shader - 原始 shader 文本
7561
7572
  * @param shaderType - shader 类型
7562
7573
  * @return 去除版本号的 shader 文本
7563
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7574
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7564
7575
  var ret = [];
7565
7576
  var header = "";
7566
7577
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7567
7578
  ret.push("#define GE_RUNTIME");
7568
- if (marcos) {
7569
- marcos.forEach(function(param) {
7579
+ if (macros) {
7580
+ macros.forEach(function(param) {
7570
7581
  var key = param[0], value = param[1];
7571
7582
  if (value === true) {
7572
7583
  ret.push("#define " + key);
@@ -7675,7 +7686,7 @@ function setBlendMode(material, blendMode) {
7675
7686
  ];
7676
7687
  break;
7677
7688
  default:
7678
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7689
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7679
7690
  }
7680
7691
  }
7681
7692
  function setSideMode(material, side) {
@@ -7721,7 +7732,7 @@ function setMaskMode(material, maskMode) {
7721
7732
  material.stencilTest = false;
7722
7733
  break;
7723
7734
  default:
7724
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7735
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7725
7736
  }
7726
7737
  }
7727
7738
 
@@ -7942,7 +7953,7 @@ function _loadImage() {
7942
7953
  }
7943
7954
  // 2. 非法类型
7944
7955
  if (!url) {
7945
- throw new Error("Invalid url type: " + JSON.stringify(source));
7956
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7946
7957
  }
7947
7958
  return [
7948
7959
  2,
@@ -8110,21 +8121,21 @@ function _loadMedia() {
8110
8121
  return _loadMedia.apply(this, arguments);
8111
8122
  }
8112
8123
 
8113
- function deserializeMipmapTexture(texOpts, bins) {
8124
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8114
8125
  return _deserializeMipmapTexture.apply(this, arguments);
8115
8126
  }
8116
8127
  function _deserializeMipmapTexture() {
8117
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8128
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8118
8129
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8119
8130
  return __generator(this, function(_state) {
8120
8131
  switch(_state.label){
8121
8132
  case 0:
8122
8133
  if (files === void 0) files = [];
8123
- if (!(texOpts.target === 34067)) return [
8134
+ if (!(textureOptions.target === 34067)) return [
8124
8135
  3,
8125
8136
  1
8126
8137
  ];
8127
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8138
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8128
8139
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8129
8140
  loadedMipmaps = [];
8130
8141
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8144,7 +8155,7 @@ function _deserializeMipmapTexture() {
8144
8155
  2,
8145
8156
  _extends({
8146
8157
  keepImageSource: false
8147
- }, texOpts, {
8158
+ }, textureOptions, {
8148
8159
  mipmaps: loadedMipmaps,
8149
8160
  sourceFrom: {
8150
8161
  target: target,
@@ -8155,7 +8166,7 @@ function _deserializeMipmapTexture() {
8155
8166
  ];
8156
8167
  case 1:
8157
8168
  // TODO: 补充测试用例
8158
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8169
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8159
8170
  jobs = mipmaps1.map(function(pointer) {
8160
8171
  return loadMipmapImage(pointer, bins);
8161
8172
  });
@@ -8170,7 +8181,7 @@ function _deserializeMipmapTexture() {
8170
8181
  2,
8171
8182
  _extends({
8172
8183
  keepImageSource: false
8173
- }, texOpts, {
8184
+ }, textureOptions, {
8174
8185
  mipmaps: loadedMipmaps1,
8175
8186
  sourceType: exports.TextureSourceType.mipmaps,
8176
8187
  sourceFrom: {
@@ -8205,7 +8216,7 @@ function _loadMipmapImage() {
8205
8216
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8206
8217
  bin = bins[index];
8207
8218
  if (!bin) {
8208
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8219
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8209
8220
  }
8210
8221
  return [
8211
8222
  2,
@@ -8409,7 +8420,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8409
8420
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8410
8421
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8411
8422
  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) {
8412
- throw Error("texture missing KTX identifier");
8423
+ throw new Error("Texture missing KTX identifier.");
8413
8424
  }
8414
8425
  // load the reset of the header in native 32 bit uint
8415
8426
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8431,15 +8442,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8431
8442
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8432
8443
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8433
8444
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8434
- logger.warn("Only 2D textures currently supported");
8445
+ logger.warn("Only 2D textures currently supported.");
8435
8446
  return;
8436
8447
  }
8437
8448
  if (this.numberOfArrayElements !== 0) {
8438
- logger.warn("Texture arrays not currently supported");
8449
+ logger.warn("Texture arrays not currently supported.");
8439
8450
  return;
8440
8451
  }
8441
8452
  if (this.numberOfFaces !== facesExpected) {
8442
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8453
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8443
8454
  return;
8444
8455
  }
8445
8456
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8527,7 +8538,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8527
8538
  3
8528
8539
  ];
8529
8540
  case 2:
8530
- throw new Error("No source from");
8541
+ throw new Error("No source from.");
8531
8542
  case 3:
8532
8543
  return [
8533
8544
  2
@@ -8771,7 +8782,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8771
8782
  })
8772
8783
  ];
8773
8784
  case 17:
8774
- throw new Error("Invalid resource type: " + type);
8785
+ throw new Error("Invalid resource type: " + type + ".");
8775
8786
  }
8776
8787
  });
8777
8788
  })();
@@ -9702,19 +9713,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9702
9713
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9703
9714
  }
9704
9715
  if (x1 < 0) {
9705
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9716
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9706
9717
  x1 = 0;
9707
9718
  }
9708
9719
  if (x2 < 0) {
9709
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9720
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9710
9721
  x2 = 0;
9711
9722
  }
9712
9723
  if (x1 > 1) {
9713
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9724
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9714
9725
  x1 = 1;
9715
9726
  }
9716
9727
  if (x2 > 1) {
9717
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9728
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9718
9729
  x2 = 1;
9719
9730
  }
9720
9731
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9895,31 +9906,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9895
9906
  }
9896
9907
  var _proto = ValueGetter.prototype;
9897
9908
  _proto.onCreate = function onCreate(props) {
9898
- throw Error(NOT_IMPLEMENT);
9909
+ throw new Error(NOT_IMPLEMENT);
9899
9910
  };
9900
9911
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9901
- throw Error(NOT_IMPLEMENT);
9912
+ throw new Error(NOT_IMPLEMENT);
9902
9913
  };
9903
9914
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9904
- throw Error(NOT_IMPLEMENT);
9915
+ throw new Error(NOT_IMPLEMENT);
9905
9916
  };
9906
9917
  _proto.getValue = function getValue(time) {
9907
- throw Error(NOT_IMPLEMENT);
9918
+ throw new Error(NOT_IMPLEMENT);
9908
9919
  };
9909
9920
  _proto.getMaxTime = function getMaxTime() {
9910
- throw Error(NOT_IMPLEMENT);
9921
+ throw new Error(NOT_IMPLEMENT);
9911
9922
  };
9912
9923
  _proto.toUniform = function toUniform(meta) {
9913
- throw Error(NOT_IMPLEMENT);
9924
+ throw new Error(NOT_IMPLEMENT);
9914
9925
  };
9915
9926
  _proto.map = function map(func) {
9916
- throw Error(NOT_IMPLEMENT);
9927
+ throw new Error(NOT_IMPLEMENT);
9917
9928
  };
9918
9929
  _proto.scaleXCoord = function scaleXCoord(scale) {
9919
9930
  return this;
9920
9931
  };
9921
9932
  _proto.toData = function toData() {
9922
- throw Error(NOT_IMPLEMENT);
9933
+ throw new Error(NOT_IMPLEMENT);
9923
9934
  };
9924
9935
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9925
9936
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -9963,6 +9974,9 @@ var StaticValue = /*#__PURE__*/ function(ValueGetter) {
9963
9974
  this.value = func(val);
9964
9975
  return this;
9965
9976
  };
9977
+ _proto.getMaxTime = function getMaxTime() {
9978
+ return 0;
9979
+ };
9966
9980
  return StaticValue;
9967
9981
  }(ValueGetter);
9968
9982
  var RandomSetValue = /*#__PURE__*/ function(ValueGetter) {
@@ -10616,7 +10630,7 @@ function createValueGetter(args) {
10616
10630
  if (isFunction(map$1[args[0]])) {
10617
10631
  return map$1[args[0]](args[1]);
10618
10632
  } else {
10619
- throw new Error("ValueType: " + args[0] + " is not support");
10633
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10620
10634
  }
10621
10635
  }
10622
10636
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10760,7 +10774,7 @@ function createCopyShader(level, writeDepth) {
10760
10774
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10761
10775
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10762
10776
  glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
10763
- marcos: [
10777
+ macros: [
10764
10778
  [
10765
10779
  "WEBGL2",
10766
10780
  !!webgl2
@@ -10833,7 +10847,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10833
10847
  var refCount = this.textureRef[id];
10834
10848
  if (refCount <= 1) {
10835
10849
  if (refCount < 0) {
10836
- console.error("ref count < 0");
10850
+ console.error("Ref count < 0.");
10837
10851
  }
10838
10852
  var tex = this.textureCache[id];
10839
10853
  if (tex) {
@@ -11511,21 +11525,21 @@ var seed$7 = 1;
11511
11525
  return RenderPass;
11512
11526
  }();
11513
11527
 
11514
- 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;}";
11528
+ 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;}";
11515
11529
 
11516
11530
  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";
11517
11531
 
11518
11532
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11519
11533
 
11520
- var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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);}";
11534
+ 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);}";
11521
11535
 
11522
11536
  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.;}";
11523
11537
 
11524
11538
  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}";
11525
11539
 
11526
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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;}";
11540
+ 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;}";
11527
11541
 
11528
- var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\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";
11542
+ 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";
11529
11543
 
11530
11544
  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}}";
11531
11545
 
@@ -12719,20 +12733,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12719
12733
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12720
12734
  var ext = this.drawBufferExtension;
12721
12735
  if (this.level === 1 && !ext && index > 0) {
12722
- throw new Error("draw multiple color buffers not available");
12736
+ throw new Error("Draw multiple color buffers not available.");
12723
12737
  }
12724
12738
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12725
12739
  if (attachment) {
12726
12740
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12727
12741
  } else {
12728
- console.error("invalid color attachment index: " + index);
12742
+ console.error("Invalid color attachment index: " + index + ".");
12729
12743
  }
12730
12744
  };
12731
12745
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12732
12746
  var ext = this.drawBufferExtension;
12733
12747
  if (this.level === 1 && !ext) {
12734
12748
  if (bufferStates.length > 1) {
12735
- throw Error("draw buffers not available");
12749
+ throw new Error("Draw buffers not available.");
12736
12750
  } else {
12737
12751
  return;
12738
12752
  }
@@ -12969,7 +12983,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12969
12983
  };
12970
12984
  _proto.createMaterial = function createMaterial(rendererOptions) {
12971
12985
  var _this_engine_renderer;
12972
- var marcos = [
12986
+ var macros = [
12973
12987
  [
12974
12988
  "ENV_EDITOR",
12975
12989
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12982,7 +12996,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12982
12996
  fragment: fragment,
12983
12997
  glslVersion: exports.GLSLVersion.GLSL1,
12984
12998
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12985
- marcos: marcos
12999
+ macros: macros
12986
13000
  },
12987
13001
  uniformSemantics: {
12988
13002
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13248,16 +13262,12 @@ function shouldIgnoreBouncing(arg, mul) {
13248
13262
  }
13249
13263
 
13250
13264
  exports.maxSpriteMeshItemCount = 8;
13251
- exports.maxSpriteTextureCount = 8;
13252
13265
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13253
- // 8 or 16
13254
- exports.maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13255
13266
  if (gpuCapability.maxVertexUniforms >= 256) {
13256
13267
  return exports.maxSpriteMeshItemCount = 32;
13257
13268
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13258
13269
  return exports.maxSpriteMeshItemCount = 16;
13259
13270
  }
13260
- exports.maxSpriteTextureCount = 8;
13261
13271
  }
13262
13272
  function getImageItemRenderInfo(item) {
13263
13273
  var renderer = item.renderer;
@@ -13275,27 +13285,11 @@ function getImageItemRenderInfo(item) {
13275
13285
  };
13276
13286
  }
13277
13287
  function spriteMeshShaderFromFilter(level, options) {
13278
- 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;
13279
- var marcos = [
13280
- [
13281
- "MAX_ITEM_COUNT",
13282
- count
13283
- ],
13284
- [
13285
- "PRE_MULTIPLY_ALPHA",
13286
- false
13287
- ],
13288
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13289
+ var macros = [
13288
13290
  [
13289
13291
  "ENV_EDITOR",
13290
13292
  env === PLAYER_OPTIONS_ENV_EDITOR
13291
- ],
13292
- [
13293
- "USE_BLEND",
13294
- !ignoreBlend
13295
- ],
13296
- [
13297
- "MAX_FRAG_TEX",
13298
- exports.maxSpriteTextureCount >= 16 ? 16 : 8
13299
13293
  ]
13300
13294
  ];
13301
13295
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13304,7 +13298,7 @@ function spriteMeshShaderFromFilter(level, options) {
13304
13298
  fragment: fragment,
13305
13299
  vertex: vertex,
13306
13300
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
13307
- marcos: marcos,
13301
+ macros: macros,
13308
13302
  shared: true
13309
13303
  };
13310
13304
  }
@@ -13314,7 +13308,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13314
13308
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13315
13309
  var wireframe = renderInfo.wireframe;
13316
13310
  var shader = spriteMeshShaderFromFilter(level, {
13317
- count: count,
13318
13311
  wireframe: wireframe,
13319
13312
  env: env
13320
13313
  });
@@ -13328,9 +13321,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13328
13321
  function setMaxSpriteMeshItemCount(count) {
13329
13322
  exports.maxSpriteMeshItemCount = count;
13330
13323
  }
13331
- function setSpriteMeshMaxFragmentTextures(count) {
13332
- exports.maxSpriteTextureCount = count;
13333
- }
13334
13324
 
13335
13325
  var defRenderInfo = {
13336
13326
  blending: 0,
@@ -14963,7 +14953,7 @@ function createShape(shapeOptions) {
14963
14953
  var type = shapeOptions.type;
14964
14954
  var Ctrl = map[type];
14965
14955
  if (!Ctrl) {
14966
- throw Error("invalid shape:" + type);
14956
+ throw new Error("Invalid shape: " + type + ".");
14967
14957
  }
14968
14958
  var ctrl = new Ctrl(options);
14969
14959
  if (type !== ShapeType.NONE) {
@@ -15793,7 +15783,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15793
15783
  var uniformValues = {};
15794
15784
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15795
15785
  var lookUpTexture = 0;
15796
- var marcos = [
15786
+ var macros = [
15797
15787
  [
15798
15788
  "ENABLE_VERTEX_TEXTURE",
15799
15789
  enableVertexTexture
@@ -15810,7 +15800,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15810
15800
  var useAttributeTrailStart = maxTrailCount > 64;
15811
15801
  var shaderCacheId = 0;
15812
15802
  if (colorOverLifetime) {
15813
- marcos.push([
15803
+ macros.push([
15814
15804
  "COLOR_OVER_LIFETIME",
15815
15805
  true
15816
15806
  ]);
@@ -15818,7 +15808,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15818
15808
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15819
15809
  }
15820
15810
  if (colorOverTrail) {
15821
- marcos.push([
15811
+ macros.push([
15822
15812
  "COLOR_OVER_TRAIL",
15823
15813
  true
15824
15814
  ]);
@@ -15826,7 +15816,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15826
15816
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15827
15817
  }
15828
15818
  if (useAttributeTrailStart) {
15829
- marcos.push([
15819
+ macros.push([
15830
15820
  "ATTR_TRAIL_START",
15831
15821
  1
15832
15822
  ]);
@@ -15836,7 +15826,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15836
15826
  }
15837
15827
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15838
15828
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15839
- marcos.push([
15829
+ macros.push([
15840
15830
  "VERT_CURVE_VALUE_COUNT",
15841
15831
  keyFrameMeta.index
15842
15832
  ], [
@@ -15855,7 +15845,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15855
15845
  shader: {
15856
15846
  vertex: vertex,
15857
15847
  fragment: fragment,
15858
- marcos: marcos,
15848
+ macros: macros,
15859
15849
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
15860
15850
  shared: true,
15861
15851
  name: "trail#" + name,
@@ -16158,12 +16148,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16158
16148
  }
16159
16149
  return dir.normalize().toArray();
16160
16150
  }
16161
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16151
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16162
16152
  if (env === void 0) env = "";
16163
16153
  var shaderCacheId = 0;
16164
16154
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16165
16155
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16166
- var marcos = [
16156
+ var macros = [
16167
16157
  [
16168
16158
  "ENABLE_VERTEX_TEXTURE",
16169
16159
  enableVertexTexture
@@ -16179,14 +16169,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16179
16169
  ];
16180
16170
  var keyFrameMeta = createKeyFrameMeta();
16181
16171
  if (trails.colorOverLifetime) {
16182
- marcos.push([
16172
+ macros.push([
16183
16173
  "COLOR_OVER_LIFETIME",
16184
16174
  true
16185
16175
  ]);
16186
16176
  shaderCacheId |= 1;
16187
16177
  }
16188
16178
  if (trails.colorOverTrail) {
16189
- marcos.push([
16179
+ macros.push([
16190
16180
  "COLOR_OVER_TRAIL",
16191
16181
  true
16192
16182
  ]);
@@ -16194,7 +16184,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16194
16184
  }
16195
16185
  var useAttributeTrailStart = particleMaxCount > 64;
16196
16186
  if (useAttributeTrailStart) {
16197
- marcos.push([
16187
+ macros.push([
16198
16188
  "ATTR_TRAIL_START",
16199
16189
  1
16200
16190
  ]);
@@ -16202,7 +16192,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16202
16192
  }
16203
16193
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16204
16194
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16205
- marcos.push([
16195
+ macros.push([
16206
16196
  "VERT_CURVE_VALUE_COUNT",
16207
16197
  keyFrameMeta.index
16208
16198
  ], [
@@ -16212,7 +16202,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16212
16202
  return {
16213
16203
  vertex: trailVert,
16214
16204
  fragment: particleFrag,
16215
- marcos: marcos,
16205
+ macros: macros,
16216
16206
  shared: true,
16217
16207
  name: "trail#" + name,
16218
16208
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -17291,7 +17281,10 @@ function randomArrItem(arr, keepArr) {
17291
17281
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17292
17282
  _inherits(ParticleBehaviourPlayable, Playable);
17293
17283
  function ParticleBehaviourPlayable() {
17294
- return Playable.apply(this, arguments);
17284
+ var _this;
17285
+ _this = Playable.apply(this, arguments) || this;
17286
+ _this.lastTime = 0;
17287
+ return _this;
17295
17288
  }
17296
17289
  var _proto = ParticleBehaviourPlayable.prototype;
17297
17290
  _proto.start = function start(context) {
@@ -17315,8 +17308,14 @@ function randomArrItem(arr, keepArr) {
17315
17308
  // TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
17316
17309
  // particleSystem.setParentTransform(parentItem.transform);
17317
17310
  particleSystem.setVisible(true);
17318
- particleSystem.onUpdate(context.deltaTime);
17311
+ var deltaTime = context.deltaTime;
17312
+ // 直接用 this.lastTime - this.time 获取 deltaTime 会有精度问题
17313
+ if (this.lastTime === this.time) {
17314
+ deltaTime = 0;
17315
+ }
17316
+ particleSystem.onUpdate(deltaTime);
17319
17317
  }
17318
+ this.lastTime = this.time;
17320
17319
  };
17321
17320
  return ParticleBehaviourPlayable;
17322
17321
  }(Playable);
@@ -17372,15 +17371,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17372
17371
  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;
17373
17372
  var detail = engine.gpuCapability.detail;
17374
17373
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17375
- var marcos = [
17374
+ var macros = [
17375
+ // spec.RenderMode
17376
17376
  [
17377
17377
  "RENDER_MODE",
17378
17378
  +renderMode
17379
17379
  ],
17380
- [
17381
- "PRE_MULTIPLY_ALPHA",
17382
- false
17383
- ],
17384
17380
  [
17385
17381
  "ENV_EDITOR",
17386
17382
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17396,13 +17392,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17396
17392
  var useOrbitalVel;
17397
17393
  this.useSprite = useSprite;
17398
17394
  if (enableVertexTexture) {
17399
- marcos.push([
17395
+ macros.push([
17400
17396
  "ENABLE_VERTEX_TEXTURE",
17401
17397
  true
17402
17398
  ]);
17403
17399
  }
17404
17400
  if (speedOverLifetime) {
17405
- marcos.push([
17401
+ macros.push([
17406
17402
  "SPEED_OVER_LIFETIME",
17407
17403
  true
17408
17404
  ]);
@@ -17410,7 +17406,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17410
17406
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17411
17407
  }
17412
17408
  if (sprite == null ? void 0 : sprite.animate) {
17413
- marcos.push([
17409
+ macros.push([
17414
17410
  "USE_SPRITE",
17415
17411
  true
17416
17412
  ]);
@@ -17424,7 +17420,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17424
17420
  this.useSprite = true;
17425
17421
  }
17426
17422
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17427
- marcos.push([
17423
+ macros.push([
17428
17424
  "COLOR_OVER_LIFETIME",
17429
17425
  true
17430
17426
  ]);
@@ -17449,7 +17445,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17449
17445
  shaderCacheId |= 1 << 7 + i;
17450
17446
  linearVelOverLifetime.enabled = true;
17451
17447
  }
17452
- marcos.push([
17448
+ macros.push([
17453
17449
  "LINEAR_VEL_" + pro.toUpperCase(),
17454
17450
  defL
17455
17451
  ]);
@@ -17460,13 +17456,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17460
17456
  useOrbitalVel = true;
17461
17457
  orbitalVelOverLifetime.enabled = true;
17462
17458
  }
17463
- marcos.push([
17459
+ macros.push([
17464
17460
  "ORB_VEL_" + pro.toUpperCase(),
17465
17461
  defO
17466
17462
  ]);
17467
17463
  });
17468
17464
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17469
- marcos.push([
17465
+ macros.push([
17470
17466
  "AS_LINEAR_MOVEMENT",
17471
17467
  true
17472
17468
  ]);
@@ -17474,7 +17470,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17474
17470
  }
17475
17471
  if (useOrbitalVel) {
17476
17472
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17477
- marcos.push([
17473
+ macros.push([
17478
17474
  "AS_ORBITAL_MOVEMENT",
17479
17475
  true
17480
17476
  ]);
@@ -17489,7 +17485,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17489
17485
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17490
17486
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17491
17487
  var _sizeOverLifetime_y;
17492
- marcos.push([
17488
+ macros.push([
17493
17489
  "SIZE_Y_BY_LIFE",
17494
17490
  1
17495
17491
  ]);
@@ -17499,7 +17495,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17499
17495
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17500
17496
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17501
17497
  shaderCacheId |= 1 << 15;
17502
- marcos.push([
17498
+ macros.push([
17503
17499
  "ROT_Z_LIFETIME",
17504
17500
  1
17505
17501
  ]);
@@ -17507,7 +17503,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17507
17503
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17508
17504
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17509
17505
  shaderCacheId |= 1 << 16;
17510
- marcos.push([
17506
+ macros.push([
17511
17507
  "ROT_X_LIFETIME",
17512
17508
  1
17513
17509
  ]);
@@ -17515,13 +17511,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17515
17511
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17516
17512
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17517
17513
  shaderCacheId |= 1 << 17;
17518
- marcos.push([
17514
+ macros.push([
17519
17515
  "ROT_Y_LIFETIME",
17520
17516
  1
17521
17517
  ]);
17522
17518
  }
17523
17519
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17524
- marcos.push([
17520
+ macros.push([
17525
17521
  "ROT_LIFETIME_AS_MOVEMENT",
17526
17522
  1
17527
17523
  ]);
@@ -17529,7 +17525,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17529
17525
  }
17530
17526
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17531
17527
  if (forceTarget) {
17532
- marcos.push([
17528
+ macros.push([
17533
17529
  "FINAL_TARGET",
17534
17530
  true
17535
17531
  ]);
@@ -17575,7 +17571,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17575
17571
  fragmentKeyFrameMeta.index,
17576
17572
  fragmentKeyFrameMeta.max
17577
17573
  ].join("+");
17578
- marcos.push([
17574
+ macros.push([
17579
17575
  "VERT_CURVE_VALUE_COUNT",
17580
17576
  vertexKeyFrameMeta.index
17581
17577
  ], [
@@ -17597,7 +17593,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17597
17593
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
17598
17594
  shared: true,
17599
17595
  cacheId: shaderCache,
17600
- marcos: marcos,
17596
+ macros: macros,
17601
17597
  name: "particle#" + name
17602
17598
  };
17603
17599
  var mtlOptions = {
@@ -17674,7 +17670,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17674
17670
  res.length = 0;
17675
17671
  break;
17676
17672
  default:
17677
- console.warn("uniform " + name + "'s type not in typeMap");
17673
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17678
17674
  }
17679
17675
  });
17680
17676
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -17900,7 +17896,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17900
17896
  }));
17901
17897
  if (increaseBuffer) {
17902
17898
  var baseIndexData = geometry.getIndexData();
17903
- var idx = enlargeBuffer(baseIndexData, particleCount * 6, inc, maxCount * 6);
17899
+ var idx = enlargeBuffer(baseIndexData, particleCount * 6, maxCount * 6, inc);
17904
17900
  idx.set(indexData, index * 6);
17905
17901
  geometry.setIndexData(idx);
17906
17902
  this.maxParticleBufferCount = idx.length / 6;
@@ -17912,7 +17908,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17912
17908
  var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
17913
17909
  if (increaseBuffer) {
17914
17910
  var baseData = geometry.getAttributeData(name);
17915
- var geoData = enlargeBuffer(baseData, vertexCount * attrSize, inc, maxCount * 4 * attrSize);
17911
+ var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
17916
17912
  geoData.set(data, data.length * index);
17917
17913
  geometry.setAttributeData(name, geoData);
17918
17914
  } else {
@@ -18010,20 +18006,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
18010
18006
  maxVertex: maxVertex
18011
18007
  };
18012
18008
  }
18013
- function getParticleMeshShader(item, env, gpuCapability) {
18009
+ function getParticleMeshShader(item, gpuCapability, env) {
18014
18010
  if (env === void 0) env = "";
18015
18011
  var _props_renderer;
18016
18012
  var props = item.content;
18017
18013
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
18018
- var marcos = [
18014
+ var macros = [
18019
18015
  [
18020
18016
  "RENDER_MODE",
18021
18017
  renderMode
18022
18018
  ],
18023
- [
18024
- "PRE_MULTIPLY_ALPHA",
18025
- false
18026
- ],
18027
18019
  [
18028
18020
  "ENV_EDITOR",
18029
18021
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18038,13 +18030,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18038
18030
  var vertex_lookup_texture = 0;
18039
18031
  var shaderCacheId = 0;
18040
18032
  if (enableVertexTexture) {
18041
- marcos.push([
18033
+ macros.push([
18042
18034
  "ENABLE_VERTEX_TEXTURE",
18043
18035
  true
18044
18036
  ]);
18045
18037
  }
18046
18038
  if (speedOverLifetime) {
18047
- marcos.push([
18039
+ macros.push([
18048
18040
  "SPEED_OVER_LIFETIME",
18049
18041
  true
18050
18042
  ]);
@@ -18053,7 +18045,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18053
18045
  }
18054
18046
  var sprite = props.textureSheetAnimation;
18055
18047
  if (sprite && sprite.animate) {
18056
- marcos.push([
18048
+ macros.push([
18057
18049
  "USE_SPRITE",
18058
18050
  true
18059
18051
  ]);
@@ -18061,7 +18053,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18061
18053
  }
18062
18054
  var colorOverLifetime = props.colorOverLifetime;
18063
18055
  if (colorOverLifetime && colorOverLifetime.color) {
18064
- marcos.push([
18056
+ macros.push([
18065
18057
  "COLOR_OVER_LIFETIME",
18066
18058
  true
18067
18059
  ]);
@@ -18086,7 +18078,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18086
18078
  defL = 1;
18087
18079
  shaderCacheId |= 1 << 7 + i;
18088
18080
  }
18089
- marcos.push([
18081
+ macros.push([
18090
18082
  "LINEAR_VEL_" + pro.toUpperCase(),
18091
18083
  defL
18092
18084
  ]);
@@ -18097,13 +18089,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18097
18089
  shaderCacheId |= 1 << 10 + i;
18098
18090
  useOrbitalVel = true;
18099
18091
  }
18100
- marcos.push([
18092
+ macros.push([
18101
18093
  "ORB_VEL_" + pro.toUpperCase(),
18102
18094
  defO
18103
18095
  ]);
18104
18096
  });
18105
18097
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18106
- marcos.push([
18098
+ macros.push([
18107
18099
  "AS_LINEAR_MOVEMENT",
18108
18100
  true
18109
18101
  ]);
@@ -18111,7 +18103,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18111
18103
  }
18112
18104
  if (useOrbitalVel) {
18113
18105
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18114
- marcos.push([
18106
+ macros.push([
18115
18107
  "AS_ORBITAL_MOVEMENT",
18116
18108
  true
18117
18109
  ]);
@@ -18123,7 +18115,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18123
18115
  var separateAxes = sizeOverLifetime.separateAxes;
18124
18116
  if (separateAxes) {
18125
18117
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18126
- marcos.push([
18118
+ macros.push([
18127
18119
  "SIZE_Y_BY_LIFE",
18128
18120
  1
18129
18121
  ]);
@@ -18138,7 +18130,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18138
18130
  if (rot.z) {
18139
18131
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18140
18132
  shaderCacheId |= 1 << 15;
18141
- marcos.push([
18133
+ macros.push([
18142
18134
  "ROT_Z_LIFETIME",
18143
18135
  1
18144
18136
  ]);
@@ -18147,7 +18139,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18147
18139
  if (rot.x) {
18148
18140
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18149
18141
  shaderCacheId |= 1 << 16;
18150
- marcos.push([
18142
+ macros.push([
18151
18143
  "ROT_X_LIFETIME",
18152
18144
  1
18153
18145
  ]);
@@ -18155,14 +18147,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18155
18147
  if (rot.y) {
18156
18148
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18157
18149
  shaderCacheId |= 1 << 17;
18158
- marcos.push([
18150
+ macros.push([
18159
18151
  "ROT_Y_LIFETIME",
18160
18152
  1
18161
18153
  ]);
18162
18154
  }
18163
18155
  }
18164
18156
  if (rot == null ? void 0 : rot.asRotation) {
18165
- marcos.push([
18157
+ macros.push([
18166
18158
  "ROT_LIFETIME_AS_MOVEMENT",
18167
18159
  1
18168
18160
  ]);
@@ -18172,7 +18164,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18172
18164
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18173
18165
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18174
18166
  if (forceOpt) {
18175
- marcos.push([
18167
+ macros.push([
18176
18168
  "FINAL_TARGET",
18177
18169
  true
18178
18170
  ]);
@@ -18213,10 +18205,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18213
18205
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18214
18206
  shared: true,
18215
18207
  cacheId: shaderCache,
18216
- marcos: marcos,
18208
+ macros: macros,
18217
18209
  name: "particle#" + item.name
18218
18210
  };
18219
- marcos.push([
18211
+ macros.push([
18220
18212
  "VERT_CURVE_VALUE_COUNT",
18221
18213
  vertexKeyFrameMeta.index
18222
18214
  ], [
@@ -18241,11 +18233,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18241
18233
  shaderIds[3] = maxVertex;
18242
18234
  shaderIds[5] = maxFrag;
18243
18235
  shader.cacheId = shaderIds.join("+");
18244
- if (!shader.marcos) {
18236
+ if (!shader.macros) {
18245
18237
  return;
18246
18238
  }
18247
- for(var i = 0; i < shader.marcos.length; i++){
18248
- var marco = shader.marcos[i];
18239
+ for(var i = 0; i < shader.macros.length; i++){
18240
+ var marco = shader.macros[i];
18249
18241
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18250
18242
  marco[1] = maxVertex;
18251
18243
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18278,17 +18270,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18278
18270
  });
18279
18271
  });
18280
18272
  items.forEach(function(item) {
18281
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18273
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18282
18274
  shaders.push(shader);
18283
18275
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18284
18276
  maxVertexCount = Math.max(maxVertexCount, vertex);
18285
18277
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18286
18278
  if (item.content.trails) {
18287
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18288
- var _shader_marcos;
18289
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, exports.ShaderType.vertex, level);
18290
- var _shader_marcos1;
18291
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18279
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18280
+ var _shader_macros;
18281
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, exports.ShaderType.vertex, level);
18282
+ var _shader_macros1;
18283
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18292
18284
  shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
18293
18285
  shaderLibrary.addShader(shader1);
18294
18286
  }
@@ -18300,10 +18292,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18300
18292
  } else {
18301
18293
  shader.glslVersion = exports.GLSLVersion.GLSL1;
18302
18294
  }
18303
- var _shader_marcos;
18304
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, exports.ShaderType.vertex, level);
18305
- var _shader_marcos1;
18306
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, exports.ShaderType.fragment, level);
18295
+ var _shader_macros;
18296
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
18297
+ var _shader_macros1;
18298
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
18307
18299
  shaderLibrary.addShader(shader);
18308
18300
  });
18309
18301
  if (level === 2) {
@@ -18570,6 +18562,7 @@ exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18570
18562
  function AnimationClip() {
18571
18563
  var _this;
18572
18564
  _this = EffectsObject.apply(this, arguments) || this;
18565
+ _this.duration = 0;
18573
18566
  _this.positionCurves = [];
18574
18567
  _this.rotationCurves = [];
18575
18568
  _this.scaleCurves = [];
@@ -18614,6 +18607,7 @@ exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18614
18607
  path: positionCurveData.path,
18615
18608
  keyFrames: createValueGetter(positionCurveData.keyFrames)
18616
18609
  };
18610
+ this.duration = Math.max(this.duration, curve.keyFrames.getMaxTime());
18617
18611
  this.positionCurves.push(curve);
18618
18612
  }
18619
18613
  for(var _iterator1 = _create_for_of_iterator_helper_loose(data.rotationCurves), _step1; !(_step1 = _iterator1()).done;){
@@ -18622,6 +18616,7 @@ exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18622
18616
  path: rotationCurveData.path,
18623
18617
  keyFrames: createValueGetter(rotationCurveData.keyFrames)
18624
18618
  };
18619
+ this.duration = Math.max(this.duration, curve1.keyFrames.getMaxTime());
18625
18620
  this.rotationCurves.push(curve1);
18626
18621
  }
18627
18622
  for(var _iterator2 = _create_for_of_iterator_helper_loose(data.scaleCurves), _step2; !(_step2 = _iterator2()).done;){
@@ -18630,6 +18625,7 @@ exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18630
18625
  path: scaleCurvesData.path,
18631
18626
  keyFrames: createValueGetter(scaleCurvesData.keyFrames)
18632
18627
  };
18628
+ this.duration = Math.max(this.duration, curve2.keyFrames.getMaxTime());
18633
18629
  this.scaleCurves.push(curve2);
18634
18630
  }
18635
18631
  for(var _iterator3 = _create_for_of_iterator_helper_loose(data.floatCurves), _step3; !(_step3 = _iterator3()).done;){
@@ -18640,6 +18636,7 @@ exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
18640
18636
  property: floatCurveData.property,
18641
18637
  className: floatCurveData.className
18642
18638
  };
18639
+ this.duration = Math.max(this.duration, curve3.keyFrames.getMaxTime());
18643
18640
  this.floatCurves.push(curve3);
18644
18641
  }
18645
18642
  };
@@ -18815,6 +18812,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
18815
18812
  this.playable = clipPlayable;
18816
18813
  this.parentMixer = parentMixer;
18817
18814
  this.track = track;
18815
+ if (_instanceof1(this.track.binding, exports.VFXItem)) {
18816
+ this.particleSystem = this.track.binding.getComponent(exports.ParticleSystem);
18817
+ }
18818
18818
  }
18819
18819
  var _proto = RuntimeClip.prototype;
18820
18820
  _proto.evaluateAt = function evaluateAt(localTime) {
@@ -18824,8 +18824,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
18824
18824
  var started = false;
18825
18825
  var boundItem = this.track.binding;
18826
18826
  if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
18827
- var _boundItem_getComponent;
18828
- if (exports.VFXItem.isParticle(boundItem) && !((_boundItem_getComponent = boundItem.getComponent(exports.ParticleSystem)) == null ? void 0 : _boundItem_getComponent.destroyed)) {
18827
+ if (exports.VFXItem.isParticle(boundItem) && this.particleSystem && !this.particleSystem.destroyed) {
18829
18828
  weight = 1.0;
18830
18829
  } else {
18831
18830
  weight = 0.0;
@@ -19191,7 +19190,7 @@ function compareTracks(a, b) {
19191
19190
  var refId = itemData.content.options.refId;
19192
19191
  var props = this.item.composition.refCompositionProps.get(refId);
19193
19192
  if (!props) {
19194
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19193
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19195
19194
  }
19196
19195
  // endBehaviour 类型需优化
19197
19196
  props.content = itemData.content;
@@ -19344,7 +19343,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19344
19343
  var _proto = SubCompositionTrack.prototype;
19345
19344
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19346
19345
  if (!_instanceof1(parentBinding, exports.VFXItem)) {
19347
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19346
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19348
19347
  }
19349
19348
  return parentBinding.getComponent(CompositionComponent);
19350
19349
  };
@@ -19599,14 +19598,41 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19599
19598
  return _possible_constructor_return(_this);
19600
19599
  }
19601
19600
  var options = props.options;
19602
- _this.textStyle = new TextStyle(options);
19603
- _this.textLayout = new TextLayout(options);
19604
- _this.text = options.text;
19605
- // Text
19601
+ _this.updateWithOptions(options);
19606
19602
  _this.updateTexture();
19607
19603
  return _this;
19608
19604
  }
19609
19605
  var _proto = TextComponent.prototype;
19606
+ _proto.update = function update(dt) {
19607
+ SpriteComponent.prototype.update.call(this, dt);
19608
+ this.updateTexture();
19609
+ };
19610
+ _proto.fromData = function fromData(data) {
19611
+ SpriteComponent.prototype.fromData.call(this, data);
19612
+ var options = data.options;
19613
+ this.updateWithOptions(options);
19614
+ // Text
19615
+ this.updateTexture();
19616
+ };
19617
+ _proto.updateWithOptions = function updateWithOptions(options) {
19618
+ // OVERRIDE by mixins
19619
+ };
19620
+ _proto.updateTexture = function updateTexture(flipY) {
19621
+ // OVERRIDE by mixins
19622
+ };
19623
+ return TextComponent;
19624
+ }(exports.SpriteComponent);
19625
+ exports.TextComponent = __decorate([
19626
+ effectsClass(DataType.TextComponent)
19627
+ ], exports.TextComponent);
19628
+ var TextComponentBase = /*#__PURE__*/ function() {
19629
+ function TextComponentBase() {}
19630
+ var _proto = TextComponentBase.prototype;
19631
+ _proto.updateWithOptions = function updateWithOptions(options) {
19632
+ this.textStyle = new TextStyle(options);
19633
+ this.textLayout = new TextLayout(options);
19634
+ this.text = options.text;
19635
+ };
19610
19636
  /**
19611
19637
  * 设置字号大小
19612
19638
  * @param value - 字号
@@ -19776,14 +19802,11 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19776
19802
  this.textStyle.fontScale = value;
19777
19803
  this.isDirty = true;
19778
19804
  };
19779
- _proto.update = function update(dt) {
19780
- SpriteComponent.prototype.update.call(this, dt);
19781
- this.updateTexture();
19782
- };
19783
19805
  /**
19784
19806
  * 更新文本
19785
19807
  * @returns
19786
- */ _proto.updateTexture = function updateTexture() {
19808
+ */ _proto.updateTexture = function updateTexture(flipY) {
19809
+ if (flipY === void 0) flipY = true;
19787
19810
  if (!this.isDirty || !this.context || !this.canvas) {
19788
19811
  return;
19789
19812
  }
@@ -19801,6 +19824,10 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19801
19824
  context.clearRect(0, 0, width, this.canvas.height);
19802
19825
  // fix bug 1/255
19803
19826
  context.fillStyle = "rgba(255, 255, 255, 0.0039)";
19827
+ if (!flipY) {
19828
+ context.translate(0, height);
19829
+ context.scale(1, -1);
19830
+ }
19804
19831
  context.fillRect(0, 0, width, this.canvas.height);
19805
19832
  style.fontDesc = this.getFontDesc();
19806
19833
  context.font = style.fontDesc;
@@ -19813,7 +19840,7 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19813
19840
  // 文本颜色
19814
19841
  context.fillStyle = "rgba(" + style.textColor[0] + ", " + style.textColor[1] + ", " + style.textColor[2] + ", " + style.textColor[3] + ")";
19815
19842
  var charsInfo = [];
19816
- // /3 为了和编辑器行为保持一致
19843
+ // /3 是为了和编辑器行为保持一致
19817
19844
  var offsetY = (lineHeight - fontSize) / 3;
19818
19845
  var x = 0;
19819
19846
  var y = layout.getOffsetY(style) + offsetY;
@@ -19867,7 +19894,7 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19867
19894
  width: imageData.width,
19868
19895
  height: imageData.height
19869
19896
  }, {
19870
- flipY: true,
19897
+ flipY: flipY,
19871
19898
  magFilter: glContext.LINEAR,
19872
19899
  minFilter: glContext.LINEAR,
19873
19900
  wrapS: glContext.CLAMP_TO_EDGE,
@@ -19875,50 +19902,47 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19875
19902
  }));
19876
19903
  this.isDirty = false;
19877
19904
  };
19878
- _proto.fromData = function fromData(data) {
19879
- SpriteComponent.prototype.fromData.call(this, data);
19880
- var options = data.options;
19881
- this.textStyle = new TextStyle(options);
19882
- this.textLayout = new TextLayout(options);
19883
- this.text = options.text;
19884
- // Text
19885
- this.updateTexture();
19886
- };
19887
19905
  _proto.getFontDesc = function getFontDesc() {
19888
- var textStyle = this.textStyle;
19889
- var fontDesc = "" + (textStyle.fontSize * textStyle.fontScale).toString() + "px ";
19890
- if (!DEFAULT_FONTS.includes(textStyle.fontFamily)) {
19891
- fontDesc += '"' + textStyle.fontFamily + '"';
19906
+ 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;
19907
+ var fontDesc = "" + (fontSize * fontScale).toString() + "px ";
19908
+ if (!DEFAULT_FONTS.includes(fontFamily)) {
19909
+ fontDesc += '"' + fontFamily + '"';
19892
19910
  } else {
19893
- fontDesc += textStyle.fontFamily;
19911
+ fontDesc += fontFamily;
19894
19912
  }
19895
- if (textStyle.textWeight !== TextWeight.normal) {
19896
- fontDesc = textStyle.textWeight + " " + fontDesc;
19913
+ if (textWeight !== TextWeight.normal) {
19914
+ fontDesc = textWeight + " " + fontDesc;
19897
19915
  }
19898
- if (textStyle.fontStyle !== FontStyle.normal) {
19899
- fontDesc = textStyle.fontStyle + " " + fontDesc;
19916
+ if (fontStyle !== FontStyle.normal) {
19917
+ fontDesc = fontStyle + " " + fontDesc;
19900
19918
  }
19901
19919
  return fontDesc;
19902
19920
  };
19903
19921
  _proto.setupOutline = function setupOutline() {
19904
19922
  var context = this.context;
19905
- var style = this.textStyle;
19906
- context.strokeStyle = "rgba(" + style.outlineColor[0] * 255 + ", " + style.outlineColor[1] * 255 + ", " + style.outlineColor[2] * 255 + ", " + style.outlineColor[3] + ")";
19907
- context.lineWidth = style.outlineWidth * 2;
19923
+ var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, outlineWidth = _this_textStyle.outlineWidth;
19924
+ var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
19925
+ if (context) {
19926
+ context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
19927
+ context.lineWidth = outlineWidth * 2;
19928
+ }
19908
19929
  };
19909
19930
  _proto.setupShadow = function setupShadow() {
19910
19931
  var context = this.context;
19911
- var style = this.textStyle;
19912
- context.shadowColor = "rgba(" + style.shadowColor[0] * 255 + ", " + style.shadowColor[1] * 255 + ", " + style.shadowColor[2] * 255 + ", " + style.shadowColor[3] + ")";
19913
- context.shadowBlur = style.shadowBlur;
19914
- context.shadowOffsetX = style.shadowOffsetX;
19915
- context.shadowOffsetY = -style.shadowOffsetY;
19932
+ var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
19933
+ var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
19934
+ if (context) {
19935
+ context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
19936
+ context.shadowBlur = shadowBlur;
19937
+ context.shadowOffsetX = shadowOffsetX;
19938
+ context.shadowOffsetY = -shadowOffsetY;
19939
+ }
19916
19940
  };
19917
- return TextComponent;
19918
- }(exports.SpriteComponent);
19919
- exports.TextComponent = __decorate([
19920
- effectsClass(DataType.TextComponent)
19921
- ], exports.TextComponent);
19941
+ return TextComponentBase;
19942
+ }();
19943
+ applyMixins(exports.TextComponent, [
19944
+ TextComponentBase
19945
+ ]);
19922
19946
 
19923
19947
  // TODO: 注册必须用
19924
19948
  var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
@@ -20147,8 +20171,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20147
20171
  * @param classConstructor - 要添加的组件类型
20148
20172
  */ _proto.addComponent = function addComponent(classConstructor) {
20149
20173
  var newComponent = new classConstructor(this.engine);
20150
- newComponent.item = this;
20151
20174
  this.components.push(newComponent);
20175
+ newComponent.item = this;
20152
20176
  newComponent.onAttached();
20153
20177
  return newComponent;
20154
20178
  };
@@ -20399,10 +20423,11 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20399
20423
  };
20400
20424
  }
20401
20425
  if (duration <= 0) {
20402
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20426
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20403
20427
  }
20404
20428
  for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20405
20429
  var component = _step.value;
20430
+ component.item = this;
20406
20431
  component.onAttached();
20407
20432
  }
20408
20433
  // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
@@ -20593,7 +20618,7 @@ exports.Item = void 0;
20593
20618
  pluginName = "tree";
20594
20619
  break;
20595
20620
  default:
20596
- throw new Error("invalid vfx item type");
20621
+ throw new Error("Invalid vfx item type.");
20597
20622
  }
20598
20623
  }
20599
20624
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20637,7 +20662,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20637
20662
  this.plugins = Object.keys(loaders).map(function(name) {
20638
20663
  var CTRL = pluginLoaderMap[name];
20639
20664
  if (!CTRL) {
20640
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20665
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20641
20666
  }
20642
20667
  var loader = new CTRL();
20643
20668
  loader.name = name;
@@ -20665,13 +20690,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20665
20690
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20666
20691
  var CTRL = pluginCtrlMap[name];
20667
20692
  if (!CTRL) {
20668
- throw new Error("plugin " + name + " no registered constructor");
20693
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20669
20694
  }
20670
20695
  var engine = composition.getEngine();
20671
20696
  var item = new CTRL(engine, props, composition);
20672
20697
  item.composition = composition;
20673
20698
  if (!_instanceof1(item, exports.VFXItem)) {
20674
- throw new Error("plugin " + name + " invalid constructor type");
20699
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20675
20700
  }
20676
20701
  return item;
20677
20702
  };
@@ -20981,7 +21006,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20981
21006
  };
20982
21007
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
20983
21008
  if (level > 14) {
20984
- console.error("序列化数据的内嵌对象层数大于上限");
21009
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20985
21010
  return;
20986
21011
  }
20987
21012
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
@@ -21018,7 +21043,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21018
21043
  switch(_state.label){
21019
21044
  case 0:
21020
21045
  if (level > 14) {
21021
- console.error("序列化数据的内嵌对象层数大于上限");
21046
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21022
21047
  return [
21023
21048
  2
21024
21049
  ];
@@ -21102,7 +21127,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21102
21127
  };
21103
21128
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21104
21129
  if (level > 14) {
21105
- console.error("序列化数据的内嵌对象层数大于上限");
21130
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21106
21131
  return;
21107
21132
  }
21108
21133
  if (!serializedData) {
@@ -21134,7 +21159,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21134
21159
  };
21135
21160
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21136
21161
  if (level > 14) {
21137
- console.error("序列化数据的内嵌对象层数大于上限");
21162
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21138
21163
  return;
21139
21164
  }
21140
21165
  if (!serializedData) {
@@ -21181,7 +21206,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21181
21206
  var effectsObject;
21182
21207
  var effectsObjectData = this.findData(guid);
21183
21208
  if (!effectsObjectData) {
21184
- console.error("未找到 uuid: " + guid + "的对象数据");
21209
+ console.error("Object data with uuid: " + guid + " not found.");
21185
21210
  return undefined;
21186
21211
  }
21187
21212
  switch(effectsObjectData.dataType){
@@ -21203,7 +21228,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21203
21228
  }
21204
21229
  }
21205
21230
  if (!effectsObject) {
21206
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21231
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21207
21232
  return undefined;
21208
21233
  }
21209
21234
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21231,7 +21256,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21231
21256
  2
21232
21257
  ];
21233
21258
  if (!_this.engine.database) {
21234
- console.error("未找到 uuid: " + guid + "的对象数据");
21259
+ console.error("Object data with uuid: " + guid + " not found.");
21235
21260
  return [
21236
21261
  2,
21237
21262
  undefined
@@ -21244,7 +21269,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21244
21269
  case 1:
21245
21270
  effectsObject = _state.sent();
21246
21271
  if (!effectsObject) {
21247
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21272
+ console.error("Disk data with uuid: " + guid + " not found.");
21248
21273
  return [
21249
21274
  2,
21250
21275
  undefined
@@ -21275,7 +21300,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21275
21300
  }
21276
21301
  }
21277
21302
  if (!effectsObject) {
21278
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21303
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21279
21304
  return [
21280
21305
  2,
21281
21306
  undefined
@@ -22707,7 +22732,7 @@ var standardVersion = /^(\d+)\.(\d+)$/;
22707
22732
  var reverseParticle = false;
22708
22733
  function getStandardJSON(json) {
22709
22734
  if (!json || typeof json !== "object") {
22710
- throw Error("expect a json object");
22735
+ throw new Error("Invalid input: Expected a JSON object.");
22711
22736
  }
22712
22737
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22713
22738
  version22Migration(json);
@@ -22728,7 +22753,7 @@ function getStandardJSON(json) {
22728
22753
  }
22729
22754
  return json;
22730
22755
  }
22731
- throw Error("invalid json version " + json.version);
22756
+ throw new Error("Invalid JSON version: " + json.version + ".");
22732
22757
  }
22733
22758
  var currentVersion = "1.0";
22734
22759
  function getStandardJSONFromV0(json) {
@@ -22820,7 +22845,7 @@ function getStandardImage(image, index, imageTags) {
22820
22845
  } else if (image && image.sourceType) {
22821
22846
  return image;
22822
22847
  }
22823
- throw Error("invalid image type");
22848
+ throw new Error("Invalid image type.");
22824
22849
  }
22825
22850
  function getStandardComposition(composition, opt) {
22826
22851
  if (opt === void 0) opt = {};
@@ -23104,7 +23129,7 @@ function _combineImageTemplate() {
23104
23129
  _state.label = 3;
23105
23130
  case 3:
23106
23131
  if (!image) {
23107
- throw new Error("image not provided.");
23132
+ throw new Error("Image not provided.");
23108
23133
  }
23109
23134
  if (!template) {
23110
23135
  return [
@@ -23222,7 +23247,7 @@ var seed$1 = 1;
23222
23247
  cancelLoading = true;
23223
23248
  _this.removeTimer(loadTimer);
23224
23249
  var totalTime = performance.now() - startTime;
23225
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23250
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23226
23251
  }, _this.timeout * 1000);
23227
23252
  _this.timers.push(loadTimer);
23228
23253
  });
@@ -23257,7 +23282,7 @@ var seed$1 = 1;
23257
23282
  ];
23258
23283
  case 3:
23259
23284
  e = _state.sent();
23260
- throw new Error("Load error in " + label + ", " + e);
23285
+ throw new Error("Load error in " + label + ", " + e + ".");
23261
23286
  case 4:
23262
23287
  throw new Error("Load canceled.");
23263
23288
  }
@@ -23356,12 +23381,13 @@ var seed$1 = 1;
23356
23381
  ];
23357
23382
  case 8:
23358
23383
  _ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
23359
- for(i2 = 0; i2 < images1.length; i2++){
23360
- // FIXME: 2024.05.29 如果 renderer 为空,这里会抛异常
23361
- imageAsset = new ImageAsset(renderer.engine);
23362
- imageAsset.data = loadedImages[i2];
23363
- imageAsset.setInstanceId(images1[i2].id);
23364
- renderer == null ? void 0 : renderer.engine.addInstance(imageAsset);
23384
+ if (renderer) {
23385
+ for(i2 = 0; i2 < images1.length; i2++){
23386
+ imageAsset = new ImageAsset(renderer.engine);
23387
+ imageAsset.data = loadedImages[i2];
23388
+ imageAsset.setInstanceId(images1[i2].id);
23389
+ renderer.engine.addInstance(imageAsset);
23390
+ }
23365
23391
  }
23366
23392
  return [
23367
23393
  4,
@@ -23403,7 +23429,7 @@ var seed$1 = 1;
23403
23429
  _state.label = 12;
23404
23430
  case 12:
23405
23431
  totalTime = performance.now() - startTime;
23406
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23432
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23407
23433
  window.clearTimeout(loadTimer);
23408
23434
  _this.removeTimer(loadTimer);
23409
23435
  scene.totalTime = totalTime;
@@ -23521,7 +23547,7 @@ var seed$1 = 1;
23521
23547
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23522
23548
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23523
23549
  }
23524
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23550
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23525
23551
  });
23526
23552
  return [
23527
23553
  2,
@@ -23552,7 +23578,7 @@ var seed$1 = 1;
23552
23578
  ];
23553
23579
  if (!isValidFontFamily(font.fontFamily)) {
23554
23580
  // 在所有设备上提醒开发者
23555
- console.warn("Risky font family: " + font.fontFamily);
23581
+ console.warn("Risky font family: " + font.fontFamily + ".");
23556
23582
  }
23557
23583
  _state.label = 1;
23558
23584
  case 1:
@@ -23579,7 +23605,7 @@ var seed$1 = 1;
23579
23605
  ];
23580
23606
  case 3:
23581
23607
  _state.sent();
23582
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23608
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23583
23609
  return [
23584
23610
  3,
23585
23611
  4
@@ -23675,7 +23701,7 @@ var seed$1 = 1;
23675
23701
  ];
23676
23702
  case 6:
23677
23703
  e = _state.sent();
23678
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23704
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23679
23705
  case 7:
23680
23706
  return [
23681
23707
  3,
@@ -23774,7 +23800,7 @@ var seed$1 = 1;
23774
23800
  ]);
23775
23801
  return [
23776
23802
  4,
23777
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23803
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23778
23804
  ];
23779
23805
  case 2:
23780
23806
  return [
@@ -23783,7 +23809,7 @@ var seed$1 = 1;
23783
23809
  ];
23784
23810
  case 3:
23785
23811
  e = _state.sent();
23786
- throw new Error("load texture " + idx + " fails, error message: " + e);
23812
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23787
23813
  case 4:
23788
23814
  source = texOpts.source;
23789
23815
  if (!isObject(source)) return [
@@ -23818,7 +23844,7 @@ var seed$1 = 1;
23818
23844
  tex.sourceType === exports.TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23819
23845
  ];
23820
23846
  }
23821
- throw new Error("Invalid texture source: " + source);
23847
+ throw new Error("Invalid texture source: " + source + ".");
23822
23848
  }
23823
23849
  });
23824
23850
  }));
@@ -23936,7 +23962,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23936
23962
  magFilter: glContext.NEAREST
23937
23963
  };
23938
23964
  }
23939
- throw new Error("Invalid texture options");
23965
+ throw new Error("Invalid texture options.");
23940
23966
  }
23941
23967
 
23942
23968
  var tmpScale = new Vector3(1, 1, 1);
@@ -24228,7 +24254,7 @@ var listOrder = 0;
24228
24254
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24229
24255
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24230
24256
  if (!textureOptions) {
24231
- throw new Error("scene.textures expected");
24257
+ throw new Error("scene.textures expected.");
24232
24258
  }
24233
24259
  var cachedTextures = textureOptions;
24234
24260
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24240,7 +24266,7 @@ var listOrder = 0;
24240
24266
  }
24241
24267
  }
24242
24268
  if (!this.composition) {
24243
- throw new Error("Invalid composition id: " + compositionId);
24269
+ throw new Error("Invalid composition id: " + compositionId + ".");
24244
24270
  }
24245
24271
  this.jsonScene = jsonScene;
24246
24272
  this.renderLevel = renderLevel;
@@ -24302,7 +24328,7 @@ var listOrder = 0;
24302
24328
  if (itemProps.type === ItemType.composition) {
24303
24329
  var refId = sourceItemData.content.options.refId;
24304
24330
  if (!this.refCompositions.get(refId)) {
24305
- throw new Error("Invalid Ref Composition id: " + refId);
24331
+ throw new Error("Invalid ref composition id: " + refId + ".");
24306
24332
  }
24307
24333
  var ref = this.getContent(this.refCompositions.get(refId));
24308
24334
  if (!this.refCompositionProps.has(refId)) {
@@ -24415,11 +24441,11 @@ var listOrder = 0;
24415
24441
  /**
24416
24442
  * 销毁状态位
24417
24443
  */ this.destroyed = false;
24444
+ this.postLoaders = [];
24418
24445
  /**
24419
24446
  * 合成暂停/播放 标识
24420
24447
  */ this.paused = false;
24421
24448
  this.lastVideoUpdateTime = 0;
24422
- this.postLoaders = [];
24423
24449
  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;
24424
24450
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24425
24451
  scene.jsonScene.imgUsage = undefined;
@@ -24818,7 +24844,7 @@ var listOrder = 0;
24818
24844
  }
24819
24845
  parent.children.push(item1);
24820
24846
  } else {
24821
- throw Error("元素引用了不存在的元素,请检查数据");
24847
+ throw new Error("The element references a non-existent element, please check the data.");
24822
24848
  }
24823
24849
  }
24824
24850
  }
@@ -25067,7 +25093,7 @@ var listOrder = 0;
25067
25093
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25068
25094
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25069
25095
  if (!this.renderer) {
25070
- console.warn("Can not translate position when container not assigned");
25096
+ console.warn("Renderer not assigned. Operation aborted.");
25071
25097
  return;
25072
25098
  }
25073
25099
  this.rootItem.translateByPixel(x, y);
@@ -25081,7 +25107,7 @@ var listOrder = 0;
25081
25107
  * @param y - y 坐标
25082
25108
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25083
25109
  if (!this.renderer) {
25084
- console.warn("Can not setPosition when container not assigned");
25110
+ console.warn("Renderer not assigned. Operation aborted.");
25085
25111
  return;
25086
25112
  }
25087
25113
  this.rootItem.setPositionByPixel(x, y);
@@ -25436,7 +25462,7 @@ var listOrder = 0;
25436
25462
  info.push("Tex " + this.textures.length);
25437
25463
  }
25438
25464
  if (info.length > 0) {
25439
- logger.warn("Release GPU memory: " + info.join(", "));
25465
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25440
25466
  }
25441
25467
  this.renderPasses.forEach(function(pass) {
25442
25468
  return pass.dispose();
@@ -25572,7 +25598,7 @@ var listOrder = 0;
25572
25598
  * @param ticker - 定时器类
25573
25599
  */ _proto.add = function add(ticker) {
25574
25600
  if (typeof ticker !== "function") {
25575
- throw new Error("Ticker: The tick object must implement the tick method.");
25601
+ throw new Error("The tick object must implement the tick method.");
25576
25602
  }
25577
25603
  this.tickers.push(ticker);
25578
25604
  };
@@ -25611,6 +25637,8 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
25611
25637
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
25612
25638
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
25613
25639
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
25640
+ var version$1 = "2.0.0-alpha.19";
25641
+ logger.info("Core version: " + version$1 + ".");
25614
25642
 
25615
25643
  var _obj;
25616
25644
  /**
@@ -25748,8 +25776,8 @@ var _obj3;
25748
25776
  1
25749
25777
  ]);
25750
25778
  _this.material = new THREE__namespace.RawShaderMaterial({
25751
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25752
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25779
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25780
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25753
25781
  alphaToCoverage: false,
25754
25782
  depthFunc: THREE__namespace.LessDepth,
25755
25783
  polygonOffsetFactor: THREE__namespace.ZeroFactor,
@@ -26737,7 +26765,7 @@ var seed = 1;
26737
26765
  texture.flipY = !!flipY;
26738
26766
  return texture;
26739
26767
  }
26740
- throw new Error("使用未知的数据类型创建纹理");
26768
+ throw new Error("Create a texture using an unknown data type.");
26741
26769
  };
26742
26770
  /**
26743
26771
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -27031,7 +27059,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
27031
27059
  }
27032
27060
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
27033
27061
  composition.statistic.firstFrameTime = firstFrameTime;
27034
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
27062
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
27035
27063
  _this.compositions.push(composition);
27036
27064
  return [
27037
27065
  2,
@@ -27197,8 +27225,8 @@ setMaxSpriteMeshItemCount(8);
27197
27225
  */ Mesh.create = function(engine, props) {
27198
27226
  return new ThreeMesh(engine, props);
27199
27227
  };
27200
- var version = "2.0.0-alpha.17";
27201
- logger.info("THREEJS plugin version: " + version);
27228
+ var version = "2.0.0-alpha.19";
27229
+ logger.info("THREEJS plugin version: " + version + ".");
27202
27230
 
27203
27231
  exports.AbstractPlugin = AbstractPlugin;
27204
27232
  exports.ActivationPlayable = ActivationPlayable;
@@ -27290,6 +27318,7 @@ exports.SpriteLoader = SpriteLoader;
27290
27318
  exports.StaticValue = StaticValue;
27291
27319
  exports.TEMPLATE_USE_OFFSCREEN_CANVAS = TEMPLATE_USE_OFFSCREEN_CANVAS;
27292
27320
  exports.TEXTURE_UNIFORM_MAP = TEXTURE_UNIFORM_MAP;
27321
+ exports.TextComponentBase = TextComponentBase;
27293
27322
  exports.TextLayout = TextLayout;
27294
27323
  exports.TextLoader = TextLoader;
27295
27324
  exports.TextStyle = TextStyle;
@@ -27310,6 +27339,7 @@ exports.ValueGetter = ValueGetter;
27310
27339
  exports.addByOrder = addByOrder;
27311
27340
  exports.addItem = addItem;
27312
27341
  exports.addItemWithOrder = addItemWithOrder;
27342
+ exports.applyMixins = applyMixins;
27313
27343
  exports.assertExist = assertExist;
27314
27344
  exports.asserts = asserts;
27315
27345
  exports.base64ToFile = base64ToFile;
@@ -27325,7 +27355,7 @@ exports.compatibleVert = compatible_vert;
27325
27355
  exports.createCopyShader = createCopyShader;
27326
27356
  exports.createGLContext = createGLContext;
27327
27357
  exports.createKeyFrameMeta = createKeyFrameMeta;
27328
- exports.createShaderWithMarcos = createShaderWithMarcos;
27358
+ exports.createShaderWithMacros = createShaderWithMacros;
27329
27359
  exports.createShape = createShape;
27330
27360
  exports.createVFXItem = createVFXItem;
27331
27361
  exports.createValueGetter = createValueGetter;
@@ -27429,7 +27459,6 @@ exports.setMaskMode = setMaskMode;
27429
27459
  exports.setMaxSpriteMeshItemCount = setMaxSpriteMeshItemCount;
27430
27460
  exports.setRayFromCamera = setRayFromCamera;
27431
27461
  exports.setSideMode = setSideMode;
27432
- exports.setSpriteMeshMaxFragmentTextures = setSpriteMeshMaxFragmentTextures;
27433
27462
  exports.setSpriteMeshMaxItemCountByGPU = setSpriteMeshMaxItemCountByGPU;
27434
27463
  exports.setUniformValue = setUniformValue;
27435
27464
  exports.sortByOrder = sortByOrder;