@galacean/effects-core 2.1.0-alpha.0 → 2.1.0-alpha.1

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.
@@ -38,10 +38,6 @@ export declare class AssetManager implements Disposable {
38
38
  */
39
39
  constructor(options?: SceneLoadOptions, downloader?: Downloader);
40
40
  updateOptions(options?: SceneLoadOptions): void;
41
- /**
42
- * 根据用户传入的参数修改场景数据
43
- */
44
- private updateSceneData;
45
41
  /**
46
42
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
47
43
  * @param url - json 的 URL 链接或者 json 对象
@@ -32,6 +32,8 @@ export declare class CompositionComponent extends Behaviour {
32
32
  getReusable(): boolean;
33
33
  onUpdate(dt: number): void;
34
34
  createContent(): void;
35
+ showItems(): void;
36
+ hideItems(): void;
35
37
  onDestroy(): void;
36
38
  hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
37
39
  fromData(data: unknown): void;
@@ -281,7 +281,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
281
281
  /**
282
282
  * 前进合成到指定时间
283
283
  * @param time - 相对0时刻的时间
284
- * @param skipRender - 是否跳过渲染
285
284
  */
286
285
  private forwardTime;
287
286
  /**
@@ -293,7 +292,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
293
292
  /**
294
293
  * 合成更新,针对所有 item 的更新
295
294
  * @param deltaTime - 更新的时间步长
296
- * @param skipRender - 是否需要渲染
297
295
  */
298
296
  update(deltaTime: number): void;
299
297
  private toLocalTime;
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.1.0-alpha.0
6
+ * Version: v2.1.0-alpha.1
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4689,7 +4689,13 @@ function getDirectStore(target) {
4689
4689
  }
4690
4690
  };
4691
4691
  _proto.dispose = function dispose() {
4692
- this.onDestroy();
4692
+ if (this.isEnableCalled) {
4693
+ this.disable();
4694
+ }
4695
+ if (this.isAwakeCalled) {
4696
+ this.isAwakeCalled = false;
4697
+ this.onDestroy();
4698
+ }
4693
4699
  if (this.item) {
4694
4700
  removeItem(this.item.components, this);
4695
4701
  }
@@ -10030,8 +10036,13 @@ var RandomValue = /*#__PURE__*/ function(ValueGetter) {
10030
10036
  this.min = props[0];
10031
10037
  this.max = props[1];
10032
10038
  };
10033
- _proto.getValue = function getValue(time) {
10034
- return randomInRange(this.min, this.max);
10039
+ _proto.getValue = function getValue(time, seed) {
10040
+ var randomSeed = seed != null ? seed : Math.random();
10041
+ return this.min + randomSeed * (this.max - this.min);
10042
+ };
10043
+ _proto.getIntegrateValue = function getIntegrateValue(t0, t1, timeScale) {
10044
+ var seed = timeScale != null ? timeScale : 1.0;
10045
+ return (this.min + seed * (this.max - this.min)) * (t1 - t0);
10035
10046
  };
10036
10047
  _proto.toUniform = function toUniform() {
10037
10048
  return new Float32Array([
@@ -11558,7 +11569,7 @@ var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord
11558
11569
 
11559
11570
  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";
11560
11571
 
11561
- 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}}";
11572
+ 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 vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\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 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform 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;}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\nvoid 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\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\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}}";
11562
11573
 
11563
11574
  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}";
11564
11575
 
@@ -16536,6 +16547,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16536
16547
  _proto.onUpdate = function onUpdate(dt) {
16537
16548
  var time = this.particleMesh.time;
16538
16549
  this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
16550
+ this.particleMesh.onUpdate(dt);
16539
16551
  };
16540
16552
  _proto.render = function render(renderer) {
16541
16553
  for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
@@ -16550,6 +16562,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16550
16562
  };
