@galacean/effects-core 2.0.0-alpha.32 → 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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.32
6
+ * Version: v2.0.0-alpha.34
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4786,7 +4786,9 @@ __decorate([
4786
4786
  // }
4787
4787
  /**
4788
4788
  * 在每次设置 enabled 为 true 时触发
4789
- */ _proto.onEnable = function onEnable() {};
4789
+ */ _proto.onEnable = function onEnable() {
4790
+ // OVERRIDE
4791
+ };
4790
4792
  /**
4791
4793
  * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
4792
4794
  */ _proto.start = function start() {
@@ -7655,55 +7657,6 @@ function getPreMultiAlpha(blending) {
7655
7657
  return 1;
7656
7658
  }
7657
7659
  }
7658
- var _obj$6;
7659
- var downgradeKeywords = (_obj$6 = {}, _obj$6[exports.ShaderType.vertex] = {
7660
- in: "attribute",
7661
- out: "varying"
7662
- }, _obj$6[exports.ShaderType.fragment] = {
7663
- in: "varying"
7664
- }, _obj$6);
7665
- /**
7666
- * 生成 shader,检测到 WebGL1 上下文会降级
7667
- * @param macros - 宏定义数组
7668
- * @param shader - 原始 shader 文本
7669
- * @param shaderType - shader 类型
7670
- * @return 去除版本号的 shader 文本
7671
- */ function createShaderWithMacros(macros, shader, shaderType, level) {
7672
- var ret = [];
7673
- var header = "";
7674
- // shader 标志宏,没有其他含义,方便不支持完全的自定义 shader 的三方引擎接入使用
7675
- ret.push("#define GE_RUNTIME");
7676
- if (macros) {
7677
- macros.forEach(function(param) {
7678
- var key = param[0], value = param[1];
7679
- if (value === true) {
7680
- ret.push("#define " + key);
7681
- } else if (Number.isFinite(value)) {
7682
- ret.push("#define " + key + " " + value);
7683
- }
7684
- });
7685
- header = ret.length ? ret.join("\n") + "\n" : "";
7686
- }
7687
- var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
7688
- var GL_TYPE = "WEBGL" + level;
7689
- header = header + ("\n#ifndef " + GL_TYPE + "\n#define " + GL_TYPE + "\n#endif");
7690
- var fullShader = header + "\n" + shader;
7691
- // 判断shader是否带有版本头
7692
- var match = fullShader.match(versionTag);
7693
- var version = match ? match[0] : "";
7694
- if (version && version.includes("300")) {
7695
- var reg = new RegExp("" + version, "g");
7696
- // 带版本头且level为1,降级
7697
- if (level === 1) {
7698
- fullShader = fullShader.replace(/\b(in|out)\b/g, function(str) {
7699
- var _downgradeKeywords_shaderType_str;
7700
- return (_downgradeKeywords_shaderType_str = downgradeKeywords[shaderType][str]) != null ? _downgradeKeywords_shaderType_str : str;
7701
- });
7702
- }
7703
- fullShader = fullShader.replace(reg, "\n");
7704
- }
7705
- return fullShader;
7706
- }
7707
7660
  function setBlendMode(material, blendMode) {
7708
7661
  switch(blendMode){
7709
7662
  case undefined:
@@ -8406,7 +8359,7 @@ function _loadMipmapImage() {
8406
8359
  return _loadMipmapImage.apply(this, arguments);
8407
8360
  }
8408
8361
 
8409
- var seed$9 = 1;
8362
+ var seed$8 = 1;
8410
8363
  /**
8411
8364
  * Texture 抽象类
8412
8365
  */ var Texture = /*#__PURE__*/ function(EffectsObject) {
@@ -8415,7 +8368,7 @@ var seed$9 = 1;
8415
8368
  var _this;
8416
8369
  _this = EffectsObject.call(this, engine) || this;
8417
8370
  _this.destroyed = false;
8418
- _this.id = "Tex" + seed$9++;
8371
+ _this.id = "Tex" + seed$8++;
8419
8372
  return _this;
8420
8373
  }
8421
8374
  var _proto = Texture.prototype;
@@ -9043,7 +8996,7 @@ exports.MaterialRenderType = void 0;
9043
8996
  /**
9044
8997
  * 用于设置材质默认名称的自增序号
9045
8998
  * @internal
9046
- */ var seed$8 = 1;
8999
+ */ var seed$7 = 1;
9047
9000
  /**
9048
9001
  * Material 抽象类
9049
9002
  */ var Material = /*#__PURE__*/ function(EffectsObject) {
@@ -9056,14 +9009,14 @@ exports.MaterialRenderType = void 0;
9056
9009
  _this.destroyed = false;
9057
9010
  _this.initialized = false;
9058
9011
  if (props) {
9059
- 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;
9012
+ var _props_name = props.name, name = _props_name === void 0 ? "Material" + seed$7++ : _props_name, _props_renderType = props.renderType, renderType = _props_renderType === void 0 ? 0 : _props_renderType, shader = props.shader, uniformSemantics = props.uniformSemantics;
9060
9013
  _this.name = name;
9061
9014
  _this.renderType = renderType; // TODO 没有地方用到
9062
9015
  _this.shaderSource = shader;
9063
9016
  _this.props = props;
9064
9017
  _this.uniformSemantics = _extends({}, uniformSemantics); // TODO 废弃,待移除
9065
9018
  } else {
9066
- _this.name = "Material" + seed$8++;
9019
+ _this.name = "Material" + seed$7++;
9067
9020
  _this.renderType = 0;
9068
9021
  }
9069
9022
  return _this;
@@ -9388,29 +9341,6 @@ function vecFill(out, number) {
9388
9341
  }
9389
9342
  return out;
9390
9343
  }
9391
- function vecAssign(out, a, count, start) {
9392
- if (start === void 0) start = 0;
9393
- for(var i = 0; i < count; i++){
9394
- out[i] = a[i + start];
9395
- }
9396
- return out;
9397
- }
9398
- function vecNormalize(out, a) {
9399
- var _Math;
9400
- if (arguments.length === 1) {
9401
- a = out;
9402
- out = [];
9403
- }
9404
- var ap = a;
9405
- var sum = (_Math = Math).hypot.apply(_Math, [].concat(ap));
9406
- if (sum === 0) {
9407
- return vecAssign(out, ap, ap.length);
9408
- }
9409
- for(var i = 0; i < ap.length; i++){
9410
- out[i] = ap[i] / sum;
9411
- }
9412
- return out;
9413
- }
9414
9344
  function vecMulCombine(out, a, b) {
9415
9345
  if (a && b) {
9416
9346
  for(var i = 0, len = a.length; i < len; i++){
@@ -9500,10 +9430,6 @@ function numberToFix(a, fixed) {
9500
9430
  var base = Math.pow(10, fixed);
9501
9431
  return Math.floor(a * base) / base;
9502
9432
  }
9503
- function pointOnLine(x1, y1, x2, y2, x3, y3) {
9504
- var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;
9505
- return det1 > -0.001 && det1 < 0.001;
9506
- }
9507
9433
 
9508
9434
  function _is_native_reflect_construct() {
9509
9435
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
@@ -10946,21 +10872,16 @@ exports.Shader = __decorate([
10946
10872
 
10947
10873
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
10948
10874
  var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
10949
- 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}";
10950
- 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";
10875
+ 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}";
10876
+ 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";
10951
10877
  function createCopyShader(level, writeDepth) {
10952
10878
  var webgl2 = level === 2;
10953
- var version = webgl2 ? "#version 300 es" : "";
10954
10879
  return {
10955
10880
  name: EFFECTS_COPY_MESH_NAME,
10956
- vertex: version + "\n" + COPY_VERTEX_SHADER,
10957
- fragment: version + "\n" + COPY_FRAGMENT_SHADER,
10881
+ vertex: COPY_VERTEX_SHADER,
10882
+ fragment: COPY_FRAGMENT_SHADER,
10958
10883
  glslVersion: webgl2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1,
10959
10884
  macros: [
10960
- [
10961
- "WEBGL2",
10962
- !!webgl2
10963
- ],
10964
10885
  [
10965
10886
  "DEPTH_TEXTURE",
10966
10887
  !!writeDepth
@@ -11128,7 +11049,7 @@ function generateEmptyTypedArray(type) {
11128
11049
  return new Float32Array(0);
11129
11050
  }
11130
11051
 
11131
- var seed$7 = 1;
11052
+ var seed$6 = 1;
11132
11053
  /**
11133
11054
  * Mesh 抽象类
11134
11055
  */ var Mesh = /*#__PURE__*/ function(RendererComponent) {
@@ -11140,14 +11061,14 @@ var seed$7 = 1;
11140
11061
  _this.visible = true;
11141
11062
  if (props) {
11142
11063
  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;
11143
- _this.id = "Mesh" + seed$7++;
11064
+ _this.id = "Mesh" + seed$6++;
11144
11065
  _this.name = name;
11145
11066
  _this.geometry = geometry;
11146
11067
  _this.material = material;
11147
11068
  _this.priority = priority;
11148
11069
  _this.worldMatrix = worldMatrix;
11149
11070
  } else {
11150
- _this.id = "Mesh" + seed$7++;
11071
+ _this.id = "Mesh" + seed$6++;
11151
11072
  _this.name = "<unnamed>";
11152
11073
  _this.worldMatrix = Matrix4.fromIdentity();
11153
11074
  _this._priority = 0;
@@ -11352,7 +11273,7 @@ exports.RenderPassDestroyAttachmentType = void 0;
11352
11273
  * 强制销毁
11353
11274
  */ RenderPassDestroyAttachmentType[RenderPassDestroyAttachmentType["destroy"] = 0] = "destroy";
11354
11275
  })(exports.RenderPassDestroyAttachmentType || (exports.RenderPassDestroyAttachmentType = {}));
11355
- var seed$6 = 1;
11276
+ var seed$5 = 1;
11356
11277
  /**
11357
11278
  * RenderPass 抽象类
11358
11279
  */ var RenderPass = /*#__PURE__*/ function() {
@@ -11362,7 +11283,7 @@ var seed$6 = 1;
11362
11283
  */ this.attachments = [];
11363
11284
  this.destroyed = false;
11364
11285
  this.initialized = false;
11365
- 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 ? exports.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;
11286
+ var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$5++ : _options_name, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _options_priority = options.priority, priority = _options_priority === void 0 ? 0 : _options_priority, _options_meshOrder = options.meshOrder, meshOrder = _options_meshOrder === void 0 ? exports.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;
11366
11287
  this.name = name;
11367
11288
  this.renderer = renderer;
11368
11289
  this.priority = priority;
@@ -11582,10 +11503,12 @@ var seed$6 = 1;
11582
11503
  */ _proto.getDepthAttachment = function getDepthAttachment() {
11583
11504
  var framebuffer = this.framebuffer;
11584
11505
  if (framebuffer) {
11506
+ var depthTexture = framebuffer.getDepthTexture();
11507
+ var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
11585
11508
  return {
11586
11509
  storageType: framebuffer.depthStencilStorageType,
11587
11510
  storage: framebuffer.depthStorage,
11588
- texture: framebuffer.getDepthTexture() ? this.getDepthTexture(framebuffer.getDepthTexture(), framebuffer.externalStorage) : undefined
11511
+ texture: texture
11589
11512
  };
11590
11513
  }
11591
11514
  };
@@ -11594,10 +11517,12 @@ var seed$6 = 1;
11594
11517
  */ _proto.getStencilAttachment = function getStencilAttachment() {
11595
11518
  var framebuffer = this.framebuffer;
11596
11519
  if (framebuffer) {
11520
+ var stencilTexture = framebuffer.getStencilTexture();
11521
+ var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
11597
11522
  return {
11598
11523
  storageType: framebuffer.depthStencilStorageType,
11599
11524
  storage: framebuffer.stencilStorage,
11600
- texture: framebuffer.getStencilTexture() ? this.getStencilTexture(framebuffer.getStencilTexture(), framebuffer.externalStorage) : undefined
11525
+ texture: texture
11601
11526
  };
11602
11527
  }
11603
11528
  };
@@ -11709,11 +11634,7 @@ var seed$6 = 1;
11709
11634
 
11710
11635
  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;}";
11711
11636
 
11712
- 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";
11713
-
11714
- var compatible_vert = "#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n";
11715
-
11716
- 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);}";
11637
+ 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);}";
11717
11638
 
11718
11639
  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.;}";
11719
11640
 
@@ -11721,13 +11642,13 @@ var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3
11721
11642
 
11722
11643
  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;}";
11723
11644
 
11724
- 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";
11645
+ 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";
11725
11646
 
11726
- 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}}";
11647
+ 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}}";
11727
11648
 
11728
- 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}";
11649
+ 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}";
11729
11650
 
