@galacean/effects-threejs 2.0.0-alpha.33 → 2.0.0-alpha.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.33
6
+ * Version: v2.0.0-alpha.34
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -4784,7 +4784,9 @@ __decorate([
4784
4784
  // }
4785
4785
  /**
4786
4786
  * 在每次设置 enabled 为 true 时触发
4787
- */ _proto.onEnable = function onEnable() {};
4787
+ */ _proto.onEnable = function onEnable() {
4788
+ // OVERRIDE
4789
+ };
4788
4790
  /**
4789
4791
  * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
4790
4792
  */ _proto.start = function start() {
@@ -7653,55 +7655,6 @@ function getPreMultiAlpha(blending) {
7653
7655
  return 1;
7654
7656
  }
7655
7657
  }
7656
- var _obj$7;
7657
- var downgradeKeywords = (_obj$7 = {}, _obj$7[ShaderType.vertex] = {
7658
- in: "attribute",
7659
- out: "varying"
7660
- }, _obj$7[ShaderType.fragment] = {
7661
- in: "varying"
7662
- }, _obj$7);
7663
- /**
7664
- * 生成 shader,检测到 WebGL1 上下文会降级
7665
- * @param macros - 宏定义数组
7666
- * @param shader - 原始 shader 文本
7667
- * @param shaderType - shader 类型
7668
- * @return 去除版本号的 shader 文本
7669
- */ function createShaderWithMacros(macros, shader, shaderType, level) {
7670
- var ret = [];
7671
- var header = "";
7672
- // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7673
- ret.push("#define GE_RUNTIME");
7674
- if (macros) {
7675
- macros.forEach(function(param) {
7676
- var key = param[0], value = param[1];
7677
- if (value === true) {
7678
- ret.push("#define " + key);
7679
- } else if (Number.isFinite(value)) {
7680
- ret.push("#define " + key + " " + value);
7681
- }
7682
- });
7683
- header = ret.length ? ret.join("\n") + "\n" : "";
7684
- }
7685
- var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
7686
- var GL_TYPE = "WEBGL" + level;
7687
- header = header + ("\n#ifndef " + GL_TYPE + "\n#define " + GL_TYPE + "\n#endif");
7688
- var fullShader = header + "\n" + shader;
7689
- // 判断shader是否带有版本头
7690
- var match = fullShader.match(versionTag);
7691
- var version = match ? match[0] : "";
7692
- if (version && version.includes("300")) {
7693
- var reg = new RegExp("" + version, "g");
7694
- // 带版本头且level为1,降级
7695
- if (level === 1) {
7696
- fullShader = fullShader.replace(/\b(in|out)\b/g, function(str) {
7697
- var _downgradeKeywords_shaderType_str;
7698
- return (_downgradeKeywords_shaderType_str = downgradeKeywords[shaderType][str]) != null ? _downgradeKeywords_shaderType_str : str;
7699
- });
7700
- }
7701
- fullShader = fullShader.replace(reg, "\n");
7702
- }
7703
- return fullShader;
7704
- }
7705
7658
  function setBlendMode(material, blendMode) {
7706
7659
  switch(blendMode){
7707
7660
  case undefined:
@@ -8404,7 +8357,7 @@ function _loadMipmapImage() {
8404
8357
  return _loadMipmapImage.apply(this, arguments);
8405
8358
  }
8406
8359
 
8407
- var seed$a = 1;
8360
+ var seed$9 = 1;
8408
8361
  /**
8409
8362
  * Texture 抽象类
8410
8363
  */ var Texture = /*#__PURE__*/ function(EffectsObject) {
@@ -8413,7 +8366,7 @@ var seed$a = 1;
8413
8366
  var _this;
8414
8367
  _this = EffectsObject.call(this, engine) || this;
8415
8368
  _this.destroyed = false;
8416
- _this.id = "Tex" + seed$a++;
8369
+ _this.id = "Tex" + seed$9++;
8417
8370
  return _this;
8418
8371
  }
8419
8372
  var _proto = Texture.prototype;
@@ -9041,7 +8994,7 @@ var MaterialRenderType;
9041
8994
  /**
9042
8995
  * 用于设置材质默认名称的自增序号
9043
8996
  * @internal
9044
- */ var seed$9 = 1;
8997
+ */ var seed$8 = 1;
9045
8998
  /**
9046
8999
  * Material 抽象类
9047
9000
  */ var Material = /*#__PURE__*/ function(EffectsObject) {
@@ -9054,14 +9007,14 @@ var MaterialRenderType;
9054
9007
  _this.destroyed = false;
9055
9008
  _this.initialized = false;
9056
9009
  if (props) {
9057
- var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$9++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
9010
+ 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;
9058
9011
  _this.name = name;
9059
9012
  _this.renderType = renderType; // TODO 没有地方用到
9060
9013
  _this.shaderSource = shader;
9061
9014
  _this.props = props;
9062
9015
  _this.uniformSemantics = _extends({}, uniformSemantics); // TODO 废弃,待移除
9063
9016
  } else {
9064
- _this.name = "Material" + seed$9++;
9017
+ _this.name = "Material" + seed$8++;
9065
9018
  _this.renderType = 0;
9066
9019
  }
9067
9020
  return _this;
@@ -9386,29 +9339,6 @@ function vecFill(out, number) {
9386
9339
  }
9387
9340
  return out;
9388
9341
  }
9389
- function vecAssign(out, a, count, start) {
9390
- if (start === void 0) start = 0;
9391
- for(var i = 0; i < count; i++){
9392
- out[i] = a[i + start];
9393
- }
9394
- return out;
9395
- }
9396
- function vecNormalize(out, a) {
9397
- var _Math;
9398
- if (arguments.length === 1) {
9399
- a = out;
9400
- out = [];
9401
- }
9402
- var ap = a;
9403
- var sum = (_Math = Math).hypot.apply(_Math, [].concat(ap));
9404
- if (sum === 0) {
9405
- return vecAssign(out, ap, ap.length);
9406
- }
9407
- for(var i = 0; i < ap.length; i++){
9408
- out[i] = ap[i] / sum;
9409
- }
9410
- return out;
9411
- }
9412
9342
  function vecMulCombine(out, a, b) {
9413
9343
  if (a && b) {
9414
9344
  for(var i = 0, len = a.length; i < len; i++){
@@ -9498,10 +9428,6 @@ function numberToFix(a, fixed) {
9498
9428
  var base = Math.pow(10, fixed);
9499
9429
  return Math.floor(a * base) / base;
9500
9430
  }
9501
- function pointOnLine(x1, y1, x2, y2, x3, y3) {
9502
- var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;
9503
- return det1 > -0.001 && det1 < 0.001;
9504
- }
9505
9431
 
9506
9432
  function _is_native_reflect_construct() {
9507
9433
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
@@ -10944,21 +10870,16 @@ Shader = __decorate([
10944
10870
 
10945
10871
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
10946
10872
  var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
10947
- 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}";
10948
- 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";
10873
+ 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}";
10874
+ 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";
10949
10875
  function createCopyShader(level, writeDepth) {
10950
10876
  var webgl2 = level === 2;
10951
- var version = webgl2 ? "#version 300 es" : "";
10952
10877
  return {
10953
10878
  name: EFFECTS_COPY_MESH_NAME,
10954
- vertex: version + "\n" + COPY_VERTEX_SHADER,
10955
- fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10879
+ vertex: COPY_VERTEX_SHADER,
10880
+ fragment: COPY_FRAGMENT_SHADER,
10956
10881
  glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
10957
10882
  macros: [
10958
- [
10959
- "WEBGL2",
10960
- !!webgl2
10961
- ],
10962
10883
  [
10963
10884
  "DEPTH_TEXTURE",
10964
10885
  !!writeDepth
@@ -11126,7 +11047,7 @@ function generateEmptyTypedArray(type) {
11126
11047
  return new Float32Array(0);
11127
11048
  }
11128
11049
 
11129
- var seed$8 = 1;
11050
+ var seed$7 = 1;
11130
11051
  /**
11131
11052
  * Mesh 抽象类
11132
11053
  */ var Mesh = /*#__PURE__*/ function(RendererComponent) {
@@ -11138,14 +11059,14 @@ var seed$8 = 1;
11138
11059
  _this.visible = true;
11139
11060
  if (props) {
11140
11061
  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;
11141
- _this.id = "Mesh" + seed$8++;
11062
+ _this.id = "Mesh" + seed$7++;
11142
11063
  _this.name = name;
11143
11064
  _this.geometry = geometry;
11144
11065
  _this.material = material;
11145
11066
  _this.priority = priority;
11146
11067
  _this.worldMatrix = worldMatrix;
11147
11068
  } else {
11148
- _this.id = "Mesh" + seed$8++;
11069
+ _this.id = "Mesh" + seed$7++;
11149
11070
  _this.name = "<unnamed>";
11150
11071
  _this.worldMatrix = Matrix4.fromIdentity();
11151
11072
  _this._priority = 0;
@@ -11350,7 +11271,7 @@ var RenderPassDestroyAttachmentType;
11350
11271
  * 强制销毁
11351
11272
  */ RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
11352
11273
  })(RenderPassDestroyAttachmentType || (RenderPassDestroyAttachmentType = {}));
11353
- var seed$7 = 1;
11274
+ var seed$6 = 1;
11354
11275
  /**
11355
11276
  * RenderPass 抽象类
11356
11277
  */ var RenderPass = /*#__PURE__*/ function() {
@@ -11360,7 +11281,7 @@ var seed$7 = 1;
11360
11281
  */ this.attachments = [];
11361
11282
  this.destroyed = false;
11362
11283
  this.initialized = false;
11363
- var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$7++ : _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;
11284
+ 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;
11364
11285
  this.name = name;
11365
11286
  this.renderer = renderer;
11366
11287
  this.priority = priority;
@@ -11580,10 +11501,12 @@ var seed$7 = 1;
11580
11501
  */ _proto.getDepthAttachment = function getDepthAttachment() {
11581
11502
  var framebuffer = this.framebuffer;
11582
11503
  if (framebuffer) {
11504
+ var depthTexture = framebuffer.getDepthTexture();
11505
+ var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
11583
11506
  return {
11584
11507
  storageType: framebuffer.depthStencilStorageType,
11585
11508
  storage: framebuffer.depthStorage,
11586
- texture: framebuffer.getDepthTexture() ? this.getDepthTexture(framebuffer.getDepthTexture(), framebuffer.externalStorage) : undefined
11509
+ texture: texture
11587
11510
  };
11588
11511
  }
11589
11512
  };
@@ -11592,10 +11515,12 @@ var seed$7 = 1;
11592
11515
  */ _proto.getStencilAttachment = function getStencilAttachment() {
11593
11516
  var framebuffer = this.framebuffer;
11594
11517
  if (framebuffer) {
11518
+ var stencilTexture = framebuffer.getStencilTexture();
11519
+ var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
11595
11520
  return {
11596
11521
  storageType: framebuffer.depthStencilStorageType,
11597
11522
  storage: framebuffer.stencilStorage,
11598
- texture: framebuffer.getStencilTexture() ? this.getStencilTexture(framebuffer.getStencilTexture(), framebuffer.externalStorage) : undefined
11523
+ texture: texture
11599
11524
  };
11600
11525
  }
11601
11526
  };
@@ -11707,11 +11632,7 @@ var seed$7 = 1;
11707
11632
 
11708
11633
  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;}";
11709
11634
 
11710
- 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";
11711
-
11712
- var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11713
-
11714
- 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);}";
11635
+ 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);}";
11715
11636
 
11716
11637
  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.;}";
11717
11638
 
@@ -11719,13 +11640,13 @@ var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3
11719
11640
 
11720
11641
  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;}";
11721
11642
 
11722
- 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";
11643
+ 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";
11723
11644
 
11724
- 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}}";
11645
+ 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}}";
11725
11646
 
11726
- 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}";
11647
+ 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}";
11727
11648
 