16551
16563
  _proto.updateTime = function updateTime(now, delta) {
16552
16564
  this.particleMesh.time = now;
16565
+ // this.particleMesh.onUpdate(delta);
16553
16566
  if (this.trailMesh) {
16554
16567
  this.trailMesh.time = now;
16555
16568
  this.trailMesh.onUpdate(delta);
@@ -16648,6 +16661,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
16648
16661
  _proto.isFrozen = function isFrozen() {
16649
16662
  return this.frozen;
16650
16663
  };
16664
+ _proto.isEnded = function isEnded() {
16665
+ return this.ended;
16666
+ };
16651
16667
  _proto.initEmitterTransform = function initEmitterTransform() {
16652
16668
  var position = this.item.transform.position.clone();
16653
16669
  var rotation = this.item.transform.rotation.clone();
@@ -17593,11 +17609,8 @@ function randomArrItem(arr, keepArr) {
17593
17609
  }
17594
17610
  var particleSystem = this.particleSystem;
17595
17611
  if (particleSystem) {
17596
- // TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
17597
- // particleSystem.setParentTransform(parentItem.transform);
17598
- particleSystem.setVisible(true);
17599
17612
  var deltaTime = context.deltaTime;
17600
- if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
17613
+ if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
17601
17614
  particleSystem.reset();
17602
17615
  }
17603
17616
  if (Math.abs(this.time - this.lastTime) < 0.001) {
@@ -17656,6 +17669,7 @@ var particleUniformTypeMap = {
17656
17669
  var ParticleMesh = /*#__PURE__*/ function() {
17657
17670
  function ParticleMesh(engine, props) {
17658
17671
  this.particleCount = 0;
17672
+ this.VERT_MAX_KEY_FRAME_COUNT = 0;
17659
17673
  var _engine_renderer;
17660
17674
  var env = ((_engine_renderer = engine.renderer) != null ? _engine_renderer : {}).env;
17661
17675
  var speedOverLifetime = props.speedOverLifetime, colorOverLifetime = props.colorOverLifetime, linearVelOverLifetime = props.linearVelOverLifetime, orbitalVelOverLifetime = props.orbitalVelOverLifetime, sizeOverLifetime = props.sizeOverLifetime, rotationOverLifetime = props.rotationOverLifetime, sprite = props.sprite, gravityModifier = props.gravityModifier, maxCount = props.maxCount, textureFlip = props.textureFlip, useSprite = props.useSprite, name = props.name, gravity = props.gravity, forceTarget = props.forceTarget, side = props.side, occlusion = props.occlusion, anchor = props.anchor, blending = props.blending, maskMode = props.maskMode, mask = props.mask, transparentOcclusion = props.transparentOcclusion, meshSlots = props.meshSlots, _props_renderMode = props.renderMode, renderMode = _props_renderMode === void 0 ? 0 : _props_renderMode, _props_diffuse = props.diffuse, diffuse = _props_diffuse === void 0 ? Texture.createWithData(engine) : _props_diffuse;
@@ -17874,6 +17888,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17874
17888
  "FRAG_MAX_KEY_FRAME_COUNT",
17875
17889
  fragmentKeyFrameMeta.max
17876
17890
  ]);
17891
+ this.VERT_MAX_KEY_FRAME_COUNT = vertexKeyFrameMeta.max;
17877
17892
  var fragment = particleFrag;
17878
17893
  var originalVertex = "#define LOOKUP_TEXTURE_CURVE " + vertex_lookup_texture + "\n" + particleVert;
17879
17894
  var vertex = originalVertex;
@@ -17982,6 +17997,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
17982
17997
  this.orbitalVelOverLifetime = orbitalVelOverLifetime;
17983
17998
  this.orbitalVelOverLifetime = orbitalVelOverLifetime;
17984
17999
  this.gravityModifier = gravityModifier;
18000
+ this.rotationOverLifetime = rotationOverLifetime;
17985
18001
  this.maxCount = maxCount;
17986
18002
  // this.duration = duration;
17987
18003
  this.textureOffsets = textureFlip ? [
@@ -18046,15 +18062,232 @@ var ParticleMesh = /*#__PURE__*/ function() {
18046
18062
  // @ts-expect-error
18047
18063
  geometry.setIndexData(new index.constructor(0));
18048
18064
  };
18065
+ _proto.onUpdate = function onUpdate(dt) {
18066
+ var aPosArray = this.geometry.getAttributeData("aPos"); // vector3
18067
+ var aVelArray = this.geometry.getAttributeData("aVel"); // vector3
18068
+ var aOffsetArray = this.geometry.getAttributeData("aOffset");
18069
+ var aRotArray = this.geometry.getAttributeData("aRot"); // vector3
18070
+ var aSeedArray = this.geometry.getAttributeData("aSeed"); // float
18071
+ // const uParams = this.mesh.material.getVector4('uParams');
18072
+ // if (!uParams) {
18073
+ // return;
18074
+ // }
18075
+ var localTime = new Float32Array([
18076
+ this.time
18077
+ ])[0];
18078
+ var particleCount = Math.ceil(aPosArray.length / 12);
18079
+ // calculate particle translation
18080
+ var aTranslationArray = this.geometry.getAttributeData("aTranslation");
18081
+ if (aTranslationArray.length < particleCount * 3) {
18082
+ aTranslationArray = new Float32Array(particleCount * 3);
18083
+ }
18084
+ var velocity = new Vector3(0, 0, 0);
18085
+ for(var i = 0; i < particleCount; i++){
18086
+ var velOffset = i * 12 + 3;
18087
+ velocity.set(aVelArray[velOffset], aVelArray[velOffset + 1], aVelArray[velOffset + 2]);
18088
+ var trans = this.calculateTranslation(velocity, aOffsetArray[i * 4 + 2], localTime, aOffsetArray[i * 4 + 3]);
18089
+ var aTranslationOffset = i * 3;
18090
+ aTranslationArray[aTranslationOffset] = trans.x;
18091
+ aTranslationArray[aTranslationOffset + 1] = trans.y;
18092
+ aTranslationArray[aTranslationOffset + 2] = trans.z;
18093
+ }
18094
+ this.geometry.setAttributeData("aTranslation", aTranslationArray);
18095
+ // calculate particle rotation
18096
+ var aRotationArray = this.geometry.getAttributeData("aRotation0");
18097
+ if (aRotationArray.length < particleCount * 9) {
18098
+ aRotationArray = new Float32Array(particleCount * 9);
18099
+ }
18100
+ for(var i1 = 0; i1 < particleCount; i1++){
18101
+ var time = localTime - aOffsetArray[i1 * 4 + 2];
18102
+ var duration = aOffsetArray[i1 * 4 + 3];
18103
+ var life = clamp$1(time / duration, 0.0, 1.0);
18104
+ var aRotOffset = i1 * 8;
18105
+ var aRot = new Vector3(aRotArray[aRotOffset], aRotArray[aRotOffset + 1], aRotArray[aRotOffset + 2]);
18106
+ var aSeed = aSeedArray[i1 * 8 + 3];
18107
+ var aRotation = this.transformFromRotation(aRot, life, duration, aSeed);
18108
+ var aRotationOffset = i1 * 9;
18109
+ var matrixArray = aRotation.toArray();
18110
+ aRotationArray.set(matrixArray, aRotationOffset);
18111
+ }
18112
+ this.geometry.setAttributeData("aRotation0", aRotationArray);
18113
+ // calculate linear movement
18114
+ var aLinearMoveArray = this.geometry.getAttributeData("aLinearMove");
18115
+ if (aLinearMoveArray.length < particleCount * 3) {
18116
+ aLinearMoveArray = new Float32Array(particleCount * 3);
18117
+ }
18118
+ for(var i2 = 0; i2 < particleCount; i2++){
18119
+ var time1 = localTime - aOffsetArray[i2 * 4 + 2];
18120
+ var duration1 = aOffsetArray[i2 * 4 + 3];
18121
+ // const life = math.clamp(time / duration, 0.0, 1.0);
18122
+ var aSeed1 = aSeedArray[i2 * 8 + 3];
18123
+ var linearMove = this.calLinearMov(time1, duration1, aSeed1);
18124
+ var aLinearMoveOffset = i2 * 3;
18125
+ aLinearMoveArray[aLinearMoveOffset] = linearMove.x;
18126
+ aLinearMoveArray[aLinearMoveOffset + 1] = linearMove.y;
18127
+ aLinearMoveArray[aLinearMoveOffset + 2] = linearMove.z;
18128
+ }
18129
+ this.geometry.setAttributeData("aLinearMove", aLinearMoveArray);
18130
+ };
18049
18131
  _proto.minusTime = function minusTime(time) {
18050
- var data = this.geometry.getAttributeData("aOffset");
18051
- assertExist(data);
18052
- for(var i = 0; i < data.length; i += 4){
18053
- data[i + 2] -= time;
18132
+ var aOffset = this.geometry.getAttributeData("aOffset");
18133
+ for(var i = 0; i < aOffset.length; i += 4){
18134
+ aOffset[i + 2] -= time;
18054
18135
  }
18055
- this.geometry.setAttributeData("aOffset", data);
18136
+ this.geometry.setAttributeData("aOffset", aOffset);
18056
18137
  this.time -= time;
18057
18138
  };
18139
+ _proto.calculateTranslation = function calculateTranslation(velocity, t0, t1, duration) {
18140
+ var uAcceleration = this.mesh.material.getVector4("uAcceleration");
18141
+ var uGravityModifierValue = this.mesh.material.getVector4("uGravityModifierValue");
18142
+ if (!uAcceleration || !uGravityModifierValue) {
18143
+ return new Vector3();
18144
+ }
18145
+ var dt = t1 - t0; // 相对delay的时间
18146
+ var d = this.gravityModifier.getIntegrateByTime(0, dt);
18147
+ var acc = [
18148
+ uAcceleration.x * d,
18149
+ uAcceleration.y * d,
18150
+ uAcceleration.z * d
18151
+ ];
18152
+ // ret.addScaledVector(velData, speedIntegrate);
18153
+ // ret.addScaledVector(acc, d);
18154
+ // speedIntegrate = speedOverLifetime.getIntegrateValue(0, time, duration);
18155
+ if (this.speedOverLifetime) {
18156
+ // dt / dur 归一化
18157
+ var speed = this.speedOverLifetime.getIntegrateValue(0, dt, duration);
18158
+ return velocity.clone().multiply(speed).add(acc);
18159
+ }
18160
+ return velocity.clone().multiply(dt).add(acc);
18161
+ };
18162
+ _proto.transformFromRotation = function transformFromRotation(rot, life, dur, aSeed) {
18163
+ var rotation = rot.clone();
18164
+ if (!this.rotationOverLifetime) {
18165
+ return new Matrix3();
18166
+ }
18167
+ if (this.rotationOverLifetime.asRotation) {
18168
+ // Adjust rotation based on the specified lifetime components
18169
+ if (this.rotationOverLifetime.x) {
18170
+ if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
18171
+ rotation.x += this.rotationOverLifetime.x.getValue(life, aSeed);
18172
+ } else {
18173
+ rotation.x += this.rotationOverLifetime.x.getValue(life);
18174
+ }
18175
+ }
18176
+ if (this.rotationOverLifetime.y) {
18177
+ if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
18178
+ rotation.y += this.rotationOverLifetime.y.getValue(life, aSeed);
18179
+ } else {
18180
+ rotation.y += this.rotationOverLifetime.y.getValue(life);
18181
+ }
18182
+ }
18183
+ if (this.rotationOverLifetime.z) {
18184
+ if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
18185
+ rotation.z += this.rotationOverLifetime.z.getValue(life, aSeed);
18186
+ } else {
18187
+ rotation.z += this.rotationOverLifetime.z.getValue(life);
18188
+ }
18189
+ }
18190
+ } else {
18191
+ // Adjust rotation based on the specified lifetime components
18192
+ if (this.rotationOverLifetime.x) {
18193
+ if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
18194
+ rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * dur;
18195
+ } else {
18196
+ rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, dur) * dur;
18197
+ }
18198
+ }
18199
+ if (this.rotationOverLifetime.y) {
18200
+ if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
18201
+ rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * dur;
18202
+ } else {
18203
+ rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, dur) * dur;
18204
+ }
18205
+ }
18206
+ if (this.rotationOverLifetime.z) {
18207
+ if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
18208
+ rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * dur;
18209
+ } else {
18210
+ rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, dur) * dur;
18211
+ }
18212
+ }
18213
+ }
18214
+ // If the rotation vector is zero, return the identity matrix
18215
+ if (rotation.dot(rotation) === 0.0) {
18216
+ return new Matrix3().identity();
18217
+ }
18218
+ // Return the rotation matrix derived from the rotation vector
18219
+ return this.mat3FromRotation(rotation);
18220
+ };
18221
+ _proto.mat3FromRotation = function mat3FromRotation(rotation) {
18222
+ var d2r = Math.PI / 180;
18223
+ var sinR = rotation.clone().multiply(d2r);
18224
+ sinR.x = Math.sin(sinR.x);
18225
+ sinR.y = Math.sin(sinR.y);
18226
+ sinR.z = Math.sin(sinR.z);
18227
+ var cosR = rotation.clone().multiply(d2r);
18228
+ cosR.x = Math.cos(cosR.x);
18229
+ cosR.y = Math.cos(cosR.y);
18230
+ cosR.z = Math.cos(cosR.z);
18231
+ var rotZ = new Matrix3(cosR.z, -sinR.z, 0., sinR.z, cosR.z, 0., 0., 0., 1.);
18232
+ var rotY = new Matrix3(cosR.y, 0., sinR.y, 0., 1., 0., -sinR.y, 0, cosR.y);
18233
+ var rotX = new Matrix3(1., 0., 0., 0, cosR.x, -sinR.x, 0., sinR.x, cosR.x);
18234
+ var result = rotZ.multiply(rotY).multiply(rotX);
18235
+ return result;
18236
+ };
18237
+ _proto.calLinearMov = function calLinearMov(time, duration, aSeed) {
18238
+ var mov = new Vector3();
18239
+ var lifetime = time / duration;
18240
+ if (!this.linearVelOverLifetime || !this.linearVelOverLifetime.enabled) {
18241
+ return new Vector3();
18242
+ }
18243
+ if (this.linearVelOverLifetime.asMovement) {
18244
+ if (this.linearVelOverLifetime.x) {
18245
+ if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
18246
+ mov.x = this.linearVelOverLifetime.x.getValue(lifetime, aSeed);
18247
+ } else {
18248
+ mov.x = this.linearVelOverLifetime.x.getValue(lifetime);
18249
+ }
18250
+ }
18251
+ if (this.linearVelOverLifetime.y) {
18252
+ if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
18253
+ mov.y = this.linearVelOverLifetime.y.getValue(lifetime, aSeed);
18254
+ } else {
18255
+ mov.y = this.linearVelOverLifetime.y.getValue(lifetime);
18256
+ }
18257
+ }
18258
+ if (this.linearVelOverLifetime.z) {
18259
+ if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
18260
+ mov.z = this.linearVelOverLifetime.z.getValue(lifetime, aSeed);
18261
+ } else {
18262
+ mov.z = this.linearVelOverLifetime.z.getValue(lifetime);
18263
+ }
18264
+ }
18265
+ } else {
18266
+ // Adjust rotation based on the specified lifetime components
18267
+ if (this.linearVelOverLifetime.x) {
18268
+ if (_instanceof1(this.linearVelOverLifetime.x, RandomValue)) {
18269
+ mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, aSeed);
18270
+ } else {
18271
+ mov.x = this.linearVelOverLifetime.x.getIntegrateValue(0.0, time, duration);
18272
+ }
18273
+ }
18274
+ if (this.linearVelOverLifetime.y) {
18275
+ if (_instanceof1(this.linearVelOverLifetime.y, RandomValue)) {
18276
+ mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, aSeed);
18277
+ } else {
18278
+ mov.y = this.linearVelOverLifetime.y.getIntegrateValue(0.0, time, duration);
18279
+ }
18280
+ }
18281
+ if (this.linearVelOverLifetime.z) {
18282
+ if (_instanceof1(this.linearVelOverLifetime.z, RandomValue)) {
18283
+ mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, aSeed);
18284
+ } else {
18285
+ mov.z = this.linearVelOverLifetime.z.getIntegrateValue(0.0, time, duration);
18286
+ }
18287
+ }
18288
+ }
18289
+ return mov;
18290
+ };
18058
18291
  _proto.removePoint = function removePoint(index) {
18059
18292
  if (index < this.particleCount) {
18060
18293
  this.geometry.setAttributeSubData("aOffset", index * 16, new Float32Array(16));
@@ -18256,6 +18489,32 @@ function generateGeometryProps(maxVertex, useSprite, name) {
18256
18489
  size: 4,
18257
18490
  stride: 4 * bpe,
18258
18491
  data: new Float32Array(0)
18492
+ },
18493
+ aTranslation: {
18494
+ size: 3,
18495
+ data: new Float32Array(0)
18496
+ },
18497
+ aLinearMove: {
18498
+ size: 3,
18499
+ data: new Float32Array(0)
18500
+ },
18501
+ aRotation0: {
18502
+ size: 3,
18503
+ offset: 0,
18504
+ stride: 9 * bpe,
18505
+ data: new Float32Array(0)
18506
+ },
18507
+ aRotation1: {
18508
+ size: 3,
18509
+ offset: 3 * bpe,
18510
+ stride: 9 * bpe,
18511
+ dataSource: "aRotation0"
18512
+ },
18513
+ aRotation2: {
18514
+ size: 3,
18515
+ offset: 6 * bpe,
18516
+ stride: 9 * bpe,
18517
+ dataSource: "aRotation0"
18259
18518
  }
18260
18519
  };
18261
18520
  if (useSprite) {
@@ -19462,6 +19721,18 @@ function compareTracks(a, b) {
19462
19721
  }
19463
19722
  }
19464
19723
  };
