@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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.17
6
+ * Version: v2.0.0-alpha.18
7
7
  */
8
8
 
9
9
  'use strict';
@@ -778,7 +778,7 @@ function isCanvas(canvas) {
778
778
  return min + Math.random() * (max - min);
779
779
  }
780
780
  function throwDestroyedError() {
781
- throw Error("destroyed item cannot be used again");
781
+ throw new Error("Destroyed item cannot be used again.");
782
782
  }
783
783
  function generateGUID() {
784
784
  return v4().replace(/-/g, "");
@@ -4502,7 +4502,7 @@ var effectsClassStore = {};
4502
4502
  function effectsClass(className) {
4503
4503
  return function(target, context) {
4504
4504
  if (effectsClassStore[className]) {
4505
- console.warn("Class " + className + " 重复注册");
4505
+ console.warn("Class " + className + " is already registered.");
4506
4506
  }
4507
4507
  // TODO: three修改json dataType, 这边重复注册直接 return
4508
4508
  effectsClassStore[className] = target;
@@ -7370,8 +7370,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
7370
7370
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
7371
7371
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
7372
7372
  var HELP_LINK = {
7373
- "Filter not imported": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",
7374
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"
7373
+ "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
7374
+ "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
7375
7375
  };
7376
7376
 
7377
7377
  /**
@@ -7556,17 +7556,17 @@ var downgradeKeywords = (_obj$7 = {}, _obj$7[exports.ShaderType.vertex] = {
7556
7556
  }, _obj$7);
7557
7557
  /**
7558
7558
  * 生成 shader,检测到 WebGL1 上下文会降级
7559
- * @param marcos - 宏定义数组
7559
+ * @param macros - 宏定义数组
7560
7560
  * @param shader - 原始 shader 文本
7561
7561
  * @param shaderType - shader 类型
7562
7562
  * @return 去除版本号的 shader 文本
7563
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7563
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7564
7564
  var ret = [];
7565
7565
  var header = "";
7566
7566
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7567
7567
  ret.push("#define GE_RUNTIME");
7568
- if (marcos) {
7569
- marcos.forEach(function(param) {
7568
+ if (macros) {
7569
+ macros.forEach(function(param) {
7570
7570
  var key = param[0], value = param[1];
7571
7571
  if (value === true) {
7572
7572
  ret.push("#define " + key);
@@ -7675,7 +7675,7 @@ function setBlendMode(material, blendMode) {
7675
7675
  ];
7676
7676
  break;
7677
7677
  default:
7678
- console.warn("blendMode " + blendMode + " not in specification, please set blend params separately");
7678
+ console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
7679
7679
  }
7680
7680
  }
7681
7681
  function setSideMode(material, side) {
@@ -7721,7 +7721,7 @@ function setMaskMode(material, maskMode) {
7721
7721
  material.stencilTest = false;
7722
7722
  break;
7723
7723
  default:
7724
- console.warn("maskMode " + maskMode + " not in specification, please set stencil params seperately");
7724
+ console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
7725
7725
  }
7726
7726
  }
7727
7727
 
@@ -7942,7 +7942,7 @@ function _loadImage() {
7942
7942
  }
7943
7943
  // 2. 非法类型
7944
7944
  if (!url) {
7945
- throw new Error("Invalid url type: " + JSON.stringify(source));
7945
+ throw new Error("Invalid url type: " + JSON.stringify(source) + ".");
7946
7946
  }
7947
7947
  return [
7948
7948
  2,
@@ -8110,21 +8110,21 @@ function _loadMedia() {
8110
8110
  return _loadMedia.apply(this, arguments);
8111
8111
  }
8112
8112
 
8113
- function deserializeMipmapTexture(texOpts, bins) {
8113
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
8114
8114
  return _deserializeMipmapTexture.apply(this, arguments);
8115
8115
  }
8116
8116
  function _deserializeMipmapTexture() {
8117
- _deserializeMipmapTexture = _async_to_generator(function(texOpts, bins, files, engine) {
8117
+ _deserializeMipmapTexture = _async_to_generator(function(textureOptions, bins, engine, files) {
8118
8118
  var mipmaps, target, loadedMipmaps, _iterator, _step, level, newLevel, _iterator1, _step1, face, loadedImageAsset, mipmaps1, target1, jobs, loadedMipmaps1, bin;
8119
8119
  return __generator(this, function(_state) {
8120
8120
  switch(_state.label){
8121
8121
  case 0:
8122
8122
  if (files === void 0) files = [];
8123
- if (!(texOpts.target === 34067)) return [
8123
+ if (!(textureOptions.target === 34067)) return [
8124
8124
  3,
8125
8125
  1
8126
8126
  ];
8127
- mipmaps = texOpts.mipmaps, target = texOpts.target;
8127
+ mipmaps = textureOptions.mipmaps, target = textureOptions.target;
8128
8128
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
8129
8129
  loadedMipmaps = [];
8130
8130
  for(_iterator = _create_for_of_iterator_helper_loose(mipmaps); !(_step = _iterator()).done;){
@@ -8144,7 +8144,7 @@ function _deserializeMipmapTexture() {
8144
8144
  2,
8145
8145
  _extends({
8146
8146
  keepImageSource: false
8147
- }, texOpts, {
8147
+ }, textureOptions, {
8148
8148
  mipmaps: loadedMipmaps,
8149
8149
  sourceFrom: {
8150
8150
  target: target,
@@ -8155,7 +8155,7 @@ function _deserializeMipmapTexture() {
8155
8155
  ];
8156
8156
  case 1:
8157
8157
  // TODO: 补充测试用例
8158
- mipmaps1 = texOpts.mipmaps, target1 = texOpts.target;
8158
+ mipmaps1 = textureOptions.mipmaps, target1 = textureOptions.target;
8159
8159
  jobs = mipmaps1.map(function(pointer) {
8160
8160
  return loadMipmapImage(pointer, bins);
8161
8161
  });
@@ -8170,7 +8170,7 @@ function _deserializeMipmapTexture() {
8170
8170
  2,
8171
8171
  _extends({
8172
8172
  keepImageSource: false
8173
- }, texOpts, {
8173
+ }, textureOptions, {
8174
8174
  mipmaps: loadedMipmaps1,
8175
8175
  sourceType: exports.TextureSourceType.mipmaps,
8176
8176
  sourceFrom: {
@@ -8205,7 +8205,7 @@ function _loadMipmapImage() {
8205
8205
  _pointer_ = pointer[1], index = _pointer_[0], start = _pointer_[1], length = _pointer_[2];
8206
8206
  bin = bins[index];
8207
8207
  if (!bin) {
8208
- throw new Error("invalid bin pointer: " + JSON.stringify(pointer));
8208
+ throw new Error("Invalid bin pointer: " + JSON.stringify(pointer) + ".");
8209
8209
  }
8210
8210
  return [
8211
8211
  2,
@@ -8409,7 +8409,7 @@ var KTXTexture = /*#__PURE__*/ function() {
8409
8409
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
8410
8410
  var identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
8411
8411
  if (identifier[0] !== 0xab || identifier[1] !== 0x4b || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 || identifier[6] !== 0x31 || identifier[7] !== 0xbb || identifier[8] !== 0x0d || identifier[9] !== 0x0a || identifier[10] !== 0x1a || identifier[11] !== 0x0a) {
8412
- throw Error("texture missing KTX identifier");
8412
+ throw new Error("Texture missing KTX identifier.");
8413
8413
  }
8414
8414
  // load the reset of the header in native 32 bit uint
8415
8415
  var dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -8431,15 +8431,15 @@ var KTXTexture = /*#__PURE__*/ function() {
8431
8431
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
8432
8432
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
8433
8433
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
8434
- logger.warn("Only 2D textures currently supported");
8434
+ logger.warn("Only 2D textures currently supported.");
8435
8435
  return;
8436
8436
  }
8437
8437
  if (this.numberOfArrayElements !== 0) {
8438
- logger.warn("Texture arrays not currently supported");
8438
+ logger.warn("Texture arrays not currently supported.");
8439
8439
  return;
8440
8440
  }
8441
8441
  if (this.numberOfFaces !== facesExpected) {
8442
- logger.warn("Number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
8442
+ logger.warn("Number of faces expected " + facesExpected + ", but found " + this.numberOfFaces + ".");
8443
8443
  return;
8444
8444
  }
8445
8445
  // we now have a completely validated file, so could use existence of loadType as success
@@ -8527,7 +8527,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8527
8527
  3
8528
8528
  ];
8529
8529
  case 2:
8530
- throw new Error("No source from");
8530
+ throw new Error("No source from.");
8531
8531
  case 3:
8532
8532
  return [
8533
8533
  2
@@ -8771,7 +8771,7 @@ var TextureFactory = /*#__PURE__*/ function() {
8771
8771
  })
8772
8772
  ];
8773
8773
  case 17:
8774
- throw new Error("Invalid resource type: " + type);
8774
+ throw new Error("Invalid resource type: " + type + ".");
8775
8775
  }
8776
8776
  });