11728
- 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.;}";
11649
+ 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.;}";
11729
11650
 
11730
11651
  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";
11731
11652
 
@@ -11743,6 +11664,159 @@ var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _M
11743
11664
 
11744
11665
  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);}";
11745
11666
 
11667
+ var shaderLib = {};
11668
+ var ShaderFactory = /*#__PURE__*/ function() {
11669
+ function ShaderFactory() {}
11670
+ ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
11671
+ if (shaderLib[includeName]) {
11672
+ logger.warn('The "' + includeName + '" shader include already exist.');
11673
+ }
11674
+ shaderLib[includeName] = includeSource;
11675
+ };
11676
+ ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
11677
+ delete shaderLib[includeName];
11678
+ };
11679
+ ShaderFactory.unRegisterAllIncludes = function unRegisterAllIncludes() {
11680
+ Object.keys(shaderLib).forEach(function(key) {
11681
+ ShaderFactory.unRegisterInclude(key);
11682
+ });
11683
+ };
11684
+ /**
11685
+ * 生成 shader,检测到 WebGL1 上下文会降级
11686
+ * @param macros - 宏定义数组
11687
+ * @param shader - 原始 shader 文本
11688
+ * @param shaderType - shader 类型
11689
+ * @return 去除版本号的 shader 文本
11690
+ */ ShaderFactory.genFinalShaderCode = function genFinalShaderCode(options) {
11691
+ var level = options.level, shaderType = options.shaderType, shader = options.shader, macros = options.macros, removeVersion = options.removeVersion;
11692
+ var macroString = ShaderFactory.genMacroString(level, macros);
11693
+ var versionString = ShaderFactory.genShaderVersion(level);
11694
+ var source = ShaderFactory.parseIncludes(shader);
11695
+ var isVersion300 = ShaderFactory.isVersion300(source);
11696
+ source = ShaderFactory.removeWebGLVersion(source);
11697
+ if (level === 2 && !isVersion300) {
11698
+ source = ShaderFactory.convertTo300(source, shaderType === ShaderType.fragment);
11699
+ }
11700
+ if (removeVersion) {
11701
+ return macroString + source;
11702
+ }
11703
+ return versionString + macroString + source;
11704
+ };
11705
+ /**
11706
+ * Convert lower GLSL version to GLSL 300 es.
11707
+ * @param source - code
11708
+ * @param isFragment - Whether it is a fragment shader.
11709
+ * */ ShaderFactory.convertTo300 = function convertTo300(source, isFragment) {
11710
+ source = source.replace(/\bvarying\b/g, isFragment ? "in" : "out");
11711
+ source = source.replace(/\btexture(2D|Cube)\b/g, "texture");
11712
+ // Remove extensions
11713
+ var regex = /#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;
11714
+ source = source.replace(regex, "");
11715
+ if (isFragment) {
11716
+ source = source.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
11717
+ source = source.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
11718
+ source = source.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
11719
+ if (!ShaderFactory.has300Output(source)) {
11720
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(source);
11721
+ if (isMRT) {
11722
+ source = source.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
11723
+ var result = source.match(/\bgl_FragData\[.+?\]/g);
11724
+ if (result) {
11725
+ source = ShaderFactory.replaceMRTShader(source, result);
11726
+ }
11727
+ } else {
11728
+ source = source.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
11729
+ source = source.replace(/\bgl_FragColor\b/g, "glFragColor");
11730
+ }
11731
+ }
11732
+ } else {
11733
+ source = source.replace(/\battribute\b/g, "in");
11734
+ }
11735
+ return source;
11736
+ };
11737
+ ShaderFactory.parseIncludes = function parseIncludes(source, regex) {
11738
+ if (regex === void 0) regex = /#include <(.+)>/gm;
11739
+ var match;
11740
+ while((match = regex.exec(source)) !== null){
11741
+ var shaderName = match[1];
11742
+ var replace = shaderLib[shaderName];
11743
+ if (replace === undefined) {
11744
+ throw new Error("Can't find include shader name " + shaderName);
11745
+ }
11746
+ source = source.replace(match[0], replace);
11747
+ }
11748
+ return source;
11749
+ };
11750
+ ShaderFactory.genMacroString = function genMacroString(level, macros, addRuntimeMacro) {
11751
+ if (addRuntimeMacro === void 0) addRuntimeMacro = true;
11752
+ var macroList = [];
11753
+ var webGLVersion = "WEBGL" + level;
11754
+ macroList.push("#ifndef " + webGLVersion);
11755
+ macroList.push("#define " + webGLVersion);
11756
+ macroList.push("#endif");
11757
+ if (addRuntimeMacro) {
11758
+ macroList.push("#define GE_RUNTIME");
11759
+ }
11760
+ if (macros && macros.length) {
11761
+ macros.forEach(function(param) {
11762
+ var key = param[0], value = param[1];
11763
+ if (value === true) {
11764
+ macroList.push("#define " + key);
11765
+ } else if (Number.isFinite(value)) {
11766
+ macroList.push("#define " + key + " " + value);
11767
+ }
11768
+ });
11769
+ }
11770
+ if (macroList.length) {
11771
+ return macroList.join("\n") + "\n";
11772
+ }
11773
+ return "";
11774
+ };
11775
+ ShaderFactory.genShaderVersion = function genShaderVersion(level) {
11776
+ if (level === 1) {
11777
+ return "#version 100\n";
11778
+ }
11779
+ return "#version 300 es\n";
11780
+ };
11781
+ ShaderFactory.isVersion300 = function isVersion300(source) {
11782
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11783
+ var match = source.match(versionTag);
11784
+ var version = match ? match[0] : "";
11785
+ return version.includes("300");
11786
+ };
11787
+ ShaderFactory.removeWebGLVersion = function removeWebGLVersion(source) {
11788
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11789
+ var match = source.match(versionTag);
11790
+ if (match) {
11791
+ return source.replace(match[0], "");
11792
+ }
11793
+ return source;
11794
+ };
11795
+ ShaderFactory.has300Output = function has300Output(fragmentShader) {
11796
+ // [layout(location = 0)] out [highp] vec4 [color];
11797
+ var fragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;
11798
+ return fragReg.test(fragmentShader);
11799
+ };
11800
+ ShaderFactory.replaceMRTShader = function replaceMRTShader(source, result) {
11801
+ var mrtIndexSet = new Set();
11802
+ var declaration = "";
11803
+ for(var i = 0; i < result.length; i++){
11804
+ var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
11805
+ if (res) {
11806
+ mrtIndexSet.add(res[1]);
11807
+ }
11808
+ }
11809
+ mrtIndexSet.forEach(function(index) {
11810
+ declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
11811
+ });
11812
+ declaration += "void main(";
11813
+ source = source.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
11814
+ source = source.replace(/void\s+?main\s*\(/g, declaration);
11815
+ return source;
11816
+ };
11817
+ return ShaderFactory;
11818
+ }();
11819
+
11746
11820
  // Bloom 阈值 Pass