11730
- 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.;}";
11651
+ 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.;}";
11731
11652
 
11732
11653
  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";
11733
11654
 
@@ -11745,6 +11666,159 @@ var gaussianUpFrag = "precision highp float;varying vec2 uv;uniform sampler2D _M
11745
11666
 
11746
11667
  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);}";
11747
11668
 
11669
+ var shaderLib = {};
11670
+ var ShaderFactory = /*#__PURE__*/ function() {
11671
+ function ShaderFactory() {}
11672
+ ShaderFactory.registerInclude = function registerInclude(includeName, includeSource) {
11673
+ if (shaderLib[includeName]) {
11674
+ logger.warn('The "' + includeName + '" shader include already exist.');
11675
+ }
11676
+ shaderLib[includeName] = includeSource;
11677
+ };
11678
+ ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
11679
+ delete shaderLib[includeName];
11680
+ };
11681
+ ShaderFactory.unRegisterAllIncludes = function unRegisterAllIncludes() {
11682
+ Object.keys(shaderLib).forEach(function(key) {
11683
+ ShaderFactory.unRegisterInclude(key);
11684
+ });
11685
+ };
11686
+ /**
11687
+ * 生成 shader,检测到 WebGL1 上下文会降级
11688
+ * @param macros - 宏定义数组
11689
+ * @param shader - 原始 shader 文本
11690
+ * @param shaderType - shader 类型
11691
+ * @return 去除版本号的 shader 文本
11692
+ */ ShaderFactory.genFinalShaderCode = function genFinalShaderCode(options) {
11693
+ var level = options.level, shaderType = options.shaderType, shader = options.shader, macros = options.macros, removeVersion = options.removeVersion;
11694
+ var macroString = ShaderFactory.genMacroString(level, macros);
11695
+ var versionString = ShaderFactory.genShaderVersion(level);
11696
+ var source = ShaderFactory.parseIncludes(shader);
11697
+ var isVersion300 = ShaderFactory.isVersion300(source);
11698
+ source = ShaderFactory.removeWebGLVersion(source);
11699
+ if (level === 2 && !isVersion300) {
11700
+ source = ShaderFactory.convertTo300(source, shaderType === exports.ShaderType.fragment);
11701
+ }
11702
+ if (removeVersion) {
11703
+ return macroString + source;
11704
+ }
11705
+ return versionString + macroString + source;
11706
+ };
11707
+ /**
11708
+ * Convert lower GLSL version to GLSL 300 es.
11709
+ * @param source - code
11710
+ * @param isFragment - Whether it is a fragment shader.
11711
+ * */ ShaderFactory.convertTo300 = function convertTo300(source, isFragment) {
11712
+ source = source.replace(/\bvarying\b/g, isFragment ? "in" : "out");
11713
+ source = source.replace(/\btexture(2D|Cube)\b/g, "texture");
11714
+ // Remove extensions
11715
+ var regex = /#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;
11716
+ source = source.replace(regex, "");
11717
+ if (isFragment) {
11718
+ source = source.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
11719
+ source = source.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
11720
+ source = source.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
11721
+ if (!ShaderFactory.has300Output(source)) {
11722
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(source);
11723
+ if (isMRT) {
11724
+ source = source.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
11725
+ var result = source.match(/\bgl_FragData\[.+?\]/g);
11726
+ if (result) {
11727
+ source = ShaderFactory.replaceMRTShader(source, result);
11728
+ }
11729
+ } else {
11730
+ source = source.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
11731
+ source = source.replace(/\bgl_FragColor\b/g, "glFragColor");
11732
+ }
11733
+ }
11734
+ } else {
11735
+ source = source.replace(/\battribute\b/g, "in");
11736
+ }
11737
+ return source;
11738
+ };
11739
+ ShaderFactory.parseIncludes = function parseIncludes(source, regex) {
11740
+ if (regex === void 0) regex = /#include <(.+)>/gm;
11741
+ var match;
11742
+ while((match = regex.exec(source)) !== null){
11743
+ var shaderName = match[1];
11744
+ var replace = shaderLib[shaderName];
11745
+ if (replace === undefined) {
11746
+ throw new Error("Can't find include shader name " + shaderName);
11747
+ }
11748
+ source = source.replace(match[0], replace);
11749
+ }
11750
+ return source;
11751
+ };
11752
+ ShaderFactory.genMacroString = function genMacroString(level, macros, addRuntimeMacro) {
11753
+ if (addRuntimeMacro === void 0) addRuntimeMacro = true;
11754
+ var macroList = [];
11755
+ var webGLVersion = "WEBGL" + level;
11756
+ macroList.push("#ifndef " + webGLVersion);
11757
+ macroList.push("#define " + webGLVersion);
11758
+ macroList.push("#endif");
11759
+ if (addRuntimeMacro) {
11760
+ macroList.push("#define GE_RUNTIME");
11761
+ }
11762
+ if (macros && macros.length) {
11763
+ macros.forEach(function(param) {
11764
+ var key = param[0], value = param[1];
11765
+ if (value === true) {
11766
+ macroList.push("#define " + key);
11767
+ } else if (Number.isFinite(value)) {
11768
+ macroList.push("#define " + key + " " + value);
11769
+ }
11770
+ });
11771
+ }
11772
+ if (macroList.length) {
11773
+ return macroList.join("\n") + "\n";
11774
+ }
11775
+ return "";
11776
+ };
11777
+ ShaderFactory.genShaderVersion = function genShaderVersion(level) {
11778
+ if (level === 1) {
11779
+ return "#version 100\n";
11780
+ }
11781
+ return "#version 300 es\n";
11782
+ };
11783
+ ShaderFactory.isVersion300 = function isVersion300(source) {
11784
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11785
+ var match = source.match(versionTag);
11786
+ var version = match ? match[0] : "";
11787
+ return version.includes("300");
11788
+ };
11789
+ ShaderFactory.removeWebGLVersion = function removeWebGLVersion(source) {
11790
+ var versionTag = /#version\s+\b\d{3}\b\s*(es)?/;
11791
+ var match = source.match(versionTag);
11792
+ if (match) {
11793
+ return source.replace(match[0], "");
11794
+ }
11795
+ return source;
11796
+ };
11797
+ ShaderFactory.has300Output = function has300Output(fragmentShader) {
11798
+ // [layout(location = 0)] out [highp] vec4 [color];
11799
+ var fragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;
11800
+ return fragReg.test(fragmentShader);
11801
+ };
11802
+ ShaderFactory.replaceMRTShader = function replaceMRTShader(source, result) {
11803
+ var mrtIndexSet = new Set();
11804
+ var declaration = "";
11805
+ for(var i = 0; i < result.length; i++){
11806
+ var res = result[i].match(/\bgl_FragData\[(.+?)\]/);
11807
+ if (res) {
11808
+ mrtIndexSet.add(res[1]);
11809
+ }
11810
+ }
11811
+ mrtIndexSet.forEach(function(index) {
11812
+ declaration += "layout(location=" + index + ") out vec4 fragOutColor" + index + ";\n";
11813
+ });
11814
+ declaration += "void main(";
11815
+ source = source.replace(/\bgl_FragData\[(.+?)\]/g, "fragOutColor$1");
11816
+ source = source.replace(/void\s+?main\s*\(/g, declaration);
11817
+ return source;
11818
+ };
11819
+ return ShaderFactory;
11820
+ }();
11821
+
11748
11822
  // Bloom 阈值 Pass
