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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.17
6
+ * Version: v2.0.0-alpha.18
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -754,7 +754,7 @@ function isCanvas(canvas) {
754
754
  return min + Math.random() * (max - min);
755
755
  }
756
756
  function throwDestroyedError() {
757
- throw Error("destroyed item cannot be used again");
757
+ throw new Error("Destroyed item cannot be used again.");
758
758
  }
759
759
  function generateGUID() {
760
760
  return v4().replace(/-/g, "");
@@ -4478,7 +4478,7 @@ var effectsClassStore = {};
4478
4478
  function effectsClass(className) {
4479
4479
  return function(target, context) {
4480
4480
  if (effectsClassStore[className]) {
4481
- console.warn("Class " + className + " 重复注册");
4481
+ console.warn("Class " + className + " is already registered.");
4482
4482
  }
4483
4483
  // TODO: three修改json dataType, 这边重复注册直接 return
4484
4484
  effectsClassStore[className] = target;
@@ -7346,8 +7346,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7346
7346
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7347
7347
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7348
7348
  var HELP_LINK = {
7349
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7350
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7349
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7350
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7351
7351
  };
7352
7352
 
7353
7353
  /**
@@ -7532,17 +7532,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[ShaderType.vertex] = {
7532
7532
  }, _obj$7);
7533
7533
  /**
7534
7534
  * 生成 shader,检测到 WebGL1 上下文会降级
7535
- * @param marcos - 宏定义数组
7535
+ * @param macros - 宏定义数组
7536
7536
  * @param shader - 原始 shader 文本
7537
7537
  * @param shaderType - shader 类型
7538
7538
  * @return 去除版本号的 shader 文本
7539
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7539
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7540
7540
  var ret = [];
7541
7541
  var header = "";
7542
7542
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7543
7543
  ret.push("#define GE_RUNTIME");
7544
- if (marcos) {
7545
- marcos.forEach(function(param) {
7544
+ if (macros) {
7545
+ macros.forEach(function(param) {
7546
7546
  var key = param[0], value = param[1];
7547
7547
  if (value === true) {
7548
7548
  ret.push("#define " + key);
@@ -7651,7 +7651,7 @@ function setBlendMode(material, blendMode) {
7651
7651
  ];
7652
7652
  break;
7653
7653
  default:
7654
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7654
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7655
7655
  }
7656
7656
  }
7657
7657
  function setSideMode(material, side) {
@@ -7697,7 +7697,7 @@ function setMaskMode(material, maskMode) {
7697
7697
  material.stencilTest = false;
7698
7698
  break;
7699
7699
  default:
7700
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7700
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7701
7701
  }
7702
7702
  }
7703
7703
 
@@ -7918,7 +7918,7 @@ function _loadImage() {
7918
7918
  }
7919
7919
  // 2. 非法类型
7920
7920
  if (!url) {
7921
- throw new Error("Invalid url type: " + JSON.stringify(source));
7921
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7922
7922
  }
7923
7923
  return [
7924
7924
  2,
@@ -8086,21 +8086,21 @@ function _loadMedia() {
8086
8086
  return _loadMedia.apply(this, arguments);
8087
8087
  }
8088
8088
 
8089
- function deserializeMipmapTexture(texOpts, bins) {
8089
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8090
8090
  return _deserializeMipmapTexture.apply(this, arguments);
8091
8091
  }
8092
8092
  function _deserializeMipmapTexture() {
8093
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8093
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8094
8094
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8095
8095
  return __generator(this, function(_state) {
8096
8096
  switch(_state.label){
8097
8097
  case 0:
8098
8098
  if (files === void 0) files = [];
8099
- if (!(texOpts.target === 34067)) return [
8099
+ if (!(textureOptions.target === 34067)) return [
8100
8100
  3,
8101
8101
  1
8102
8102
  ];
8103
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8103
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8104
8104
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8105
8105
  loadedMipmaps = [];
8106
8106
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8120,7 +8120,7 @@ function _deserializeMipmapTexture() {
8120
8120
  2,
8121
8121
  _extends({
8122
8122
  keepImageSource: false
8123
- }, texOpts, {
8123
+ }, textureOptions, {
8124
8124
  mipmaps: loadedMipmaps,
8125
8125
  sourceFrom: {
8126
8126
  target: target,
@@ -8131,7 +8131,7 @@ function _deserializeMipmapTexture() {
8131
8131
  ];
8132
8132
  case 1:
8133
8133
  // TODO: 补充测试用例
8134
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8134
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8135
8135
  jobs = mipmaps1.map(function(pointer) {
8136
8136
  return loadMipmapImage(pointer, bins);
8137
8137
  });
@@ -8146,7 +8146,7 @@ function _deserializeMipmapTexture() {
8146
8146
  2,
8147
8147
  _extends({
8148
8148
  keepImageSource: false
8149
- }, texOpts, {
8149
+ }, textureOptions, {
8150
8150
  mipmaps: loadedMipmaps1,
8151
8151
  sourceType: TextureSourceType.mipmaps,
8152
8152
  sourceFrom: {
@@ -8181,7 +8181,7 @@ function _loadMipmapImage() {
8181
8181
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8182
8182
  bin = bins[index];
8183
8183
  if (!bin) {
8184
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8184
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8185
8185
  }
8186
8186
  return [
8187
8187
  2,
@@ -8385,7 +8385,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8385
8385
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8386
8386
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8387
8387
  if (identifier[0] !== 0xab || identifier[1] !== 0x4b || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 || identifier[6] !== 0x31 || identifier[7] !== 0xbb || identifier[8] !== 0x0d || identifier[9] !== 0x0a || identifier[10] !== 0x1a || identifier[11] !== 0x0a) {
8388
- throw Error("texture missing KTX identifier");
8388
+ throw new Error("Texture missing KTX identifier.");
8389
8389
  }
8390
8390
  // load the reset of the header in native 32 bit uint
8391
8391
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8407,15 +8407,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8407
8407
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8408
8408
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8409
8409
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8410
- logger.warn("Only 2D textures currently supported");
8410
+ logger.warn("Only 2D textures currently supported.");
8411
8411
  return;
8412
8412
  }
8413
8413
  if (this.numberOfArrayElements !== 0) {
8414
- logger.warn("Texture arrays not currently supported");
8414
+ logger.warn("Texture arrays not currently supported.");
8415
8415
  return;
8416
8416
  }
8417
8417
  if (this.numberOfFaces !== facesExpected) {
8418
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8418
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8419
8419
  return;
8420
8420
  }
8421
8421
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8503,7 +8503,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8503
8503
  3
8504
8504
  ];
8505
8505
  case 2:
8506
- throw new Error("No source from");
8506
+ throw new Error("No source from.");
8507
8507
  case 3:
8508
8508
  return [
8509
8509
  2
@@ -8747,7 +8747,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8747
8747
  })
8748
8748
  ];
8749
8749
  case 17:
8750
- throw new Error("Invalid resource type: " + type);
8750
+ throw new Error("Invalid resource type: " + type + ".");
8751
8751
  }
8752
8752
  });
8753
8753
  })();
@@ -9678,19 +9678,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9678
9678
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9679
9679
  }
9680
9680
  if (x1 < 0) {
9681
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9681
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9682
9682
  x1 = 0;
9683
9683
  }
9684
9684
  if (x2 < 0) {
9685
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9685
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9686
9686
  x2 = 0;
9687
9687
  }
9688
9688
  if (x1 > 1) {
9689
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9689
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9690
9690
  x1 = 1;
9691
9691
  }
9692
9692
  if (x2 > 1) {
9693
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9693
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9694
9694
  x2 = 1;
9695
9695
  }
9696
9696
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9871,31 +9871,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9871
9871
  }
9872
9872
  var _proto = ValueGetter.prototype;
9873
9873
  _proto.onCreate = function onCreate(props) {
9874
- throw Error(NOT_IMPLEMENT);
9874
+ throw new Error(NOT_IMPLEMENT);
9875
9875
  };
9876
9876
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9877
- throw Error(NOT_IMPLEMENT);
9877
+ throw new Error(NOT_IMPLEMENT);
9878
9878
  };
9879
9879
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9880
- throw Error(NOT_IMPLEMENT);
9880
+ throw new Error(NOT_IMPLEMENT);
9881
9881
  };
9882
9882
  _proto.getValue = function getValue(time) {
9883
- throw Error(NOT_IMPLEMENT);
9883
+ throw new Error(NOT_IMPLEMENT);
9884
9884
  };
9885
9885
  _proto.getMaxTime = function getMaxTime() {
9886
- throw Error(NOT_IMPLEMENT);
9886
+ throw new Error(NOT_IMPLEMENT);
9887
9887
  };
9888
9888
  _proto.toUniform = function toUniform(meta) {
9889
- throw Error(NOT_IMPLEMENT);
9889
+ throw new Error(NOT_IMPLEMENT);
9890
9890
  };
9891
9891
  _proto.map = function map(func) {
9892
- throw Error(NOT_IMPLEMENT);
9892
+ throw new Error(NOT_IMPLEMENT);
9893
9893
  };
9894
9894
  _proto.scaleXCoord = function scaleXCoord(scale) {
9895
9895
  return this;
9896
9896
  };
9897
9897
  _proto.toData = function toData() {
9898
- throw Error(NOT_IMPLEMENT);
9898
+ throw new Error(NOT_IMPLEMENT);
9899
9899
  };
9900
9900
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9901
9901
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -10592,7 +10592,7 @@ function createValueGetter(args) {
10592
10592
  if (isFunction(map$1[args[0]])) {
10593
10593
  return map$1[args[0]](args[1]);
10594
10594
  } else {
10595
- throw new Error("ValueType: " + args[0] + " is not support");
10595
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10596
10596
  }
10597
10597
  }
10598
10598
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10736,7 +10736,7 @@ function createCopyShader(level, writeDepth) {
10736
10736
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10737
10737
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10738
10738
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
10739
- marcos: [
10739
+ macros: [
10740
10740
  [
10741
10741
  "WEBGL2",
10742
10742
  !!webgl2
@@ -10809,7 +10809,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10809
10809
  var refCount = this.textureRef[id];
10810
10810
  if (refCount <= 1) {
10811
10811
  if (refCount < 0) {
10812
- console.error("ref count < 0");
10812
+ console.error("Ref count < 0.");
10813
10813
  }
10814
10814
  var tex = this.textureCache[id];
10815
10815
  if (tex) {
@@ -11487,21 +11487,21 @@ var seed$7 = 1;
11487
11487
  return RenderPass;
11488
11488
  }();
11489
11489
 
11490
- var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
11490
+ var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
11491
11491
 
11492
11492
  var compatible_frag = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n";
11493
11493
 
11494
11494
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11495
11495
 
11496
- var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
11496
+ var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
11497
11497
 
11498
11498
  var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}";
11499
11499
 
11500
11500
  var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
11501
11501
 
11502
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
11502
+ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
11503
11503
 
11504
- var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
11504
+ var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
11505
11505
 
11506
11506
  var particleVert = "#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
11507
11507
 
@@ -12695,20 +12695,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12695
12695
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12696
12696
  var ext = this.drawBufferExtension;
12697
12697
  if (this.level === 1 && !ext && index > 0) {
12698
- throw new Error("draw multiple color buffers not available");
12698
+ throw new Error("Draw multiple color buffers not available.");
12699
12699
  }
12700
12700
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12701
12701
  if (attachment) {
12702
12702
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12703
12703
  } else {
12704
- console.error("invalid color attachment index: " + index);
12704
+ console.error("Invalid color attachment index: " + index + ".");
12705
12705
  }
12706
12706
  };
12707
12707
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12708
12708
  var ext = this.drawBufferExtension;
12709
12709
  if (this.level === 1 && !ext) {
12710
12710
  if (bufferStates.length > 1) {
12711
- throw Error("draw buffers not available");
12711
+ throw new Error("Draw buffers not available.");
12712
12712
  } else {
12713
12713
  return;
12714
12714
  }
@@ -12945,7 +12945,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12945
12945
  };
12946
12946
  _proto.createMaterial = function createMaterial(rendererOptions) {
12947
12947
  var _this_engine_renderer;
12948
- var marcos = [
12948
+ var macros = [
12949
12949
  [
12950
12950
  "ENV_EDITOR",
12951
12951
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12958,7 +12958,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12958
12958
  fragment: fragment,
12959
12959
  glslVersion: GLSLVersion.GLSL1,
12960
12960
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12961
- marcos: marcos
12961
+ macros: macros
12962
12962
  },
12963
12963
  uniformSemantics: {
12964
12964
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13224,16 +13224,12 @@ function shouldIgnoreBouncing(arg, mul) {
13224
13224
  }
13225
13225
 
13226
13226
  var maxSpriteMeshItemCount = 8;
13227
- var maxSpriteTextureCount = 8;
13228
13227
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13229
- // 8 or 16
13230
- maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13231
13228
  if (gpuCapability.maxVertexUniforms >= 256) {
13232
13229
  return maxSpriteMeshItemCount = 32;
13233
13230
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13234
13231
  return maxSpriteMeshItemCount = 16;
13235
13232
  }
13236
- maxSpriteTextureCount = 8;
13237
13233
  }
13238
13234
  function getImageItemRenderInfo(item) {
13239
13235
  var renderer = item.renderer;
@@ -13251,27 +13247,11 @@ function getImageItemRenderInfo(item) {
13251
13247
  };
13252
13248
  }
13253
13249
  function spriteMeshShaderFromFilter(level, options) {
13254
- var _ref = options != null ? options : {}, _ref_count = _ref.count, count = _ref_count === void 0 ? 2 : _ref_count, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, ignoreBlend = _ref.ignoreBlend, wireframe = _ref.wireframe;
13255
- var marcos = [
13256
- [
13257
- "MAX_ITEM_COUNT",
13258
- count
13259
- ],
13260
- [
13261
- "PRE_MULTIPLY_ALPHA",
13262
- false
13263
- ],
13250
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13251
+ var macros = [
13264
13252
  [
13265
13253
  "ENV_EDITOR",
13266
13254
  env === PLAYER_OPTIONS_ENV_EDITOR
13267
- ],
13268
- [
13269
- "USE_BLEND",
13270
- !ignoreBlend
13271
- ],
13272
- [
13273
- "MAX_FRAG_TEX",
13274
- maxSpriteTextureCount >= 16 ? 16 : 8
13275
13255
  ]
13276
13256
  ];
13277
13257
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13280,7 +13260,7 @@ function spriteMeshShaderFromFilter(level, options) {
13280
13260
  fragment: fragment,
13281
13261
  vertex: vertex,
13282
13262
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
13283
- marcos: marcos,
13263
+ macros: macros,
13284
13264
  shared: true
13285
13265
  };
13286
13266
  }
@@ -13290,7 +13270,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13290
13270
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13291
13271
  var wireframe = renderInfo.wireframe;
13292
13272
  var shader = spriteMeshShaderFromFilter(level, {
13293
- count: count,
13294
13273
  wireframe: wireframe,
13295
13274
  env: env
13296
13275
  });
@@ -13304,9 +13283,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13304
13283
  function setMaxSpriteMeshItemCount(count) {
13305
13284
  maxSpriteMeshItemCount = count;
13306
13285
  }
13307
- function setSpriteMeshMaxFragmentTextures(count) {
13308
- maxSpriteTextureCount = count;
13309
- }
13310
13286
 
13311
13287
  var defRenderInfo = {
13312
13288
  blending: 0,
@@ -14939,7 +14915,7 @@ function createShape(shapeOptions) {
14939
14915
  var type = shapeOptions.type;
14940
14916
  var Ctrl = map[type];
14941
14917
  if (!Ctrl) {
14942
- throw Error("invalid shape:" + type);
14918
+ throw new Error("Invalid shape: " + type + ".");
14943
14919
  }
14944
14920
  var ctrl = new Ctrl(options);
14945
14921
  if (type !== ShapeType.NONE) {
@@ -15769,7 +15745,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15769
15745
  var uniformValues = {};
15770
15746
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15771
15747
  var lookUpTexture = 0;
15772
- var marcos = [
15748
+ var macros = [
15773
15749
  [
15774
15750
  "ENABLE_VERTEX_TEXTURE",
15775
15751
  enableVertexTexture
@@ -15786,7 +15762,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15786
15762
  var useAttributeTrailStart = maxTrailCount > 64;
15787
15763
  var shaderCacheId = 0;
15788
15764
  if (colorOverLifetime) {
15789
- marcos.push([
15765
+ macros.push([
15790
15766
  "COLOR_OVER_LIFETIME",
15791
15767
  true
15792
15768
  ]);
@@ -15794,7 +15770,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15794
15770
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15795
15771
  }
15796
15772
  if (colorOverTrail) {
15797
- marcos.push([
15773
+ macros.push([
15798
15774
  "COLOR_OVER_TRAIL",
15799
15775
  true
15800
15776
  ]);
@@ -15802,7 +15778,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15802
15778
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15803
15779
  }
15804
15780
  if (useAttributeTrailStart) {
15805
- marcos.push([
15781
+ macros.push([
15806
15782
  "ATTR_TRAIL_START",
15807
15783
  1
15808
15784
  ]);
@@ -15812,7 +15788,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15812
15788
  }
15813
15789
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15814
15790
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15815
- marcos.push([
15791
+ macros.push([
15816
15792
  "VERT_CURVE_VALUE_COUNT",
15817
15793
  keyFrameMeta.index
15818
15794
  ], [
@@ -15831,7 +15807,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15831
15807
  shader: {
15832
15808
  vertex: vertex,
15833
15809
  fragment: fragment,
15834
- marcos: marcos,
15810
+ macros: macros,
15835
15811
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
15836
15812
  shared: true,
15837
15813
  name: "trail#" + name,
@@ -16134,12 +16110,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16134
16110
  }
16135
16111
  return dir.normalize().toArray();
16136
16112
  }
16137
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16113
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16138
16114
  if (env === void 0) env = "";
16139
16115
  var shaderCacheId = 0;
16140
16116
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16141
16117
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16142
- var marcos = [
16118
+ var macros = [
16143
16119
  [
16144
16120
  "ENABLE_VERTEX_TEXTURE",
16145
16121
  enableVertexTexture
@@ -16155,14 +16131,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16155
16131
  ];
16156
16132
  var keyFrameMeta = createKeyFrameMeta();
16157
16133
  if (trails.colorOverLifetime) {
16158
- marcos.push([
16134
+ macros.push([
16159
16135
  "COLOR_OVER_LIFETIME",
16160
16136
  true
16161
16137
  ]);
16162
16138
  shaderCacheId |= 1;
16163
16139
  }
16164
16140
  if (trails.colorOverTrail) {
16165
- marcos.push([
16141
+ macros.push([
16166
16142
  "COLOR_OVER_TRAIL",
16167
16143
  true
16168
16144
  ]);
@@ -16170,7 +16146,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16170
16146
  }
16171
16147
  var useAttributeTrailStart = particleMaxCount > 64;
16172
16148
  if (useAttributeTrailStart) {
16173
- marcos.push([
16149
+ macros.push([
16174
16150
  "ATTR_TRAIL_START",
16175
16151
  1
16176
16152
  ]);
@@ -16178,7 +16154,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16178
16154
  }
16179
16155
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16180
16156
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16181
- marcos.push([
16157
+ macros.push([
16182
16158
  "VERT_CURVE_VALUE_COUNT",
16183
16159
  keyFrameMeta.index
16184
16160
  ], [
@@ -16188,7 +16164,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16188
16164
  return {
16189
16165
  vertex: trailVert,
16190
16166
  fragment: particleFrag,
16191
- marcos: marcos,
16167
+ macros: macros,
16192
16168
  shared: true,
16193
16169
  name: "trail#" + name,
16194
16170
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -17348,15 +17324,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17348
17324
  var speedOverLifetime = props.speedOverLifetime, colorOverLifetime = props.colorOverLifetime, linearVelOverLifetime = props.linearVelOverLifetime, orbitalVelOverLifetime = props.orbitalVelOverLifetime, sizeOverLifetime = props.sizeOverLifetime, rotationOverLifetime = props.rotationOverLifetime, sprite = props.sprite, gravityModifier = props.gravityModifier, maxCount = props.maxCount, textureFlip = props.textureFlip, useSprite = props.useSprite, name = props.name, gravity = props.gravity, forceTarget = props.forceTarget, side = props.side, occlusion = props.occlusion, anchor = props.anchor, blending = props.blending, maskMode = props.maskMode, mask = props.mask, transparentOcclusion = props.transparentOcclusion, meshSlots = props.meshSlots, _props_renderMode = props.renderMode, renderMode = _props_renderMode === void 0 ? 0 : _props_renderMode, _props_diffuse = props.diffuse, diffuse = _props_diffuse === void 0 ? Texture.createWithData(engine) : _props_diffuse;
17349
17325
  var detail = engine.gpuCapability.detail;
17350
17326
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17351
- var marcos = [
17327
+ var macros = [
17328
+ // spec.RenderMode
17352
17329
  [
17353
17330
  "RENDER_MODE",
17354
17331
  +renderMode
17355
17332
  ],
17356
- [
17357
- "PRE_MULTIPLY_ALPHA",
17358
- false
17359
- ],
17360
17333
  [
17361
17334
  "ENV_EDITOR",
17362
17335
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17372,13 +17345,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17372
17345
  var useOrbitalVel;
17373
17346
  this.useSprite = useSprite;
17374
17347
  if (enableVertexTexture) {
17375
- marcos.push([
17348
+ macros.push([
17376
17349
  "ENABLE_VERTEX_TEXTURE",
17377
17350
  true
17378
17351
  ]);
17379
17352
  }
17380
17353
  if (speedOverLifetime) {
17381
- marcos.push([
17354
+ macros.push([
17382
17355
  "SPEED_OVER_LIFETIME",
17383
17356
  true
17384
17357
  ]);
@@ -17386,7 +17359,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17386
17359
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17387
17360
  }
17388
17361
  if (sprite == null ? void 0 : sprite.animate) {
17389
- marcos.push([
17362
+ macros.push([
17390
17363
  "USE_SPRITE",
17391
17364
  true
17392
17365
  ]);
@@ -17400,7 +17373,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17400
17373
  this.useSprite = true;
17401
17374
  }
17402
17375
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17403
- marcos.push([
17376
+ macros.push([
17404
17377
  "COLOR_OVER_LIFETIME",
17405
17378
  true
17406
17379
  ]);
@@ -17425,7 +17398,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17425
17398
  shaderCacheId |= 1 << 7 + i;
17426
17399
  linearVelOverLifetime.enabled = true;
17427
17400
  }
17428
- marcos.push([
17401
+ macros.push([
17429
17402
  "LINEAR_VEL_" + pro.toUpperCase(),
17430
17403
  defL
17431
17404
  ]);
@@ -17436,13 +17409,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17436
17409
  useOrbitalVel = true;
17437
17410
  orbitalVelOverLifetime.enabled = true;
17438
17411
  }
17439
- marcos.push([
17412
+ macros.push([
17440
17413
  "ORB_VEL_" + pro.toUpperCase(),
17441
17414
  defO
17442
17415
  ]);
17443
17416
  });
17444
17417
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17445
- marcos.push([
17418
+ macros.push([
17446
17419
  "AS_LINEAR_MOVEMENT",
17447
17420
  true
17448
17421
  ]);
@@ -17450,7 +17423,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17450
17423
  }
17451
17424
  if (useOrbitalVel) {
17452
17425
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17453
- marcos.push([
17426
+ macros.push([
17454
17427
  "AS_ORBITAL_MOVEMENT",
17455
17428
  true
17456
17429
  ]);
@@ -17465,7 +17438,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17465
17438
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17466
17439
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17467
17440
  var _sizeOverLifetime_y;
17468
- marcos.push([
17441
+ macros.push([
17469
17442
  "SIZE_Y_BY_LIFE",
17470
17443
  1
17471
17444
  ]);
@@ -17475,7 +17448,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17475
17448
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17476
17449
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17477
17450
  shaderCacheId |= 1 << 15;
17478
- marcos.push([
17451
+ macros.push([
17479
17452
  "ROT_Z_LIFETIME",
17480
17453
  1
17481
17454
  ]);
@@ -17483,7 +17456,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17483
17456
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17484
17457
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17485
17458
  shaderCacheId |= 1 << 16;
17486
- marcos.push([
17459
+ macros.push([
17487
17460
  "ROT_X_LIFETIME",
17488
17461
  1
17489
17462
  ]);
@@ -17491,13 +17464,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17491
17464
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17492
17465
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17493
17466
  shaderCacheId |= 1 << 17;
17494
- marcos.push([
17467
+ macros.push([
17495
17468
  "ROT_Y_LIFETIME",
17496
17469
  1
17497
17470
  ]);
17498
17471
  }
17499
17472
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17500
- marcos.push([
17473
+ macros.push([
17501
17474
  "ROT_LIFETIME_AS_MOVEMENT",
17502
17475
  1
17503
17476
  ]);
@@ -17505,7 +17478,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17505
17478
  }
17506
17479
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17507
17480
  if (forceTarget) {
17508
- marcos.push([
17481
+ macros.push([
17509
17482
  "FINAL_TARGET",
17510
17483
  true
17511
17484
  ]);
@@ -17551,7 +17524,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17551
17524
  fragmentKeyFrameMeta.index,
17552
17525
  fragmentKeyFrameMeta.max
17553
17526
  ].join("+");
17554
- marcos.push([
17527
+ macros.push([
17555
17528
  "VERT_CURVE_VALUE_COUNT",
17556
17529
  vertexKeyFrameMeta.index
17557
17530
  ], [
@@ -17573,7 +17546,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17573
17546
  glslVersion: level === 1 ? GLSLVersion.GLSL1 : GLSLVersion.GLSL3,
17574
17547
  shared: true,
17575
17548
  cacheId: shaderCache,
17576
- marcos: marcos,
17549
+ macros: macros,
17577
17550
  name: "particle#" + name
17578
17551
  };
17579
17552
  var mtlOptions = {
@@ -17650,7 +17623,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17650
17623
  res.length = 0;
17651
17624
  break;
17652
17625
  default:
17653
- console.warn("uniform " + name + "'s type not in typeMap");
17626
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17654
17627
  }
17655
17628
  });
17656
17629
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -17986,20 +17959,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
17986
17959
  maxVertex: maxVertex
17987
17960
  };
17988
17961
  }
17989
- function getParticleMeshShader(item, env, gpuCapability) {
17962
+ function getParticleMeshShader(item, gpuCapability, env) {
17990
17963
  if (env === void 0) env = "";
17991
17964
  var _props_renderer;
17992
17965
  var props = item.content;
17993
17966
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
17994
- var marcos = [
17967
+ var macros = [
17995
17968
  [
17996
17969
  "RENDER_MODE",
17997
17970
  renderMode
17998
17971
  ],
17999
- [
18000
- "PRE_MULTIPLY_ALPHA",
18001
- false
18002
- ],
18003
17972
  [
18004
17973
  "ENV_EDITOR",
18005
17974
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18014,13 +17983,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18014
17983
  var vertex_lookup_texture = 0;
18015
17984
  var shaderCacheId = 0;
18016
17985
  if (enableVertexTexture) {
18017
- marcos.push([
17986
+ macros.push([
18018
17987
  "ENABLE_VERTEX_TEXTURE",
18019
17988
  true
18020
17989
  ]);
18021
17990
  }
18022
17991
  if (speedOverLifetime) {
18023
- marcos.push([
17992
+ macros.push([
18024
17993
  "SPEED_OVER_LIFETIME",
18025
17994
  true
18026
17995
  ]);
@@ -18029,7 +17998,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18029
17998
  }
18030
17999
  var sprite = props.textureSheetAnimation;
18031
18000
  if (sprite && sprite.animate) {
18032
- marcos.push([
18001
+ macros.push([
18033
18002
  "USE_SPRITE",
18034
18003
  true
18035
18004
  ]);
@@ -18037,7 +18006,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18037
18006
  }
18038
18007
  var colorOverLifetime = props.colorOverLifetime;
18039
18008
  if (colorOverLifetime && colorOverLifetime.color) {
18040
- marcos.push([
18009
+ macros.push([
18041
18010
  "COLOR_OVER_LIFETIME",
18042
18011
  true
18043
18012
  ]);
@@ -18062,7 +18031,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18062
18031
  defL = 1;
18063
18032
  shaderCacheId |= 1 << 7 + i;
18064
18033
  }
18065
- marcos.push([
18034
+ macros.push([
18066
18035
  "LINEAR_VEL_" + pro.toUpperCase(),
18067
18036
  defL
18068
18037
  ]);
@@ -18073,13 +18042,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18073
18042
  shaderCacheId |= 1 << 10 + i;
18074
18043
  useOrbitalVel = true;
18075
18044
  }
18076
- marcos.push([
18045
+ macros.push([
18077
18046
  "ORB_VEL_" + pro.toUpperCase(),
18078
18047
  defO
18079
18048
  ]);
18080
18049
  });
18081
18050
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18082
- marcos.push([
18051
+ macros.push([
18083
18052
  "AS_LINEAR_MOVEMENT",
18084
18053
  true
18085
18054
  ]);
@@ -18087,7 +18056,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18087
18056
  }
18088
18057
  if (useOrbitalVel) {
18089
18058
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18090
- marcos.push([
18059
+ macros.push([
18091
18060
  "AS_ORBITAL_MOVEMENT",
18092
18061
  true
18093
18062
  ]);
@@ -18099,7 +18068,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18099
18068
  var separateAxes = sizeOverLifetime.separateAxes;
18100
18069
  if (separateAxes) {
18101
18070
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18102
- marcos.push([
18071
+ macros.push([
18103
18072
  "SIZE_Y_BY_LIFE",
18104
18073
  1
18105
18074
  ]);
@@ -18114,7 +18083,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18114
18083
  if (rot.z) {
18115
18084
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18116
18085
  shaderCacheId |= 1 << 15;
18117
- marcos.push([
18086
+ macros.push([
18118
18087
  "ROT_Z_LIFETIME",
18119
18088
  1
18120
18089
  ]);
@@ -18123,7 +18092,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18123
18092
  if (rot.x) {
18124
18093
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18125
18094
  shaderCacheId |= 1 << 16;
18126
- marcos.push([
18095
+ macros.push([
18127
18096
  "ROT_X_LIFETIME",
18128
18097
  1
18129
18098
  ]);
@@ -18131,14 +18100,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18131
18100
  if (rot.y) {
18132
18101
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18133
18102
  shaderCacheId |= 1 << 17;
18134
- marcos.push([
18103
+ macros.push([
18135
18104
  "ROT_Y_LIFETIME",
18136
18105
  1
18137
18106
  ]);
18138
18107
  }
18139
18108
  }
18140
18109
  if (rot == null ? void 0 : rot.asRotation) {
18141
- marcos.push([
18110
+ macros.push([
18142
18111
  "ROT_LIFETIME_AS_MOVEMENT",
18143
18112
  1
18144
18113
  ]);
@@ -18148,7 +18117,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18148
18117
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18149
18118
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18150
18119
  if (forceOpt) {
18151
- marcos.push([
18120
+ macros.push([
18152
18121
  "FINAL_TARGET",
18153
18122
  true
18154
18123
  ]);
@@ -18189,10 +18158,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18189
18158
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18190
18159
  shared: true,
18191
18160
  cacheId: shaderCache,
18192
- marcos: marcos,
18161
+ macros: macros,
18193
18162
  name: "particle#" + item.name
18194
18163
  };
18195
- marcos.push([
18164
+ macros.push([
18196
18165
  "VERT_CURVE_VALUE_COUNT",
18197
18166
  vertexKeyFrameMeta.index
18198
18167
  ], [
@@ -18217,11 +18186,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18217
18186
  shaderIds[3] = maxVertex;
18218
18187
  shaderIds[5] = maxFrag;
18219
18188
  shader.cacheId = shaderIds.join("+");
18220
- if (!shader.marcos) {
18189
+ if (!shader.macros) {
18221
18190
  return;
18222
18191
  }
18223
- for(var i = 0; i < shader.marcos.length; i++){
18224
- var marco = shader.marcos[i];
18192
+ for(var i = 0; i < shader.macros.length; i++){
18193
+ var marco = shader.macros[i];
18225
18194
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18226
18195
  marco[1] = maxVertex;
18227
18196
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18254,17 +18223,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18254
18223
  });
18255
18224
  });
18256
18225
  items.forEach(function(item) {
18257
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18226
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18258
18227
  shaders.push(shader);
18259
18228
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18260
18229
  maxVertexCount = Math.max(maxVertexCount, vertex);
18261
18230
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18262
18231
  if (item.content.trails) {
18263
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18264
- var _shader_marcos;
18265
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, ShaderType.vertex, level);
18266
- var _shader_marcos1;
18267
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, ShaderType.fragment, level);
18232
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18233
+ var _shader_macros;
18234
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
18235
+ var _shader_macros1;
18236
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
18268
18237
  shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
18269
18238
  shaderLibrary.addShader(shader1);
18270
18239
  }
@@ -18276,10 +18245,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18276
18245
  } else {
18277
18246
  shader.glslVersion = GLSLVersion.GLSL1;
18278
18247
  }
18279
- var _shader_marcos;
18280
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, ShaderType.vertex, level);
18281
- var _shader_marcos1;
18282
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, ShaderType.fragment, level);
18248
+ var _shader_macros;
18249
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
18250
+ var _shader_macros1;
18251
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
18283
18252
  shaderLibrary.addShader(shader);
18284
18253
  });
18285
18254
  if (level === 2) {
@@ -19167,7 +19136,7 @@ function compareTracks(a, b) {
19167
19136
  var refId = itemData.content.options.refId;
19168
19137
  var props = this.item.composition.refCompositionProps.get(refId);
19169
19138
  if (!props) {
19170
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19139
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19171
19140
  }
19172
19141
  // endBehaviour 类型需优化
19173
19142
  props.content = itemData.content;
@@ -19320,7 +19289,7 @@ var SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19320
19289
  var _proto = SubCompositionTrack.prototype;
19321
19290
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19322
19291
  if (!_instanceof1(parentBinding, VFXItem)) {
19323
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19292
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19324
19293
  }
19325
19294
  return parentBinding.getComponent(CompositionComponent);
19326
19295
  };
@@ -20375,7 +20344,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20375
20344
  };
20376
20345
  }
20377
20346
  if (duration <= 0) {
20378
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20347
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20379
20348
  }
20380
20349
  for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20381
20350
  var component = _step.value;
@@ -20569,7 +20538,7 @@ var Item;
20569
20538
  pluginName = "tree";
20570
20539
  break;
20571
20540
  default:
20572
- throw new Error("invalid vfx item type");
20541
+ throw new Error("Invalid vfx item type.");
20573
20542
  }
20574
20543
  }
20575
20544
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20613,7 +20582,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20613
20582
  this.plugins = Object.keys(loaders).map(function(name) {
20614
20583
  var CTRL = pluginLoaderMap[name];
20615
20584
  if (!CTRL) {
20616
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20585
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20617
20586
  }
20618
20587
  var loader = new CTRL();
20619
20588
  loader.name = name;
@@ -20641,13 +20610,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20641
20610
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20642
20611
  var CTRL = pluginCtrlMap[name];
20643
20612
  if (!CTRL) {
20644
- throw new Error("plugin " + name + " no registered constructor");
20613
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20645
20614
  }
20646
20615
  var engine = composition.getEngine();
20647
20616
  var item = new CTRL(engine, props, composition);
20648
20617
  item.composition = composition;
20649
20618
  if (!_instanceof1(item, VFXItem)) {
20650
- throw new Error("plugin " + name + " invalid constructor type");
20619
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20651
20620
  }
20652
20621
  return item;
20653
20622
  };
@@ -20957,7 +20926,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20957
20926
  };
20958
20927
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
20959
20928
  if (level > 14) {
20960
- console.error("序列化数据的内嵌对象层数大于上限");
20929
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20961
20930
  return;
20962
20931
  }
20963
20932
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
@@ -20994,7 +20963,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20994
20963
  switch(_state.label){
20995
20964
  case 0:
20996
20965
  if (level > 14) {
20997
- console.error("序列化数据的内嵌对象层数大于上限");
20966
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20998
20967
  return [
20999
20968
  2
21000
20969
  ];
@@ -21078,7 +21047,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21078
21047
  };
21079
21048
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21080
21049
  if (level > 14) {
21081
- console.error("序列化数据的内嵌对象层数大于上限");
21050
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21082
21051
  return;
21083
21052
  }
21084
21053
  if (!serializedData) {
@@ -21110,7 +21079,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21110
21079
  };
21111
21080
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21112
21081
  if (level > 14) {
21113
- console.error("序列化数据的内嵌对象层数大于上限");
21082
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21114
21083
  return;
21115
21084
  }
21116
21085
  if (!serializedData) {
@@ -21157,7 +21126,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21157
21126
  var effectsObject;
21158
21127
  var effectsObjectData = this.findData(guid);
21159
21128
  if (!effectsObjectData) {
21160
- console.error("未找到 uuid: " + guid + "的对象数据");
21129
+ console.error("Object data with uuid: " + guid + " not found.");
21161
21130
  return undefined;
21162
21131
  }
21163
21132
  switch(effectsObjectData.dataType){
@@ -21179,7 +21148,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21179
21148
  }
21180
21149
  }
21181
21150
  if (!effectsObject) {
21182
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21151
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21183
21152
  return undefined;
21184
21153
  }
21185
21154
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21207,7 +21176,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21207
21176
  2
21208
21177
  ];
21209
21178
  if (!_this.engine.database) {
21210
- console.error("未找到 uuid: " + guid + "的对象数据");
21179
+ console.error("Object data with uuid: " + guid + " not found.");
21211
21180
  return [
21212
21181
  2,
21213
21182
  undefined
@@ -21220,7 +21189,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21220
21189
  case 1:
21221
21190
  effectsObject = _state.sent();
21222
21191
  if (!effectsObject) {
21223
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21192
+ console.error("Disk data with uuid: " + guid + " not found.");
21224
21193
  return [
21225
21194
  2,
21226
21195
  undefined
@@ -21251,7 +21220,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21251
21220
  }
21252
21221
  }
21253
21222
  if (!effectsObject) {
21254
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21223
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21255
21224
  return [
21256
21225
  2,
21257
21226
  undefined
@@ -22683,7 +22652,7 @@ var standardVersion = /^(\d+)\.(\d+)$/;
22683
22652
  var reverseParticle = false;
22684
22653
  function getStandardJSON(json) {
22685
22654
  if (!json || typeof json !== "object") {
22686
- throw Error("expect a json object");
22655
+ throw new Error("Invalid input: Expected a JSON object.");
22687
22656
  }
22688
22657
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22689
22658
  version22Migration(json);
@@ -22704,7 +22673,7 @@ function getStandardJSON(json) {
22704
22673
  }
22705
22674
  return json;
22706
22675
  }
22707
- throw Error("invalid json version " + json.version);
22676
+ throw new Error("Invalid JSON version: " + json.version + ".");
22708
22677
  }
22709
22678
  var currentVersion = "1.0";
22710
22679
  function getStandardJSONFromV0(json) {
@@ -22796,7 +22765,7 @@ function getStandardImage(image, index, imageTags) {
22796
22765
  } else if (image && image.sourceType) {
22797
22766
  return image;
22798
22767
  }
22799
- throw Error("invalid image type");
22768
+ throw new Error("Invalid image type.");
22800
22769
  }
22801
22770
  function getStandardComposition(composition, opt) {
22802
22771
  if (opt === void 0) opt = {};
@@ -23080,7 +23049,7 @@ function _combineImageTemplate() {
23080
23049
  _state.label = 3;
23081
23050
  case 3:
23082
23051
  if (!image) {
23083
- throw new Error("image not provided.");
23052
+ throw new Error("Image not provided.");
23084
23053
  }
23085
23054
  if (!template) {
23086
23055
  return [
@@ -23198,7 +23167,7 @@ var seed$1 = 1;
23198
23167
  cancelLoading = true;
23199
23168
  _this.removeTimer(loadTimer);
23200
23169
  var totalTime = performance.now() - startTime;
23201
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23170
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23202
23171
  }, _this.timeout * 1000);
23203
23172
  _this.timers.push(loadTimer);
23204
23173
  });
@@ -23233,7 +23202,7 @@ var seed$1 = 1;
23233
23202
  ];
23234
23203
  case 3:
23235
23204
  e = _state.sent();
23236
- throw new Error("Load error in " + label + ", " + e);
23205
+ throw new Error("Load error in " + label + ", " + e + ".");
23237
23206
  case 4:
23238
23207
  throw new Error("Load canceled.");
23239
23208
  }
@@ -23379,7 +23348,7 @@ var seed$1 = 1;
23379
23348
  _state.label = 12;
23380
23349
  case 12:
23381
23350
  totalTime = performance.now() - startTime;
23382
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23351
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23383
23352
  window.clearTimeout(loadTimer);
23384
23353
  _this.removeTimer(loadTimer);
23385
23354
  scene.totalTime = totalTime;
@@ -23497,7 +23466,7 @@ var seed$1 = 1;
23497
23466
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23498
23467
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23499
23468
  }
23500
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23469
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23501
23470
  });
23502
23471
  return [
23503
23472
  2,
@@ -23528,7 +23497,7 @@ var seed$1 = 1;
23528
23497
  ];
23529
23498
  if (!isValidFontFamily(font.fontFamily)) {
23530
23499
  // 在所有设备上提醒开发者
23531
- console.warn("Risky font family: " + font.fontFamily);
23500
+ console.warn("Risky font family: " + font.fontFamily + ".");
23532
23501
  }
23533
23502
  _state.label = 1;
23534
23503
  case 1:
@@ -23555,7 +23524,7 @@ var seed$1 = 1;
23555
23524
  ];
23556
23525
  case 3:
23557
23526
  _state.sent();
23558
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23527
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23559
23528
  return [
23560
23529
  3,
23561
23530
  4
@@ -23651,7 +23620,7 @@ var seed$1 = 1;
23651
23620
  ];
23652
23621
  case 6:
23653
23622
  e = _state.sent();
23654
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23623
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23655
23624
  case 7:
23656
23625
  return [
23657
23626
  3,
@@ -23750,7 +23719,7 @@ var seed$1 = 1;
23750
23719
  ]);
23751
23720
  return [
23752
23721
  4,
23753
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23722
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23754
23723
  ];
23755
23724
  case 2:
23756
23725
  return [
@@ -23759,7 +23728,7 @@ var seed$1 = 1;
23759
23728
  ];
23760
23729
  case 3:
23761
23730
  e = _state.sent();
23762
- throw new Error("load texture " + idx + " fails, error message: " + e);
23731
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23763
23732
  case 4:
23764
23733
  source = texOpts.source;
23765
23734
  if (!isObject(source)) return [
@@ -23794,7 +23763,7 @@ var seed$1 = 1;
23794
23763
  tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23795
23764
  ];
23796
23765
  }
23797
- throw new Error("Invalid texture source: " + source);
23766
+ throw new Error("Invalid texture source: " + source + ".");
23798
23767
  }
23799
23768
  });
23800
23769
  }));
@@ -23912,7 +23881,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23912
23881
  magFilter: glContext.NEAREST
23913
23882
  };
23914
23883
  }
23915
- throw new Error("Invalid texture options");
23884
+ throw new Error("Invalid texture options.");
23916
23885
  }
23917
23886
 
23918
23887
  var tmpScale = new Vector3(1, 1, 1);
@@ -24204,7 +24173,7 @@ var listOrder = 0;
24204
24173
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24205
24174
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24206
24175
  if (!textureOptions) {
24207
- throw new Error("scene.textures expected");
24176
+ throw new Error("scene.textures expected.");
24208
24177
  }
24209
24178
  var cachedTextures = textureOptions;
24210
24179
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24216,7 +24185,7 @@ var listOrder = 0;
24216
24185
  }
24217
24186
  }
24218
24187
  if (!this.composition) {
24219
- throw new Error("Invalid composition id: " + compositionId);
24188
+ throw new Error("Invalid composition id: " + compositionId + ".");
24220
24189
  }
24221
24190
  this.jsonScene = jsonScene;
24222
24191
  this.renderLevel = renderLevel;
@@ -24278,7 +24247,7 @@ var listOrder = 0;
24278
24247
  if (itemProps.type === ItemType.composition) {
24279
24248
  var refId = sourceItemData.content.options.refId;
24280
24249
  if (!this.refCompositions.get(refId)) {
24281
- throw new Error("Invalid Ref Composition id: " + refId);
24250
+ throw new Error("Invalid ref composition id: " + refId + ".");
24282
24251
  }
24283
24252
  var ref = this.getContent(this.refCompositions.get(refId));
24284
24253
  if (!this.refCompositionProps.has(refId)) {
@@ -24391,11 +24360,11 @@ var listOrder = 0;
24391
24360
  /**
24392
24361
  * 销毁状态位
24393
24362
  */ this.destroyed = false;
24363
+ this.postLoaders = [];
24394
24364
  /**
24395
24365
  * 合成暂停/播放 标识
24396
24366
  */ this.paused = false;
24397
24367
  this.lastVideoUpdateTime = 0;
24398
- this.postLoaders = [];
24399
24368
  var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, onPlayerPause = props.onPlayerPause, onMessageItem = props.onMessageItem, onEnd = props.onEnd, event = props.event, width = props.width, height = props.height;
24400
24369
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24401
24370
  scene.jsonScene.imgUsage = undefined;
@@ -24794,7 +24763,7 @@ var listOrder = 0;
24794
24763
  }
24795
24764
  parent.children.push(item1);
24796
24765
  } else {
24797
- throw Error("元素引用了不存在的元素,请检查数据");
24766
+ throw new Error("The element references a non-existent element, please check the data.");
24798
24767
  }
24799
24768
  }