11747
11821
  var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
11748
11822
  _inherits(BloomThresholdPass, RenderPass);
@@ -12040,7 +12114,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
12040
12114
  }(RenderPass);
12041
12115
 
12042
12116
  var RENDER_PASS_NAME_PREFIX = "_effects_default_";
12043
- var seed$6 = 1;
12117
+ var seed$5 = 1;
12044
12118
  /**
12045
12119
  * RenderFrame 抽象类
12046
12120
  */ var RenderFrame = /*#__PURE__*/ function() {
@@ -12194,7 +12268,7 @@ var seed$6 = 1;
12194
12268
  }
12195
12269
  this.semantics = new SemanticMap(options.semantics);
12196
12270
  this.clearAction = clearAction;
12197
- this.name = "RenderFrame" + seed$6++;
12271
+ this.name = "RenderFrame" + seed$5++;
12198
12272
  var firstRP = renderPasses[0];
12199
12273
  this.emptyTexture = generateWhiteTexture(engine);
12200
12274
  this.transparentTexture = generateTransparentTexture(engine);
@@ -12503,6 +12577,9 @@ var seed$6 = 1;
12503
12577
  _proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
12504
12578
  var info = this.renderPassInfoMap.get(renderPass);
12505
12579
  var priority = mesh.priority;