19724
+ _proto.showItems = function showItems() {
19725
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
19726
+ var item = _step.value;
19727
+ item.setVisible(true);
19728
+ }
19729
+ };
19730
+ _proto.hideItems = function hideItems() {
19731
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
19732
+ var item = _step.value;
19733
+ item.setVisible(false);
19734
+ }
19735
+ };
19465
19736
  _proto.onDestroy = function onDestroy() {
19466
19737
  if (this.item.composition) {
19467
19738
  if (this.items) {
@@ -19572,6 +19843,34 @@ function compareTracks(a, b) {
19572
19843
  return CompositionComponent;
19573
19844
  }(Behaviour);
19574
19845
 
19846
+ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
19847
+ _inherits(SubCompositionMixerPlayable, Playable);
19848
+ function SubCompositionMixerPlayable() {
19849
+ return Playable.apply(this, arguments);
19850
+ }
19851
+ var _proto = SubCompositionMixerPlayable.prototype;
19852
+ _proto.processFrame = function processFrame(context) {
19853
+ var boundObject = context.output.getUserData();
19854
+ if (!_instanceof1(boundObject, CompositionComponent)) {
19855
+ return;
19856
+ }
19857
+ var compositionComponent = boundObject;
19858
+ var hasInput = false;
19859
+ for(var i = 0; i < this.getInputCount(); i++){
19860
+ if (this.getInputWeight(i) > 0) {
19861
+ hasInput = true;
19862
+ break;
19863
+ }
19864
+ }
19865
+ if (hasInput) {
19866
+ compositionComponent.showItems();
19867
+ } else {
19868
+ compositionComponent.hideItems();
19869
+ }
19870
+ };
19871
+ return SubCompositionMixerPlayable;
19872
+ }(Playable);
19873
+
19575
19874
  exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19576
19875
  _inherits(SubCompositionTrack, TrackAsset);
19577
19876
  function SubCompositionTrack() {
@@ -19584,6 +19883,9 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
19584
19883
  }
19585
19884
  return parentBinding.getComponent(CompositionComponent);
19586
19885
  };
19886
+ _proto.createTrackMixer = function createTrackMixer(graph) {
19887
+ return new SubCompositionMixerPlayable(graph);
19888
+ };
19587
19889
  return SubCompositionTrack;
19588
19890
  }(exports.TrackAsset);