11749
11823
  var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
11750
11824
  _inherits(BloomThresholdPass, RenderPass);
@@ -12042,7 +12116,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
12042
12116
  }(RenderPass);
12043
12117
 
12044
12118
  var RENDER_PASS_NAME_PREFIX = "_effects_default_";
12045
- var seed$5 = 1;
12119
+ var seed$4 = 1;
12046
12120
  /**
12047
12121
  * RenderFrame 抽象类
12048
12122
  */ var RenderFrame = /*#__PURE__*/ function() {
@@ -12196,7 +12270,7 @@ var seed$5 = 1;
12196
12270
  }
12197
12271
  this.semantics = new SemanticMap(options.semantics);
12198
12272
  this.clearAction = clearAction;
12199
- this.name = "RenderFrame" + seed$5++;
12273
+ this.name = "RenderFrame" + seed$4++;
12200
12274
  var firstRP = renderPasses[0];
12201
12275
  this.emptyTexture = generateWhiteTexture(engine);
12202
12276
  this.transparentTexture = generateTransparentTexture(engine);
@@ -12505,6 +12579,9 @@ var seed$5 = 1;
12505
12579
  _proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
12506
12580
  var info = this.renderPassInfoMap.get(renderPass);
12507
12581
  var priority = mesh.priority;