12580
+ if (!info) {
12581
+ return;
12582
+ }
12506
12583
  if (renderPass.meshes.length === 0) {
12507
12584
  info.listStart = info.listEnd = priority;
12508
12585
  } else {
@@ -12677,6 +12754,8 @@ var seed$6 = 1;
12677
12754
  * 创建拷贝 RenderPass 用到的 Mesh 对象
12678
12755
  * @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
12679
12756
  */ _proto.createCopyMesh = function createCopyMesh(semantics) {
12757
+ var // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12758
+ _this_renderer_getShaderLibrary;
12680
12759
  var name = EFFECTS_COPY_MESH_NAME;
12681
12760
  var engine = this.renderer.engine;
12682
12761
  var geometry = Geometry.create(engine, {
@@ -12701,8 +12780,7 @@ var seed$6 = 1;
12701
12780
  drawCount: 4
12702
12781
  });
12703
12782
  var shader = createCopyShader(engine.gpuCapability.level, !!(semantics == null ? void 0 : semantics.depthTexture));
12704
- // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12705
- this.renderer.getShaderLibrary().addShader(shader);
12783
+ (_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
12706
12784
  var material = Material.create(engine, {
12707
12785
  uniformValues: {
12708
12786
  // @ts-expect-error
@@ -12766,7 +12844,10 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
12766
12844
  }
12767
12845
  var _proto = FinalCopyRP.prototype;
12768
12846
  _proto.configure = function configure(renderer) {
12769
- this.prePassTexture = renderer.getFramebuffer().getColorTextures()[0];
12847
+ var framebuffer = renderer.getFramebuffer();
12848
+ if (framebuffer) {
12849
+ this.prePassTexture = framebuffer.getColorTextures()[0];
12850
+ }
12770
12851
  renderer.setFramebuffer(null);
12771
12852
  };
12772
12853
  _proto.execute = function execute(renderer) {
@@ -13127,7 +13208,7 @@ var Renderer = /*#__PURE__*/ function() {
13127
13208
 
13128
13209
  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";
13129
13210
  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";
13130
- var seed$5 = 1;
13211
+ var seed$4 = 1;
13131
13212
  var InteractMesh = /*#__PURE__*/ function() {
13132
13213
  function InteractMesh(props, rendererOptions, transform, engine) {
13133
13214
  this.transform = transform;
@@ -13228,7 +13309,7 @@ var InteractMesh = /*#__PURE__*/ function() {
13228
13309
  };
13229
13310
  _proto.createMesh = function createMesh(geometry, material) {
13230
13311
  return Mesh.create(this.engine, {
13231
- name: "Interact_preview" + seed$5++,
13312
+ name: "Interact_preview" + seed$4++,
13232
13313
  priority: 0,
13233
13314
  worldMatrix: Matrix4.fromIdentity(),
13234
13315
  geometry: geometry,
@@ -13280,13 +13361,15 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13280
13361
  if (type === InteractType.CLICK) {
13281
13362
  this.clickable = true;
13282
13363
  if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
13283
- var rendererOptions = this.item.composition.getRendererOptions();
13284
- this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13364
+ var rendererOptions = composition == null ? void 0 : composition.getRendererOptions();
13365
+ if (rendererOptions !== undefined) {
13366
+ this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13367
+ }
13285
13368
  }
13286
13369
  }
13287
13370
  if (options.type === InteractType.DRAG) {
13288
13371
  if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
13289
- composition.event && this.beginDragTarget(options, composition.event);
13372
+ (composition == null ? void 0 : composition.event) && this.beginDragTarget(options, composition.event);
13290
13373
  }
13291
13374
  }
13292
13375
  if (this.previewContent) {
@@ -13557,11 +13640,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
13557
13640
  var shaderLibrary = render.getShaderLibrary();
13558
13641
  var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
13559
13642
  var env = (options != null ? options : {}).env;
13560
- if (!shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)]) {
13561
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13562
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
13643
+ if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
13644
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13645
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, maxSpriteMeshItemCount, 1, env));
13563
13646
  if (detail.writableFragDepth) {
13564
- shaderLibrary.addShader(createCopyShader(level, true));
13647
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
13565
13648
  }
13566
13649
  }
13567
13650
  return Promise.resolve();
@@ -13893,7 +13976,7 @@ var tempColor = [
13893
13976
  1,
13894
13977
  1
13895
13978
  ];
13896
- var seed$4 = 0;
13979
+ var seed$3 = 0;
13897
13980
  var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13898
13981
  _inherits(SpriteColorPlayable, Playable);
13899
13982
  function SpriteColorPlayable() {
@@ -13934,8 +14017,9 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13934
14017
  colorChanged = true;
13935
14018
  }
13936
14019
  if (colorChanged) {
14020
+ var _this_spriteMaterial_getVector4;
13937
14021
  vecMulCombine(this.renderColor, colorInc, this.startColor);
13938
- this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
14022
+ (_this_spriteMaterial_getVector4 = this.spriteMaterial.getVector4("_Color")) == null ? void 0 : _this_spriteMaterial_getVector4.setFromArray(this.renderColor);
13939
14023
  }
13940
14024
  };
13941
14025
  _proto.create = function create(clipData) {
@@ -14001,7 +14085,7 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14001
14085
  }
14002
14086
  }
14003
14087
  };
14004
- _this.name = "MSprite" + seed$4++;
14088
+ _this.name = "MSprite" + seed$3++;
14005
14089
  _this.renderer = {
14006
14090
  renderMode: RenderMode.BILLBOARD,
14007
14091
  blending: BlendingMode.ALPHA,
@@ -14187,9 +14271,11 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14187
14271
  var data = this.getItemInitData();
14188
14272
  var renderer = this.renderer;
14189
14273
  var texParams = this.material.getVector4("_TexParams");
14190
- texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14191
- texParams.y = +this.preMultiAlpha;
14192
- texParams.z = renderer.renderMode;
14274
+ if (texParams) {
14275
+ texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14276
+ texParams.y = +this.preMultiAlpha;
14277
+ texParams.z = renderer.renderMode;
14278
+ }
14193
14279
  var attributes = {
14194
14280
  atlasOffset: new Float32Array(data.atlasOffset.length),
14195
14281
  index: new Uint16Array(data.index.length)
@@ -14482,7 +14568,7 @@ function setConfig(name, value) {
14482
14568
  }
14483
14569
 
14484
14570
  var tempQuat$1 = new Quaternion();
14485
- var seed$3 = 1;
14571
+ var seed$2 = 1;
14486
14572
  // TODO 继承 Component
14487
14573
  var Transform = /*#__PURE__*/ function() {
14488
14574
  function Transform(props, parent) {
@@ -14533,7 +14619,7 @@ var Transform = /*#__PURE__*/ function() {
14533
14619
  quat: new Quaternion(0, 0, 0, 1),
14534
14620
  scale: new Vector3(1, 1, 1)
14535
14621
  };
14536
- this.name = "transform_" + seed$3++;
14622
+ this.name = "transform_" + seed$2++;
14537
14623
  if (props) {
14538
14624
  this.setTransform(props);
14539
14625
  }
@@ -15838,8 +15924,8 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
15838
15924
  }
15839
15925
 
15840
15926
  var Burst = /*#__PURE__*/ function() {
15841
- function Burst(opts) {
15842
- var time = opts.time, interval = opts.interval, count = opts.count, cycles = opts.cycles, probability = opts.probability;
15927
+ function Burst(options) {
15928
+ var time = options.time, interval = options.interval, count = options.count, cycles = options.cycles, probability = options.probability;
15843
15929
  this.time = +time || 0;
15844
15930
  this.interval = +interval || 1;
15845
15931
  this.count = _instanceof1(count, ValueGetter) ? count : createValueGetter(count);
@@ -15867,7 +15953,14 @@ var Burst = /*#__PURE__*/ function() {
15867
15953
  this.now = 0;
15868
15954
  };
15869
15955
  _proto.clone = function clone() {
15870
- return new Burst(this);
15956
+ var options = {
15957
+ time: this.time,
15958
+ interval: this.interval,
15959
+ count: this.count,
15960
+ cycles: this.cycles,
15961
+ probability: this.probability
15962
+ };
15963
+ return new Burst(options);
15871
15964
  };
15872
15965
  return Burst;
15873
15966
  }();
@@ -16329,6 +16422,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16329
16422
  if (index >= 0 && index < pointCountPerTrail) {
16330
16423
  var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
16331
16424
  var data = this.geometry.getAttributeData("aColor");
16425
+ assertExist(data);
16332
16426
  out.x = data[startIndex];
16333
16427
  out.y = data[1 + startIndex];
16334
16428
  out.z = data[2 + startIndex];
@@ -16336,14 +16430,14 @@ var TrailMesh = /*#__PURE__*/ function() {
16336
16430
  }
16337
16431
  };
16338
16432
  _proto.clearAllTrails = function clearAllTrails() {
16339
- var geo = this.geometry;
16433
+ var indexData = this.geometry.getIndexData();
16434
+ assertExist(indexData);
16340
16435
  this.trailCursors = new Uint16Array(this.trailCursors.length);
16341
- // @ts-expect-error
16342
- geo.setIndexData(new Uint16Array(geo.getIndexData().length));
16436
+ this.geometry.setIndexData(new Uint16Array(indexData.length));
16343
16437
  };
16344
16438
  _proto.minusTime = function minusTime(time) {
16345
- // FIXME: 可选性
16346
16439
  var data = this.geometry.getAttributeData("aTime");
16440
+ assertExist(data);
16347
16441
  for(var i = 0; i < data.length; i++){
16348
16442
  data[i] -= time;
16349
16443
  }
@@ -16355,6 +16449,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16355
16449
  var pointCountPerTrail = this.pointCountPerTrail;
16356
16450
  var indicesPerTrail = (pointCountPerTrail - 1) * 6;
16357
16451
  var indices = this.geometry.getIndexData();
16452
+ assertExist(indices);
16358
16453
  indices.set(new Uint16Array(indicesPerTrail), index * indicesPerTrail);
16359
16454
  this.geometry.setIndexData(indices);
16360
16455
  this.trailCursors[index] = 0;
@@ -16808,7 +16903,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16808
16903
  break;
16809
16904
  }
16810
16905
  var burst = bursts[j];
16811
- var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
16906
+ var opts = burst.getGeneratorOptions(timePassed, lifetime);
16812
16907
  if (opts) {
16813
16908
  var originVec = [
16814
16909
  0,
@@ -16817,9 +16912,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16817
16912
  ];
16818
16913
  var offsets = emission.burstOffsets[j];
16819
16914
  var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
16820
- if (burst.once) {
16821
- this.removeBurst(j);
16822
- }
16823
16915
  for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
16824
16916
  var _p_transform;
16825
16917
  if (shouldSkipGenerate()) {
@@ -17460,9 +17552,10 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
17460
17552
  // this.item = vfxItem;
17461
17553
  var interaction = props.interaction;
17462
17554
  if (interaction) {
17555
+ var _interaction_radius;
17463
17556
  this.interaction = {
17464
17557
  multiple: interaction.multiple,
17465
- radius: interaction.radius,
17558
+ radius: (_interaction_radius = interaction.radius) != null ? _interaction_radius : 0.4,
17466
17559
  behavior: interaction.behavior
17467
17560
  };
17468
17561
  }
@@ -17546,7 +17639,10 @@ function randomArrItem(arr, keepArr) {
17546
17639
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17547
17640
  _inherits(ParticleBehaviourPlayable, Playable);
17548
17641
  function ParticleBehaviourPlayable() {
17549
- return Playable.apply(this, arguments);
17642
+ var _this;
17643
+ _this = Playable.apply(this, arguments) || this;
17644
+ _this.lastTime = 0;
17645
+ return _this;
17550
17646
  }
17551
17647
  var _proto = ParticleBehaviourPlayable.prototype;
17552
17648
  _proto.start = function start(context) {
@@ -17574,8 +17670,12 @@ function randomArrItem(arr, keepArr) {
17574
17670
  if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
17575
17671
  particleSystem.reset();
17576
17672
  }
17673
+ if (Math.abs(this.time - this.lastTime) < 0.001) {
17674
+ deltaTime = 0;
17675
+ }
17577
17676
  particleSystem.onUpdate(deltaTime);
17578
17677
  }
17678
+ this.lastTime = this.time;
17579
17679
  };
17580
17680
  return ParticleBehaviourPlayable;
17581
17681
  }(Playable);
@@ -17988,6 +18088,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17988
18088
  _proto.getPointColor = function getPointColor(index) {
17989
18089
  var data = this.geometry.getAttributeData("aRot");
17990
18090
  var i = index * 32 + 4;
18091
+ assertExist(data);
17991
18092
  return [
17992
18093
  data[i],
17993
18094
  data[i + 1],
@@ -18017,6 +18118,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18017
18118
  };
18018
18119
  _proto.minusTime = function minusTime(time) {
18019
18120
  var data = this.geometry.getAttributeData("aOffset");
18121
+ assertExist(data);
18020
18122
  for(var i = 0; i < data.length; i += 4){
18021
18123
  data[i + 2] -= time;
18022
18124
  }
@@ -18143,6 +18245,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18143
18245
  var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
18144
18246
  if (increaseBuffer) {
18145
18247
  var baseData = geometry.getAttributeData(name);
18248
+ assertExist(baseData);
18146
18249
  var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
18147
18250
  geoData.set(data, data.length * index);
18148
18251
  geometry.setAttributeData(name, geoData);
@@ -18512,12 +18615,8 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18512
18615
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18513
18616
  if (item.content.trails) {
18514
18617
  var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18515
- var _shader_macros;
18516
- shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, ShaderType.vertex, level);
18517
- var _shader_macros1;
18518
- shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, ShaderType.fragment, level);
18519
18618
  shader1.glslVersion = level === 2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1;
18520
- shaderLibrary.addShader(shader1);
18619
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
18521
18620
  }
18522
18621
  });
18523
18622
  shaders.forEach(function(shader) {
@@ -18527,15 +18626,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18527
18626
  } else {
18528
18627
  shader.glslVersion = GLSLVersion.GLSL1;
18529
18628
  }
18530
- var _shader_macros;
18531
- shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, ShaderType.vertex, level);
18532
- var _shader_macros1;
18533
- shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, ShaderType.fragment, level);
18534
- shaderLibrary.addShader(shader);
18629
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
18535
18630
  });
18536
18631
  if (level === 2) {
18537
18632
  items.forEach(function(item) {
18538
- // @ts-expect-error
18539
18633
  item.content.options.meshSlots = [
18540
18634
  maxVertexCount,
18541
18635
  maxFragmentCount
@@ -19773,7 +19867,9 @@ var CanvasPool = /*#__PURE__*/ function() {
19773
19867
  };
19774
19868
  _proto.getCanvas = function getCanvas() {
19775
19869
  if (this.elements.length !== 0) {
19776
- return this.elements.shift();
19870
+ var canvas = this.elements.shift();
19871
+ assertExist(canvas);
19872
+ return canvas;
19777
19873
  }
19778
19874
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19779
19875
  return window._createOffscreenCanvas(10, 10);
@@ -19798,9 +19894,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19798
19894
  return CanvasPool;
19799
19895
  }();
19800
19896
  var canvasPool = new CanvasPool();
19801
- function getDefaultTemplateCanvasPool() {
19802
- return canvasPool;
19803
- }
19804
19897
 
19805
19898
  var DEFAULT_FONTS = [
19806
19899
  "serif",
@@ -20222,7 +20315,6 @@ var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
20222
20315
  return TextLoader;
20223
20316
  }(AbstractPlugin);
20224
20317
 
20225
- var seed$2 = 1;
20226
20318
  var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20227
20319
  _inherits(EffectComponent, RendererComponent);
20228
20320
  function EffectComponent(engine) {
@@ -20233,7 +20325,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20233
20325
  */ _this.worldMatrix = Matrix4.fromIdentity();
20234
20326
  _this.triangles = [];
20235
20327
  _this.destroyed = false;
20236
- _this.visible = false;
20237
20328
  // TODO 点击测试后续抽象一个 Collider 组件
20238
20329
  _this.getHitTestParams = function(force) {
20239
20330
  var area = _this.getBoundingBox();
@@ -20244,18 +20335,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20244
20335
  };
20245
20336
  }
20246
20337
  };
20247
- _this.id = "Mesh" + seed$2++;
20248
- _this.name = "<unnamed>";
20338
+ _this.name = "EffectComponent";
20249
20339
  _this._priority = 0;
20250
20340
  return _this;
20251
20341
  }
20252
20342
  var _proto = EffectComponent.prototype;
20253
- /**
20254
- * 设置当前 Mesh 的可见性。
20255
- * @param visible - true:可见,false:不可见
20256
- */ _proto.setVisible = function setVisible(visible) {
20257
- this.visible = visible;
20258
- };
20259
20343
  _proto.start = function start() {
20260
20344
  this.item.getHitTestParams = this.getHitTestParams;
20261
20345
  };
@@ -20266,16 +20350,6 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20266
20350
  renderer.drawGeometry(this.geometry, this.material);
20267
20351
  };
20268
20352
  /**
20269
- * 获取当前 Mesh 的可见性。
20270
- */ _proto.getVisible = function getVisible() {
20271
- return this.visible;
20272
- };
20273
- /**
20274
- * 获取当前 Mesh 的第一个 geometry。
20275
- */ _proto.firstGeometry = function firstGeometry() {
20276
- return this.geometry;
20277
- };
20278
- /**
20279
20353
  * 设置当前 Mesh 的材质
20280
20354
  * @param material - 要设置的材质
20281
20355
  * @param destroy - 可选的材质销毁选项
@@ -20322,27 +20396,11 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20322
20396
  * @param options - 可选的销毁选项
20323
20397
  */ _proto.dispose = function dispose(options) {
20324
20398
  if (this.destroyed) {
20325
- //console.error('call mesh.destroy multiple times', this);
20326
20399
  return;
20327
20400
  }
20328
- // if (options?.geometries !== DestroyOptions.keep) {
20329
- // this.geometry.dispose();
20330
- // }
20331
- // const materialDestroyOption = options?.material;
20332
- // if (materialDestroyOption !== DestroyOptions.keep) {
20333
- // this.material.dispose(materialDestroyOption);
20334
- // }
20335
20401
  this.destroyed = true;
20336
20402
  RendererComponent.prototype.dispose.call(this);
20337
20403
  };
20338
- _create_class(EffectComponent, [
20339
- {
20340
- key: "isDestroyed",
20341
- get: function get() {
20342
- return this.destroyed;
20343
- }
20344
- }
20345
- ]);
20346
20404
  return EffectComponent;
20347
20405
  }(RendererComponent);
20348
20406
  __decorate([
@@ -20352,8 +20410,10 @@ EffectComponent = __decorate([
20352
20410
  effectsClass(DataType.EffectComponent)
20353
20411
  ], EffectComponent);
20354
20412
  function geometryToTriangles(geometry) {
20355
- var indices = geometry.getIndexData();
20356
- var vertices = geometry.getAttributeData("aPos");
20413
+ var _geometry_getIndexData;
20414
+ var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
20415
+ var _geometry_getAttributeData;
20416
+ var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
20357
20417
  var res = [];
20358
20418
  for(var i = 0; i < indices.length; i += 3){
20359
20419
  var index0 = indices[i] * 3;
@@ -23078,6 +23138,7 @@ function getStandardJSON(json) {
23078
23138
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
23079
23139
  return version30Migration(version21Migration(getStandardJSONFromV0(json)));
23080
23140
  }
23141
+ reverseParticle = false;
23081
23142
  var vs = standardVersion.exec(json.version) || [];
23082
23143
  var mainVersion = Number(vs[1]);
23083
23144
  var minorVersion = Number(vs[2]);
@@ -23824,7 +23885,6 @@ var seed$1 = 1;
23824
23885
  return __generator(this, function(_state) {
23825
23886
  switch(_state.label){
23826
23887
  case 0:
23827
- // TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
23828
23888
  jsonScene = getStandardJSON(json);
23829
23889
  _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
23830
23890
  pluginSystem = new PluginSystem(plugins);
@@ -24118,18 +24178,18 @@ var seed$1 = 1;
24118
24178
  source: source
24119
24179
  };
24120
24180
  });
24121
- jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(texOpts, idx) {
24122
- var e, source, image, tex;
24181
+ jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
24182
+ var e, source, image, texture;
24123
24183
  return __generator(this, function(_state) {
24124
24184
  switch(_state.label){
24125
24185
  case 0:
24126
- if (_instanceof1(texOpts, Texture)) {
24186
+ if (_instanceof1(textureOptions, Texture)) {
24127
24187
  return [
24128
24188
  2,
24129
- texOpts
24189
+ textureOptions
24130
24190
  ];
24131
24191
  }
24132
- if (!("mipmaps" in texOpts)) return [
24192
+ if (!("mipmaps" in textureOptions)) return [
24133
24193
  3,
24134
24194
  4
24135
24195
  ];
@@ -24143,7 +24203,7 @@ var seed$1 = 1;
24143
24203
  ]);
24144
24204
  return [
24145
24205
  4,
24146
- deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
24206
+ deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
24147
24207
  ];
24148
24208
  case 2:
24149
24209
  return [
@@ -24154,12 +24214,11 @@ var seed$1 = 1;
24154
24214
  e = _state.sent();
24155
24215
  throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
24156
24216
  case 4:
24157
- source = texOpts.source;
24217
+ source = textureOptions.source;
24158
24218
  if (!isObject(source)) return [
24159
24219
  3,
24160
24220
  5
24161
24221
  ];
24162
- //@ts-expect-error
24163
24222
  image = engine.assetLoader.loadGUID(source.id).data;
24164
24223
  return [
24165
24224
  3,
@@ -24179,12 +24238,12 @@ var seed$1 = 1;
24179
24238
  _state.label = 7;
24180
24239
  case 7:
24181
24240
  if (image) {
24182
- tex = createTextureOptionsBySource(image, _this.assets[idx]);
24183
- tex.id = texOpts.id;
24184
- tex.dataType = DataType.Texture;
24241
+ texture = createTextureOptionsBySource(image, _this.assets[idx]);
24242
+ texture.id = textureOptions.id;
24243
+ texture.dataType = DataType.Texture;
24185
24244
  return [
24186
24245
  2,
24187
- tex.sourceType === TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
24246
+ texture.sourceType === TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
24188
24247
  ];
24189
24248
  }
24190
24249
  throw new Error("Invalid texture source: " + source + ".");
@@ -27571,7 +27630,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
27571
27630
  registerPlugin("particle", ParticleLoader, VFXItem, true);
27572
27631
  registerPlugin("cal", CalculateLoader, VFXItem, true);
27573
27632
  registerPlugin("interact", InteractLoader, VFXItem, true);
27574
- var version$1 = "2.0.0-alpha.33";
27633
+ var version$1 = "2.0.0-alpha.34";
27575
27634
  logger.info("Core version: " + version$1 + ".");
27576
27635
 
27577
27636
  var _obj;
@@ -27646,11 +27705,12 @@ var _obj3;
27646
27705
  var shader = props == null ? void 0 : props.shader;
27647
27706
  var level = engine.gpuCapability.level;
27648
27707
  _this.shader = new Shader(engine);
27708
+ var _shader_vertex, _shader_fragment;
27649
27709
  _this.shader.shaderData = _extends({}, shader, {
27650
27710
  id: generateGUID(),
27651
27711
  dataType: DataType.Shader,
27652
- vertex: (shader == null ? void 0 : shader.vertex) || "",
27653
- fragment: (shader == null ? void 0 : shader.fragment) || ""
27712
+ vertex: (_shader_vertex = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex : "",
27713
+ fragment: (_shader_fragment = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment : ""
27654
27714
  });
27655
27715
  for(var i = 0; i < maxSpriteMeshItemCount; i++){
27656
27716
  _this.uniforms["uSampler" + i] = new THREE.Uniform(null);
@@ -27716,9 +27776,22 @@ var _obj3;
27716
27776
  8,
27717
27777
  1
27718
27778
  ]);
27779
+ var _shader_vertex1, _shader_fragment1;
27719
27780
  _this.material = new THREE.RawShaderMaterial({
27720
- vertexShader: createShaderWithMacros(shader.macros, shader.vertex, ShaderType.vertex, _this.engine.gpuCapability.level),
27721
- fragmentShader: createShaderWithMacros(shader.macros, shader.fragment, ShaderType.fragment, _this.engine.gpuCapability.level),
27781
+ vertexShader: ShaderFactory.genFinalShaderCode({
27782
+ level: _this.engine.gpuCapability.level,
27783
+ shaderType: ShaderType.vertex,
27784
+ shader: (_shader_vertex1 = shader == null ? void 0 : shader.vertex) != null ? _shader_vertex1 : "",
27785
+ macros: shader == null ? void 0 : shader.macros,
27786
+ removeVersion: true
27787
+ }),
27788
+ fragmentShader: ShaderFactory.genFinalShaderCode({
27789
+ level: _this.engine.gpuCapability.level,
27790
+ shaderType: ShaderType.fragment,
27791
+ shader: (_shader_fragment1 = shader == null ? void 0 : shader.fragment) != null ? _shader_fragment1 : "",
27792
+ macros: shader == null ? void 0 : shader.macros,
27793
+ removeVersion: true
27794
+ }),
27722
27795
  alphaToCoverage: false,
27723
27796
  depthFunc: THREE.LessDepth,
27724
27797
  polygonOffsetFactor: THREE.ZeroFactor,
@@ -29238,8 +29311,8 @@ setMaxSpriteMeshItemCount(8);
29238
29311
  */ Mesh.create = function(engine, props) {
29239
29312
  return new ThreeMesh(engine, props);
29240
29313
  };
29241
- var version = "2.0.0-alpha.33";
29314
+ var version = "2.0.0-alpha.34";
29242
29315
  logger.info("THREEJS plugin version: " + version + ".");
29243
29316
 
29244
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
29317
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, 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, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
29245
29318
  //# sourceMappingURL=index.mjs.map