19589
19891
  exports.SubCompositionTrack = __decorate([
@@ -23679,22 +23981,6 @@ var seed = 1;
23679
23981
  this.timeout = timeout;
23680
23982
  };
23681
23983
  /**
23682
- * 根据用户传入的参数修改场景数据
23683
- */ _proto.updateSceneData = function updateSceneData(items) {
23684
- var variables = this.options.variables;
23685
- if (!variables || Object.keys(variables).length === 0) {
23686
- return;
23687
- }
23688
- items.forEach(function(item) {
23689
- if (item.type === ItemType.text) {
23690
- var textVariable = variables[item.name];
23691
- if (textVariable) {
23692
- item.content.options.text = textVariable;
23693
- }
23694
- }
23695
- });
23696
- };
23697
- /**
23698
23984
  * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
23699
23985
  * @param url - json 的 URL 链接或者 json 对象
23700
23986
  * @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
@@ -23821,7 +24107,6 @@ var seed = 1;
23821
24107
  for(i1 = 0; i1 < scene.images.length; i1++){
23822
24108
  scene.textureOptions[i1].image = scene.images[i1];
23823
24109
  }
23824
- _this.updateSceneData(scene.jsonScene.items);
23825
24110
  _state.label = 5;
23826
24111
  case 5:
23827
24112
  return [
@@ -23878,7 +24163,6 @@ var seed = 1;
23878
24163
  ];
23879
24164
  case 10:
23880
24165
  loadedTextures = _state.sent();
23881
- _this.updateSceneData(jsonScene.items);
23882
24166
  scene = {
23883
24167
  timeInfos: timeInfos,
23884
24168
  url: url,
@@ -25212,6 +25496,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25212
25496
  * 跳到指定时间点(不做任何播放行为)
25213
25497
  * @param time - 相对 startTime 的时间
25214
25498
  */ _proto.setTime = function setTime(time) {
25499
+ var speed = this.speed;
25215
25500
  var pause = this.paused;
25216
25501
  if (pause) {
25217
25502
  this.resume();
@@ -25220,7 +25505,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25220
25505
  this.rootComposition.onStart();
25221
25506
  this.rootComposition.isStartCalled = true;
25222
25507
  }
25508
+ this.setSpeed(1);
25223
25509
  this.forwardTime(time + this.startTime);
25510
+ this.setSpeed(speed);
25224
25511
  if (pause) {
25225
25512
  this.pause();
25226
25513
  }
@@ -25232,7 +25519,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25232
25519
  /**
25233
25520
  * 前进合成到指定时间
25234
25521
  * @param time - 相对0时刻的时间
25235
- * @param skipRender - 是否跳过渲染
25236
25522
  */ _proto.forwardTime = function forwardTime(time) {
25237
25523
  var deltaTime = time * 1000 - this.rootComposition.time * 1000;
25238
25524
  var reverse = deltaTime < 0;
@@ -25282,7 +25568,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25282
25568
  /**
25283
25569
  * 合成更新,针对所有 item 的更新
25284
25570
  * @param deltaTime - 更新的时间步长
25285
- * @param skipRender - 是否需要渲染
25286
25571
  */ _proto.update = function update(deltaTime) {
25287
25572
  if (!this.assigned || this.paused) {
25288
25573
  return;
@@ -27785,7 +28070,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27785
28070
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27786
28071
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27787
28072
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27788
- var version = "2.1.0-alpha.0";
28073
+ var version = "2.1.0-alpha.1";
27789
28074
  logger.info("Core version: " + version + ".");
27790
28075
 
27791
28076
  exports.AbstractPlugin = AbstractPlugin;