8777
8777
  })();
@@ -9702,19 +9702,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
9702
9702
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
9703
9703
  }
9704
9704
  if (x1 < 0) {
9705
- console.error("invalid bezier points, x1 < 0", p0, p1, p2, p3);
9705
+ console.error("Invalid bezier points, x1 < 0", p0, p1, p2, p3);
9706
9706
  x1 = 0;
9707
9707
  }
9708
9708
  if (x2 < 0) {
9709
- console.error("invalid bezier points, x2 < 0", p0, p1, p2, p3);
9709
+ console.error("Invalid bezier points, x2 < 0", p0, p1, p2, p3);
9710
9710
  x2 = 0;
9711
9711
  }
9712
9712
  if (x1 > 1) {
9713
- console.error("invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9713
+ console.error("Invalid bezier points, x1 >= 1", p0, p1, p2, p3);
9714
9714
  x1 = 1;
9715
9715
  }
9716
9716
  if (x2 > 1) {
9717
- console.error("invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9717
+ console.error("Invalid bezier points, x2 >= 1", p0, p1, p2, p3);
9718
9718
  x2 = 1;
9719
9719
  }
9720
9720
  var str = ("bez_" + x1 + "_" + y1 + "_" + x2 + "_" + y2).replace(/\./g, "p");
@@ -9895,31 +9895,31 @@ var ValueGetter = /*#__PURE__*/ function() {
9895
9895
  }
9896
9896
  var _proto = ValueGetter.prototype;
9897
9897
  _proto.onCreate = function onCreate(props) {
9898
- throw Error(NOT_IMPLEMENT);
9898
+ throw new Error(NOT_IMPLEMENT);
9899
9899
  };
9900
9900
  _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
9901
- throw Error(NOT_IMPLEMENT);
9901
+ throw new Error(NOT_IMPLEMENT);
9902
9902
  };
9903
9903
  _proto.getIntegrateByTime = function getIntegrateByTime(t0, time) {
9904
- throw Error(NOT_IMPLEMENT);
9904
+ throw new Error(NOT_IMPLEMENT);
9905
9905
  };
9906
9906
  _proto.getValue = function getValue(time) {
9907
- throw Error(NOT_IMPLEMENT);
9907
+ throw new Error(NOT_IMPLEMENT);
9908
9908
  };
9909
9909
  _proto.getMaxTime = function getMaxTime() {
9910
- throw Error(NOT_IMPLEMENT);
9910
+ throw new Error(NOT_IMPLEMENT);
9911
9911
  };
9912
9912
  _proto.toUniform = function toUniform(meta) {
9913
- throw Error(NOT_IMPLEMENT);
9913
+ throw new Error(NOT_IMPLEMENT);
9914
9914
  };
9915
9915
  _proto.map = function map(func) {
9916
- throw Error(NOT_IMPLEMENT);
9916
+ throw new Error(NOT_IMPLEMENT);
9917
9917
  };
9918
9918
  _proto.scaleXCoord = function scaleXCoord(scale) {
9919
9919
  return this;
9920
9920
  };
9921
9921
  _proto.toData = function toData() {
9922
- throw Error(NOT_IMPLEMENT);
9922
+ throw new Error(NOT_IMPLEMENT);
9923
9923
  };
9924
9924
  ValueGetter.getAllData = function getAllData(meta, halfFloat) {
9925
9925
  var ret = new (halfFloat ? Float16ArrayWrapper : Float32Array)(meta.index * 4);
@@ -10616,7 +10616,7 @@ function createValueGetter(args) {
10616
10616
  if (isFunction(map$1[args[0]])) {
10617
10617
  return map$1[args[0]](args[1]);
10618
10618
  } else {
10619
- throw new Error("ValueType: " + args[0] + " is not support");
10619
+ throw new Error("ValueType: " + args[0] + " is not supported, see " + HELP_LINK["ValueType: 21/22 is not supported"] + ".");
10620
10620
  }
10621
10621
  }
10622
10622
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -10760,7 +10760,7 @@ function createCopyShader(level, writeDepth) {
10760
10760
  vertex: version + "\n" + COPY_VERTEX_SHADER,
10761
10761
  fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10762
10762
  glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
10763
- marcos: [
10763
+ macros: [
10764
10764
  [
10765
10765
  "WEBGL2",
10766
10766
  !!webgl2
@@ -10833,7 +10833,7 @@ var PassTextureCache = /*#__PURE__*/ function() {
10833
10833
  var refCount = this.textureRef[id];
10834
10834
  if (refCount <= 1) {
10835
10835
  if (refCount < 0) {
10836
- console.error("ref count < 0");
10836
+ console.error("Ref count < 0.");
10837
10837
  }
10838
10838
  var tex = this.textureCache[id];
10839
10839
  if (tex) {
@@ -11511,21 +11511,21 @@ var seed$7 = 1;
11511
11511
  return RenderPass;
11512
11512
  }();
11513
11513
 
11514
- var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
11514
+ var blend = "vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}";
11515
11515
 
11516
11516
  var compatible_frag = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n";
11517
11517
 
11518
11518
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11519
11519
 
11520
- var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
11520
+ var itemFrameFrag = "#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}";
11521
11521
 
11522
11522
  var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}";
11523
11523
 
11524
11524
  var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
11525
11525
 
11526
- var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
11526
+ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
11527
11527
 
11528
- var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
11528
+ var particleFrag = "#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n";
11529
11529
 
11530
11530
  var particleVert = "#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}";
11531
11531
 
@@ -12719,20 +12719,20 @@ var GPUCapability = /*#__PURE__*/ function() {
12719
12719
  _proto.framebufferTexture2D = function framebufferTexture2D(gl, target, index, textarget, texture) {
12720
12720
  var ext = this.drawBufferExtension;
12721
12721
  if (this.level === 1 && !ext && index > 0) {
12722
- throw new Error("draw multiple color buffers not available");
12722
+ throw new Error("Draw multiple color buffers not available.");
12723
12723
  }
12724
12724
  var attachment = ext ? ext["COLOR_ATTACHMENT" + index + "_WEBGL"] : gl["COLOR_ATTACHMENT" + index];
12725
12725
  if (attachment) {
12726
12726
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
12727
12727
  } else {
12728
- console.error("invalid color attachment index: " + index);
12728
+ console.error("Invalid color attachment index: " + index + ".");
12729
12729
  }
12730
12730
  };
12731
12731
  _proto.drawBuffers = function drawBuffers(gl, bufferStates) {
12732
12732
  var ext = this.drawBufferExtension;
12733
12733
  if (this.level === 1 && !ext) {
12734
12734
  if (bufferStates.length > 1) {
12735
- throw Error("draw buffers not available");
12735
+ throw new Error("Draw buffers not available.");
12736
12736
  } else {
12737
12737
  return;
12738
12738
  }
@@ -12969,7 +12969,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12969
12969
  };
12970
12970
  _proto.createMaterial = function createMaterial(rendererOptions) {
12971
12971
  var _this_engine_renderer;
12972
- var marcos = [
12972
+ var macros = [
12973
12973
  [
12974
12974
  "ENV_EDITOR",
12975
12975
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12982,7 +12982,7 @@ var InteractMesh = /*#__PURE__*/ function() {
12982
12982
  fragment: fragment,
12983
12983
  glslVersion: exports.GLSLVersion.GLSL1,
12984
12984
  cacheId: "" + rendererOptions.cachePrefix + "_effects_interact",
12985
- marcos: marcos
12985
+ macros: macros
12986
12986
  },
12987
12987
  uniformSemantics: {
12988
12988
  effects_MatrixVP: "VIEWPROJECTION",
@@ -13248,16 +13248,12 @@ function shouldIgnoreBouncing(arg, mul) {
13248
13248
  }
13249
13249
 
13250
13250
  exports.maxSpriteMeshItemCount = 8;
13251
- exports.maxSpriteTextureCount = 8;
13252
13251
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
13253
- // 8 or 16
13254
- exports.maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
13255
13252
  if (gpuCapability.maxVertexUniforms >= 256) {
13256
13253
  return exports.maxSpriteMeshItemCount = 32;
13257
13254
  } else if (gpuCapability.maxVertexUniforms >= 128) {
13258
13255
  return exports.maxSpriteMeshItemCount = 16;
13259
13256
  }
13260
- exports.maxSpriteTextureCount = 8;
13261
13257
  }
13262
13258
  function getImageItemRenderInfo(item) {
13263
13259
  var renderer = item.renderer;
@@ -13275,27 +13271,11 @@ function getImageItemRenderInfo(item) {
13275
13271
  };
13276
13272
  }
13277
13273
  function spriteMeshShaderFromFilter(level, options) {
13278
- var _ref = options != null ? options : {}, _ref_count = _ref.count, count = _ref_count === void 0 ? 2 : _ref_count, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, ignoreBlend = _ref.ignoreBlend, wireframe = _ref.wireframe;
13279
- var marcos = [
13280
- [
13281
- "MAX_ITEM_COUNT",
13282
- count
13283
- ],
13284
- [
13285
- "PRE_MULTIPLY_ALPHA",
13286
- false
13287
- ],
13274
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
13275
+ var macros = [
13288
13276
  [
13289
13277
  "ENV_EDITOR",
13290
13278
  env === PLAYER_OPTIONS_ENV_EDITOR
13291
- ],
13292
- [
13293
- "USE_BLEND",
13294
- !ignoreBlend
13295
- ],
13296
- [
13297
- "MAX_FRAG_TEX",
13298
- exports.maxSpriteTextureCount >= 16 ? 16 : 8
13299
13279
  ]
13300
13280
  ];
13301
13281
  var fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -13304,7 +13284,7 @@ function spriteMeshShaderFromFilter(level, options) {
13304
13284
  fragment: fragment,
13305
13285
  vertex: vertex,
13306
13286
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
13307
- marcos: marcos,
13287
+ macros: macros,
13308
13288
  shared: true
13309
13289
  };
13310
13290
  }
@@ -13314,7 +13294,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
13314
13294
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13315
13295
  var wireframe = renderInfo.wireframe;
13316
13296
  var shader = spriteMeshShaderFromFilter(level, {
13317
- count: count,
13318
13297
  wireframe: wireframe,
13319
13298
  env: env
13320
13299
  });
@@ -13328,9 +13307,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
13328
13307
  function setMaxSpriteMeshItemCount(count) {
13329
13308
  exports.maxSpriteMeshItemCount = count;
13330
13309
  }
13331
- function setSpriteMeshMaxFragmentTextures(count) {
13332
- exports.maxSpriteTextureCount = count;
13333
- }
13334
13310
 
13335
13311
  var defRenderInfo = {
13336
13312
  blending: 0,
@@ -14963,7 +14939,7 @@ function createShape(shapeOptions) {
14963
14939
  var type = shapeOptions.type;
14964
14940
  var Ctrl = map[type];
14965
14941
  if (!Ctrl) {
14966
- throw Error("invalid shape:" + type);
14942
+ throw new Error("Invalid shape: " + type + ".");
14967
14943
  }
14968
14944
  var ctrl = new Ctrl(options);
14969
14945
  if (type !== ShapeType.NONE) {
@@ -15793,7 +15769,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15793
15769
  var uniformValues = {};
15794
15770
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15795
15771
  var lookUpTexture = 0;
15796
- var marcos = [
15772
+ var macros = [
15797
15773
  [
15798
15774
  "ENABLE_VERTEX_TEXTURE",
15799
15775
  enableVertexTexture
@@ -15810,7 +15786,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15810
15786
  var useAttributeTrailStart = maxTrailCount > 64;
15811
15787
  var shaderCacheId = 0;
15812
15788
  if (colorOverLifetime) {
15813
- marcos.push([
15789
+ macros.push([
15814
15790
  "COLOR_OVER_LIFETIME",
15815
15791
  true
15816
15792
  ]);
@@ -15818,7 +15794,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15818
15794
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
15819
15795
  }
15820
15796
  if (colorOverTrail) {
15821
- marcos.push([
15797
+ macros.push([
15822
15798
  "COLOR_OVER_TRAIL",
15823
15799
  true
15824
15800
  ]);
@@ -15826,7 +15802,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15826
15802
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
15827
15803
  }
15828
15804
  if (useAttributeTrailStart) {
15829
- marcos.push([
15805
+ macros.push([
15830
15806
  "ATTR_TRAIL_START",
15831
15807
  1
15832
15808
  ]);
@@ -15836,7 +15812,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15836
15812
  }
15837
15813
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15838
15814
  var uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15839
- marcos.push([
15815
+ macros.push([
15840
15816
  "VERT_CURVE_VALUE_COUNT",
15841
15817
  keyFrameMeta.index
15842
15818
  ], [
@@ -15855,7 +15831,7 @@ var TrailMesh = /*#__PURE__*/ function() {
15855
15831
  shader: {
15856
15832
  vertex: vertex,
15857
15833
  fragment: fragment,
15858
- marcos: marcos,
15834
+ macros: macros,
15859
15835
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
15860
15836
  shared: true,
15861
15837
  name: "trail#" + name,
@@ -16158,12 +16134,12 @@ function calculateDirection(prePoint, point, nextPoint) {
16158
16134
  }
16159
16135
  return dir.normalize().toArray();
16160
16136
  }
16161
- function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability) {
16137
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
16162
16138
  if (env === void 0) env = "";
16163
16139
  var shaderCacheId = 0;
16164
16140
  var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
16165
16141
  var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
16166
- var marcos = [
16142
+ var macros = [
16167
16143
  [
16168
16144
  "ENABLE_VERTEX_TEXTURE",
16169
16145
  enableVertexTexture
@@ -16179,14 +16155,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16179
16155
  ];
16180
16156
  var keyFrameMeta = createKeyFrameMeta();
16181
16157
  if (trails.colorOverLifetime) {
16182
- marcos.push([
16158
+ macros.push([
16183
16159
  "COLOR_OVER_LIFETIME",
16184
16160
  true
16185
16161
  ]);
16186
16162
  shaderCacheId |= 1;
16187
16163
  }
16188
16164
  if (trails.colorOverTrail) {
16189
- marcos.push([
16165
+ macros.push([
16190
16166
  "COLOR_OVER_TRAIL",
16191
16167
  true
16192
16168
  ]);
@@ -16194,7 +16170,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16194
16170
  }
16195
16171
  var useAttributeTrailStart = particleMaxCount > 64;
16196
16172
  if (useAttributeTrailStart) {
16197
- marcos.push([
16173
+ macros.push([
16198
16174
  "ATTR_TRAIL_START",
16199
16175
  1
16200
16176
  ]);
@@ -16202,7 +16178,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16202
16178
  }
16203
16179
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
16204
16180
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
16205
- marcos.push([
16181
+ macros.push([
16206
16182
  "VERT_CURVE_VALUE_COUNT",
16207
16183
  keyFrameMeta.index
16208
16184
  ], [
@@ -16212,7 +16188,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
16212
16188
  return {
16213
16189
  vertex: trailVert,
16214
16190
  fragment: particleFrag,
16215
- marcos: marcos,
16191
+ macros: macros,
16216
16192
  shared: true,
16217
16193
  name: "trail#" + name,
16218
16194
  cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
@@ -17372,15 +17348,12 @@ var ParticleMesh = /*#__PURE__*/ function() {
17372
17348
  var speedOverLifetime = props.speedOverLifetime, colorOverLifetime = props.colorOverLifetime, linearVelOverLifetime = props.linearVelOverLifetime, orbitalVelOverLifetime = props.orbitalVelOverLifetime, sizeOverLifetime = props.sizeOverLifetime, rotationOverLifetime = props.rotationOverLifetime, sprite = props.sprite, gravityModifier = props.gravityModifier, maxCount = props.maxCount, textureFlip = props.textureFlip, useSprite = props.useSprite, name = props.name, gravity = props.gravity, forceTarget = props.forceTarget, side = props.side, occlusion = props.occlusion, anchor = props.anchor, blending = props.blending, maskMode = props.maskMode, mask = props.mask, transparentOcclusion = props.transparentOcclusion, meshSlots = props.meshSlots, _props_renderMode = props.renderMode, renderMode = _props_renderMode === void 0 ? 0 : _props_renderMode, _props_diffuse = props.diffuse, diffuse = _props_diffuse === void 0 ? Texture.createWithData(engine) : _props_diffuse;
17373
17349
  var detail = engine.gpuCapability.detail;
17374
17350
  var halfFloatTexture = detail.halfFloatTexture, maxVertexUniforms = detail.maxVertexUniforms;
17375
- var marcos = [
17351
+ var macros = [
17352
+ // spec.RenderMode
17376
17353
  [
17377
17354
  "RENDER_MODE",
17378
17355
  +renderMode
17379
17356
  ],
17380
- [
17381
- "PRE_MULTIPLY_ALPHA",
17382
- false
17383
- ],
17384
17357
  [
17385
17358
  "ENV_EDITOR",
17386
17359
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17396,13 +17369,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17396
17369
  var useOrbitalVel;
17397
17370
  this.useSprite = useSprite;
17398
17371
  if (enableVertexTexture) {
17399
- marcos.push([
17372
+ macros.push([
17400
17373
  "ENABLE_VERTEX_TEXTURE",
17401
17374
  true
17402
17375
  ]);
17403
17376
  }
17404
17377
  if (speedOverLifetime) {
17405
- marcos.push([
17378
+ macros.push([
17406
17379
  "SPEED_OVER_LIFETIME",
17407
17380
  true
17408
17381
  ]);
@@ -17410,7 +17383,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17410
17383
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
17411
17384
  }
17412
17385
  if (sprite == null ? void 0 : sprite.animate) {
17413
- marcos.push([
17386
+ macros.push([
17414
17387
  "USE_SPRITE",
17415
17388
  true
17416
17389
  ]);
@@ -17424,7 +17397,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17424
17397
  this.useSprite = true;
17425
17398
  }
17426
17399
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
17427
- marcos.push([
17400
+ macros.push([
17428
17401
  "COLOR_OVER_LIFETIME",
17429
17402
  true
17430
17403
  ]);
@@ -17449,7 +17422,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17449
17422
  shaderCacheId |= 1 << 7 + i;
17450
17423
  linearVelOverLifetime.enabled = true;
17451
17424
  }
17452
- marcos.push([
17425
+ macros.push([
17453
17426
  "LINEAR_VEL_" + pro.toUpperCase(),
17454
17427
  defL
17455
17428
  ]);
@@ -17460,13 +17433,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17460
17433
  useOrbitalVel = true;
17461
17434
  orbitalVelOverLifetime.enabled = true;
17462
17435
  }
17463
- marcos.push([
17436
+ macros.push([
17464
17437
  "ORB_VEL_" + pro.toUpperCase(),
17465
17438
  defO
17466
17439
  ]);
17467
17440
  });
17468
17441
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
17469
- marcos.push([
17442
+ macros.push([
17470
17443
  "AS_LINEAR_MOVEMENT",
17471
17444
  true
17472
17445
  ]);
@@ -17474,7 +17447,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17474
17447
  }
17475
17448
  if (useOrbitalVel) {
17476
17449
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
17477
- marcos.push([
17450
+ macros.push([
17478
17451
  "AS_ORBITAL_MOVEMENT",
17479
17452
  true
17480
17453
  ]);
@@ -17489,7 +17462,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17489
17462
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
17490
17463
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
17491
17464
  var _sizeOverLifetime_y;
17492
- marcos.push([
17465
+ macros.push([
17493
17466
  "SIZE_Y_BY_LIFE",
17494
17467
  1
17495
17468
  ]);
@@ -17499,7 +17472,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17499
17472
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
17500
17473
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
17501
17474
  shaderCacheId |= 1 << 15;
17502
- marcos.push([
17475
+ macros.push([
17503
17476
  "ROT_Z_LIFETIME",
17504
17477
  1
17505
17478
  ]);
@@ -17507,7 +17480,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17507
17480
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
17508
17481
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
17509
17482
  shaderCacheId |= 1 << 16;
17510
- marcos.push([
17483
+ macros.push([
17511
17484
  "ROT_X_LIFETIME",
17512
17485
  1
17513
17486
  ]);
@@ -17515,13 +17488,13 @@ var ParticleMesh = /*#__PURE__*/ function() {
17515
17488
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
17516
17489
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
17517
17490
  shaderCacheId |= 1 << 17;
17518
- marcos.push([
17491
+ macros.push([
17519
17492
  "ROT_Y_LIFETIME",
17520
17493
  1
17521
17494
  ]);
17522
17495
  }
17523
17496
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
17524
- marcos.push([
17497
+ macros.push([
17525
17498
  "ROT_LIFETIME_AS_MOVEMENT",
17526
17499
  1
17527
17500
  ]);
@@ -17529,7 +17502,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17529
17502
  }
17530
17503
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
17531
17504
  if (forceTarget) {
17532
- marcos.push([
17505
+ macros.push([
17533
17506
  "FINAL_TARGET",
17534
17507
  true
17535
17508
  ]);
@@ -17575,7 +17548,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17575
17548
  fragmentKeyFrameMeta.index,
17576
17549
  fragmentKeyFrameMeta.max
17577
17550
  ].join("+");
17578
- marcos.push([
17551
+ macros.push([
17579
17552
  "VERT_CURVE_VALUE_COUNT",
17580
17553
  vertexKeyFrameMeta.index
17581
17554
  ], [
@@ -17597,7 +17570,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17597
17570
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
17598
17571
  shared: true,
17599
17572
  cacheId: shaderCache,
17600
- marcos: marcos,
17573
+ macros: macros,
17601
17574
  name: "particle#" + name
17602
17575
  };
17603
17576
  var mtlOptions = {
@@ -17674,7 +17647,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17674
17647
  res.length = 0;
17675
17648
  break;
17676
17649
  default:
17677
- console.warn("uniform " + name + "'s type not in typeMap");
17650
+ console.warn("Uniform " + name + "'s type not in typeMap.");
17678
17651
  }
17679
17652
  });
17680
17653
  material.setVector3("emissionColor", new Vector3(0, 0, 0));
@@ -18010,20 +17983,16 @@ function generateGeometryProps(maxVertex, useSprite, name) {
18010
17983
  maxVertex: maxVertex
18011
17984
  };
18012
17985
  }
18013
- function getParticleMeshShader(item, env, gpuCapability) {
17986
+ function getParticleMeshShader(item, gpuCapability, env) {
18014
17987
  if (env === void 0) env = "";
18015
17988
  var _props_renderer;
18016
17989
  var props = item.content;
18017
17990
  var renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
18018
- var marcos = [
17991
+ var macros = [
18019
17992
  [
18020
17993
  "RENDER_MODE",
18021
17994
  renderMode
18022
17995
  ],
18023
- [
18024
- "PRE_MULTIPLY_ALPHA",
18025
- false
18026
- ],
18027
17996
  [
18028
17997
  "ENV_EDITOR",
18029
17998
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -18038,13 +18007,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18038
18007
  var vertex_lookup_texture = 0;
18039
18008
  var shaderCacheId = 0;
18040
18009
  if (enableVertexTexture) {
18041
- marcos.push([
18010
+ macros.push([
18042
18011
  "ENABLE_VERTEX_TEXTURE",
18043
18012
  true
18044
18013
  ]);
18045
18014
  }
18046
18015
  if (speedOverLifetime) {
18047
- marcos.push([
18016
+ macros.push([
18048
18017
  "SPEED_OVER_LIFETIME",
18049
18018
  true
18050
18019
  ]);
@@ -18053,7 +18022,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18053
18022
  }
18054
18023
  var sprite = props.textureSheetAnimation;
18055
18024
  if (sprite && sprite.animate) {
18056
- marcos.push([
18025
+ macros.push([
18057
18026
  "USE_SPRITE",
18058
18027
  true
18059
18028
  ]);
@@ -18061,7 +18030,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18061
18030
  }
18062
18031
  var colorOverLifetime = props.colorOverLifetime;
18063
18032
  if (colorOverLifetime && colorOverLifetime.color) {
18064
- marcos.push([
18033
+ macros.push([
18065
18034
  "COLOR_OVER_LIFETIME",
18066
18035
  true
18067
18036
  ]);
@@ -18086,7 +18055,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18086
18055
  defL = 1;
18087
18056
  shaderCacheId |= 1 << 7 + i;
18088
18057
  }
18089
- marcos.push([
18058
+ macros.push([
18090
18059
  "LINEAR_VEL_" + pro.toUpperCase(),
18091
18060
  defL
18092
18061
  ]);
@@ -18097,13 +18066,13 @@ function getParticleMeshShader(item, env, gpuCapability) {
18097
18066
  shaderCacheId |= 1 << 10 + i;
18098
18067
  useOrbitalVel = true;
18099
18068
  }
18100
- marcos.push([
18069
+ macros.push([
18101
18070
  "ORB_VEL_" + pro.toUpperCase(),
18102
18071
  defO
18103
18072
  ]);
18104
18073
  });
18105
18074
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
18106
- marcos.push([
18075
+ macros.push([
18107
18076
  "AS_LINEAR_MOVEMENT",
18108
18077
  true
18109
18078
  ]);
@@ -18111,7 +18080,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18111
18080
  }
18112
18081
  if (useOrbitalVel) {
18113
18082
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
18114
- marcos.push([
18083
+ macros.push([
18115
18084
  "AS_ORBITAL_MOVEMENT",
18116
18085
  true
18117
18086
  ]);
@@ -18123,7 +18092,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18123
18092
  var separateAxes = sizeOverLifetime.separateAxes;
18124
18093
  if (separateAxes) {
18125
18094
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
18126
- marcos.push([
18095
+ macros.push([
18127
18096
  "SIZE_Y_BY_LIFE",
18128
18097
  1
18129
18098
  ]);
@@ -18138,7 +18107,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18138
18107
  if (rot.z) {
18139
18108
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
18140
18109
  shaderCacheId |= 1 << 15;
18141
- marcos.push([
18110
+ macros.push([
18142
18111
  "ROT_Z_LIFETIME",
18143
18112
  1
18144
18113
  ]);
@@ -18147,7 +18116,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18147
18116
  if (rot.x) {
18148
18117
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
18149
18118
  shaderCacheId |= 1 << 16;
18150
- marcos.push([
18119
+ macros.push([
18151
18120
  "ROT_X_LIFETIME",
18152
18121
  1
18153
18122
  ]);
@@ -18155,14 +18124,14 @@ function getParticleMeshShader(item, env, gpuCapability) {
18155
18124
  if (rot.y) {
18156
18125
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
18157
18126
  shaderCacheId |= 1 << 17;
18158
- marcos.push([
18127
+ macros.push([
18159
18128
  "ROT_Y_LIFETIME",
18160
18129
  1
18161
18130
  ]);
18162
18131
  }
18163
18132
  }
18164
18133
  if (rot == null ? void 0 : rot.asRotation) {
18165
- marcos.push([
18134
+ macros.push([
18166
18135
  "ROT_LIFETIME_AS_MOVEMENT",
18167
18136
  1
18168
18137
  ]);
@@ -18172,7 +18141,7 @@ function getParticleMeshShader(item, env, gpuCapability) {
18172
18141
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
18173
18142
  var forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
18174
18143
  if (forceOpt) {
18175
- marcos.push([
18144
+ macros.push([
18176
18145
  "FINAL_TARGET",
18177
18146
  true
18178
18147
  ]);
@@ -18213,10 +18182,10 @@ function getParticleMeshShader(item, env, gpuCapability) {
18213
18182
  vertex: "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert,
18214
18183
  shared: true,
18215
18184
  cacheId: shaderCache,
18216
- marcos: marcos,
18185
+ macros: macros,
18217
18186
  name: "particle#" + item.name
18218
18187
  };
18219
- marcos.push([
18188
+ macros.push([
18220
18189
  "VERT_CURVE_VALUE_COUNT",
18221
18190
  vertexKeyFrameMeta.index
18222
18191
  ], [
@@ -18241,11 +18210,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18241
18210
  shaderIds[3] = maxVertex;
18242
18211
  shaderIds[5] = maxFrag;
18243
18212
  shader.cacheId = shaderIds.join("+");
18244
- if (!shader.marcos) {
18213
+ if (!shader.macros) {
18245
18214
  return;
18246
18215
  }
18247
- for(var i = 0; i < shader.marcos.length; i++){
18248
- var marco = shader.marcos[i];
18216
+ for(var i = 0; i < shader.macros.length; i++){
18217
+ var marco = shader.macros[i];
18249
18218
  if (marco[0] === "VERT_CURVE_VALUE_COUNT") {
18250
18219
  marco[1] = maxVertex;
18251
18220
  } else if (marco[0] === "FRAG_CURVE_VALUE_COUNT") {
@@ -18278,17 +18247,17 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18278
18247
  });
18279
18248
  });
18280
18249
  items.forEach(function(item) {
18281
- var _getParticleMeshShader = getParticleMeshShader(item, env, gpuCapability), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18250
+ var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
18282
18251
  shaders.push(shader);
18283
18252
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
18284
18253
  maxVertexCount = Math.max(maxVertexCount, vertex);
18285
18254
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18286
18255
  if (item.content.trails) {
18287
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
18288
- var _shader_marcos;
18289
- shader1.vertex = createShaderWithMarcos((_shader_marcos = shader1.marcos) != null ? _shader_marcos : [], shader1.vertex, exports.ShaderType.vertex, level);
18290
- var _shader_marcos1;
18291
- shader1.fragment = createShaderWithMarcos((_shader_marcos1 = shader1.marcos) != null ? _shader_marcos1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18256
+ var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18257
+ var _shader_macros;
18258
+ shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, exports.ShaderType.vertex, level);
18259
+ var _shader_macros1;
18260
+ shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18292
18261
  shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
18293
18262
  shaderLibrary.addShader(shader1);
18294
18263
  }
@@ -18300,10 +18269,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18300
18269
  } else {
18301
18270
  shader.glslVersion = exports.GLSLVersion.GLSL1;
18302
18271
  }
18303
- var _shader_marcos;
18304
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, exports.ShaderType.vertex, level);
18305
- var _shader_marcos1;
18306
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, exports.ShaderType.fragment, level);
18272
+ var _shader_macros;
18273
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
18274
+ var _shader_macros1;
18275
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
18307
18276
  shaderLibrary.addShader(shader);
18308
18277
  });
18309
18278
  if (level === 2) {
@@ -19191,7 +19160,7 @@ function compareTracks(a, b) {
19191
19160
  var refId = itemData.content.options.refId;
19192
19161
  var props = this.item.composition.refCompositionProps.get(refId);
19193
19162
  if (!props) {
19194
- throw new Error("引用的Id: " + refId + " 的预合成不存在");
19163
+ throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
19195
19164
  }
19196
19165
  // endBehaviour 类型需优化
19197
19166
  props.content = itemData.content;
@@ -19344,7 +19313,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19344
19313
  var _proto = SubCompositionTrack.prototype;
19345
19314
  _proto.resolveBinding = function resolveBinding(parentBinding) {
19346
19315
  if (!_instanceof1(parentBinding, exports.VFXItem)) {
19347
- throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
19316
+ throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
19348
19317
  }
19349
19318
  return parentBinding.getComponent(CompositionComponent);
19350
19319
  };
@@ -20399,7 +20368,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
20399
20368
  };
20400
20369
  }
20401
20370
  if (duration <= 0) {
20402
- throw Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"]);
20371
+ throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20403
20372
  }
20404
20373
  for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20405
20374
  var component = _step.value;
@@ -20593,7 +20562,7 @@ exports.Item = void 0;
20593
20562
  pluginName = "tree";
20594
20563
  break;
20595
20564
  default:
20596
- throw new Error("invalid vfx item type");
20565
+ throw new Error("Invalid vfx item type.");
20597
20566
  }
20598
20567
  }
20599
20568
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -20637,7 +20606,7 @@ var PluginSystem = /*#__PURE__*/ function() {
20637
20606
  this.plugins = Object.keys(loaders).map(function(name) {
20638
20607
  var CTRL = pluginLoaderMap[name];
20639
20608
  if (!CTRL) {
20640
- throw new Error("plugin '" + name + "' not found." + getPluginUsageInfo(name));
20609
+ throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
20641
20610
  }
20642
20611
  var loader = new CTRL();
20643
20612
  loader.name = name;
@@ -20665,13 +20634,13 @@ var PluginSystem = /*#__PURE__*/ function() {
20665
20634
  _proto.createPluginItem = function createPluginItem(name, props, composition) {
20666
20635
  var CTRL = pluginCtrlMap[name];
20667
20636
  if (!CTRL) {
20668
- throw new Error("plugin " + name + " no registered constructor");
20637
+ throw new Error("The plugin '" + name + "' does not have a registered constructor.");
20669
20638
  }
20670
20639
  var engine = composition.getEngine();
20671
20640
  var item = new CTRL(engine, props, composition);
20672
20641
  item.composition = composition;
20673
20642
  if (!_instanceof1(item, exports.VFXItem)) {
20674
- throw new Error("plugin " + name + " invalid constructor type");
20643
+ throw new Error("The plugin '" + name + "' invalid constructor type.");
20675
20644
  }
20676
20645
  return item;
20677
20646
  };
@@ -20981,7 +20950,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
20981
20950
  };
20982
20951
  SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
20983
20952
  if (level > 14) {
20984
- console.error("序列化数据的内嵌对象层数大于上限");
20953
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
20985
20954
  return;
20986
20955
  }
20987
20956
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
@@ -21018,7 +20987,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21018
20987
  switch(_state.label){
21019
20988
  case 0:
21020
20989
  if (level > 14) {
21021
- console.error("序列化数据的内嵌对象层数大于上限");
20990
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21022
20991
  return [
21023
20992
  2
21024
20993
  ];
@@ -21102,7 +21071,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21102
21071
  };
21103
21072
  SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
21104
21073
  if (level > 14) {
21105
- console.error("序列化数据的内嵌对象层数大于上限");
21074
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21106
21075
  return;
21107
21076
  }
21108
21077
  if (!serializedData) {
@@ -21134,7 +21103,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21134
21103
  };
21135
21104
  SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
21136
21105
  if (level > 14) {
21137
- console.error("序列化数据的内嵌对象层数大于上限");
21106
+ console.error("The nested object layers of the serialized data exceed the maximum limit.");
21138
21107
  return;
21139
21108
  }
21140
21109
  if (!serializedData) {
@@ -21181,7 +21150,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21181
21150
  var effectsObject;
21182
21151
  var effectsObjectData = this.findData(guid);
21183
21152
  if (!effectsObjectData) {
21184
- console.error("未找到 uuid: " + guid + "的对象数据");
21153
+ console.error("Object data with uuid: " + guid + " not found.");
21185
21154
  return undefined;
21186
21155
  }
21187
21156
  switch(effectsObjectData.dataType){
@@ -21203,7 +21172,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21203
21172
  }
21204
21173
  }
21205
21174
  if (!effectsObject) {
21206
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21175
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21207
21176
  return undefined;
21208
21177
  }
21209
21178
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21231,7 +21200,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21231
21200
  2
21232
21201
  ];
21233
21202
  if (!_this.engine.database) {
21234
- console.error("未找到 uuid: " + guid + "的对象数据");
21203
+ console.error("Object data with uuid: " + guid + " not found.");
21235
21204
  return [
21236
21205
  2,
21237
21206
  undefined
@@ -21244,7 +21213,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21244
21213
  case 1:
21245
21214
  effectsObject = _state.sent();
21246
21215
  if (!effectsObject) {
21247
- console.error("未找到 uuid: " + guid + "的磁盘数据");
21216
+ console.error("Disk data with uuid: " + guid + " not found.");
21248
21217
  return [
21249
21218
  2,
21250
21219
  undefined
@@ -21275,7 +21244,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
21275
21244
  }
21276
21245
  }
21277
21246
  if (!effectsObject) {
21278
- console.error("未找到 DataType: " + effectsObjectData.dataType + "的构造函数");
21247
+ console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
21279
21248
  return [
21280
21249
  2,
21281
21250
  undefined
@@ -22707,7 +22676,7 @@ var standardVersion = /^(\d+)\.(\d+)$/;
22707
22676
  var reverseParticle = false;
22708
22677
  function getStandardJSON(json) {
22709
22678
  if (!json || typeof json !== "object") {
22710
- throw Error("expect a json object");
22679
+ throw new Error("Invalid input: Expected a JSON object.");
22711
22680
  }
22712
22681
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
22713
22682
  version22Migration(json);
@@ -22728,7 +22697,7 @@ function getStandardJSON(json) {
22728
22697
  }
22729
22698
  return json;
22730
22699
  }
22731
- throw Error("invalid json version " + json.version);
22700
+ throw new Error("Invalid JSON version: " + json.version + ".");
22732
22701
  }
22733
22702
  var currentVersion = "1.0";
22734
22703
  function getStandardJSONFromV0(json) {
@@ -22820,7 +22789,7 @@ function getStandardImage(image, index, imageTags) {
22820
22789
  } else if (image && image.sourceType) {
22821
22790
  return image;
22822
22791
  }
22823
- throw Error("invalid image type");
22792
+ throw new Error("Invalid image type.");
22824
22793
  }
22825
22794
  function getStandardComposition(composition, opt) {
22826
22795
  if (opt === void 0) opt = {};
@@ -23104,7 +23073,7 @@ function _combineImageTemplate() {
23104
23073
  _state.label = 3;
23105
23074
  case 3:
23106
23075
  if (!image) {
23107
- throw new Error("image not provided.");
23076
+ throw new Error("Image not provided.");
23108
23077
  }
23109
23078
  if (!template) {
23110
23079
  return [
@@ -23222,7 +23191,7 @@ var seed$1 = 1;
23222
23191
  cancelLoading = true;
23223
23192
  _this.removeTimer(loadTimer);
23224
23193
  var totalTime = performance.now() - startTime;
23225
- reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl));
23194
+ reject(new Error("Load time out: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + "."));
23226
23195
  }, _this.timeout * 1000);
23227
23196
  _this.timers.push(loadTimer);
23228
23197
  });
@@ -23257,7 +23226,7 @@ var seed$1 = 1;
23257
23226
  ];
23258
23227
  case 3:
23259
23228
  e = _state.sent();
23260
- throw new Error("Load error in " + label + ", " + e);
23229
+ throw new Error("Load error in " + label + ", " + e + ".");
23261
23230
  case 4:
23262
23231
  throw new Error("Load canceled.");
23263
23232
  }
@@ -23403,7 +23372,7 @@ var seed$1 = 1;
23403
23372
  _state.label = 12;
23404
23373
  case 12:
23405
23374
  totalTime = performance.now() - startTime;
23406
- logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl);
23375
+ logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfos.join(" ") + ", url: " + assetUrl + ".");
23407
23376
  window.clearTimeout(loadTimer);
23408
23377
  _this.removeTimer(loadTimer);
23409
23378
  scene.totalTime = totalTime;
@@ -23521,7 +23490,7 @@ var seed$1 = 1;
23521
23490
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
23522
23491
  return _this.loadBins(new URL(bin.url, baseUrl).href);
23523
23492
  }
23524
- throw new Error("Invalid bins source: " + JSON.stringify(bins));
23493
+ throw new Error("Invalid bins source: " + JSON.stringify(bins) + ".");
23525
23494
  });
23526
23495
  return [
23527
23496
  2,
@@ -23552,7 +23521,7 @@ var seed$1 = 1;
23552
23521
  ];
23553
23522
  if (!isValidFontFamily(font.fontFamily)) {
23554
23523
  // 在所有设备上提醒开发者
23555
- console.warn("Risky font family: " + font.fontFamily);
23524
+ console.warn("Risky font family: " + font.fontFamily + ".");
23556
23525
  }
23557
23526
  _state.label = 1;
23558
23527
  case 1:
@@ -23579,7 +23548,7 @@ var seed$1 = 1;
23579
23548
  ];
23580
23549
  case 3:
23581
23550
  _state.sent();
23582
- logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL));
23551
+ logger.warn("Invalid font family or font source: " + JSON.stringify(font.fontURL) + ".");
23583
23552
  return [
23584
23553
  3,
23585
23554
  4
@@ -23675,7 +23644,7 @@ var seed$1 = 1;
23675
23644
  ];
23676
23645
  case 6:
23677
23646
  e = _state.sent();
23678
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message);
23647
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
23679
23648
  case 7:
23680
23649
  return [
23681
23650
  3,
@@ -23774,7 +23743,7 @@ var seed$1 = 1;
23774
23743
  ]);
23775
23744
  return [
23776
23745
  4,
23777
- deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine)
23746
+ deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
23778
23747
  ];
23779
23748
  case 2:
23780
23749
  return [
@@ -23783,7 +23752,7 @@ var seed$1 = 1;
23783
23752
  ];
23784
23753
  case 3:
23785
23754
  e = _state.sent();
23786
- throw new Error("load texture " + idx + " fails, error message: " + e);
23755
+ throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
23787
23756
  case 4:
23788
23757
  source = texOpts.source;
23789
23758
  if (!isObject(source)) return [
@@ -23818,7 +23787,7 @@ var seed$1 = 1;
23818
23787
  tex.sourceType === exports.TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
23819
23788
  ];
23820
23789
  }
23821
- throw new Error("Invalid texture source: " + source);
23790
+ throw new Error("Invalid texture source: " + source + ".");
23822
23791
  }
23823
23792
  });
23824
23793
  }));
@@ -23936,7 +23905,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
23936
23905
  magFilter: glContext.NEAREST
23937
23906
  };
23938
23907
  }
23939
- throw new Error("Invalid texture options");
23908
+ throw new Error("Invalid texture options.");
23940
23909
  }
23941
23910
 
23942
23911
  var tmpScale = new Vector3(1, 1, 1);
@@ -24228,7 +24197,7 @@ var listOrder = 0;
24228
24197
  var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
24229
24198
  var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
24230
24199
  if (!textureOptions) {
24231
- throw new Error("scene.textures expected");
24200
+ throw new Error("scene.textures expected.");
24232
24201
  }
24233
24202
  var cachedTextures = textureOptions;
24234
24203
  for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
@@ -24240,7 +24209,7 @@ var listOrder = 0;
24240
24209
  }
24241
24210
  }
24242
24211
  if (!this.composition) {
24243
- throw new Error("Invalid composition id: " + compositionId);
24212
+ throw new Error("Invalid composition id: " + compositionId + ".");
24244
24213
  }
24245
24214
  this.jsonScene = jsonScene;
24246
24215
  this.renderLevel = renderLevel;
@@ -24302,7 +24271,7 @@ var listOrder = 0;
24302
24271
  if (itemProps.type === ItemType.composition) {
24303
24272
  var refId = sourceItemData.content.options.refId;
24304
24273
  if (!this.refCompositions.get(refId)) {
24305
- throw new Error("Invalid Ref Composition id: " + refId);
24274
+ throw new Error("Invalid ref composition id: " + refId + ".");
24306
24275
  }
24307
24276
  var ref = this.getContent(this.refCompositions.get(refId));
24308
24277
  if (!this.refCompositionProps.has(refId)) {
@@ -24415,11 +24384,11 @@ var listOrder = 0;
24415
24384
  /**
24416
24385
  * 销毁状态位
24417
24386
  */ this.destroyed = false;
24387
+ this.postLoaders = [];
24418
24388
  /**
24419
24389
  * 合成暂停/播放 标识
24420
24390
  */ this.paused = false;
24421
24391
  this.lastVideoUpdateTime = 0;
24422
- this.postLoaders = [];
24423
24392
  var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, onPlayerPause = props.onPlayerPause, onMessageItem = props.onMessageItem, onEnd = props.onEnd, event = props.event, width = props.width, height = props.height;
24424
24393
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
24425
24394
  scene.jsonScene.imgUsage = undefined;
@@ -24818,7 +24787,7 @@ var listOrder = 0;
24818
24787
  }
24819
24788
  parent.children.push(item1);
24820
24789
  } else {
24821
- throw Error("元素引用了不存在的元素,请检查数据");
24790
+ throw new Error("The element references a non-existent element, please check the data.");
24822
24791
  }
24823
24792
  }
24824
24793
  }
@@ -25067,7 +25036,7 @@ var listOrder = 0;
25067
25036
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
25068
25037
  */ _proto.translateByPixel = function translateByPixel(x, y) {
25069
25038
  if (!this.renderer) {
25070
- console.warn("Can not translate position when container not assigned");
25039
+ console.warn("Renderer not assigned. Operation aborted.");
25071
25040
  return;
25072
25041
  }
25073
25042
  this.rootItem.translateByPixel(x, y);
@@ -25081,7 +25050,7 @@ var listOrder = 0;
25081
25050
  * @param y - y 坐标
25082
25051
  */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
25083
25052
  if (!this.renderer) {
25084
- console.warn("Can not setPosition when container not assigned");
25053
+ console.warn("Renderer not assigned. Operation aborted.");
25085
25054
  return;
25086
25055
  }
25087
25056
  this.rootItem.setPositionByPixel(x, y);
@@ -25436,7 +25405,7 @@ var listOrder = 0;
25436
25405
  info.push("Tex " + this.textures.length);
25437
25406
  }
25438
25407
  if (info.length > 0) {
25439
- logger.warn("Release GPU memory: " + info.join(", "));
25408
+ logger.warn("Release GPU memory: " + info.join(", ") + ".");
25440
25409
  }
25441
25410
  this.renderPasses.forEach(function(pass) {
25442
25411
  return pass.dispose();
@@ -25572,7 +25541,7 @@ var listOrder = 0;
25572
25541
  * @param ticker - 定时器类
25573
25542
  */ _proto.add = function add(ticker) {
25574
25543
  if (typeof ticker !== "function") {
25575
- throw new Error("Ticker: The tick object must implement the tick method.");
25544
+ throw new Error("The tick object must implement the tick method.");
25576
25545
  }
25577
25546
  this.tickers.push(ticker);
25578
25547
  };
@@ -25748,8 +25717,8 @@ var _obj3;
25748
25717
  1
25749
25718
  ]);
25750
25719
  _this.material = new THREE__namespace.RawShaderMaterial({
25751
- vertexShader: createShaderWithMarcos(shader.marcos, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25752
- fragmentShader: createShaderWithMarcos(shader.marcos, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25720
+ vertexShader: createShaderWithMacros(shader.macros, shader.vertex, exports.ShaderType.vertex, _this.engine.gpuCapability.level),
25721
+ fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, exports.ShaderType.fragment, _this.engine.gpuCapability.level),
25753
25722
  alphaToCoverage: false,
25754
25723
  depthFunc: THREE__namespace.LessDepth,
25755
25724
  polygonOffsetFactor: THREE__namespace.ZeroFactor,
@@ -26737,7 +26706,7 @@ var seed = 1;
26737
26706
  texture.flipY = !!flipY;
26738
26707
  return texture;
26739
26708
  }
26740
- throw new Error("使用未知的数据类型创建纹理");
26709
+ throw new Error("Create a texture using an unknown data type.");
26741
26710
  };
26742
26711
  /**
26743
26712
  * 将 WebGL 纹理过滤器枚举类型映射到 THREE 纹理过滤器枚举类型
@@ -27031,7 +27000,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
27031
27000
  }
27032
27001
  firstFrameTime = performance.now() - last + composition.statistic.loadTime;
27033
27002
  composition.statistic.firstFrameTime = firstFrameTime;
27034
- logger.info("first frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms");
27003
+ logger.info("First frame: [" + composition.name + "]" + firstFrameTime.toFixed(4) + "ms.");
27035
27004
  _this.compositions.push(composition);
27036
27005
  return [
27037
27006
  2,
@@ -27197,8 +27166,8 @@ setMaxSpriteMeshItemCount(8);
27197
27166
  */ Mesh.create = function(engine, props) {
27198
27167
  return new ThreeMesh(engine, props);
27199
27168
  };
27200
- var version = "2.0.0-alpha.17";
27201
- logger.info("THREEJS plugin version: " + version);
27169
+ var version = "2.0.0-alpha.18";
27170
+ logger.info("THREEJS plugin version: " + version + ".");
27202
27171
 
27203
27172
  exports.AbstractPlugin = AbstractPlugin;
27204
27173
  exports.ActivationPlayable = ActivationPlayable;
@@ -27325,7 +27294,7 @@ exports.compatibleVert = compatible_vert;
27325
27294
  exports.createCopyShader = createCopyShader;
27326
27295
  exports.createGLContext = createGLContext;
27327
27296
  exports.createKeyFrameMeta = createKeyFrameMeta;
27328
- exports.createShaderWithMarcos = createShaderWithMarcos;
27297
+ exports.createShaderWithMacros = createShaderWithMacros;
27329
27298
  exports.createShape = createShape;
27330
27299
  exports.createVFXItem = createVFXItem;
27331
27300
  exports.createValueGetter = createValueGetter;
@@ -27429,7 +27398,6 @@ exports.setMaskMode = setMaskMode;
27429
27398
  exports.setMaxSpriteMeshItemCount = setMaxSpriteMeshItemCount;
27430
27399
  exports.setRayFromCamera = setRayFromCamera;
27431
27400
  exports.setSideMode = setSideMode;
27432
- exports.setSpriteMeshMaxFragmentTextures = setSpriteMeshMaxFragmentTextures;
27433
27401
  exports.setSpriteMeshMaxItemCountByGPU = setSpriteMeshMaxItemCountByGPU;
27434
27402
  exports.setUniformValue = setUniformValue;
27435
27403
  exports.sortByOrder = sortByOrder;