@galacean/effects-threejs 2.1.0-alpha.4 → 2.1.0-alpha.5

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 threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-alpha.4
6
+ * Version: v2.1.0-alpha.5
7
7
  */
8
8
 
9
9
  'use strict';
@@ -11613,7 +11613,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
11613
11613
 
11614
11614
  var screenMeshVert = "precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}";
11615
11615
 
11616
- var colorGradingFrag = "precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor*=hdrColor.a;hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}";
11616
+ var colorGradingFrag = "precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}";
11617
11617
 
11618
11618
  var gaussianDown_frag = "precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}";
11619
11619
 
@@ -18137,7 +18137,9 @@ var ParticleMesh = /*#__PURE__*/ function() {
18137
18137
  aPos: new Float32Array(48),
18138
18138
  aRot: new Float32Array(32),
18139
18139
  aOffset: new Float32Array(16),
18140
- aTranslation: new Float32Array(12)
18140
+ aTranslation: new Float32Array(12),
18141
+ aLinearMove: new Float32Array(12),
18142
+ aRotation0: new Float32Array(36)
18141
18143
  };
18142
18144
  var useSprite = this.useSprite;
18143
18145
  if (useSprite) {
@@ -25459,7 +25461,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25459
25461
  }));
25460
25462
  _this.url = scene.url;
25461
25463
  _this.assigned = true;
25462
- _this.globalTime = 0;
25463
25464
  _this.interactive = true;
25464
25465
  _this.handleItemMessage = handleItemMessage;
25465
25466
  _this.createRenderFrame();
@@ -25622,7 +25623,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25622
25623
  * 重置状态函数
25623
25624
  */ _proto.reset = function reset() {
25624
25625
  this.rendererOptions = null;
25625
- this.globalTime = 0;
25626
25626
  this.rootItem.ended = false;
25627
25627
  this.pluginSystem.resetComposition(this, this.renderFrame);
25628
25628
  };
@@ -25660,9 +25660,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25660
25660
  if (!this.assigned || this.paused) {
25661
25661
  return;
25662
25662
  }
25663
- var time = this.getUpdateTime(deltaTime * this.speed);
25664
- this.globalTime += time;
25665
- this.updateRootComposition();
25663
+ var dt = this.getUpdateTime(deltaTime * this.speed);
25664
+ this.updateRootComposition(dt / 1000);
25666
25665
  this.updateVideo();
25667
25666
  // 更新 model-tree-plugin
25668
25667
  this.updatePluginLoaders(deltaTime);
@@ -25671,8 +25670,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25671
25670
  this.callAwake(this.rootItem);
25672
25671
  this.rootItem.beginPlay();
25673
25672
  }
25674
- this.sceneTicking.update.tick(time);
25675
- this.sceneTicking.lateUpdate.tick(time);
25673
+ this.sceneTicking.update.tick(dt);
25674
+ this.sceneTicking.lateUpdate.tick(dt);
25676
25675
  this.updateCamera();
25677
25676
  this.prepareRender();
25678
25677
  if (this.shouldDispose()) {
@@ -25813,9 +25812,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
25813
25812
  };
25814
25813
  /**
25815
25814
  * 更新主合成组件
25816
- */ _proto.updateRootComposition = function updateRootComposition() {
25815
+ */ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
25817
25816
  if (this.rootComposition.isActiveAndEnabled) {
25818
- var localTime = this.toLocalTime(this.globalTime / 1000);
25817
+ var localTime = this.toLocalTime(this.time + deltaTime);
25819
25818
  this.rootComposition.time = localTime;
25820
25819
  }
25821
25820
  };
@@ -28158,7 +28157,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
28158
28157
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
28159
28158
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
28160
28159
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
28161
- var version$1 = "2.1.0-alpha.4";
28160
+ var version$1 = "2.1.0-alpha.5";
28162
28161
  logger.info("Core version: " + version$1 + ".");
28163
28162
 
28164
28163
  var _obj;
@@ -29839,7 +29838,7 @@ setMaxSpriteMeshItemCount(8);
29839
29838
  */ Mesh.create = function(engine, props) {
29840
29839
  return new ThreeMesh(engine, props);
29841
29840
  };
29842
- var version = "2.1.0-alpha.4";
29841
+ var version = "2.1.0-alpha.5";
29843
29842
  logger.info("THREEJS plugin version: " + version + ".");
29844
29843
 
29845
29844
  exports.AbstractPlugin = AbstractPlugin;