@galacean/effects-core 2.0.0-alpha.33 → 2.0.0-alpha.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.33
6
+ * Version: v2.0.0-alpha.35
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -4782,7 +4782,9 @@ __decorate([
4782
4782
  // }
4783
4783
  /**
4784
4784
  * 在每次设置 enabled 为 true 时触发
4785
- */ _proto.onEnable = function onEnable() {};
4785
+ */ _proto.onEnable = function onEnable() {
4786
+ // OVERRIDE
4787
+ };
4786
4788
  /**
4787
4789
  * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
4788
4790
  */ _proto.start = function start() {
@@ -7651,55 +7653,6 @@ function getPreMultiAlpha(blending) {
7651
7653
  return 1;
7652
7654
  }
7653
7655
  }
7654
- var _obj$6;
7655
- var downgradeKeywords = (_obj$6 = {}, _obj$6[ShaderType.vertex] = {
7656
- in: "attribute",
7657
- out: "varying"
7658
- }, _obj$6[ShaderType.fragment] = {
7659
- in: "varying"
7660
- }, _obj$6);
7661
- /**
7662
- * 生成 shader,检测到 WebGL1 上下文会降级
7663
- * @param macros - 宏定义数组
7664
- * @param shader - 原始 shader 文本
7665
- * @param shaderType - shader 类型
7666
- * @return 去除版本号的 shader 文本
7667
- */ function createShaderWithMacros(macros, shader, shaderType, level) {
7668
- var ret = [];
7669
- var header = "";
7670
- // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7671
- ret.push("#define GE_RUNTIME");
7672
- if (macros) {
7673
- macros.forEach(function(param) {
7674
- var key = param[0], value = param[1];
7675
- if (value === true) {
7676
- ret.push("#define " + key);
7677
- } else if (Number.isFinite(value)) {
7678
- ret.push("#define " + key + " " + value);
7679
- }
7680
- });
7681
- header = ret.length ? ret.join("\n") + "\n" : "";
7682
- }
7683
- var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
7684
- var GL_TYPE = "WEBGL" + level;
7685
- header = header + ("\n#ifndef " + GL_TYPE + "\n#define " + GL_TYPE + "\n#endif");
7686
- var fullShader = header + "\n" + shader;
7687
- // 判断shader是否带有版本头
7688
- var match = fullShader.match(versionTag);
7689
- var version = match ? match[0] : "";
7690
- if (version && version.includes("300")) {
7691
- var reg = new RegExp("" + version, "g");
7692
- // 带版本头且level为1,降级
7693
- if (level === 1) {
7694
- fullShader = fullShader.replace(/\b(in|out)\b/g, function(str) {
7695
- var _downgradeKeywords_shaderType_str;
7696
- return (_downgradeKeywords_shaderType_str = downgradeKeywords[shaderType][str]) != null ? _downgradeKeywords_shaderType_str : str;
7697
- });
7698
- }
7699
- fullShader = fullShader.replace(reg, "\n");
7700
- }
7701
- return fullShader;
7702
- }
7703
7656
  function setBlendMode(material, blendMode) {
7704
7657
  switch(blendMode){
7705
7658
  case undefined:
@@ -8402,7 +8355,7 @@ function _loadMipmapImage() {
8402
8355
  return _loadMipmapImage.apply(this, arguments);
8403
8356
  }
8404
8357
 
8405
- var seed$9 = 1;
8358
+ var seed$8 = 1;
8406
8359
  /**
8407
8360
  * Texture 抽象类
8408
8361
  */ var Texture = /*#__PURE__*/ function(EffectsObject) {
@@ -8411,7 +8364,7 @@ var seed$9 = 1;
8411
8364
  var _this;
8412
8365
  _this = EffectsObject.call(this, engine) || this;
8413
8366
  _this.destroyed = false;
8414
- _this.id = "Tex" + seed$9++;
8367
+ _this.id = "Tex" + seed$8++;
8415
8368
  return _this;
8416
8369
  }
8417
8370
  var _proto = Texture.prototype;
@@ -9039,7 +8992,7 @@ var MaterialRenderType;
9039
8992
  /**
9040
8993
  * 用于设置材质默认名称的自增序号
9041
8994
  * @internal
9042
- */ var seed$8 = 1;
8995
+ */ var seed$7 = 1;
9043
8996
  /**
9044
8997
  * Material 抽象类
9045
8998
  */ var Material = /*#__PURE__*/ function(EffectsObject) {
@@ -9052,14 +9005,14 @@ var MaterialRenderType;
9052
9005
  _this.destroyed = false;
9053
9006
  _this.initialized = false;
9054
9007
  if (props) {
9055
- var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$8++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
9008
+ var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$7++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
9056
9009
  _this.name = name;
9057
9010
  _this.renderType = renderType; // TODO 没有地方用到
9058
9011
  _this.shaderSource = shader;
9059
9012
  _this.props = props;
9060
9013
  _this.uniformSemantics = _extends({}, uniformSemantics); // TODO 废弃,待移除
9061
9014
  } else {
9062
- _this.name = "Material" + seed$8++;
9015
+ _this.name = "Material" + seed$7++;
9063
9016
  _this.renderType = 0;
9064
9017
  }
9065
9018
  return _this;
@@ -9384,29 +9337,6 @@ function vecFill(out, number) {
9384
9337
  }
9385
9338
  return out;
9386
9339
  }
9387
- function vecAssign(out, a, count, start) {
9388
- if (start === void 0) start = 0;
9389
- for(var i = 0; i < count; i++){
9390
- out[i] = a[i + start];
9391
- }
9392
- return out;
9393
- }
9394
- function vecNormalize(out, a) {
9395
- var _Math;
9396
- if (arguments.length === 1) {
9397
- a = out;
9398
- out = [];
9399
- }
9400
- var ap = a;
9401
- var sum = (_Math = Math).hypot.apply(_Math, [].concat(ap));
9402
- if (sum === 0) {
9403
- return vecAssign(out, ap, ap.length);
9404
- }
9405
- for(var i = 0; i < ap.length; i++){
9406
- out[i] = ap[i] / sum;
9407
- }
9408
- return out;
9409
- }
9410
9340
  function vecMulCombine(out, a, b) {
9411
9341
  if (a && b) {
9412
9342
  for(var i = 0, len = a.length; i < len; i++){
@@ -9496,10 +9426,6 @@ function numberToFix(a, fixed) {
9496
9426
  var base = Math.pow(10, fixed);
9497
9427
  return Math.floor(a * base) / base;
9498
9428
  }
9499
- function pointOnLine(x1, y1, x2, y2, x3, y3) {
9500
- var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;
9501
- return det1 > -0.001 && det1 < 0.001;
9502
- }
9503
9429
 
9504
9430
  function _is_native_reflect_construct() {
9505
9431
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
@@ -10942,21 +10868,16 @@ Shader = __decorate([
10942
10868
 
10943
10869
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
10944
10870
  var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
10945
- var COPY_VERTEX_SHADER = "\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
10946
- var COPY_FRAGMENT_SHADER = "precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";
10871
+ var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
10872
+ var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
10947
10873
  function createCopyShader(level, writeDepth) {
10948
10874
  var webgl2 = level === 2;
10949
- var version = webgl2 ? "#version 300 es" : "";
10950
10875
  return {
10951
10876
  name: EFFECTS_COPY_MESH_NAME,
10952
- vertex: version + "\n" + COPY_VERTEX_SHADER,
10953
- fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10877
+ vertex: COPY_VERTEX_SHADER,
10878
+ fragment: COPY_FRAGMENT_SHADER,
10954
10879
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
10955
10880
  macros: [
10956
- [
10957
- "WEBGL2",
10958
- !!webgl2
10959
- ],
10960
10881
  [
10961
10882
  "DEPTH_TEXTURE",
10962
10883
  !!writeDepth
@@ -11124,7 +11045,7 @@ function generateEmptyTypedArray(type) {
11124
11045
  return new Float32Array(0);
11125
11046
  }
11126
11047
 
11127
- var seed$7 = 1;
11048
+ var seed$6 = 1;
11128
11049
  /**
11129
11050
  * Mesh 抽象类
11130
11051
  */ var Mesh = /*#__PURE__*/ function(RendererComponent) {
@@ -11136,14 +11057,14 @@ var seed$7 = 1;
11136
11057
  _this.visible = true;
11137
11058
  if (props) {
11138
11059
  var material = props.material, geometry = props.geometry, _props_name = props.name, name = _props_name === void 0 ? "<unnamed>" : _props_name, _props_priority = props.priority, priority = _props_priority === void 0 ? 0 : _props_priority, _props_worldMatrix = props.worldMatrix, worldMatrix = _props_worldMatrix === void 0 ? Matrix4.fromIdentity() : _props_worldMatrix;
11139
- _this.id = "Mesh" + seed$7++;
11060
+ _this.id = "Mesh" + seed$6++;
11140
11061
  _this.name = name;
11141
11062
  _this.geometry = geometry;
11142
11063
  _this.material = material;
11143
11064
  _this.priority = priority;
11144
11065
  _this.worldMatrix = worldMatrix;
11145
11066
  } else {
11146
- _this.id = "Mesh" + seed$7++;
11067
+ _this.id = "Mesh" + seed$6++;
11147
11068
  _this.name = "<unnamed>";
11148
11069
  _this.worldMatrix = Matrix4.fromIdentity();
11149
11070
  _this._priority = 0;
@@ -11348,7 +11269,7 @@ var RenderPassDestroyAttachmentType;
11348
11269
  * 强制销毁
11349
11270
  */ RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
11350
11271
  })(RenderPassDestroyAttachmentType || (RenderPassDestroyAttachmentType = {}));
11351
- var seed$6 = 1;
11272
+ var seed$5 = 1;
11352
11273
  /**
11353
11274
  * RenderPass 抽象类
11354
11275
  */ var RenderPass = /*#__PURE__*/ function() {
@@ -11358,7 +11279,7 @@ var seed$6 = 1;
11358
11279
  */ this.attachments = [];
11359
11280
  this.destroyed = false;
11360
11281
  this.initialized = false;
11361
- var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$6++ : _options_name, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _options_priority = options.priority, priority = _options_priority === void 0 ? 0 : _options_priority, _options_meshOrder = options.meshOrder, meshOrder = _options_meshOrder === void 0 ? OrderType.ascending : _options_meshOrder, _options_meshes = options.meshes, meshes = _options_meshes === void 0 ? [] : _options_meshes, _options_delegate = options.delegate, delegate = _options_delegate === void 0 ? {} : _options_delegate;
11282
+ var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$5++ : _options_name, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _options_priority = options.priority, priority = _options_priority === void 0 ? 0 : _options_priority, _options_meshOrder = options.meshOrder, meshOrder = _options_meshOrder === void 0 ? OrderType.ascending : _options_meshOrder, _options_meshes = options.meshes, meshes = _options_meshes === void 0 ? [] : _options_meshes, _options_delegate = options.delegate, delegate = _options_delegate === void 0 ? {} : _options_delegate;
11362
11283
  this.name = name;
11363
11284
  this.renderer = renderer;
11364
11285
  this.priority = priority;
@@ -11578,10 +11499,12 @@ var seed$6 = 1;
11578
11499
  */ _proto.getDepthAttachment = function getDepthAttachment() {
11579
11500
  var framebuffer = this.framebuffer;
11580
11501
  if (framebuffer) {
11502
+ var depthTexture = framebuffer.getDepthTexture();
11503
+ var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
11581
11504
  return {
11582
11505
  storageType: framebuffer.depthStencilStorageType,
11583
11506
  storage: framebuffer.depthStorage,
11584
- texture: framebuffer.getDepthTexture() ? this.getDepthTexture(framebuffer.getDepthTexture(), framebuffer.externalStorage) : undefined
11507
+ texture: texture
11585
11508
  };
11586
11509
  }
11587
11510
  };
@@ -11590,10 +11513,12 @@ var seed$6 = 1;
11590
11513
  */ _proto.getStencilAttachment = function getStencilAttachment() {
11591
11514
  var framebuffer = this.framebuffer;
11592
11515
  if (framebuffer) {
11516
+ var stencilTexture = framebuffer.getStencilTexture();
11517
+ var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
11593
11518
  return {
11594
11519
  storageType: framebuffer.depthStencilStorageType,
11595
11520
  storage: framebuffer.stencilStorage,
11596
- texture: framebuffer.getStencilTexture() ? this.getStencilTexture(framebuffer.getStencilTexture(), framebuffer.externalStorage) : undefined
11521
+ texture: texture
11597
11522
  };
11598
11523
  }
11599
11524
  };
@@ -11705,11 +11630,7 @@ var seed$6 = 1;
11705
11630
 
11706
11631
  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;}";
11707
11632
 
11708
- 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";
11709
-
11710
- var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11711
-
11712
- 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);}";
11633
+ var itemFrameFrag = "#version 100\nprecision highp float;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;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}";
11713
11634
 
11714
11635
  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.;}";
11715
11636
 
@@ -11717,13 +11638,13 @@ var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3
11717
11638
 
11718
11639
  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;}";
11719
11640
 
11720
- 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";
11641
+ var particleFrag = "#version 100\nprecision mediump float;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;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying 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\nvarying vec4 vTexCoordBlend;\n#endif\nvarying 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(){gl_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);gl_FragColor=color;}\n#endif\n";
11721
11642
 
11722
- 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}}";
11643
+ var particleVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\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\nattribute float aSeed;varying 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.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec3 aVel;attribute vec3 aRot;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying 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\nvarying float vLife;varying vec4 vColor;varying 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}}";
11723
11644
 
11724
- var trailVert = "#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 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.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nout float vLife;out vec2 vTexCoord;out vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
11645
+ var trailVert = "#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\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\nattribute float aSeed;varying 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.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
11725
11646
 
11726
- var value = "#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.;}";
11647
+ var value = "#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\nattribute float aSeed;varying 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.;}";
11727
11648
 
11728
11649
  var valueDefine = "#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";
11729
11650
 
@@ -11741,6 +11662,159 @@ var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _M
11741
11662
 
11742
11663
  var thresholdFrag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}";
11743
11664
 
11665
+ var shaderLib = {};
11666
+ var ShaderFactory = /*#__PURE__*/ function() {
11667
+ function ShaderFactory() {}
11668
+ ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
11669
+ if (shaderLib[includeName]) {
11670
+ logger.warn('The "' + includeName + '" shader include already exist.');
11671
+ }
11672
+ shaderLib[includeName] = includeSource;
11673
+ };
11674
+ ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
11675
+ delete shaderLib[includeName];
11676
+ };
11677
+ ShaderFactory.unRegisterAllIncludes = function unRegisterAllIncludes() {
11678
+ Object.keys(shaderLib).forEach(function(key) {
11679
+ ShaderFactory.unRegisterInclude(key);
11680
+ });
11681
+ };
11682
+ /**
11683
+ * 生成 shader,检测到 WebGL1 上下文会降级
11684
+ * @param macros - 宏定义数组
11685
+ * @param shader - 原始 shader 文本
11686
+ * @param shaderType - shader 类型
11687
+ * @return 去除版本号的 shader 文本
11688
+ */ ShaderFactory.genFinalShaderCode = function genFinalShaderCode(options) {
11689
+ var level = options.level, shaderType = options.shaderType, shader = options.shader, macros = options.macros, removeVersion = options.removeVersion;
11690
+ var macroString = ShaderFactory.genMacroString(level, macros);
11691
+ var versionString = ShaderFactory.genShaderVersion(level);
11692
+ var source = ShaderFactory.parseIncludes(shader);
11693
+ var isVersion300 = ShaderFactory.isVersion300(source);
11694
+ source = ShaderFactory.removeWebGLVersion(source);
11695
+ if (level === 2 && !isVersion300) {
11696
+ source = ShaderFactory.convertTo300(source, shaderType === ShaderType.fragment);
11697
+ }
11698
+ if (removeVersion) {
11699
+ return macroString + source;
11700
+ }
11701
+ return versionString + macroString + source;
11702
+ };
11703
+ /**
11704
+ * Convert lower GLSL version to GLSL 300 es.
11705
+ * @param source - code
11706
+ * @param isFragment - Whether it is a fragment shader.
11707
+ * */ ShaderFactory.convertTo300 = function convertTo300(source, isFragment) {
11708
+ source = source.replace(/\bvarying\b/g, isFragment ? "in" : "out");
11709
+ source = source.replace(/\btexture(2D|Cube)\b/g, "texture");
11710
+ // Remove extensions
11711
+ var regex = /#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;
11712
+ source = source.replace(regex, "");
11713
+ if (isFragment) {
11714
+ source = source.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
11715
+ source = source.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
11716
+ source = source.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
11717
+ if (!ShaderFactory.has300Output(source)) {
11718
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(source);
11719
+ if (isMRT) {
11720
+ source = source.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
11721
+ var result = source.match(/\bgl_FragData\[.+?\]/g);
11722
+ if (result) {
11723
+ source = ShaderFactory.replaceMRTShader(source, result);
11724
+ }
11725
+ } else {
11726
+ source = source.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
11727
+ source = source.replace(/\bgl_FragColor\b/g, "glFragColor");
11728
+ }
11729
+ }
11730
+ } else {
11731
+ source = source.replace(/\battribute\b/g, "in");
11732
+ }
11733
+ return source;
11734
+ };
11735
+ ShaderFactory.parseIncludes = function parseIncludes(source, regex) {
11736
+ if (regex === void 0) regex = /#include <(.+)>/gm;
11737
+ var match;
11738
+ while((match = regex.exec(source)) !== null){
11739
+ var shaderName = match[1];
11740
+ var replace = shaderLib[shaderName];
11741
+ if (replace === undefined) {
11742
+ throw new Error("Can't find include shader name " + shaderName);
11743
+ }
11744
+ source = source.replace(match[0], replace);
11745
+ }
11746
+ return source;
11747
+ };
11748
+ ShaderFactory.genMacroString = function genMacroString(level, macros, addRuntimeMacro) {
11749
+ if (addRuntimeMacro === void 0) addRuntimeMacro = true;
11750
+ var macroList = [];
11751
+ var webGLVersion = "WEBGL" + level;
11752
+ macroList.push("#ifndef " + webGLVersion);
11753
+ macroList.push("#define " + webGLVersion);
11754
+ macroList.push("#endif");
11755
+ if (addRuntimeMacro) {
11756
+ macroList.push("#define GE_RUNTIME");
11757
+ }
11758
+ if (macros && macros.length) {
11759
+ macros.forEach(function(param) {
11760
+ var key = param[0], value = param[1];
11761
+ if (value === true) {
11762
+ macroList.push("#define " + key);
11763
+ } else if (Number.isFinite(value)) {
11764
+ macroList.push("#define " + key + " " + value);
11765
+ }
11766
+ });
11767
+ }
11768
+ if (macroList.length) {
11769
+ return macroList.join("\n") + "\n";
11770
+ }
11771
+ return "";
11772
+ };
11773
+ ShaderFactory.genShaderVersion = function genShaderVersion(level) {
11774
+ if (level === 1) {
11775
+ return "#version 100\n";
11776
+ }
11777
+ return "#version 300 es\n";
11778
+ };
11779
+ ShaderFactory.isVersion300 = function isVersion300(source) {
11780
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11781
+ var match = source.match(versionTag);
11782
+ var version = match ? match[0] : "";
11783
+ return version.includes("300");
11784
+ };
11785
+ ShaderFactory.removeWebGLVersion = function removeWebGLVersion(source) {
11786
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11787
+ var match = source.match(versionTag);
11788
+ if (match) {
11789
+ return source.replace(match[0], "");
11790
+ }
11791
+ return source;
11792
+ };
11793
+ ShaderFactory.has300Output = function has300Output(fragmentShader) {
11794
+ // [layout(location = 0)] out [highp] vec4 [color];
11795
+ var fragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;
11796
+ return fragReg.test(fragmentShader);
11797
+ };
11798
+ ShaderFactory.replaceMRTShader = function replaceMRTShader(source, result) {
11799
+ var mrtIndexSet = new Set();
11800
+ var declaration = "";
11801
+ for(var i = 0; i < result.length; i++){
11802
+ var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
11803
+ if (res) {
11804
+ mrtIndexSet.add(res[1]);
11805
+ }
11806
+ }
11807
+ mrtIndexSet.forEach(function(index) {
11808
+ declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
11809
+ });
11810
+ declaration += "void main(";
11811
+ source = source.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
11812
+ source = source.replace(/void\s+?main\s*\(/g, declaration);
11813
+ return source;
11814
+ };
11815
+ return ShaderFactory;
11816
+ }();
11817
+
11744
11818
  // Bloom 阈值 Pass
11745
11819
  var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
11746
11820
  _inherits(BloomThresholdPass, RenderPass);
@@ -12038,7 +12112,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
12038
12112
  }(RenderPass);
12039
12113
 
12040
12114
  var RENDER_PASS_NAME_PREFIX = "_effects_default_";
12041
- var seed$5 = 1;
12115
+ var seed$4 = 1;
12042
12116
  /**
12043
12117
  * RenderFrame 抽象类
12044
12118
  */ var RenderFrame = /*#__PURE__*/ function() {
@@ -12192,7 +12266,7 @@ var seed$5 = 1;
12192
12266
  }
12193
12267
  this.semantics = new SemanticMap(options.semantics);
12194
12268
  this.clearAction = clearAction;
12195
- this.name = "RenderFrame" + seed$5++;
12269
+ this.name = "RenderFrame" + seed$4++;
12196
12270
  var firstRP = renderPasses[0];
12197
12271
  this.emptyTexture = generateWhiteTexture(engine);
12198
12272
  this.transparentTexture = generateTransparentTexture(engine);
@@ -12501,6 +12575,9 @@ var seed$5 = 1;
12501
12575
  _proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
12502
12576
  var info = this.renderPassInfoMap.get(renderPass);
12503
12577
  var priority = mesh.priority;
12578
+ if (!info) {
12579
+ return;
12580
+ }
12504
12581
  if (renderPass.meshes.length === 0) {
12505
12582
  info.listStart = info.listEnd = priority;
12506
12583
  } else {
@@ -12675,6 +12752,8 @@ var seed$5 = 1;
12675
12752
  * 创建拷贝 RenderPass 用到的 Mesh 对象
12676
12753
  * @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
12677
12754
  */ _proto.createCopyMesh = function createCopyMesh(semantics) {
12755
+ var // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12756
+ _this_renderer_getShaderLibrary;
12678
12757
  var name = EFFECTS_COPY_MESH_NAME;
12679
12758
  var engine = this.renderer.engine;
12680
12759
  var geometry = Geometry.create(engine, {
@@ -12699,8 +12778,7 @@ var seed$5 = 1;
12699
12778
  drawCount: 4
12700
12779
  });
12701
12780
  var shader = createCopyShader(engine.gpuCapability.level, !!(semantics == null ? void 0 : semantics.depthTexture));
12702
- // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12703
- this.renderer.getShaderLibrary().addShader(shader);
12781
+ (_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
12704
12782
  var material = Material.create(engine, {
12705
12783
  uniformValues: {
12706
12784
  // @ts-expect-error
@@ -12764,7 +12842,10 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
12764
12842
  }
12765
12843
  var _proto = FinalCopyRP.prototype;
12766
12844
  _proto.configure = function configure(renderer) {
12767
- this.prePassTexture = renderer.getFramebuffer().getColorTextures()[0];
12845
+ var framebuffer = renderer.getFramebuffer();
12846
+ if (framebuffer) {
12847
+ this.prePassTexture = framebuffer.getColorTextures()[0];
12848
+ }
12768
12849
  renderer.setFramebuffer(null);
12769
12850
  };
12770
12851
  _proto.execute = function execute(renderer) {
@@ -13125,7 +13206,7 @@ var Renderer = /*#__PURE__*/ function() {
13125
13206
 
13126
13207
  var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n";
13127
13208
  var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n";
13128
- var seed$4 = 1;
13209
+ var seed$3 = 1;
13129
13210
  var InteractMesh = /*#__PURE__*/ function() {
13130
13211
  function InteractMesh(props, rendererOptions, transform, engine) {
13131
13212
  this.transform = transform;
@@ -13226,7 +13307,7 @@ var InteractMesh = /*#__PURE__*/ function() {
13226
13307
  };
13227
13308
  _proto.createMesh = function createMesh(geometry, material) {
13228
13309
  return Mesh.create(this.engine, {
13229
- name: "Interact_preview" + seed$4++,
13310
+ name: "Interact_preview" + seed$3++,
13230
13311
  priority: 0,
13231
13312
  worldMatrix: Matrix4.fromIdentity(),
13232
13313
  geometry: geometry,
@@ -13278,13 +13359,15 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13278
13359
  if (type === InteractType.CLICK) {
13279
13360
  this.clickable = true;
13280
13361
  if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
13281
- var rendererOptions = this.item.composition.getRendererOptions();
13282
- this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13362
+ var rendererOptions = composition == null ? void 0 : composition.getRendererOptions();
13363
+ if (rendererOptions !== undefined) {
13364
+ this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13365
+ }
13283
13366
  }
13284
13367
  }
13285
13368
  if (options.type === InteractType.DRAG) {
13286
13369
  if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
13287
- composition.event && this.beginDragTarget(options, composition.event);
13370
+ (composition == null ? void 0 : composition.event) && this.beginDragTarget(options, composition.event);
13288
13371
  }
13289
13372
  }
13290
13373
  if (this.previewContent) {
@@ -13555,11 +13638,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
13555
13638
  var shaderLibrary = render.getShaderLibrary();
13556
13639
  var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
13557
13640
  var env = (options != null ? options : {}).env;
13558
- if (!shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)]) {
13559
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13560
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
13641
+ if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
13642
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13643
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
13561
13644
  if (detail.writableFragDepth) {
13562
- shaderLibrary.addShader(createCopyShader(level, true));
13645
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
13563
13646
  }
13564
13647
  }
13565
13648
  return Promise.resolve();
@@ -13891,7 +13974,7 @@ var tempColor = [
13891
13974
  1,
13892
13975
  1
13893
13976
  ];
13894
- var seed$3 = 0;
13977
+ var seed$2 = 0;
13895
13978
  var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13896
13979
  _inherits(SpriteColorPlayable, Playable);
13897
13980
  function SpriteColorPlayable() {
@@ -13932,8 +14015,9 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13932
14015
  colorChanged = true;
13933
14016
  }
13934
14017
  if (colorChanged) {
14018
+ var _this_spriteMaterial_getVector4;
13935
14019
  vecMulCombine(this.renderColor, colorInc, this.startColor);
13936
- this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
14020
+ (_this_spriteMaterial_getVector4 = this.spriteMaterial.getVector4("_Color")) == null ? void 0 : _this_spriteMaterial_getVector4.setFromArray(this.renderColor);
13937
14021
  }
13938
14022
  };
13939
14023
  _proto.create = function create(clipData) {
@@ -13999,7 +14083,7 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13999
14083
  }
14000
14084
  }
14001
14085
  };
14002
- _this.name = "MSprite" + seed$3++;
14086
+ _this.name = "MSprite" + seed$2++;
14003
14087
  _this.renderer = {
14004
14088
  renderMode: RenderMode.BILLBOARD,
14005
14089
  blending: BlendingMode.ALPHA,
@@ -14185,9 +14269,11 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14185
14269
  var data = this.getItemInitData();
14186
14270
  var renderer = this.renderer;
14187
14271
  var texParams = this.material.getVector4("_TexParams");
14188
- texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14189
- texParams.y = +this.preMultiAlpha;
14190
- texParams.z = renderer.renderMode;
14272
+ if (texParams) {
14273
+ texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14274
+ texParams.y = +this.preMultiAlpha;
14275
+ texParams.z = renderer.renderMode;
14276
+ }
14191
14277
  var attributes = {
14192
14278
  atlasOffset: new Float32Array(data.atlasOffset.length),
14193
14279
  index: new Uint16Array(data.index.length)
@@ -14480,7 +14566,7 @@ function setConfig(name, value) {
14480
14566
  }
14481
14567
 
14482
14568
  var tempQuat$1 = new Quaternion();
14483
- var seed$2 = 1;
14569
+ var seed$1 = 1;
14484
14570
  // TODO 继承 Component
14485
14571
  var Transform = /*#__PURE__*/ function() {
14486
14572
  function Transform(props, parent) {
@@ -14531,7 +14617,7 @@ var Transform = /*#__PURE__*/ function() {
14531
14617
  quat: new Quaternion(0, 0, 0, 1),
14532
14618
  scale: new Vector3(1, 1, 1)
14533
14619
  };
14534
- this.name = "transform_" + seed$2++;
14620
+ this.name = "transform_" + seed$1++;
14535
14621
  if (props) {
14536
14622
  this.setTransform(props);
14537
14623
  }
@@ -15836,8 +15922,8 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
15836
15922
  }
15837
15923
 
15838
15924
  var Burst = /*#__PURE__*/ function() {
15839
- function Burst(opts) {
15840
- var time = opts.time, interval = opts.interval, count = opts.count, cycles = opts.cycles, probability = opts.probability;
15925
+ function Burst(options) {
15926
+ var time = options.time, interval = options.interval, count = options.count, cycles = options.cycles, probability = options.probability;
15841
15927
  this.time = +time || 0;
15842
15928
  this.interval = +interval || 1;
15843
15929
  this.count = _instanceof1(count, ValueGetter) ? count : createValueGetter(count);
@@ -15865,7 +15951,14 @@ var Burst = /*#__PURE__*/ function() {
15865
15951
  this.now = 0;
15866
15952
  };
15867
15953
  _proto.clone = function clone() {
15868
- return new Burst(this);
15954
+ var options = {
15955
+ time: this.time,
15956
+ interval: this.interval,
15957
+ count: this.count,
15958
+ cycles: this.cycles,
15959
+ probability: this.probability
15960
+ };
15961
+ return new Burst(options);
15869
15962
  };
15870
15963
  return Burst;
15871
15964
  }();
@@ -16327,6 +16420,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16327
16420
  if (index >= 0 && index < pointCountPerTrail) {
16328
16421
  var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
16329
16422
  var data = this.geometry.getAttributeData("aColor");
16423
+ assertExist(data);
16330
16424
  out.x = data[startIndex];
16331
16425
  out.y = data[1 + startIndex];
16332
16426
  out.z = data[2 + startIndex];
@@ -16334,14 +16428,14 @@ var TrailMesh = /*#__PURE__*/ function() {
16334
16428
  }
16335
16429
  };
16336
16430
  _proto.clearAllTrails = function clearAllTrails() {
16337
- var geo = this.geometry;
16431
+ var indexData = this.geometry.getIndexData();
16432
+ assertExist(indexData);
16338
16433
  this.trailCursors = new Uint16Array(this.trailCursors.length);
16339
- // @ts-expect-error
16340
- geo.setIndexData(new Uint16Array(geo.getIndexData().length));
16434
+ this.geometry.setIndexData(new Uint16Array(indexData.length));
16341
16435
  };
16342
16436
  _proto.minusTime = function minusTime(time) {
16343
- // FIXME: 可选性
16344
16437
  var data = this.geometry.getAttributeData("aTime");
16438
+ assertExist(data);
16345
16439
  for(var i = 0; i < data.length; i++){
16346
16440
  data[i] -= time;
16347
16441
  }
@@ -16353,6 +16447,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16353
16447
  var pointCountPerTrail = this.pointCountPerTrail;
16354
16448
  var indicesPerTrail = (pointCountPerTrail - 1) * 6;
16355
16449
  var indices = this.geometry.getIndexData();
16450
+ assertExist(indices);
16356
16451
  indices.set(new Uint16Array(indicesPerTrail), index * indicesPerTrail);
16357
16452
  this.geometry.setIndexData(indices);
16358
16453
  this.trailCursors[index] = 0;
@@ -16806,7 +16901,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16806
16901
  break;
16807
16902
  }
16808
16903
  var burst = bursts[j];
16809
- var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
16904
+ var opts = burst.getGeneratorOptions(timePassed, lifetime);
16810
16905
  if (opts) {
16811
16906
  var originVec = [
16812
16907
  0,
@@ -16815,9 +16910,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16815
16910
  ];
16816
16911
  var offsets = emission.burstOffsets[j];
16817
16912
  var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
16818
- if (burst.once) {
16819
- this.removeBurst(j);
16820
- }
16821
16913
  for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
16822
16914
  var _p_transform;
16823
16915
  if (shouldSkipGenerate()) {
@@ -17454,13 +17546,14 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
17454
17546
  }
17455
17547
  }
17456
17548
  this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
17549
+ this.renderer.item = this.item;
17457
17550
  this.meshes = this.renderer.meshes;
17458
- // this.item = vfxItem;
17459
17551
  var interaction = props.interaction;
17460
17552
  if (interaction) {
17553
+ var _interaction_radius;
17461
17554
  this.interaction = {
17462
17555
  multiple: interaction.multiple,
17463
- radius: interaction.radius,
17556
+ radius: (_interaction_radius = interaction.radius) != null ? _interaction_radius : 0.4,
17464
17557
  behavior: interaction.behavior
17465
17558
  };
17466
17559
  }
@@ -17544,7 +17637,10 @@ function randomArrItem(arr, keepArr) {
17544
17637
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17545
17638
  _inherits(ParticleBehaviourPlayable, Playable);
17546
17639
  function ParticleBehaviourPlayable() {
17547
- return Playable.apply(this, arguments);
17640
+ var _this;
17641
+ _this = Playable.apply(this, arguments) || this;
17642
+ _this.lastTime = 0;
17643
+ return _this;
17548
17644
  }
17549
17645
  var _proto = ParticleBehaviourPlayable.prototype;
17550
17646
  _proto.start = function start(context) {
@@ -17572,8 +17668,12 @@ function randomArrItem(arr, keepArr) {
17572
17668
  if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
17573
17669
  particleSystem.reset();
17574
17670
  }
17671
+ if (Math.abs(this.time - this.lastTime) < 0.001) {
17672
+ deltaTime = 0;
17673
+ }
17575
17674
  particleSystem.onUpdate(deltaTime);
17576
17675
  }
17676
+ this.lastTime = this.time;
17577
17677
  };
17578
17678
  return ParticleBehaviourPlayable;
17579
17679
  }(Playable);
@@ -17986,6 +18086,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17986
18086
  _proto.getPointColor = function getPointColor(index) {
17987
18087
  var data = this.geometry.getAttributeData("aRot");
17988
18088
  var i = index * 32 + 4;
18089
+ assertExist(data);
17989
18090
  return [
17990
18091
  data[i],
17991
18092
  data[i + 1],
@@ -18015,6 +18116,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18015
18116
  };
18016
18117
  _proto.minusTime = function minusTime(time) {
18017
18118
  var data = this.geometry.getAttributeData("aOffset");
18119
+ assertExist(data);
18018
18120
  for(var i = 0; i < data.length; i += 4){
18019
18121
  data[i + 2] -= time;
18020
18122
  }
@@ -18141,6 +18243,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18141
18243
  var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
18142
18244
  if (increaseBuffer) {
18143
18245
  var baseData = geometry.getAttributeData(name);
18246
+ assertExist(baseData);
18144
18247
  var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
18145
18248
  geoData.set(data, data.length * index);
18146
18249
  geometry.setAttributeData(name, geoData);
@@ -18510,12 +18613,8 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18510
18613
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18511
18614
  if (item.content.trails) {
18512
18615
  var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18513
- var _shader_macros;
18514
- shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
18515
- var _shader_macros1;
18516
- shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
18517
18616
  shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
18518
- shaderLibrary.addShader(shader1);
18617
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
18519
18618
  }
18520
18619
  });
18521
18620
  shaders.forEach(function(shader) {
@@ -18525,15 +18624,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18525
18624
  } else {
18526
18625
  shader.glslVersion = GLSLVersion.GLSL1;
18527
18626
  }
18528
- var _shader_macros;
18529
- shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
18530
- var _shader_macros1;
18531
- shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
18532
- shaderLibrary.addShader(shader);
18627
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
18533
18628
  });
18534
18629
  if (level === 2) {
18535
18630
  items.forEach(function(item) {
18536
- // @ts-expect-error
18537
18631
  item.content.options.meshSlots = [
18538
18632
  maxVertexCount,
18539
18633
  maxFragmentCount
@@ -19402,7 +19496,7 @@ function compareTracks(a, b) {
19402
19496
  this.items.length = 0;
19403
19497
  if (this.item.composition) {
19404
19498
  var assetLoader = this.item.engine.assetLoader;
19405
- var itemProps = this.item.props.items ? this.item.props.items : [];
19499
+ var itemProps = this.data.items ? this.data.items : [];
19406
19500
  for(var i = 0; i < itemProps.length; i++){
19407
19501
  var item = void 0;
19408
19502
  var itemData = itemProps[i];
@@ -19771,7 +19865,9 @@ var CanvasPool = /*#__PURE__*/ function() {
19771
19865
  };
19772
19866
  _proto.getCanvas = function getCanvas() {
19773
19867
  if (this.elements.length !== 0) {
19774
- return this.elements.shift();
19868
+ var canvas = this.elements.shift();
19869
+ assertExist(canvas);
19870
+ return canvas;
19775
19871
  }
19776
19872
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19777
19873
  return window._createOffscreenCanvas(10, 10);
@@ -19796,9 +19892,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19796
19892
  return CanvasPool;
19797
19893
  }();
19798
19894
  var canvasPool = new CanvasPool();
19799
- function getDefaultTemplateCanvasPool() {
19800
- return canvasPool;
19801
- }
19802
19895
 
19803
19896
  var DEFAULT_FONTS = [
19804
19897
  "serif",
@@ -20220,7 +20313,6 @@ var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
20220
20313
  return TextLoader;
20221
20314
  }(AbstractPlugin);
20222
20315
 
20223
- var seed$1 = 1;
20224
20316
  var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20225
20317
  _inherits(EffectComponent, RendererComponent);
20226
20318
  function EffectComponent(engine) {
@@ -20231,7 +20323,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20231
20323
  */ _this.worldMatrix = Matrix4.fromIdentity();
20232
20324
  _this.triangles = [];
20233
20325
  _this.destroyed = false;
20234
- _this.visible = false;
20235
20326
  // TODO 点击测试后续抽象一个 Collider 组件
20236
20327
  _this.getHitTestParams = function(force) {
20237
20328
  var area = _this.getBoundingBox();
@@ -20242,18 +20333,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20242
20333
  };
20243
20334
  }
20244
20335
  };
20245
- _this.id = "Mesh" + seed$1++;
20246
- _this.name = "<unnamed>";
20336
+ _this.name = "EffectComponent";
20247
20337
  _this._priority = 0;
20248
20338
  return _this;
20249
20339
  }
20250
20340
  var _proto = EffectComponent.prototype;
20251
- /**
20252
- * 设置当前 Mesh 的可见性。
20253
- * @param visible - true:可见,false:不可见
20254
- */ _proto.setVisible = function setVisible(visible) {
20255
- this.visible = visible;
20256
- };
20257
20341
  _proto.start = function start() {
20258
20342
  this.item.getHitTestParams = this.getHitTestParams;
20259
20343
  };
@@ -20264,16 +20348,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20264
20348
  renderer.drawGeometry(this.geometry, this.material);
20265
20349
  };
20266
20350
  /**
20267
- * 获取当前 Mesh 的可见性。
20268
- */ _proto.getVisible = function getVisible() {
20269
- return this.visible;
20270
- };
20271
- /**
20272
- * 获取当前 Mesh 的第一个 geometry。
20273
- */ _proto.firstGeometry = function firstGeometry() {
20274
- return this.geometry;
20275
- };
20276
- /**
20277
20351
  * 设置当前 Mesh 的材质
20278
20352
  * @param material - 要设置的材质
20279
20353
  * @param destroy - 可选的材质销毁选项
@@ -20320,27 +20394,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20320
20394
  * @param options - 可选的销毁选项
20321
20395
  */ _proto.dispose = function dispose(options) {
20322
20396
  if (this.destroyed) {
20323
- //console.error('call mesh.destroy multiple times', this);
20324
20397
  return;
20325
20398
  }
20326
- // if (options?.geometries !== DestroyOptions.keep) {
20327
- // this.geometry.dispose();
20328
- // }
20329
- // const materialDestroyOption = options?.material;
20330
- // if (materialDestroyOption !== DestroyOptions.keep) {
20331
- // this.material.dispose(materialDestroyOption);
20332
- // }
20333
20399
  this.destroyed = true;
20334
20400
  RendererComponent.prototype.dispose.call(this);
20335
20401
  };
20336
- _create_class(EffectComponent, [
20337
- {
20338
- key: "isDestroyed",
20339
- get: function get() {
20340
- return this.destroyed;
20341
- }
20342
- }
20343
- ]);
20344
20402
  return EffectComponent;
20345
20403
  }(RendererComponent);
20346
20404
  __decorate([
@@ -20350,8 +20408,10 @@ EffectComponent = __decorate([
20350
20408
  effectsClass(DataType.EffectComponent)
20351
20409
  ], EffectComponent);
20352
20410
  function geometryToTriangles(geometry) {
20353
- var indices = geometry.getIndexData();
20354
- var vertices = geometry.getAttributeData("aPos");
20411
+ var _geometry_getIndexData;
20412
+ var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
20413
+ var _geometry_getAttributeData;
20414
+ var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
20355
20415
  var res = [];
20356
20416
  for(var i = 0; i < indices.length; i += 3){
20357
20417
  var index0 = indices[i] * 3;
@@ -23076,6 +23136,7 @@ function getStandardJSON(json) {
23076
23136
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
23077
23137
  return version30Migration(version21Migration(getStandardJSONFromV0(json)));
23078
23138
  }
23139
+ reverseParticle = false;
23079
23140
  var vs = standardVersion.exec(json.version) || [];
23080
23141
  var mainVersion = Number(vs[1]);
23081
23142
  var minorVersion = Number(vs[2]);
@@ -23822,7 +23883,6 @@ var seed = 1;
23822
23883
  return __generator(this, function(_state) {
23823
23884
  switch(_state.label){
23824
23885
  case 0:
23825
- // TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
23826
23886
  jsonScene = getStandardJSON(json);
23827
23887
  _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
23828
23888
  pluginSystem = new PluginSystem(plugins);
@@ -24116,18 +24176,18 @@ var seed = 1;
24116
24176
  source: source
24117
24177
  };
24118
24178
  });
24119
- jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(texOpts, idx) {
24120
- var e, source, image, tex;
24179
+ jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
24180
+ var e, source, image, texture;
24121
24181
  return __generator(this, function(_state) {
24122
24182
  switch(_state.label){
24123
24183
  case 0:
24124
- if (_instanceof1(texOpts, Texture)) {
24184
+ if (_instanceof1(textureOptions, Texture)) {
24125
24185
  return [
24126
24186
  2,
24127
- texOpts
24187
+ textureOptions
24128
24188
  ];
24129
24189
  }
24130
- if (!("mipmaps" in texOpts)) return [
24190
+ if (!("mipmaps" in textureOptions)) return [
24131
24191
  3,
24132
24192
  4
24133
24193
  ];
@@ -24141,7 +24201,7 @@ var seed = 1;
24141
24201
  ]);
24142
24202
  return [
24143
24203
  4,
24144
- deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
24204
+ deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
24145
24205
  ];
24146
24206
  case 2:
24147
24207
  return [
@@ -24152,12 +24212,11 @@ var seed = 1;
24152
24212
  e = _state.sent();
24153
24213
  throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
24154
24214
  case 4:
24155
- source = texOpts.source;
24215
+ source = textureOptions.source;
24156
24216
  if (!isObject(source)) return [
24157
24217
  3,
24158
24218
  5
24159
24219
  ];
24160
- //@ts-expect-error
24161
24220
  image = engine.assetLoader.loadGUID(source.id).data;
24162
24221
  return [
24163
24222
  3,
@@ -24177,12 +24236,12 @@ var seed = 1;
24177
24236
  _state.label = 7;
24178
24237
  case 7:
24179
24238
  if (image) {
24180
- tex = createTextureOptionsBySource(image, _this.assets[idx]);
24181
- tex.id = texOpts.id;
24182
- tex.dataType = DataType.Texture;
24239
+ texture = createTextureOptionsBySource(image, _this.assets[idx]);
24240
+ texture.id = textureOptions.id;
24241
+ texture.dataType = DataType.Texture;
24183
24242
  return [
24184
24243
  2,
24185
- tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
24244
+ texture.sourceType === TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
24186
24245
  ];
24187
24246
  }
24188
24247
  throw new Error("Invalid texture source: " + source + ".");
@@ -24677,7 +24736,6 @@ var listOrder = 0;
24677
24736
  if (!this.refCompositionProps.has(refId)) {
24678
24737
  this.refCompositionProps.set(refId, ref);
24679
24738
  }
24680
- itemProps.items = ref.items;
24681
24739
  }
24682
24740
  items.push(itemProps);
24683
24741
  }
@@ -27569,8 +27627,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
27569
27627
  registerPlugin("particle", ParticleLoader, VFXItem, true);
27570
27628
  registerPlugin("cal", CalculateLoader, VFXItem, true);
27571
27629
  registerPlugin("interact", InteractLoader, VFXItem, true);
27572
- var version = "2.0.0-alpha.33";
27630
+ var version = "2.0.0-alpha.35";
27573
27631
  logger.info("Core version: " + version + ".");
27574
27632
 
27575
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
27633
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
27576
27634
  //# sourceMappingURL=index.mjs.map