12582
+ if (!info) {
12583
+ return;
12584
+ }
12508
12585
  if (renderPass.meshes.length === 0) {
12509
12586
  info.listStart = info.listEnd = priority;
12510
12587
  } else {
@@ -12679,6 +12756,8 @@ var seed$5 = 1;
12679
12756
  * 创建拷贝 RenderPass 用到的 Mesh 对象
12680
12757
  * @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
12681
12758
  */ _proto.createCopyMesh = function createCopyMesh(semantics) {
12759
+ var // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12760
+ _this_renderer_getShaderLibrary;
12682
12761
  var name = EFFECTS_COPY_MESH_NAME;
12683
12762
  var engine = this.renderer.engine;
12684
12763
  var geometry = Geometry.create(engine, {
@@ -12703,8 +12782,7 @@ var seed$5 = 1;
12703
12782
  drawCount: 4
12704
12783
  });
12705
12784
  var shader = createCopyShader(engine.gpuCapability.level, !!(semantics == null ? void 0 : semantics.depthTexture));
12706
- // FIXME: 如果不把shader添加进shaderLibrary,这里可以移到core中,有性能上的考虑
12707
- this.renderer.getShaderLibrary().addShader(shader);
12785
+ (_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
12708
12786
  var material = Material.create(engine, {
12709
12787
  uniformValues: {
12710
12788
  // @ts-expect-error
@@ -12768,7 +12846,10 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
12768
12846
  }
12769
12847
  var _proto = FinalCopyRP.prototype;
12770
12848
  _proto.configure = function configure(renderer) {
12771
- this.prePassTexture = renderer.getFramebuffer().getColorTextures()[0];
12849
+ var framebuffer = renderer.getFramebuffer();
12850
+ if (framebuffer) {
12851
+ this.prePassTexture = framebuffer.getColorTextures()[0];
12852
+ }
12772
12853
  renderer.setFramebuffer(null);
12773
12854
  };
12774
12855
  _proto.execute = function execute(renderer) {
@@ -13129,7 +13210,7 @@ var Renderer = /*#__PURE__*/ function() {
13129
13210
 
13130
13211
  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";
13131
13212
  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";
13132
- var seed$4 = 1;
13213
+ var seed$3 = 1;
13133
13214
  var InteractMesh = /*#__PURE__*/ function() {
13134
13215
  function InteractMesh(props, rendererOptions, transform, engine) {
13135
13216
  this.transform = transform;
@@ -13230,7 +13311,7 @@ var InteractMesh = /*#__PURE__*/ function() {
13230
13311
  };
13231
13312
  _proto.createMesh = function createMesh(geometry, material) {
13232
13313
  return Mesh.create(this.engine, {
13233
- name: "Interact_preview" + seed$4++,
13314
+ name: "Interact_preview" + seed$3++,
13234
13315
  priority: 0,
13235
13316
  worldMatrix: Matrix4.fromIdentity(),
13236
13317
  geometry: geometry,
@@ -13282,13 +13363,15 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13282
13363
  if (type === InteractType.CLICK) {
13283
13364
  this.clickable = true;
13284
13365
  if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
13285
- var rendererOptions = this.item.composition.getRendererOptions();
13286
- this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13366
+ var rendererOptions = composition == null ? void 0 : composition.getRendererOptions();
13367
+ if (rendererOptions !== undefined) {
13368
+ this.previewContent = new InteractMesh(this.item.props.content, rendererOptions, this.transform, this.engine);
13369
+ }
13287
13370
  }
13288
13371
  }
13289
13372
  if (options.type === InteractType.DRAG) {
13290
13373
  if (env !== PLAYER_OPTIONS_ENV_EDITOR || options.enableInEditor) {
13291
- composition.event && this.beginDragTarget(options, composition.event);
13374
+ (composition == null ? void 0 : composition.event) && this.beginDragTarget(options, composition.event);
13292
13375
  }
13293
13376
  }
13294
13377
  if (this.previewContent) {
@@ -13559,11 +13642,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
13559
13642
  var shaderLibrary = render.getShaderLibrary();
13560
13643
  var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
13561
13644
  var env = (options != null ? options : {}).env;
13562
- if (!shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)]) {
13563
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13564
- shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, exports.maxSpriteMeshItemCount, 1, env));
13645
+ if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
13646
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
13647
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, exports.maxSpriteMeshItemCount, 1, env));
13565
13648
  if (detail.writableFragDepth) {
13566
- shaderLibrary.addShader(createCopyShader(level, true));
13649
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
13567
13650
  }
13568
13651
  }
13569
13652
  return Promise.resolve();
@@ -13895,7 +13978,7 @@ var tempColor = [
13895
13978
  1,
13896
13979
  1
13897
13980
  ];
13898
- var seed$3 = 0;
13981
+ var seed$2 = 0;
13899
13982
  var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13900
13983
  _inherits(SpriteColorPlayable, Playable);
13901
13984
  function SpriteColorPlayable() {
@@ -13936,8 +14019,9 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13936
14019
  colorChanged = true;
13937
14020
  }
13938
14021
  if (colorChanged) {
14022
+ var _this_spriteMaterial_getVector4;
13939
14023
  vecMulCombine(this.renderColor, colorInc, this.startColor);
13940
- this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor);
14024
+ (_this_spriteMaterial_getVector4 = this.spriteMaterial.getVector4("_Color")) == null ? void 0 : _this_spriteMaterial_getVector4.setFromArray(this.renderColor);
13941
14025
  }
13942
14026
  };
13943
14027
  _proto.create = function create(clipData) {
@@ -14003,7 +14087,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14003
14087
  }
14004
14088
  }
14005
14089
  };
14006
- _this.name = "MSprite" + seed$3++;
14090
+ _this.name = "MSprite" + seed$2++;
14007
14091
  _this.renderer = {
14008
14092
  renderMode: RenderMode.BILLBOARD,
14009
14093
  blending: BlendingMode.ALPHA,
@@ -14189,9 +14273,11 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14189
14273
  var data = this.getItemInitData();
14190
14274
  var renderer = this.renderer;
14191
14275
  var texParams = this.material.getVector4("_TexParams");
14192
- texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14193
- texParams.y = +this.preMultiAlpha;
14194
- texParams.z = renderer.renderMode;
14276
+ if (texParams) {
14277
+ texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
14278
+ texParams.y = +this.preMultiAlpha;
14279
+ texParams.z = renderer.renderMode;
14280
+ }
14195
14281
  var attributes = {
14196
14282
  atlasOffset: new Float32Array(data.atlasOffset.length),
14197
14283
  index: new Uint16Array(data.index.length)
@@ -14484,7 +14570,7 @@ function setConfig(name, value) {
14484
14570
  }
14485
14571
 
14486
14572
  var tempQuat$1 = new Quaternion();
14487
- var seed$2 = 1;
14573
+ var seed$1 = 1;
14488
14574
  // TODO 继承 Component
14489
14575
  var Transform = /*#__PURE__*/ function() {
14490
14576
  function Transform(props, parent) {
@@ -14535,7 +14621,7 @@ var Transform = /*#__PURE__*/ function() {
14535
14621
  quat: new Quaternion(0, 0, 0, 1),
14536
14622
  scale: new Vector3(1, 1, 1)
14537
14623
  };
14538
- this.name = "transform_" + seed$2++;
14624
+ this.name = "transform_" + seed$1++;
14539
14625
  if (props) {
14540
14626
  this.setTransform(props);
14541
14627
  }
@@ -15840,8 +15926,8 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
15840
15926
  }
15841
15927
 
15842
15928
  var Burst = /*#__PURE__*/ function() {
15843
- function Burst(opts) {
15844
- var time = opts.time, interval = opts.interval, count = opts.count, cycles = opts.cycles, probability = opts.probability;
15929
+ function Burst(options) {
15930
+ var time = options.time, interval = options.interval, count = options.count, cycles = options.cycles, probability = options.probability;
15845
15931
  this.time = +time || 0;
15846
15932
  this.interval = +interval || 1;
15847
15933
  this.count = _instanceof1(count, ValueGetter) ? count : createValueGetter(count);
@@ -15869,7 +15955,14 @@ var Burst = /*#__PURE__*/ function() {
15869
15955
  this.now = 0;
15870
15956
  };
15871
15957
  _proto.clone = function clone() {
15872
- return new Burst(this);
15958
+ var options = {
15959
+ time: this.time,
15960
+ interval: this.interval,
15961
+ count: this.count,
15962
+ cycles: this.cycles,
15963
+ probability: this.probability
15964
+ };
15965
+ return new Burst(options);
15873
15966
  };
15874
15967
  return Burst;
15875
15968
  }();
@@ -16007,6 +16100,17 @@ var Link = /*#__PURE__*/ function() {
16007
16100
  }while (node = node.pre);
16008
16101
  }
16009
16102
  };
16103
+ _proto.getNodeByIndex = function getNodeByIndex(index) {
16104
+ var i = 0, res = this.first;
16105
+ if (!res || index >= this.length || index < 0) {
16106
+ return null;
16107
+ }
16108
+ while(i < index){
16109
+ res = res.next;
16110
+ i++;
16111
+ }
16112
+ return res;
16113
+ };
16010
16114
  return Link;
16011
16115
  }();
16012
16116
 
@@ -16320,6 +16424,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16320
16424
  if (index >= 0 && index < pointCountPerTrail) {
16321
16425
  var startIndex = (trail * pointCountPerTrail + index) * 24 + 8;
16322
16426
  var data = this.geometry.getAttributeData("aColor");
16427
+ assertExist(data);
16323
16428
  out.x = data[startIndex];
16324
16429
  out.y = data[1 + startIndex];
16325
16430
  out.z = data[2 + startIndex];
@@ -16327,14 +16432,14 @@ var TrailMesh = /*#__PURE__*/ function() {
16327
16432
  }
16328
16433
  };
16329
16434
  _proto.clearAllTrails = function clearAllTrails() {
16330
- var geo = this.geometry;
16435
+ var indexData = this.geometry.getIndexData();
16436
+ assertExist(indexData);
16331
16437
  this.trailCursors = new Uint16Array(this.trailCursors.length);
16332
- // @ts-expect-error
16333
- geo.setIndexData(new Uint16Array(geo.getIndexData().length));
16438
+ this.geometry.setIndexData(new Uint16Array(indexData.length));
16334
16439
  };
16335
16440
  _proto.minusTime = function minusTime(time) {
16336
- // FIXME: 可选性
16337
16441
  var data = this.geometry.getAttributeData("aTime");
16442
+ assertExist(data);
16338
16443
  for(var i = 0; i < data.length; i++){
16339
16444
  data[i] -= time;
16340
16445
  }
@@ -16346,6 +16451,7 @@ var TrailMesh = /*#__PURE__*/ function() {
16346
16451
  var pointCountPerTrail = this.pointCountPerTrail;
16347
16452
  var indicesPerTrail = (pointCountPerTrail - 1) * 6;
16348
16453
  var indices = this.geometry.getIndexData();
16454
+ assertExist(indices);
16349
16455
  indices.set(new Uint16Array(indicesPerTrail), index * indicesPerTrail);
16350
16456
  this.geometry.setIndexData(indices);
16351
16457
  this.trailCursors[index] = 0;
@@ -16799,7 +16905,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16799
16905
  break;
16800
16906
  }
16801
16907
  var burst = bursts[j];
16802
- var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
16908
+ var opts = burst.getGeneratorOptions(timePassed, lifetime);
16803
16909
  if (opts) {
16804
16910
  var originVec = [
16805
16911
  0,
@@ -16808,9 +16914,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16808
16914
  ];
16809
16915
  var offsets = emission.burstOffsets[j];
16810
16916
  var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
16811
- if (burst.once) {
16812
- this.removeBurst(j);
16813
- }
16814
16917
  for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
16815
16918
  var _p_transform;
16816
16919
  if (shouldSkipGenerate()) {
@@ -16843,10 +16946,8 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16843
16946
  content[3].delay -= duration;
16844
16947
  });
16845
16948
  this.renderer.minusTimeForLoop(duration);
16846
- this.onIterate(this);
16847
16949
  } else {
16848
16950
  this.ended = true;
16849
- this.onEnd(this);
16850
16951
  var endBehavior = this.item.endBehavior;
16851
16952
  if (endBehavior === EndBehavior.freeze) {
16852
16953
  this.frozen = true;
@@ -16994,7 +17095,21 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16994
17095
  time: startTime
16995
17096
  });
16996
17097
  };
16997
- _proto.getPointPosition = function getPointPosition(point) {
17098
+ /**
17099
+ * 通过索引获取指定index粒子当前时刻的位置
17100
+ * @params index - 粒子索引
17101
+ */ _proto.getPointPositionByIndex = function getPointPositionByIndex(index) {
17102
+ var point = this.particleLink.getNodeByIndex(index);
17103
+ if (!point) {
17104
+ console.error("Get point error.");
17105
+ return null;
17106
+ } else {
17107
+ return this.getPointPosition(point.content[3]);
17108
+ }
17109
+ };
17110
+ /**
17111
+ * 通过粒子参数获取当前时刻粒子的位置
17112
+ */ _proto.getPointPosition = function getPointPosition(point) {
16998
17113
  var transform = point.transform, vel = point.vel, lifetime = point.lifetime, delay = point.delay, _point_gravity = point.gravity, gravity = _point_gravity === void 0 ? [] : _point_gravity;
16999
17114
  var forceTarget = this.options.forceTarget;
17000
17115
  var time = this.lastUpdate - delay;
@@ -17016,8 +17131,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
17016
17131
  }
17017
17132
  return ret;
17018
17133
  };
17019
- _proto.onEnd = function onEnd(particle) {};
17020
- _proto.onIterate = function onIterate(particle) {};
17021
17134
  _proto.initPoint = function initPoint(data) {
17022
17135
  var options = this.options;
17023
17136
  var lifetime = this.lifetime;
@@ -17441,9 +17554,10 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
17441
17554
  // this.item = vfxItem;
17442
17555
  var interaction = props.interaction;
17443
17556
  if (interaction) {
17557
+ var _interaction_radius;
17444
17558
  this.interaction = {
17445
17559
  multiple: interaction.multiple,
17446
- radius: interaction.radius,
17560
+ radius: (_interaction_radius = interaction.radius) != null ? _interaction_radius : 0.4,
17447
17561
  behavior: interaction.behavior
17448
17562
  };
17449
17563
  }
@@ -17527,7 +17641,10 @@ function randomArrItem(arr, keepArr) {
17527
17641
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17528
17642
  _inherits(ParticleBehaviourPlayable, Playable);
17529
17643
  function ParticleBehaviourPlayable() {
17530
- return Playable.apply(this, arguments);
17644
+ var _this;
17645
+ _this = Playable.apply(this, arguments) || this;
17646
+ _this.lastTime = 0;
17647
+ return _this;
17531
17648
  }
17532
17649
  var _proto = ParticleBehaviourPlayable.prototype;
17533
17650
  _proto.start = function start(context) {
@@ -17555,8 +17672,12 @@ function randomArrItem(arr, keepArr) {
17555
17672
  if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
17556
17673
  particleSystem.reset();
17557
17674
  }
17675
+ if (Math.abs(this.time - this.lastTime) < 0.001) {
17676
+ deltaTime = 0;
17677
+ }
17558
17678
  particleSystem.onUpdate(deltaTime);
17559
17679
  }
17680
+ this.lastTime = this.time;
17560
17681
  };
17561
17682
  return ParticleBehaviourPlayable;
17562
17683
  }(Playable);
@@ -17969,6 +18090,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17969
18090
  _proto.getPointColor = function getPointColor(index) {
17970
18091
  var data = this.geometry.getAttributeData("aRot");
17971
18092
  var i = index * 32 + 4;
18093
+ assertExist(data);
17972
18094
  return [
17973
18095
  data[i],
17974
18096
  data[i + 1],
@@ -17976,31 +18098,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
17976
18098
  data[i + 3]
17977
18099
  ];
17978
18100
  };
17979
- /**
17980
- * 待废弃
17981
- * @deprecated - 使用 `particle-system.getPointPosition` 替代
17982
- */ _proto.getPointPosition = function getPointPosition(index) {
17983
- var geo = this.geometry;
17984
- var posIndex = index * 48;
17985
- var posData = geo.getAttributeData("aPos");
17986
- var offsetData = geo.getAttributeData("aOffset");
17987
- var time = this.time - offsetData[index * 16 + 2];
17988
- var pointDur = offsetData[index * 16 + 3];
17989
- var mtl = this.mesh.material;
17990
- var acc = mtl.getVector4("uAcceleration").toVector3();
17991
- var pos = Vector3.fromArray(posData, posIndex);
17992
- var vel = Vector3.fromArray(posData, posIndex + 3);
17993
- var ret = calculateTranslation(new Vector3(), this, acc, time, pointDur, pos, vel);
17994
- if (this.forceTarget) {
17995
- var target = mtl.getVector3("uFinalTarget");
17996
- var life = this.forceTarget.curve.getValue(time / pointDur);
17997
- var dl = 1 - life;
17998
- ret.x = ret.x * dl + target.x * life;
17999
- ret.y = ret.y * dl + target.y * life;
18000
- ret.z = ret.z * dl + target.z * life;
18001
- }
18002
- return ret;
18003
- };
18004
18101
  _proto.clearPoints = function clearPoints() {
18005
18102
  this.resetGeometryData(this.geometry);
18006
18103
  this.particleCount = 0;
@@ -18023,6 +18120,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18023
18120
  };
18024
18121
  _proto.minusTime = function minusTime(time) {
18025
18122
  var data = this.geometry.getAttributeData("aOffset");
18123
+ assertExist(data);
18026
18124
  for(var i = 0; i < data.length; i += 4){
18027
18125
  data[i + 2] -= time;
18028
18126
  }
@@ -18149,6 +18247,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
18149
18247
  var attrSize = geometry.getAttributeStride(name) / Float32Array.BYTES_PER_ELEMENT;
18150
18248
  if (increaseBuffer) {
18151
18249
  var baseData = geometry.getAttributeData(name);
18250
+ assertExist(baseData);
18152
18251
  var geoData = enlargeBuffer(baseData, vertexCount * attrSize, maxCount * 4 * attrSize, inc);
18153
18252
  geoData.set(data, data.length * index);
18154
18253
  geometry.setAttributeData(name, geoData);
@@ -18518,12 +18617,8 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18518
18617
  // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
18519
18618
  if (item.content.trails) {
18520
18619
  var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
18521
- var _shader_macros;
18522
- shader1.vertex = createShaderWithMacros((_shader_macros = shader1.macros) != null ? _shader_macros : [], shader1.vertex, exports.ShaderType.vertex, level);
18523
- var _shader_macros1;
18524
- shader1.fragment = createShaderWithMacros((_shader_macros1 = shader1.macros) != null ? _shader_macros1 : [], shader1.fragment, exports.ShaderType.fragment, level);
18525
18620
  shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
18526
- shaderLibrary.addShader(shader1);
18621
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
18527
18622
  }
18528
18623
  });
18529
18624
  shaders.forEach(function(shader) {
@@ -18533,15 +18628,10 @@ var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
18533
18628
  } else {
18534
18629
  shader.glslVersion = exports.GLSLVersion.GLSL1;
18535
18630
  }
18536
- var _shader_macros;
18537
- shader.vertex = createShaderWithMacros((_shader_macros = shader.macros) != null ? _shader_macros : [], shader.vertex, exports.ShaderType.vertex, level);
18538
- var _shader_macros1;
18539
- shader.fragment = createShaderWithMacros((_shader_macros1 = shader.macros) != null ? _shader_macros1 : [], shader.fragment, exports.ShaderType.fragment, level);
18540
- shaderLibrary.addShader(shader);
18631
+ shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
18541
18632
  });
18542
18633
  if (level === 2) {
18543
18634
  items.forEach(function(item) {
18544
- // @ts-expect-error
18545
18635
  item.content.options.meshSlots = [
18546
18636
  maxVertexCount,
18547
18637
  maxFragmentCount
@@ -19355,9 +19445,6 @@ function compareTracks(a, b) {
19355
19445
  _this.startTime = 0;
19356
19446
  _this.items = [] // 场景的所有元素
19357
19447
  ;
19358
- /**
19359
- * 合成是否冻结标志位
19360
- */ _this.fezzed = false;
19361
19448
  _this.reusable = false;
19362
19449
  _this.sceneBindings = [];
19363
19450
  _this.graph = new PlayableGraph();
@@ -19782,7 +19869,9 @@ var CanvasPool = /*#__PURE__*/ function() {
19782
19869
  };
19783
19870
  _proto.getCanvas = function getCanvas() {
19784
19871
  if (this.elements.length !== 0) {
19785
- return this.elements.shift();
19872
+ var canvas = this.elements.shift();
19873
+ assertExist(canvas);
19874
+ return canvas;
19786
19875
  }
19787
19876
  if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
19788
19877
  return window._createOffscreenCanvas(10, 10);
@@ -19807,9 +19896,6 @@ var CanvasPool = /*#__PURE__*/ function() {
19807
19896
  return CanvasPool;
19808
19897
  }();
19809
19898
  var canvasPool = new CanvasPool();
19810
- function getDefaultTemplateCanvasPool() {
19811
- return canvasPool;
19812
- }
19813
19899
 
19814
19900
  var DEFAULT_FONTS = [
19815
19901
  "serif",
@@ -20231,7 +20317,6 @@ var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
20231
20317
  return TextLoader;
20232
20318
  }(AbstractPlugin);
20233
20319
 
20234
- var seed$1 = 1;
20235
20320
  exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20236
20321
  _inherits(EffectComponent, RendererComponent);
20237
20322
  function EffectComponent(engine) {
@@ -20242,7 +20327,6 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20242
20327
  */ _this.worldMatrix = Matrix4.fromIdentity();
20243
20328
  _this.triangles = [];
20244
20329
  _this.destroyed = false;
20245
- _this.visible = false;
20246
20330
  // TODO 点击测试后续抽象一个 Collider 组件
20247
20331
  _this.getHitTestParams = function(force) {
20248
20332
  var area = _this.getBoundingBox();
@@ -20253,18 +20337,11 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20253
20337
  };
20254
20338
  }
20255
20339
  };
20256
- _this.id = "Mesh" + seed$1++;
20257
- _this.name = "<unnamed>";
20340
+ _this.name = "EffectComponent";
20258
20341
  _this._priority = 0;
20259
20342
  return _this;
20260
20343
  }
20261
20344
  var _proto = EffectComponent.prototype;
20262
- /**
20263
- * 设置当前 Mesh 的可见性。
20264
- * @param visible - true:可见,false:不可见
20265
- */ _proto.setVisible = function setVisible(visible) {
20266
- this.visible = visible;
20267
- };
20268
20345
  _proto.start = function start() {
20269
20346
  this.item.getHitTestParams = this.getHitTestParams;
20270
20347
  };
@@ -20275,16 +20352,6 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20275
20352
  renderer.drawGeometry(this.geometry, this.material);
20276
20353
  };
20277
20354
  /**
20278
- * 获取当前 Mesh 的可见性。
20279
- */ _proto.getVisible = function getVisible() {
20280
- return this.visible;
20281
- };
20282
- /**
20283
- * 获取当前 Mesh 的第一个 geometry。
20284
- */ _proto.firstGeometry = function firstGeometry() {
20285
- return this.geometry;
20286
- };
20287
- /**
20288
20355
  * 设置当前 Mesh 的材质
20289
20356
  * @param material - 要设置的材质
20290
20357
  * @param destroy - 可选的材质销毁选项
@@ -20331,27 +20398,11 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20331
20398
  * @param options - 可选的销毁选项
20332
20399
  */ _proto.dispose = function dispose(options) {
20333
20400
  if (this.destroyed) {
20334
- //console.error('call mesh.destroy multiple times', this);
20335
20401
  return;
20336
20402
  }
20337
- // if (options?.geometries !== DestroyOptions.keep) {
20338
- // this.geometry.dispose();
20339
- // }
20340
- // const materialDestroyOption = options?.material;
20341
- // if (materialDestroyOption !== DestroyOptions.keep) {
20342
- // this.material.dispose(materialDestroyOption);
20343
- // }
20344
20403
  this.destroyed = true;
20345
20404
  RendererComponent.prototype.dispose.call(this);
20346
20405
  };
20347
- _create_class(EffectComponent, [
20348
- {
20349
- key: "isDestroyed",
20350
- get: function get() {
20351
- return this.destroyed;
20352
- }
20353
- }
20354
- ]);
20355
20406
  return EffectComponent;
20356
20407
  }(RendererComponent);
20357
20408
  __decorate([
@@ -20361,8 +20412,10 @@ exports.EffectComponent = __decorate([
20361
20412
  effectsClass(DataType.EffectComponent)
20362
20413
  ], exports.EffectComponent);
20363
20414
  function geometryToTriangles(geometry) {
20364
- var indices = geometry.getIndexData();
20365
- var vertices = geometry.getAttributeData("aPos");
20415
+ var _geometry_getIndexData;
20416
+ var indices = (_geometry_getIndexData = geometry.getIndexData()) != null ? _geometry_getIndexData : [];
20417
+ var _geometry_getAttributeData;
20418
+ var vertices = (_geometry_getAttributeData = geometry.getAttributeData("aPos")) != null ? _geometry_getAttributeData : [];
20366
20419
  var res = [];
20367
20420
  for(var i = 0; i < indices.length; i += 3){
20368
20421
  var index0 = indices[i] * 3;
@@ -23087,6 +23140,7 @@ function getStandardJSON(json) {
23087
23140
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
23088
23141
  return version30Migration(version21Migration(getStandardJSONFromV0(json)));
23089
23142
  }
23143
+ reverseParticle = false;
23090
23144
  var vs = standardVersion.exec(json.version) || [];
23091
23145
  var mainVersion = Number(vs[1]);
23092
23146
  var minorVersion = Number(vs[2]);
@@ -23833,7 +23887,6 @@ var seed = 1;
23833
23887
  return __generator(this, function(_state) {
23834
23888
  switch(_state.label){
23835
23889
  case 0:
23836
- // TODO: 后面切换到新的数据版本,就不用掉用 getStandardJSON 做转换了
23837
23890
  jsonScene = getStandardJSON(json);
23838
23891
  _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
23839
23892
  pluginSystem = new PluginSystem(plugins);
@@ -24127,18 +24180,18 @@ var seed = 1;
24127
24180
  source: source
24128
24181
  };
24129
24182
  });
24130
- jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(texOpts, idx) {
24131
- var e, source, image, tex;
24183
+ jobs = textures.map(/*#__PURE__*/ _async_to_generator(function(textureOptions, idx) {
24184
+ var e, source, image, texture;
24132
24185
  return __generator(this, function(_state) {
24133
24186
  switch(_state.label){
24134
24187
  case 0:
24135
- if (_instanceof1(texOpts, Texture)) {
24188
+ if (_instanceof1(textureOptions, Texture)) {
24136
24189
  return [
24137
24190
  2,
24138
- texOpts
24191
+ textureOptions
24139
24192
  ];
24140
24193
  }
24141
- if (!("mipmaps" in texOpts)) return [
24194
+ if (!("mipmaps" in textureOptions)) return [
24142
24195
  3,
24143
24196
  4
24144
24197
  ];
@@ -24152,7 +24205,7 @@ var seed = 1;
24152
24205
  ]);
24153
24206
  return [
24154
24207
  4,
24155
- deserializeMipmapTexture(texOpts, bins, engine, jsonScene.bins)
24208
+ deserializeMipmapTexture(textureOptions, bins, engine, jsonScene.bins)
24156
24209
  ];
24157
24210
  case 2:
24158
24211
  return [
@@ -24163,12 +24216,11 @@ var seed = 1;
24163
24216
  e = _state.sent();
24164
24217
  throw new Error("Load texture " + idx + " fails, error message: " + e + ".");
24165
24218
  case 4:
24166
- source = texOpts.source;
24219
+ source = textureOptions.source;
24167
24220
  if (!isObject(source)) return [
24168
24221
  3,
24169
24222
  5
24170
24223
  ];
24171
- //@ts-expect-error
24172
24224
  image = engine.assetLoader.loadGUID(source.id).data;
24173
24225
  return [
24174
24226
  3,
@@ -24188,12 +24240,12 @@ var seed = 1;
24188
24240
  _state.label = 7;
24189
24241
  case 7:
24190
24242
  if (image) {
24191
- tex = createTextureOptionsBySource(image, _this.assets[idx]);
24192
- tex.id = texOpts.id;
24193
- tex.dataType = DataType.Texture;
24243
+ texture = createTextureOptionsBySource(image, _this.assets[idx]);
24244
+ texture.id = textureOptions.id;
24245
+ texture.dataType = DataType.Texture;
24194
24246
  return [
24195
24247
  2,
24196
- tex.sourceType === exports.TextureSourceType.compressed ? tex : _extends({}, tex, texOpts)
24248
+ texture.sourceType === exports.TextureSourceType.compressed ? texture : _extends({}, texture, textureOptions)
24197
24249
  ];
24198
24250
  }
24199
24251
  throw new Error("Invalid texture source: " + source + ".");
@@ -25025,28 +25077,6 @@ var listOrder = 0;
25025
25077
  }
25026
25078
  };
25027
25079
  /**
25028
- * 是否合成需要重新播放
25029
- * @returns 重新播放合成标志位
25030
- */ _proto.shouldRestart = function shouldRestart() {
25031
- var _this_rootItem = this.rootItem, duration = _this_rootItem.duration, endBehavior = _this_rootItem.endBehavior;
25032
- var time = this.rootComposition.time;
25033
- return endBehavior === EndBehavior.restart && duration - time < 0.02;
25034
- };
25035
- /**
25036
- * 是否合成需要销毁
25037
- * @returns 销毁合成标志位
25038
- */ _proto.shouldDispose = function shouldDispose() {
25039
- if (this.reusable) {
25040
- return false;
25041
- }
25042
- var endBehavior = this.rootItem.endBehavior;
25043
- if (this.rootItem.isEnded(this.time)) {
25044
- this.rootItem.ended = true;
25045
- }
25046
- // TODO: 合成结束行为
25047
- return this.rootItem.ended && endBehavior === EndBehavior.destroy;
25048
- };
25049
- /**
25050
25080
  * 合成更新,针对所有 item 的更新
25051
25081
  * @param deltaTime - 更新的时间步长
25052
25082
  * @param skipRender - 是否需要渲染
@@ -25057,49 +25087,56 @@ var listOrder = 0;
25057
25087
  var time = this.getUpdateTime(deltaTime * this.speed);
25058
25088
  this.globalTime += time;
25059
25089
  this.updateRootComposition();
25060
- if (this.shouldRestart()) {
25061
- this.emit("end", {
25062
- composition: this
25063
- });
25064
- this.restart();
25065
- // restart then tick to avoid flicker
25066
- }
25067
25090
  this.updateVideo();
25068
25091
  // 更新 model-tree-plugin
25069
25092
  this.updatePluginLoaders(deltaTime);
25093
+ // scene VFXItem components lifetime function.
25070
25094
  this.callStart(this.rootItem);
25071
25095
  this.callUpdate(this.rootItem, time);
25072
25096
  this.callLateUpdate(this.rootItem, time);
25073
25097
  this.updateCamera();
25098
+ this.prepareRender();
25074
25099
  if (this.shouldDispose()) {
25075
- this.emit("end", {
25076
- composition: this
25077
- });
25078
25100
  this.dispose();
25079
- } else {
25080
- this.prepareRender();
25081
25101
  }
25082
25102
  };
25083
25103
  _proto.toLocalTime = function toLocalTime(time) {
25084
25104
  var localTime = time - this.rootItem.start;
25085
25105
  var duration = this.rootItem.duration;
25086
25106
  if (localTime - duration > 0.001) {
25087
- if (this.rootItem.endBehavior === EndBehavior.restart) {
25088
- localTime = localTime % duration;
25089
- } else if (this.rootItem.endBehavior === EndBehavior.freeze) {
25090
- localTime = Math.min(duration, localTime);
25091
- if (localTime === duration) {
25092
- if (!this.rootComposition.fezzed) {
25093
- this.rootComposition.fezzed = true;
25094
- this.emit("end", {
25095
- composition: this
25096
- });
25107
+ if (!this.rootItem.ended) {
25108
+ this.rootItem.ended = true;
25109
+ this.emit("end", {
25110
+ composition: this
25111
+ });
25112
+ }
25113
+ switch(this.rootItem.endBehavior){
25114
+ case EndBehavior.restart:
25115
+ {
25116
+ localTime = localTime % duration;
25117
+ this.restart();
25118
+ break;
25119
+ }
25120
+ case EndBehavior.freeze:
25121
+ {
25122
+ localTime = Math.min(duration, localTime);
25123
+ break;
25124
+ }
25125
+ case EndBehavior.forward:
25126
+ {
25127
+ break;
25128
+ }
25129
+ case EndBehavior.destroy:
25130
+ {
25131
+ break;
25097
25132
  }
25098
- }
25099
25133
  }
25100
25134
  }
25101
25135
  return localTime;
25102
25136
  };
25137
+ _proto.shouldDispose = function shouldDispose() {
25138
+ return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
25139
+ };
25103
25140
  _proto.getUpdateTime = function getUpdateTime(t) {
25104
25141
  var startTimeInMs = this.startTime * 1000;
25105
25142
  var now = this.rootComposition.time * 1000;
@@ -25430,7 +25467,9 @@ var listOrder = 0;
25430
25467
  (_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
25431
25468
  (_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
25432
25469
  this.update = function() {
25433
- logger.error("Update disposed composition: " + _this.name + ".");
25470
+ {
25471
+ logger.error("Update disposed composition: " + _this.name + ".");
25472
+ }
25434
25473
  };
25435
25474
  this.dispose = noop;
25436
25475
  if (textures && this.keepResource) {
@@ -27593,7 +27632,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27593
27632
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27594
27633
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27595
27634
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27596
- var version = "2.0.0-alpha.32";
27635
+ var version = "2.0.0-alpha.34";
27597
27636
  logger.info("Core version: " + version + ".");
27598
27637
 
27599
27638
  exports.AbstractPlugin = AbstractPlugin;
@@ -27678,6 +27717,7 @@ exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0 = SEMANTIC_PRE_COLOR_ATTACHMENT_SIZ
27678
27717
  exports.SPRITE_VERTEX_STRIDE = SPRITE_VERTEX_STRIDE;
27679
27718
  exports.SemanticMap = SemanticMap;
27680
27719
  exports.SerializationHelper = SerializationHelper;
27720
+ exports.ShaderFactory = ShaderFactory;
27681
27721
  exports.ShaderVariant = ShaderVariant;
27682
27722
  exports.SpriteColorPlayable = SpriteColorPlayable;
27683
27723
  exports.SpriteLoader = SpriteLoader;
@@ -27710,12 +27750,9 @@ exports.colorGradingFrag = colorGradingFrag;
27710
27750
  exports.colorStopsFromGradient = colorStopsFromGradient;
27711
27751
  exports.colorToArr = colorToArr$1;
27712
27752
  exports.combineImageTemplate = combineImageTemplate;
27713
- exports.compatibleFrag = compatible_frag;
27714
- exports.compatibleVert = compatible_vert;
27715
27753
  exports.createCopyShader = createCopyShader;
27716
27754
  exports.createGLContext = createGLContext;
27717
27755
  exports.createKeyFrameMeta = createKeyFrameMeta;
27718
- exports.createShaderWithMacros = createShaderWithMacros;
27719
27756
  exports.createShape = createShape;
27720
27757
  exports.createValueGetter = createValueGetter;
27721
27758
  exports.decimalEqual = decimalEqual;
@@ -27741,7 +27778,6 @@ exports.generateWhiteTexture = generateWhiteTexture;
27741
27778
  exports.getBackgroundImage = getBackgroundImage;
27742
27779
  exports.getColorFromGradientStops = getColorFromGradientStops;
27743
27780
  exports.getConfig = getConfig;
27744
- exports.getDefaultTemplateCanvasPool = getDefaultTemplateCanvasPool;
27745
27781
  exports.getDefaultTextureFactory = getDefaultTextureFactory;
27746
27782
  exports.getGeometryByShape = getGeometryByShape;
27747
27783
  exports.getGeometryTriangles = getGeometryTriangles;
@@ -27808,7 +27844,6 @@ exports.particleOriginTranslateMap = particleOriginTranslateMap$1;
27808
27844
  exports.particleUniformTypeMap = particleUniformTypeMap;
27809
27845
  exports.particleVert = particleVert;
27810
27846
  exports.pluginLoaderMap = pluginLoaderMap;
27811
- exports.pointOnLine = pointOnLine;
27812
27847
  exports.randomInRange = randomInRange;
27813
27848
  exports.registerPlugin = registerPlugin;
27814
27849
  exports.removeItem = removeItem;
@@ -27837,10 +27872,8 @@ exports.unregisterPlugin = unregisterPlugin;
27837
27872
  exports.valIfUndefined = valIfUndefined;
27838
27873
  exports.value = value;
27839
27874
  exports.valueDefine = valueDefine;
27840
- exports.vecAssign = vecAssign;
27841
27875
  exports.vecFill = vecFill;
27842
27876
  exports.vecMulCombine = vecMulCombine;
27843
- exports.vecNormalize = vecNormalize;
27844
27877
  exports.version = version;
27845
27878
  exports.vertexFormatType2GLType = vertexFormatType2GLType;
27846
27879
  //# sourceMappingURL=index.js.map