@galacean/effects-core 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/composition.d.ts +0 -4
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/composition.d.ts
CHANGED
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.
|
|
6
|
+
* Version: v2.1.0-alpha.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -11591,7 +11591,7 @@ var valueDefine = "#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValu
|
|
|
11591
11591
|
|
|
11592
11592
|
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.;}";
|
|
11593
11593
|
|
|
11594
|
-
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
|
|
11594
|
+
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);}";
|
|
11595
11595
|
|
|
11596
11596
|
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);}";
|
|
11597
11597
|
|
|
@@ -18115,7 +18115,9 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
18115
18115
|
aPos: new Float32Array(48),
|
|
18116
18116
|
aRot: new Float32Array(32),
|
|
18117
18117
|
aOffset: new Float32Array(16),
|
|
18118
|
-
aTranslation: new Float32Array(12)
|
|
18118
|
+
aTranslation: new Float32Array(12),
|
|
18119
|
+
aLinearMove: new Float32Array(12),
|
|
18120
|
+
aRotation0: new Float32Array(36)
|
|
18119
18121
|
};
|
|
18120
18122
|
var useSprite = this.useSprite;
|
|
18121
18123
|
if (useSprite) {
|
|
@@ -25437,7 +25439,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
25437
25439
|
}));
|
|
25438
25440
|
_this.url = scene.url;
|
|
25439
25441
|
_this.assigned = true;
|
|
25440
|
-
_this.globalTime = 0;
|
|
25441
25442
|
_this.interactive = true;
|
|
25442
25443
|
_this.handleItemMessage = handleItemMessage;
|
|
25443
25444
|
_this.createRenderFrame();
|
|
@@ -25600,7 +25601,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
25600
25601
|
* 重置状态函数
|
|
25601
25602
|
*/ _proto.reset = function reset() {
|
|
25602
25603
|
this.rendererOptions = null;
|
|
25603
|
-
this.globalTime = 0;
|
|
25604
25604
|
this.rootItem.ended = false;
|
|
25605
25605
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
25606
25606
|
};
|
|
@@ -25638,9 +25638,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
25638
25638
|
if (!this.assigned || this.paused) {
|
|
25639
25639
|
return;
|
|
25640
25640
|
}
|
|
25641
|
-
var
|
|
25642
|
-
this.
|
|
25643
|
-
this.updateRootComposition();
|
|
25641
|
+
var dt = this.getUpdateTime(deltaTime * this.speed);
|
|
25642
|
+
this.updateRootComposition(dt / 1000);
|
|
25644
25643
|
this.updateVideo();
|
|
25645
25644
|
// 更新 model-tree-plugin
|
|
25646
25645
|
this.updatePluginLoaders(deltaTime);
|
|
@@ -25649,8 +25648,8 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
25649
25648
|
this.callAwake(this.rootItem);
|
|
25650
25649
|
this.rootItem.beginPlay();
|
|
25651
25650
|
}
|
|
25652
|
-
this.sceneTicking.update.tick(
|
|
25653
|
-
this.sceneTicking.lateUpdate.tick(
|
|
25651
|
+
this.sceneTicking.update.tick(dt);
|
|
25652
|
+
this.sceneTicking.lateUpdate.tick(dt);
|
|
25654
25653
|
this.updateCamera();
|
|
25655
25654
|
this.prepareRender();
|
|
25656
25655
|
if (this.shouldDispose()) {
|
|
@@ -25791,9 +25790,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
25791
25790
|
};
|
|
25792
25791
|
/**
|
|
25793
25792
|
* 更新主合成组件
|
|
25794
|
-
*/ _proto.updateRootComposition = function updateRootComposition() {
|
|
25793
|
+
*/ _proto.updateRootComposition = function updateRootComposition(deltaTime) {
|
|
25795
25794
|
if (this.rootComposition.isActiveAndEnabled) {
|
|
25796
|
-
var localTime = this.toLocalTime(this.
|
|
25795
|
+
var localTime = this.toLocalTime(this.time + deltaTime);
|
|
25797
25796
|
this.rootComposition.time = localTime;
|
|
25798
25797
|
}
|
|
25799
25798
|
};
|
|
@@ -28136,7 +28135,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
28136
28135
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
28137
28136
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
28138
28137
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
28139
|
-
var version = "2.1.0-alpha.
|
|
28138
|
+
var version = "2.1.0-alpha.5";
|
|
28140
28139
|
logger.info("Core version: " + version + ".");
|
|
28141
28140
|
|
|
28142
28141
|
exports.AbstractPlugin = AbstractPlugin;
|