24800
24769
  }
@@ -25043,7 +25012,7 @@ var listOrder = 0;
25043
25012
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25044
25013
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25045
25014
  if (!this.renderer) {
25046
- console.warn("Can not translate position when container not assigned");
25015
+ console.warn("Renderer not assigned. Operation aborted.");
25047
25016
  return;
25048
25017
  }
25049
25018
  this.rootItem.translateByPixel(x, y);
@@ -25057,7 +25026,7 @@ var listOrder = 0;
25057
25026
  * @param y - y 坐标
25058
25027
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25059
25028
  if (!this.renderer) {
25060
- console.warn("Can not setPosition when container not assigned");
25029
+ console.warn("Renderer not assigned. Operation aborted.");
25061
25030
  return;
25062
25031
  }
25063
25032
  this.rootItem.setPositionByPixel(x, y);
@@ -25412,7 +25381,7 @@ var listOrder = 0;
25412
25381
  info.push("Tex " + this.textures.length);
25413
25382
  }
25414
25383
  if (info.length > 0) {
25415
- logger.warn("Release GPU memory: " + info.join(", "));
25384
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25416
25385
  }
25417
25386
  this.renderPasses.forEach(function(pass) {
25418
25387
  return pass.dispose();
@@ -25548,7 +25517,7 @@ var listOrder = 0;
25548
25517
  * @param ticker - 定时器类
25549
25518
  */ _proto.add = function add(ticker) {
25550
25519
  if (typeof ticker !== "function") {
25551
- throw new Error("Ticker: The tick object must implement the tick method.");
25520
+ throw new Error("The tick object must implement the tick method.");
25552
25521
  }
25553
25522
  this.tickers.push(ticker);
25554
25523
  };
@@ -25724,8 +25693,8 @@ var _obj3;
25724
25693
  1
25725
25694
  ]);
