@galacean/effects-core 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 core 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';
@@ -610,7 +610,7 @@ function isCanvas(canvas) {
610
610
  return min + Math.random() * (max - min);
611
611
  }
612
612
  function throwDestroyedError() {
613
- throw Error('destroyed item cannot be used again');
613
+ throw new Error('Destroyed item cannot be used again.');
614
614
  }
615
615
  function generateGUID() {
616
616
  return v4().replace(/-/g, '');
@@ -4243,7 +4243,7 @@ const effectsClassStore = {};
4243
4243
  function effectsClass(className) {
4244
4244
  return (target, context)=>{
4245
4245
  if (effectsClassStore[className]) {
4246
- console.warn(`Class ${className} 重复注册`);
4246
+ console.warn(`Class ${className} is already registered.`);
4247
4247
  }
4248
4248
  // TODO: three修改json dataType, 这边重复注册直接 return
4249
4249
  effectsClassStore[className] = target;
@@ -7024,8 +7024,8 @@ const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = 'PRE_MAIN_COLOR_0';
7024
7024
  const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = 'PRE_MAIN_COLOR_SIZE_0';
7025
7025
  const PLAYER_OPTIONS_ENV_EDITOR = 'editor';
7026
7026
  const HELP_LINK = {
7027
- 'Filter not imported': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg',
7028
- 'Item duration can\'t be less than 0': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg'
7027
+ 'Item duration can\'t be less than 0': 'https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS',
7028
+ 'ValueType: 21/22 is not supported': 'https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b'
7029
7029
  };
7030
7030
 
7031
7031
  /**
@@ -7206,17 +7206,17 @@ const downgradeKeywords = {
7206
7206
  };
7207
7207
  /**
7208
7208
  * 生成 shader,检测到 WebGL1 上下文会降级
7209
- * @param marcos - 宏定义数组
7209
+ * @param macros - 宏定义数组
7210
7210
  * @param shader - 原始 shader 文本
7211
7211
  * @param shaderType - shader 类型
7212
7212
  * @return 去除版本号的 shader 文本
7213
- */ function createShaderWithMarcos(marcos, shader, shaderType, level) {
7213
+ */ function createShaderWithMacros(macros, shader, shaderType, level) {
7214
7214
  const ret = [];
7215
7215
  let header = '';
7216
7216
  // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7217
7217
  ret.push('#define GE_RUNTIME');
7218
- if (marcos) {
7219
- marcos.forEach(([key, value])=>{
7218
+ if (macros) {
7219
+ macros.forEach(([key, value])=>{
7220
7220
  if (value === true) {
7221
7221
  ret.push(`#define ${key}`);
7222
7222
  } else if (Number.isFinite(value)) {
@@ -7327,7 +7327,7 @@ function setBlendMode(material, blendMode) {
7327
7327
  ];
7328
7328
  break;
7329
7329
  default:
7330
- console.warn(`blendMode ${blendMode} not in specification, please set blend params separately`);
7330
+ console.warn(`BlendMode ${blendMode} not in specification, please set blend params separately.`);
7331
7331
  }
7332
7332
  }
7333
7333
  function setSideMode(material, side) {
@@ -7373,7 +7373,7 @@ function setMaskMode(material, maskMode) {
7373
7373
  material.stencilTest = false;
7374
7374
  break;
7375
7375
  default:
7376
- console.warn(`maskMode ${maskMode} not in specification, please set stencil params seperately`);
7376
+ console.warn(`MaskMode ${maskMode} not in specification, please set stencil params seperately.`);
7377
7377
  }
7378
7378
  }
7379
7379
 
@@ -7545,7 +7545,7 @@ function _loadImage() {
7545
7545
  }
7546
7546
  // 2. 非法类型
7547
7547
  if (!url) {
7548
- throw new Error(`Invalid url type: ${JSON.stringify(source)}`);
7548
+ throw new Error(`Invalid url type: ${JSON.stringify(source)}.`);
7549
7549
  }
7550
7550
  return new Promise((resolve, reject)=>{
7551
7551
  const img = new Image();
@@ -7658,13 +7658,13 @@ function _loadMedia() {
7658
7658
  return _loadMedia.apply(this, arguments);
7659
7659
  }
7660
7660
 
7661
- function deserializeMipmapTexture(texOpts, bins) {
7661
+ function deserializeMipmapTexture(textureOptions, bins, engine) {
7662
7662
  return _deserializeMipmapTexture.apply(this, arguments);
7663
7663
  }
7664
7664
  function _deserializeMipmapTexture() {
7665
- _deserializeMipmapTexture = _async_to_generator(function*(texOpts, bins, files = [], engine) {
7666
- if (texOpts.target === 34067) {
7667
- const { mipmaps, target } = texOpts;
7665
+ _deserializeMipmapTexture = _async_to_generator(function*(textureOptions, bins, engine, files = []) {
7666
+ if (textureOptions.target === 34067) {
7667
+ const { mipmaps, target } = textureOptions;
7668
7668
  // const jobs = mipmaps.map(mipmap => Promise.all(mipmap.map(pointer => loadMipmapImage(pointer, bins))));
7669
7669
  const loadedMipmaps = [];
7670
7670
  for (const level of mipmaps){
@@ -7680,7 +7680,7 @@ function _deserializeMipmapTexture() {
7680
7680
  // const bin = files[mipmaps[0][0][1][0]].url;
7681
7681
  return _extends({
7682
7682
  keepImageSource: false
7683
- }, texOpts, {
7683
+ }, textureOptions, {
7684
7684
  mipmaps: loadedMipmaps,
7685
7685
  sourceFrom: {
7686
7686
  target,
@@ -7690,13 +7690,13 @@ function _deserializeMipmapTexture() {
7690
7690
  });
7691
7691
  } else {
7692
7692
  // TODO: 补充测试用例
7693
- const { mipmaps, target } = texOpts;
7693
+ const { mipmaps, target } = textureOptions;
7694
7694
  const jobs = mipmaps.map((pointer)=>loadMipmapImage(pointer, bins));
7695
7695
  const loadedMipmaps = yield Promise.all(jobs);
7696
7696
  const bin = files[mipmaps[0][1][0]].url;
7697
7697
  return _extends({
7698
7698
  keepImageSource: false
7699
- }, texOpts, {
7699
+ }, textureOptions, {
7700
7700
  mipmaps: loadedMipmaps,
7701
7701
  sourceType: exports.TextureSourceType.mipmaps,
7702
7702
  sourceFrom: {
@@ -7721,7 +7721,7 @@ function _loadMipmapImage() {
7721
7721
  const [index, start, length] = pointer[1];
7722
7722
  const bin = bins[index];
7723
7723
  if (!bin) {
7724
- throw new Error(`invalid bin pointer: ${JSON.stringify(pointer)}`);
7724
+ throw new Error(`Invalid bin pointer: ${JSON.stringify(pointer)}.`);
7725
7725
  }
7726
7726
  return loadImage(new Blob([
7727
7727
  new Uint8Array(bin, start, length)
@@ -7920,7 +7920,7 @@ class KTXTexture {
7920
7920
  // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
7921
7921
  const identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);
7922
7922
  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) {
7923
- throw Error('texture missing KTX identifier');
7923
+ throw new Error('Texture missing KTX identifier.');
7924
7924
  }
7925
7925
  // load the reset of the header in native 32 bit uint
7926
7926
  const dataSize = Uint32Array.BYTES_PER_ELEMENT;
@@ -7942,15 +7942,15 @@ class KTXTexture {
7942
7942
  // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
7943
7943
  this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
7944
7944
  if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
7945
- logger.warn('Only 2D textures currently supported');
7945
+ logger.warn('Only 2D textures currently supported.');
7946
7946
  return;
7947
7947
  }
7948
7948
  if (this.numberOfArrayElements !== 0) {
7949
- logger.warn('Texture arrays not currently supported');
7949
+ logger.warn('Texture arrays not currently supported.');
7950
7950
  return;
7951
7951
  }
7952
7952
  if (this.numberOfFaces !== facesExpected) {
7953
- logger.warn('Number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);
7953
+ logger.warn(`Number of faces expected ${facesExpected}, but found ${this.numberOfFaces}.`);
7954
7954
  return;
7955
7955
  }
7956
7956
  // we now have a completely validated file, so could use existence of loadType as success
@@ -7990,7 +7990,7 @@ class TextureFactory {
7990
7990
  texture.updateSource(sourceOpts);
7991
7991
  _this.reloadPending[id] = false;
7992
7992
  } else {
7993
- throw new Error('No source from');
7993
+ throw new Error('No source from.');
7994
7994
  }
7995
7995
  })();
7996
7996
  }
@@ -8117,7 +8117,7 @@ class TextureFactory {
8117
8117
  });
8118
8118
  }
8119
8119
  }
8120
- throw new Error(`Invalid resource type: ${type}`);
8120
+ throw new Error(`Invalid resource type: ${type}.`);
8121
8121
  })();
8122
8122
  }
8123
8123
  loadMipmapImages(pointers, bin) {
@@ -8933,19 +8933,19 @@ function buildEasingCurve(leftKeyframe, rightKeyframe) {
8933
8933
  y2 = numberToFix((p2.y - p0.y) / valueInterval, 5);
8934
8934
  }
8935
8935
  if (x1 < 0) {
8936
- console.error('invalid bezier points, x1 < 0', p0, p1, p2, p3);
8936
+ console.error('Invalid bezier points, x1 < 0', p0, p1, p2, p3);
8937
8937
  x1 = 0;
8938
8938
  }
8939
8939
  if (x2 < 0) {
8940
- console.error('invalid bezier points, x2 < 0', p0, p1, p2, p3);
8940
+ console.error('Invalid bezier points, x2 < 0', p0, p1, p2, p3);
8941
8941
  x2 = 0;
8942
8942
  }
8943
8943
  if (x1 > 1) {
8944
- console.error('invalid bezier points, x1 >= 1', p0, p1, p2, p3);
8944
+ console.error('Invalid bezier points, x1 >= 1', p0, p1, p2, p3);
8945
8945
  x1 = 1;
8946
8946
  }
8947
8947
  if (x2 > 1) {
8948
- console.error('invalid bezier points, x2 >= 1', p0, p1, p2, p3);
8948
+ console.error('Invalid bezier points, x2 >= 1', p0, p1, p2, p3);
8949
8949
  x2 = 1;
8950
8950
  }
8951
8951
  const str = ('bez_' + x1 + '_' + y1 + '_' + x2 + '_' + y2).replace(/\./g, 'p');
@@ -9129,31 +9129,31 @@ class ValueGetter {
9129
9129
  return halfFloat ? ret.data : ret;
9130
9130
  }
9131
9131
  onCreate(props) {
9132
- throw Error(NOT_IMPLEMENT);
9132
+ throw new Error(NOT_IMPLEMENT);
9133
9133
  }
9134
9134
  getIntegrateValue(t0, t1, timeScale = 1) {
9135
- throw Error(NOT_IMPLEMENT);
9135
+ throw new Error(NOT_IMPLEMENT);
9136
9136
  }
9137
9137
  getIntegrateByTime(t0, time) {
9138
- throw Error(NOT_IMPLEMENT);
9138
+ throw new Error(NOT_IMPLEMENT);
9139
9139
  }
9140
9140
  getValue(time) {
9141
- throw Error(NOT_IMPLEMENT);
9141
+ throw new Error(NOT_IMPLEMENT);
9142
9142
  }
9143
9143
  getMaxTime() {
9144
- throw Error(NOT_IMPLEMENT);
9144
+ throw new Error(NOT_IMPLEMENT);
9145
9145
  }
9146
9146
  toUniform(meta) {
9147
- throw Error(NOT_IMPLEMENT);
9147
+ throw new Error(NOT_IMPLEMENT);
9148
9148
  }
9149
9149
  map(func) {
9150
- throw Error(NOT_IMPLEMENT);
9150
+ throw new Error(NOT_IMPLEMENT);
9151
9151
  }
9152
9152
  scaleXCoord(scale) {
9153
9153
  return this;
9154
9154
  }
9155
9155
  toData() {
9156
- throw Error(NOT_IMPLEMENT);
9156
+ throw new Error(NOT_IMPLEMENT);
9157
9157
  }
9158
9158
  constructor(arg){
9159
9159
  this.onCreate(arg);
@@ -9785,7 +9785,7 @@ function createValueGetter(args) {
9785
9785
  if (isFunction(map$1[args[0]])) {
9786
9786
  return map$1[args[0]](args[1]);
9787
9787
  } else {
9788
- throw new Error(`ValueType: ${args[0]} is not support`);
9788
+ throw new Error(`ValueType: ${args[0]} is not supported, see ${HELP_LINK['ValueType: 21/22 is not supported']}.`);
9789
9789
  }
9790
9790
  }
9791
9791
  function lineSegIntegrate(t, t0, t1, y0, y1) {
@@ -9959,7 +9959,7 @@ function createCopyShader(level, writeDepth) {
9959
9959
  vertex: version + '\n' + COPY_VERTEX_SHADER,
9960
9960
  fragment: version + '\n' + COPY_FRAGMENT_SHADER,
9961
9961
  glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
9962
- marcos: [
9962
+ macros: [
9963
9963
  [
9964
9964
  'WEBGL2',
9965
9965
  !!webgl2
@@ -10023,7 +10023,7 @@ class PassTextureCache {
10023
10023
  const refCount = this.textureRef[id];
10024
10024
  if (refCount <= 1) {
10025
10025
  if (refCount < 0) {
10026
- console.error('ref count < 0');
10026
+ console.error('Ref count < 0.');
10027
10027
  }
10028
10028
  const tex = this.textureCache[id];
10029
10029
  if (tex) {
@@ -10637,21 +10637,21 @@ let seed$6 = 1;
10637
10637
  }
10638
10638
  }
10639
10639
 
10640
- 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;}";
10640
+ 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;}";
10641
10641
 
10642
10642
  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";
10643
10643
 
10644
10644
  var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
10645
10645
 
10646
- 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);}";
10646
+ 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);}";
10647
10647
 
10648
10648
  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.;}";
10649
10649
 
10650
10650
  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}";
10651
10651
 
10652
- 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;}";
10652
+ 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;}";
10653
10653
 
10654
- 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";
10654
+ 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";
10655
10655
 
10656
10656
  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}}";
10657
10657
 
@@ -11798,20 +11798,20 @@ class GPUCapability {
11798
11798
  framebufferTexture2D(gl, target, index, textarget, texture) {
11799
11799
  const ext = this.drawBufferExtension;
11800
11800
  if (this.level === 1 && !ext && index > 0) {
11801
- throw new Error('draw multiple color buffers not available');
11801
+ throw new Error('Draw multiple color buffers not available.');
11802
11802
  }
11803
11803
  const attachment = ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : gl[`COLOR_ATTACHMENT${index}`];
11804
11804
  if (attachment) {
11805
11805
  gl.framebufferTexture2D(target, attachment, textarget, texture, 0);
11806
11806
  } else {
11807
- console.error('invalid color attachment index: ' + index);
11807
+ console.error(`Invalid color attachment index: ${index}.`);
11808
11808
  }
11809
11809
  }
11810
11810
  drawBuffers(gl, bufferStates) {
11811
11811
  const ext = this.drawBufferExtension;
11812
11812
  if (this.level === 1 && !ext) {
11813
11813
  if (bufferStates.length > 1) {
11814
- throw Error('draw buffers not available');
11814
+ throw new Error('Draw buffers not available.');
11815
11815
  } else {
11816
11816
  return;
11817
11817
  }
@@ -12071,7 +12071,7 @@ class InteractMesh {
12071
12071
  }
12072
12072
  createMaterial(rendererOptions) {
12073
12073
  var _this_engine_renderer;
12074
- const marcos = [
12074
+ const macros = [
12075
12075
  [
12076
12076
  'ENV_EDITOR',
12077
12077
  ((_this_engine_renderer = this.engine.renderer) == null ? void 0 : _this_engine_renderer.env) === PLAYER_OPTIONS_ENV_EDITOR
@@ -12084,7 +12084,7 @@ class InteractMesh {
12084
12084
  fragment,
12085
12085
  glslVersion: exports.GLSLVersion.GLSL1,
12086
12086
  cacheId: `${rendererOptions.cachePrefix}_effects_interact`,
12087
- marcos
12087
+ macros
12088
12088
  },
12089
12089
  uniformSemantics: {
12090
12090
  effects_MatrixVP: 'VIEWPROJECTION',
@@ -12349,16 +12349,12 @@ function shouldIgnoreBouncing(arg, mul) {
12349
12349
  }
12350
12350
 
12351
12351
  exports.maxSpriteMeshItemCount = 8;
12352
- exports.maxSpriteTextureCount = 8;
12353
12352
  function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
12354
- // 8 or 16
12355
- exports.maxSpriteTextureCount = Math.min(gpuCapability.maxFragmentTextures, 16);
12356
12353
  if (gpuCapability.maxVertexUniforms >= 256) {
12357
12354
  return exports.maxSpriteMeshItemCount = 32;
12358
12355
  } else if (gpuCapability.maxVertexUniforms >= 128) {
12359
12356
  return exports.maxSpriteMeshItemCount = 16;
12360
12357
  }
12361
- exports.maxSpriteTextureCount = 8;
12362
12358
  }
12363
12359
  function getImageItemRenderInfo(item) {
12364
12360
  const { renderer } = item;
@@ -12376,27 +12372,11 @@ function getImageItemRenderInfo(item) {
12376
12372
  };
12377
12373
  }
12378
12374
  function spriteMeshShaderFromFilter(level, options) {
12379
- const { count = 2, env = '', ignoreBlend, wireframe } = options != null ? options : {};
12380
- const marcos = [
12381
- [
12382
- 'MAX_ITEM_COUNT',
12383
- count
12384
- ],
12385
- [
12386
- 'PRE_MULTIPLY_ALPHA',
12387
- false
12388
- ],
12375
+ const { env = '', wireframe } = options != null ? options : {};
12376
+ const macros = [
12389
12377
  [
12390
12378
  'ENV_EDITOR',
12391
12379
  env === PLAYER_OPTIONS_ENV_EDITOR
12392
- ],
12393
- [
12394
- 'USE_BLEND',
12395
- !ignoreBlend
12396
- ],
12397
- [
12398
- 'MAX_FRAG_TEX',
12399
- exports.maxSpriteTextureCount >= 16 ? 16 : 8
12400
12380
  ]
12401
12381
  ];
12402
12382
  const fragment = wireframe ? itemFrameFrag : itemFrag;
@@ -12405,7 +12385,7 @@ function spriteMeshShaderFromFilter(level, options) {
12405
12385
  fragment,
12406
12386
  vertex,
12407
12387
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
12408
- marcos,
12388
+ macros,
12409
12389
  shared: true
12410
12390
  };
12411
12391
  }
@@ -12415,7 +12395,6 @@ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
12415
12395
  function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
12416
12396
  const { wireframe } = renderInfo;
12417
12397
  const shader = spriteMeshShaderFromFilter(level, {
12418
- count,
12419
12398
  wireframe,
12420
12399
  env
12421
12400
  });
@@ -12429,9 +12408,6 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
12429
12408
  function setMaxSpriteMeshItemCount(count) {
12430
12409
  exports.maxSpriteMeshItemCount = count;
12431
12410
  }
12432
- function setSpriteMeshMaxFragmentTextures(count) {
12433
- exports.maxSpriteTextureCount = count;
12434
- }
12435
12411
 
12436
12412
  const defRenderInfo = {
12437
12413
  blending: 0,
@@ -13995,7 +13971,7 @@ function createShape(shapeOptions) {
13995
13971
  const { type } = shapeOptions;
13996
13972
  const Ctrl = map[type];
13997
13973
  if (!Ctrl) {
13998
- throw Error('invalid shape:' + type);
13974
+ throw new Error(`Invalid shape: ${type}.`);
13999
13975
  }
14000
13976
  const ctrl = new Ctrl(options);
14001
13977
  if (type !== ShapeType.NONE) {
@@ -14964,7 +14940,7 @@ class TrailMesh {
14964
14940
  const uniformValues = {};
14965
14941
  // const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
14966
14942
  const lookUpTexture = 0;
14967
- const marcos = [
14943
+ const macros = [
14968
14944
  [
14969
14945
  'ENABLE_VERTEX_TEXTURE',
14970
14946
  enableVertexTexture
@@ -14981,7 +14957,7 @@ class TrailMesh {
14981
14957
  const useAttributeTrailStart = maxTrailCount > 64;
14982
14958
  let shaderCacheId = 0;
14983
14959
  if (colorOverLifetime) {
14984
- marcos.push([
14960
+ macros.push([
14985
14961
  'COLOR_OVER_LIFETIME',
14986
14962
  true
14987
14963
  ]);
@@ -14989,7 +14965,7 @@ class TrailMesh {
14989
14965
  uniformValues.uColorOverLifetime = Texture.createWithData(engine, imageDataFromGradient(colorOverLifetime));
14990
14966
  }
14991
14967
  if (colorOverTrail) {
14992
- marcos.push([
14968
+ macros.push([
14993
14969
  'COLOR_OVER_TRAIL',
14994
14970
  true
14995
14971
  ]);
@@ -14997,7 +14973,7 @@ class TrailMesh {
14997
14973
  uniformValues.uColorOverTrail = Texture.createWithData(engine, imageDataFromGradient(colorOverTrail));
14998
14974
  }
14999
14975
  if (useAttributeTrailStart) {
15000
- marcos.push([
14976
+ macros.push([
15001
14977
  'ATTR_TRAIL_START',
15002
14978
  1
15003
14979
  ]);
@@ -15007,7 +14983,7 @@ class TrailMesh {
15007
14983
  }
15008
14984
  uniformValues.uOpacityOverLifetimeValue = opacityOverLifetime.toUniform(keyFrameMeta);
15009
14985
  const uWidthOverTrail = widthOverTrail.toUniform(keyFrameMeta);
15010
- marcos.push([
14986
+ macros.push([
15011
14987
  'VERT_CURVE_VALUE_COUNT',
15012
14988
  keyFrameMeta.index
15013
14989
  ], [
@@ -15026,7 +15002,7 @@ class TrailMesh {
15026
15002
  shader: {
15027
15003
  vertex,
15028
15004
  fragment,
15029
- marcos,
15005
+ macros,
15030
15006
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
15031
15007
  shared: true,
15032
15008
  name: `trail#${name}`,
@@ -15181,11 +15157,11 @@ function calculateDirection(prePoint, point, nextPoint) {
15181
15157
  }
15182
15158
  return dir.normalize().toArray();
15183
15159
  }
15184
- function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapability) {
15160
+ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env = '') {
15185
15161
  let shaderCacheId = 0;
15186
15162
  const lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
15187
15163
  const enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
15188
- const marcos = [
15164
+ const macros = [
15189
15165
  [
15190
15166
  'ENABLE_VERTEX_TEXTURE',
15191
15167
  enableVertexTexture
@@ -15201,14 +15177,14 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15201
15177
  ];
15202
15178
  const keyFrameMeta = createKeyFrameMeta();
15203
15179
  if (trails.colorOverLifetime) {
15204
- marcos.push([
15180
+ macros.push([
15205
15181
  'COLOR_OVER_LIFETIME',
15206
15182
  true
15207
15183
  ]);
15208
15184
  shaderCacheId |= 1;
15209
15185
  }
15210
15186
  if (trails.colorOverTrail) {
15211
- marcos.push([
15187
+ macros.push([
15212
15188
  'COLOR_OVER_TRAIL',
15213
15189
  true
15214
15190
  ]);
@@ -15216,7 +15192,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15216
15192
  }
15217
15193
  const useAttributeTrailStart = particleMaxCount > 64;
15218
15194
  if (useAttributeTrailStart) {
15219
- marcos.push([
15195
+ macros.push([
15220
15196
  'ATTR_TRAIL_START',
15221
15197
  1
15222
15198
  ]);
@@ -15224,7 +15200,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15224
15200
  }
15225
15201
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
15226
15202
  getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
15227
- marcos.push([
15203
+ macros.push([
15228
15204
  'VERT_CURVE_VALUE_COUNT',
15229
15205
  keyFrameMeta.index
15230
15206
  ], [
@@ -15234,7 +15210,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
15234
15210
  return {
15235
15211
  vertex: trailVert,
15236
15212
  fragment: particleFrag,
15237
- marcos,
15213
+ macros,
15238
15214
  shared: true,
15239
15215
  name: 'trail#' + name,
15240
15216
  cacheId: `-t:+${shaderCacheId}+${keyFrameMeta.index}+${keyFrameMeta.max}`
@@ -16545,15 +16521,12 @@ class ParticleMesh {
16545
16521
  const { speedOverLifetime, colorOverLifetime, linearVelOverLifetime, orbitalVelOverLifetime, sizeOverLifetime, rotationOverLifetime, sprite, gravityModifier, maxCount, textureFlip, useSprite, name, gravity, forceTarget, side, occlusion, anchor, blending, maskMode, mask, transparentOcclusion, meshSlots, renderMode = 0, diffuse = Texture.createWithData(engine) } = props;
16546
16522
  const { detail } = engine.gpuCapability;
16547
16523
  const { halfFloatTexture, maxVertexUniforms } = detail;
16548
- const marcos = [
16524
+ const macros = [
16525
+ // spec.RenderMode
16549
16526
  [
16550
16527
  'RENDER_MODE',
16551
16528
  +renderMode
16552
16529
  ],
16553
- [
16554
- 'PRE_MULTIPLY_ALPHA',
16555
- false
16556
- ],
16557
16530
  [
16558
16531
  'ENV_EDITOR',
16559
16532
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -16569,13 +16542,13 @@ class ParticleMesh {
16569
16542
  let useOrbitalVel;
16570
16543
  this.useSprite = useSprite;
16571
16544
  if (enableVertexTexture) {
16572
- marcos.push([
16545
+ macros.push([
16573
16546
  'ENABLE_VERTEX_TEXTURE',
16574
16547
  true
16575
16548
  ]);
16576
16549
  }
16577
16550
  if (speedOverLifetime) {
16578
- marcos.push([
16551
+ macros.push([
16579
16552
  'SPEED_OVER_LIFETIME',
16580
16553
  true
16581
16554
  ]);
@@ -16583,7 +16556,7 @@ class ParticleMesh {
16583
16556
  uniformValues.uSpeedLifetimeValue = speedOverLifetime.toUniform(vertexKeyFrameMeta);
16584
16557
  }
16585
16558
  if (sprite == null ? void 0 : sprite.animate) {
16586
- marcos.push([
16559
+ macros.push([
16587
16560
  'USE_SPRITE',
16588
16561
  true
16589
16562
  ]);
@@ -16597,7 +16570,7 @@ class ParticleMesh {
16597
16570
  this.useSprite = true;
16598
16571
  }
16599
16572
  if (colorOverLifetime == null ? void 0 : colorOverLifetime.color) {
16600
- marcos.push([
16573
+ macros.push([
16601
16574
  'COLOR_OVER_LIFETIME',
16602
16575
  true
16603
16576
  ]);
@@ -16622,7 +16595,7 @@ class ParticleMesh {
16622
16595
  shaderCacheId |= 1 << 7 + i;
16623
16596
  linearVelOverLifetime.enabled = true;
16624
16597
  }
16625
- marcos.push([
16598
+ macros.push([
16626
16599
  `LINEAR_VEL_${pro.toUpperCase()}`,
16627
16600
  defL
16628
16601
  ]);
@@ -16633,13 +16606,13 @@ class ParticleMesh {
16633
16606
  useOrbitalVel = true;
16634
16607
  orbitalVelOverLifetime.enabled = true;
16635
16608
  }
16636
- marcos.push([
16609
+ macros.push([
16637
16610
  `ORB_VEL_${pro.toUpperCase()}`,
16638
16611
  defO
16639
16612
  ]);
16640
16613
  });
16641
16614
  if (linearVelOverLifetime == null ? void 0 : linearVelOverLifetime.asMovement) {
16642
- marcos.push([
16615
+ macros.push([
16643
16616
  'AS_LINEAR_MOVEMENT',
16644
16617
  true
16645
16618
  ]);
@@ -16647,7 +16620,7 @@ class ParticleMesh {
16647
16620
  }
16648
16621
  if (useOrbitalVel) {
16649
16622
  if (orbitalVelOverLifetime == null ? void 0 : orbitalVelOverLifetime.asRotation) {
16650
- marcos.push([
16623
+ macros.push([
16651
16624
  'AS_ORBITAL_MOVEMENT',
16652
16625
  true
16653
16626
  ]);
@@ -16662,7 +16635,7 @@ class ParticleMesh {
16662
16635
  uniformValues.uSizeByLifetimeValue = sizeOverLifetime == null ? void 0 : sizeOverLifetime.x.toUniform(vertexKeyFrameMeta);
16663
16636
  if (sizeOverLifetime == null ? void 0 : sizeOverLifetime.separateAxes) {
16664
16637
  var _sizeOverLifetime_y;
16665
- marcos.push([
16638
+ macros.push([
16666
16639
  'SIZE_Y_BY_LIFE',
16667
16640
  1
16668
16641
  ]);
@@ -16672,7 +16645,7 @@ class ParticleMesh {
16672
16645
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.z) {
16673
16646
  uniformValues.uRZByLifeTimeValue = rotationOverLifetime.z.toUniform(vertexKeyFrameMeta);
16674
16647
  shaderCacheId |= 1 << 15;
16675
- marcos.push([
16648
+ macros.push([
16676
16649
  'ROT_Z_LIFETIME',
16677
16650
  1
16678
16651
  ]);
@@ -16680,7 +16653,7 @@ class ParticleMesh {
16680
16653
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.x) {
16681
16654
  uniformValues.uRXByLifeTimeValue = rotationOverLifetime.x.toUniform(vertexKeyFrameMeta);
16682
16655
  shaderCacheId |= 1 << 16;
16683
- marcos.push([
16656
+ macros.push([
16684
16657
  'ROT_X_LIFETIME',
16685
16658
  1
16686
16659
  ]);
@@ -16688,13 +16661,13 @@ class ParticleMesh {
16688
16661
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.y) {
16689
16662
  uniformValues.uRYByLifeTimeValue = rotationOverLifetime.y.toUniform(vertexKeyFrameMeta);
16690
16663
  shaderCacheId |= 1 << 17;
16691
- marcos.push([
16664
+ macros.push([
16692
16665
  'ROT_Y_LIFETIME',
16693
16666
  1
16694
16667
  ]);
16695
16668
  }
16696
16669
  if (rotationOverLifetime == null ? void 0 : rotationOverLifetime.asRotation) {
16697
- marcos.push([
16670
+ macros.push([
16698
16671
  'ROT_LIFETIME_AS_MOVEMENT',
16699
16672
  1
16700
16673
  ]);
@@ -16702,7 +16675,7 @@ class ParticleMesh {
16702
16675
  }
16703
16676
  uniformValues.uGravityModifierValue = gravityModifier.toUniform(vertexKeyFrameMeta);
16704
16677
  if (forceTarget) {
16705
- marcos.push([
16678
+ macros.push([
16706
16679
  'FINAL_TARGET',
16707
16680
  true
16708
16681
  ]);
@@ -16748,7 +16721,7 @@ class ParticleMesh {
16748
16721
  fragmentKeyFrameMeta.index,
16749
16722
  fragmentKeyFrameMeta.max
16750
16723
  ].join('+');
16751
- marcos.push([
16724
+ macros.push([
16752
16725
  'VERT_CURVE_VALUE_COUNT',
16753
16726
  vertexKeyFrameMeta.index
16754
16727
  ], [
@@ -16770,7 +16743,7 @@ class ParticleMesh {
16770
16743
  glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
16771
16744
  shared: true,
16772
16745
  cacheId: shaderCache,
16773
- marcos,
16746
+ macros,
16774
16747
  name: `particle#${name}`
16775
16748
  };
16776
16749
  const mtlOptions = {
@@ -16847,7 +16820,7 @@ class ParticleMesh {
16847
16820
  res.length = 0;
16848
16821
  break;
16849
16822
  default:
16850
- console.warn(`uniform ${name}'s type not in typeMap`);
16823
+ console.warn(`Uniform ${name}'s type not in typeMap.`);
16851
16824
  }
16852
16825
  });
16853
16826
  material.setVector3('emissionColor', new Vector3(0, 0, 0));
@@ -16978,19 +16951,15 @@ function generateGeometryProps(maxVertex, useSprite, name) {
16978
16951
  maxVertex
16979
16952
  };
16980
16953
  }
16981
- function getParticleMeshShader(item, env = '', gpuCapability) {
16954
+ function getParticleMeshShader(item, gpuCapability, env = '') {
16982
16955
  var _props_renderer;
16983
16956
  const props = item.content;
16984
16957
  const renderMode = +(((_props_renderer = props.renderer) == null ? void 0 : _props_renderer.renderMode) || 0);
16985
- const marcos = [
16958
+ const macros = [
16986
16959
  [
16987
16960
  'RENDER_MODE',
16988
16961
  renderMode
16989
16962
  ],
16990
- [
16991
- 'PRE_MULTIPLY_ALPHA',
16992
- false
16993
- ],
16994
16963
  [
16995
16964
  'ENV_EDITOR',
16996
16965
  env === PLAYER_OPTIONS_ENV_EDITOR
@@ -17005,13 +16974,13 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17005
16974
  let vertex_lookup_texture = 0;
17006
16975
  let shaderCacheId = 0;
17007
16976
  if (enableVertexTexture) {
17008
- marcos.push([
16977
+ macros.push([
17009
16978
  'ENABLE_VERTEX_TEXTURE',
17010
16979
  true
17011
16980
  ]);
17012
16981
  }
17013
16982
  if (speedOverLifetime) {
17014
- marcos.push([
16983
+ macros.push([
17015
16984
  'SPEED_OVER_LIFETIME',
17016
16985
  true
17017
16986
  ]);
@@ -17020,7 +16989,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17020
16989
  }
17021
16990
  const sprite = props.textureSheetAnimation;
17022
16991
  if (sprite && sprite.animate) {
17023
- marcos.push([
16992
+ macros.push([
17024
16993
  'USE_SPRITE',
17025
16994
  true
17026
16995
  ]);
@@ -17028,7 +16997,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17028
16997
  }
17029
16998
  const colorOverLifetime = props.colorOverLifetime;
17030
16999
  if (colorOverLifetime && colorOverLifetime.color) {
17031
- marcos.push([
17000
+ macros.push([
17032
17001
  'COLOR_OVER_LIFETIME',
17033
17002
  true
17034
17003
  ]);
@@ -17053,7 +17022,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17053
17022
  defL = 1;
17054
17023
  shaderCacheId |= 1 << 7 + i;
17055
17024
  }
17056
- marcos.push([
17025
+ macros.push([
17057
17026
  `LINEAR_VEL_${pro.toUpperCase()}`,
17058
17027
  defL
17059
17028
  ]);
@@ -17064,13 +17033,13 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17064
17033
  shaderCacheId |= 1 << 10 + i;
17065
17034
  useOrbitalVel = true;
17066
17035
  }
17067
- marcos.push([
17036
+ macros.push([
17068
17037
  `ORB_VEL_${pro.toUpperCase()}`,
17069
17038
  defO
17070
17039
  ]);
17071
17040
  });
17072
17041
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asMovement) {
17073
- marcos.push([
17042
+ macros.push([
17074
17043
  'AS_LINEAR_MOVEMENT',
17075
17044
  true
17076
17045
  ]);
@@ -17078,7 +17047,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17078
17047
  }
17079
17048
  if (useOrbitalVel) {
17080
17049
  if (positionOverLifetime == null ? void 0 : positionOverLifetime.asRotation) {
17081
- marcos.push([
17050
+ macros.push([
17082
17051
  'AS_ORBITAL_MOVEMENT',
17083
17052
  true
17084
17053
  ]);
@@ -17090,7 +17059,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17090
17059
  const separateAxes = sizeOverLifetime.separateAxes;
17091
17060
  if (separateAxes) {
17092
17061
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, sizeOverLifetime.x);
17093
- marcos.push([
17062
+ macros.push([
17094
17063
  'SIZE_Y_BY_LIFE',
17095
17064
  1
17096
17065
  ]);
@@ -17105,7 +17074,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17105
17074
  if (rot.z) {
17106
17075
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot == null ? void 0 : rot.z);
17107
17076
  shaderCacheId |= 1 << 15;
17108
- marcos.push([
17077
+ macros.push([
17109
17078
  'ROT_Z_LIFETIME',
17110
17079
  1
17111
17080
  ]);
@@ -17114,7 +17083,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17114
17083
  if (rot.x) {
17115
17084
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.x);
17116
17085
  shaderCacheId |= 1 << 16;
17117
- marcos.push([
17086
+ macros.push([
17118
17087
  'ROT_X_LIFETIME',
17119
17088
  1
17120
17089
  ]);
@@ -17122,14 +17091,14 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17122
17091
  if (rot.y) {
17123
17092
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, rot.y);
17124
17093
  shaderCacheId |= 1 << 17;
17125
- marcos.push([
17094
+ macros.push([
17126
17095
  'ROT_Y_LIFETIME',
17127
17096
  1
17128
17097
  ]);
17129
17098
  }
17130
17099
  }
17131
17100
  if (rot == null ? void 0 : rot.asRotation) {
17132
- marcos.push([
17101
+ macros.push([
17133
17102
  'ROT_LIFETIME_AS_MOVEMENT',
17134
17103
  1
17135
17104
  ]);
@@ -17139,7 +17108,7 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17139
17108
  getKeyFrameMetaByRawValue(vertexKeyFrameMeta, positionOverLifetime == null ? void 0 : positionOverLifetime.gravityOverLifetime);
17140
17109
  const forceOpt = positionOverLifetime == null ? void 0 : positionOverLifetime.forceTarget;
17141
17110
  if (forceOpt) {
17142
- marcos.push([
17111
+ macros.push([
17143
17112
  'FINAL_TARGET',
17144
17113
  true
17145
17114
  ]);
@@ -17180,10 +17149,10 @@ function getParticleMeshShader(item, env = '', gpuCapability) {
17180
17149
  vertex: `#define LOOKUP_TEXTURE_CURVE ${vertex_lookup_texture}\n${particleVert}`,
17181
17150
  shared: true,
17182
17151
  cacheId: shaderCache,
17183
- marcos,
17152
+ macros,
17184
17153
  name: `particle#${item.name}`
17185
17154
  };
17186
- marcos.push([
17155
+ macros.push([
17187
17156
  'VERT_CURVE_VALUE_COUNT',
17188
17157
  vertexKeyFrameMeta.index
17189
17158
  ], [
@@ -17208,11 +17177,11 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
17208
17177
  shaderIds[3] = maxVertex;
17209
17178
  shaderIds[5] = maxFrag;
17210
17179
  shader.cacheId = shaderIds.join('+');
17211
- if (!shader.marcos) {
17180
+ if (!shader.macros) {
17212
17181
  return;
17213
17182
  }
17214
- for(let i = 0; i < shader.marcos.length; i++){
17215
- const marco = shader.marcos[i];
17183
+ for(let i = 0; i < shader.macros.length; i++){
17184
+ const marco = shader.macros[i];
17216
17185
  if (marco[0] === 'VERT_CURVE_VALUE_COUNT') {
17217
17186
  marco[1] = maxVertex;
17218
17187
  } else if (marco[0] === 'FRAG_CURVE_VALUE_COUNT') {
@@ -17241,17 +17210,17 @@ class ParticleLoader extends AbstractPlugin {
17241
17210
  });
17242
17211
  });
17243
17212
  items.forEach((item)=>{
17244
- const { shader, fragment, vertex } = getParticleMeshShader(item, env, gpuCapability);
17213
+ const { shader, fragment, vertex } = getParticleMeshShader(item, gpuCapability, env);
17245
17214
  shaders.push(shader);
17246
17215
  maxFragmentCount = Math.max(maxFragmentCount, fragment);
17247
17216
  maxVertexCount = Math.max(maxVertexCount, vertex);
17248
17217
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
17249
17218
  if (item.content.trails) {
17250
- const shader = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, env, gpuCapability);
17251
- var _shader_marcos;
17252
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, exports.ShaderType.vertex, level);
17253
- var _shader_marcos1;
17254
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, exports.ShaderType.fragment, level);
17219
+ const shader = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
17220
+ var _shader_macros;
17221
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
17222
+ var _shader_macros1;
17223
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
17255
17224
  shader.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
17256
17225
  shaderLibrary.addShader(shader);
17257
17226
  }
@@ -17263,10 +17232,10 @@ class ParticleLoader extends AbstractPlugin {
17263
17232
  } else {
17264
17233
  shader.glslVersion = exports.GLSLVersion.GLSL1;
17265
17234
  }
17266
- var _shader_marcos;
17267
- shader.vertex = createShaderWithMarcos((_shader_marcos = shader.marcos) != null ? _shader_marcos : [], shader.vertex, exports.ShaderType.vertex, level);
17268
- var _shader_marcos1;
17269
- shader.fragment = createShaderWithMarcos((_shader_marcos1 = shader.marcos) != null ? _shader_marcos1 : [], shader.fragment, exports.ShaderType.fragment, level);
17235
+ var _shader_macros;
17236
+ shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
17237
+ var _shader_macros1;
17238
+ shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
17270
17239
  shaderLibrary.addShader(shader);
17271
17240
  });
17272
17241
  if (level === 2) {
@@ -18012,7 +17981,7 @@ function compareTracks(a, b) {
18012
17981
  const refId = itemData.content.options.refId;
18013
17982
  const props = this.item.composition.refCompositionProps.get(refId);
18014
17983
  if (!props) {
18015
- throw new Error(`引用的Id: ${refId} 的预合成不存在`);
17984
+ throw new Error(`Referenced precomposition with Id: ${refId} does not exist.`);
18016
17985
  }
18017
17986
  // endBehaviour 类型需优化
18018
17987
  props.content = itemData.content;
@@ -18156,7 +18125,7 @@ function compareTracks(a, b) {
18156
18125
  class SubCompositionTrack extends TrackAsset {
18157
18126
  resolveBinding(parentBinding) {
18158
18127
  if (!(parentBinding instanceof VFXItem)) {
18159
- throw new Error('SubCompositionTrack needs to be set under the VFXItem track');
18128
+ throw new Error('SubCompositionTrack needs to be set under the VFXItem track.');
18160
18129
  }
18161
18130
  return parentBinding.getComponent(CompositionComponent);
18162
18131
  }
@@ -19171,7 +19140,7 @@ class VFXItem extends EffectsObject {
19171
19140
  };
19172
19141
  }
19173
19142
  if (duration <= 0) {
19174
- throw Error(`Item duration can't be less than 0, see ${HELP_LINK['Item duration can\'t be less than 0']}`);
19143
+ throw new Error(`Item duration can't be less than 0, see ${HELP_LINK['Item duration can\'t be less than 0']}.`);
19175
19144
  }
19176
19145
  for (const component of this.components){
19177
19146
  component.onAttached();
@@ -19337,7 +19306,7 @@ exports.Item = void 0;
19337
19306
  pluginName = 'tree';
19338
19307
  break;
19339
19308
  default:
19340
- throw new Error('invalid vfx item type');
19309
+ throw new Error('Invalid vfx item type.');
19341
19310
  }
19342
19311
  }
19343
19312
  return composition.pluginSystem.createPluginItem(pluginName, props, composition);
@@ -19378,13 +19347,13 @@ class PluginSystem {
19378
19347
  createPluginItem(name, props, composition) {
19379
19348
  const CTRL = pluginCtrlMap[name];
19380
19349
  if (!CTRL) {
19381
- throw new Error(`plugin ${name} no registered constructor`);
19350
+ throw new Error(`The plugin '${name}' does not have a registered constructor.`);
19382
19351
  }
19383
19352
  const engine = composition.getEngine();
19384
19353
  const item = new CTRL(engine, props, composition);
19385
19354
  item.composition = composition;
19386
19355
  if (!(item instanceof VFXItem)) {
19387
- throw new Error(`plugin ${name} invalid constructor type`);
19356
+ throw new Error(`The plugin '${name}' invalid constructor type.`);
19388
19357
  }
19389
19358
  return item;
19390
19359
  }
@@ -19437,7 +19406,7 @@ class PluginSystem {
19437
19406
  this.plugins = Object.keys(loaders).map((name)=>{
19438
19407
  const CTRL = pluginLoaderMap[name];
19439
19408
  if (!CTRL) {
19440
- throw new Error(`plugin '${name}' not found.` + getPluginUsageInfo(name));
19409
+ throw new Error(`The plugin '${name}' not found.` + getPluginUsageInfo(name));
19441
19410
  }
19442
19411
  const loader = new CTRL();
19443
19412
  loader.name = name;
@@ -19633,7 +19602,7 @@ class SerializationHelper {
19633
19602
  }
19634
19603
  static deserializeProperty(property, engine, level, type) {
19635
19604
  if (level > 14) {
19636
- console.error('序列化数据的内嵌对象层数大于上限');
19605
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19637
19606
  return;
19638
19607
  }
19639
19608
  // 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
@@ -19664,7 +19633,7 @@ class SerializationHelper {
19664
19633
  static deserializePropertyAsync(property, engine, level, type) {
19665
19634
  return _async_to_generator(function*() {
19666
19635
  if (level > 14) {
19667
- console.error('序列化数据的内嵌对象层数大于上限');
19636
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19668
19637
  return;
19669
19638
  }
19670
19639
  if (isArray(property)) {
@@ -19695,7 +19664,7 @@ class SerializationHelper {
19695
19664
  }
19696
19665
  static serializeObjectProperty(objectProperty, serializedData, level) {
19697
19666
  if (level > 14) {
19698
- console.error('序列化数据的内嵌对象层数大于上限');
19667
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19699
19668
  return;
19700
19669
  }
19701
19670
  if (!serializedData) {
@@ -19726,7 +19695,7 @@ class SerializationHelper {
19726
19695
  }
19727
19696
  static serializeArrayProperty(arrayProperty, serializedData, level) {
19728
19697
  if (level > 14) {
19729
- console.error('序列化数据的内嵌对象层数大于上限');
19698
+ console.error('The nested object layers of the serialized data exceed the maximum limit.');
19730
19699
  return;
19731
19700
  }
19732
19701
  if (!serializedData) {
@@ -19768,7 +19737,7 @@ class SerializationHelper {
19768
19737
  let effectsObject;
19769
19738
  const effectsObjectData = this.findData(guid);
19770
19739
  if (!effectsObjectData) {
19771
- console.error('未找到 uuid: ' + guid + '的对象数据');
19740
+ console.error(`Object data with uuid: ${guid} not found.`);
19772
19741
  return undefined;
19773
19742
  }
19774
19743
  switch(effectsObjectData.dataType){
@@ -19790,7 +19759,7 @@ class SerializationHelper {
19790
19759
  }
19791
19760
  }
19792
19761
  if (!effectsObject) {
19793
- console.error('未找到 DataType: ' + effectsObjectData.dataType + '的构造函数');
19762
+ console.error(`Constructor for DataType: ${effectsObjectData.dataType} not found.`);
19794
19763
  return undefined;
19795
19764
  }
19796
19765
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -19809,12 +19778,12 @@ class SerializationHelper {
19809
19778
  const effectsObjectData = _this.findData(guid);
19810
19779
  if (!effectsObjectData) {
19811
19780
  if (!_this.engine.database) {
19812
- console.error('未找到 uuid: ' + guid + '的对象数据');
19781
+ console.error(`Object data with uuid: ${guid} not found.`);
19813
19782
  return undefined;
19814
19783
  }
19815
19784
  effectsObject = yield _this.engine.database.loadGUID(guid);
19816
19785
  if (!effectsObject) {
19817
- console.error('未找到 uuid: ' + guid + '的磁盘数据');
19786
+ console.error(`Disk data with uuid: ${guid} not found.`);
19818
19787
  return undefined;
19819
19788
  }
19820
19789
  _this.engine.addInstance(effectsObject);
@@ -19839,7 +19808,7 @@ class SerializationHelper {
19839
19808
  }
19840
19809
  }
19841
19810
  if (!effectsObject) {
19842
- console.error('未找到 DataType: ' + effectsObjectData.dataType + '的构造函数');
19811
+ console.error(`Constructor for DataType: ${effectsObjectData.dataType} not found.`);
19843
19812
  return undefined;
19844
19813
  }
19845
19814
  effectsObject.setInstanceId(effectsObjectData.id);
@@ -21236,7 +21205,7 @@ const standardVersion = /^(\d+)\.(\d+)$/;
21236
21205
  let reverseParticle = false;
21237
21206
  function getStandardJSON(json) {
21238
21207
  if (!json || typeof json !== 'object') {
21239
- throw Error('expect a json object');
21208
+ throw new Error('Invalid input: Expected a JSON object.');
21240
21209
  }
21241
21210
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
21242
21211
  version22Migration(json);
@@ -21257,7 +21226,7 @@ function getStandardJSON(json) {
21257
21226
  }
21258
21227
  return json;
21259
21228
  }
21260
- throw Error('invalid json version ' + json.version);
21229
+ throw new Error(`Invalid JSON version: ${json.version}.`);
21261
21230
  }
21262
21231
  let currentVersion = '1.0';
21263
21232
  function getStandardJSONFromV0(json) {
@@ -21343,7 +21312,7 @@ function getStandardImage(image, index, imageTags) {
21343
21312
  } else if (image && image.sourceType) {
21344
21313
  return image;
21345
21314
  }
21346
- throw Error('invalid image type');
21315
+ throw new Error('Invalid image type.');
21347
21316
  }
21348
21317
  function getStandardComposition(composition, opt = {}) {
21349
21318
  var _composition_meta;
@@ -21610,7 +21579,7 @@ function _combineImageTemplate() {
21610
21579
  image = url;
21611
21580
  }
21612
21581
  if (!image) {
21613
- throw new Error('image not provided.');
21582
+ throw new Error('Image not provided.');
21614
21583
  }
21615
21584
  if (!template) {
21616
21585
  return image;
@@ -21684,7 +21653,7 @@ let seed = 1;
21684
21653
  cancelLoading = true;
21685
21654
  _this.removeTimer(loadTimer);
21686
21655
  const totalTime = performance.now() - startTime;
21687
- reject(new Error(`Load time out: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}`));
21656
+ reject(new Error(`Load time out: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}.`));
21688
21657
  }, _this.timeout * 1000);
21689
21658
  _this.timers.push(loadTimer);
21690
21659
  });
@@ -21696,7 +21665,7 @@ let seed = 1;
21696
21665
  timeInfos.push(`[${label}: ${(performance.now() - st).toFixed(2)}]`);
21697
21666
  return result;
21698
21667
  } catch (e) {
21699
- throw new Error(`Load error in ${label}, ${e}`);
21668
+ throw new Error(`Load error in ${label}, ${e}.`);
21700
21669
  }
21701
21670
  }
21702
21671
  throw new Error('Load canceled.');
@@ -21767,7 +21736,7 @@ let seed = 1;
21767
21736
  yield hookTimeInfo('processPlugins', ()=>pluginSystem.loadResources(scene, _this.options));
21768
21737
  }
21769
21738
  const totalTime = performance.now() - startTime;
21770
- logger.info(`Load asset: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}`);
21739
+ logger.info(`Load asset: totalTime: ${totalTime.toFixed(4)}ms ${timeInfos.join(' ')}, url: ${assetUrl}.`);
21771
21740
  window.clearTimeout(loadTimer);
21772
21741
  _this.removeTimer(loadTimer);
21773
21742
  scene.totalTime = totalTime;
@@ -21839,7 +21808,7 @@ let seed = 1;
21839
21808
  if (passRenderLevel(bin.renderLevel, renderLevel)) {
21840
21809
  return _this.loadBins(new URL(bin.url, baseUrl).href);
21841
21810
  }
21842
- throw new Error(`Invalid bins source: ${JSON.stringify(bins)}`);
21811
+ throw new Error(`Invalid bins source: ${JSON.stringify(bins)}.`);
21843
21812
  });
21844
21813
  return Promise.all(jobs);
21845
21814
  })();
@@ -21856,7 +21825,7 @@ let seed = 1;
21856
21825
  if (font.fontURL && !AssetManager.fonts.has(font.fontFamily)) {
21857
21826
  if (!isValidFontFamily(font.fontFamily)) {
21858
21827
  // 在所有设备上提醒开发者
21859
- console.warn(`Risky font family: ${font.fontFamily}`);
21828
+ console.warn(`Risky font family: ${font.fontFamily}.`);
21860
21829
  }
21861
21830
  try {
21862
21831
  const url = new URL(font.fontURL, _this.baseUrl).href;
@@ -21868,7 +21837,7 @@ let seed = 1;
21868
21837
  AssetManager.fonts.add(font.fontFamily);
21869
21838
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21870
21839
  } catch (e) {
21871
- logger.warn(`Invalid font family or font source: ${JSON.stringify(font.fontURL)}`);
21840
+ logger.warn(`Invalid font family or font source: ${JSON.stringify(font.fontURL)}.`);
21872
21841
  }
21873
21842
  }
21874
21843
  }));
@@ -21910,7 +21879,7 @@ let seed = 1;
21910
21879
  }
21911
21880
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21912
21881
  } catch (e) {
21913
- throw new Error(`Failed to load. Check the template or if the URL is ${isVideo ? 'video' : 'image'} type, URL: ${url}, Error: ${e.message}`);
21882
+ throw new Error(`Failed to load. Check the template or if the URL is ${isVideo ? 'video' : 'image'} type, URL: ${url}, Error: ${e.message}.`);
21914
21883
  }
21915
21884
  }
21916
21885
  } else if ('compressed' in img && useCompressedTexture && compressedTexture) {
@@ -21959,9 +21928,9 @@ let seed = 1;
21959
21928
  }
21960
21929
  if ('mipmaps' in texOpts) {
21961
21930
  try {
21962
- return yield deserializeMipmapTexture(texOpts, bins, jsonScene.bins, engine);
21931
+ return yield deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins);
21963
21932
  } catch (e) {
21964
- throw new Error(`load texture ${idx} fails, error message: ${e}`);
21933
+ throw new Error(`Load texture ${idx} fails, error message: ${e}.`);
21965
21934
  }
21966
21935
  }
21967
21936
  const { source } = texOpts;
@@ -21978,7 +21947,7 @@ let seed = 1;
21978
21947
  tex.dataType = DataType.Texture;
21979
21948
  return tex.sourceType === exports.TextureSourceType.compressed ? tex : _extends({}, tex, texOpts);
21980
21949
  }
21981
- throw new Error(`Invalid texture source: ${source}`);
21950
+ throw new Error(`Invalid texture source: ${source}.`);
21982
21951
  }));
21983
21952
  return Promise.all(jobs);
21984
21953
  })();
@@ -22089,7 +22058,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
22089
22058
  magFilter: glContext.NEAREST
22090
22059
  };
22091
22060
  }
22092
- throw new Error('Invalid texture options');
22061
+ throw new Error('Invalid texture options.');
22093
22062
  }
22094
22063
 
22095
22064
  const tmpScale = new Vector3(1, 1, 1);
@@ -22396,7 +22365,7 @@ let listOrder = 0;
22396
22365
  if (itemProps.type === ItemType.composition) {
22397
22366
  const refId = sourceItemData.content.options.refId;
22398
22367
  if (!this.refCompositions.get(refId)) {
22399
- throw new Error('Invalid Ref Composition id: ' + refId);
22368
+ throw new Error(`Invalid ref composition id: ${refId}.`);
22400
22369
  }
22401
22370
  const ref = this.getContent(this.refCompositions.get(refId));
22402
22371
  if (!this.refCompositionProps.has(refId)) {
@@ -22490,7 +22459,7 @@ let listOrder = 0;
22490
22459
  const { jsonScene, renderLevel, textureOptions, pluginSystem, totalTime } = scene;
22491
22460
  const { compositions, imgUsage, compositionId } = jsonScene;
22492
22461
  if (!textureOptions) {
22493
- throw new Error('scene.textures expected');
22462
+ throw new Error('scene.textures expected.');
22494
22463
  }
22495
22464
  const cachedTextures = textureOptions;
22496
22465
  for (const comp of compositions){
@@ -22501,7 +22470,7 @@ let listOrder = 0;
22501
22470
  }
22502
22471
  }
22503
22472
  if (!this.composition) {
22504
- throw new Error('Invalid composition id: ' + compositionId);
22473
+ throw new Error(`Invalid composition id: ${compositionId}.`);
22505
22474
  }
22506
22475
  this.jsonScene = jsonScene;
22507
22476
  this.renderLevel = renderLevel;
@@ -22871,7 +22840,7 @@ let listOrder = 0;
22871
22840
  }
22872
22841
  parent.children.push(item);
22873
22842
  } else {
22874
- throw Error('元素引用了不存在的元素,请检查数据');
22843
+ throw new Error('The element references a non-existent element, please check the data.');
22875
22844
  }
22876
22845
  }
22877
22846
  }
@@ -23102,7 +23071,7 @@ let listOrder = 0;
23102
23071
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
23103
23072
  */ translateByPixel(x, y) {
23104
23073
  if (!this.renderer) {
23105
- console.warn('Can not translate position when container not assigned');
23074
+ console.warn('Renderer not assigned. Operation aborted.');
23106
23075
  return;
23107
23076
  }
23108
23077
  this.rootItem.translateByPixel(x, y);
@@ -23116,7 +23085,7 @@ let listOrder = 0;
23116
23085
  * @param y - y 坐标
23117
23086
  */ setPositionByPixel(x, y) {
23118
23087
  if (!this.renderer) {
23119
- console.warn('Can not setPosition when container not assigned');
23088
+ console.warn('Renderer not assigned. Operation aborted.');
23120
23089
  return;
23121
23090
  }
23122
23091
  this.rootItem.setPositionByPixel(x, y);
@@ -23203,11 +23172,11 @@ let listOrder = 0;
23203
23172
  /**
23204
23173
  * 销毁状态位
23205
23174
  */ this.destroyed = false;
23175
+ this.postLoaders = [];
23206
23176
  /**
23207
23177
  * 合成暂停/播放 标识
23208
23178
  */ this.paused = false;
23209
23179
  this.lastVideoUpdateTime = 0;
23210
- this.postLoaders = [];
23211
23180
  const { reusable = false, speed = 1, baseRenderOrder = 0, renderer, onPlayerPause, onMessageItem, onEnd, event, width, height } = props;
23212
23181
  this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
23213
23182
  scene.jsonScene.imgUsage = undefined;
@@ -23431,7 +23400,7 @@ let listOrder = 0;
23431
23400
  info.push(`Tex ${this.textures.length}`);
23432
23401
  }
23433
23402
  if (info.length > 0) {
23434
- logger.warn(`Release GPU memory: ${info.join(', ')}`);
23403
+ logger.warn(`Release GPU memory: ${info.join(', ')}.`);
23435
23404
  }
23436
23405
  this.renderPasses.forEach((pass)=>pass.dispose());
23437
23406
  this.meshes.forEach((mesh)=>mesh.dispose());
@@ -23556,7 +23525,7 @@ let listOrder = 0;
23556
23525
  * @param ticker - 定时器类
23557
23526
  */ add(ticker) {
23558
23527
  if (typeof ticker !== 'function') {
23559
- throw new Error('Ticker: The tick object must implement the tick method.');
23528
+ throw new Error('The tick object must implement the tick method.');
23560
23529
  }
23561
23530
  this.tickers.push(ticker);
23562
23531
  }
@@ -23723,7 +23692,7 @@ exports.compatibleVert = compatible_vert;
23723
23692
  exports.createCopyShader = createCopyShader;
23724
23693
  exports.createGLContext = createGLContext;
23725
23694
  exports.createKeyFrameMeta = createKeyFrameMeta;
23726
- exports.createShaderWithMarcos = createShaderWithMarcos;
23695
+ exports.createShaderWithMacros = createShaderWithMacros;
23727
23696
  exports.createShape = createShape;
23728
23697
  exports.createVFXItem = createVFXItem;
23729
23698
  exports.createValueGetter = createValueGetter;
@@ -23827,7 +23796,6 @@ exports.setMaskMode = setMaskMode;
23827
23796
  exports.setMaxSpriteMeshItemCount = setMaxSpriteMeshItemCount;
23828
23797
  exports.setRayFromCamera = setRayFromCamera;
23829
23798
  exports.setSideMode = setSideMode;
23830
- exports.setSpriteMeshMaxFragmentTextures = setSpriteMeshMaxFragmentTextures;
23831
23799
  exports.setSpriteMeshMaxItemCountByGPU = setSpriteMeshMaxItemCountByGPU;
23832
23800
  exports.sortByOrder = sortByOrder;
23833
23801
  exports.spec = index$1;