25726
25695
  _this.material = new THREE.RawShaderMaterial({
25727
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25728
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25696
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
25697
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
25729
25698
  alphaToCoverage: false,
25730
25699
  depthFunc: THREE.LessDepth,
25731
25700
  polygonOffsetFactor: THREE.ZeroFactor,
@@ -26713,7 +26682,7 @@ var seed = 1;
26713
26682
  texture.flipY = !!flipY;
26714
26683
  return texture;
26715
26684
  }
26716
- throw new Error("使用未知的数据类型创建纹理");
26685
+ throw new Error("Create a texture using an unknown data type.");
26717
26686
  };
26718
26687
  /**
26719
26688
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -27007,7 +26976,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
27007
26976
  }
27008
26977
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
27009
26978
  composition.statistic.firstFrameTime = firstFrameTime;
27010
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
26979
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
27011
26980
  _this.compositions.push(composition);
27012
26981
  return [
27013
26982
  2,
@@ -27173,8 +27142,8 @@ setMaxSpriteMeshItemCount(8);
27173
27142
  */ Mesh.create = function(engine, props) {
27174
27143
  return new ThreeMesh(engine, props);
27175
27144
  };
27176
- var version = "2.0.0-alpha.17";
27177
- logger.info("THREEJS plugin version: " + version);
27145
+ var version = "2.0.0-alpha.18";
27146
+ logger.info("THREEJS plugin version: " + version + ".");
27178
27147
 
27179
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27148
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createVFXItem, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27180
27149
  //# sourceMappingURL=index.mjs.map