@galacean/effects-core 2.1.3 → 2.1.5-alpha.0
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 +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
6
|
+
* Version: v2.1.5-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -10149,7 +10149,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
|
|
|
10149
10149
|
|
|
10150
10150
|
var itemVert = "precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}";
|
|
10151
10151
|
|
|
10152
|
-
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;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(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y))
|
|
10152
|
+
var itemFrag = "precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;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(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
|
|
10153
10153
|
|
|
10154
10154
|
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";
|
|
10155
10155
|
|
|
@@ -13348,6 +13348,11 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
13348
13348
|
texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
|
|
13349
13349
|
texParams.y = +this.preMultiAlpha;
|
|
13350
13350
|
texParams.z = renderer.renderMode;
|
|
13351
|
+
if (texParams.x === 0) {
|
|
13352
|
+
this.material.enableMacro("ALPHA_CLIP");
|
|
13353
|
+
} else {
|
|
13354
|
+
this.material.disableMacro("ALPHA_CLIP");
|
|
13355
|
+
}
|
|
13351
13356
|
}
|
|
13352
13357
|
var attributes = {
|
|
13353
13358
|
atlasOffset: new Float32Array(data.atlasOffset.length),
|
|
@@ -16577,10 +16582,17 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16577
16582
|
];
|
|
16578
16583
|
};
|
|
16579
16584
|
_proto.onStart = function onStart() {
|
|
16585
|
+
var _this = this;
|
|
16586
|
+
var _this_item_composition;
|
|
16580
16587
|
var options = this.item.props.content.options;
|
|
16581
16588
|
var env = this.item.engine.renderer.env;
|
|
16582
16589
|
var composition = this.item.composition;
|
|
16583
16590
|
var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
|
|
16591
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.on("goto", function() {
|
|
16592
|
+
if (_this.item.time > 0) {
|
|
16593
|
+
_this.duringPlay = true;
|
|
16594
|
+
}
|
|
16595
|
+
});
|
|
16584
16596
|
if (type === InteractType.CLICK) {
|
|
16585
16597
|
this.clickable = true;
|
|
16586
16598
|
if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
@@ -16621,12 +16633,12 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
16621
16633
|
};
|
|
16622
16634
|
_proto.onUpdate = function onUpdate(dt) {
|
|
16623
16635
|
var _this_previewContent;
|
|
16624
|
-
this.duringPlay = true;
|
|
16625
16636
|
// trigger messageBegin when item enter
|
|
16626
|
-
if (this.item.time > 0 && this.
|
|
16637
|
+
if (this.item.time > 0 && !this.duringPlay) {
|
|
16627
16638
|
var _this_item_composition;
|
|
16628
16639
|
var options = this.item.props.content.options;
|
|
16629
16640
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
16641
|
+
this.duringPlay = true;
|
|
16630
16642
|
}
|
|
16631
16643
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
16632
16644
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
@@ -16939,9 +16951,9 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
|
|
|
16939
16951
|
env: env
|
|
16940
16952
|
});
|
|
16941
16953
|
shader.shared = true;
|
|
16942
|
-
if (!wireframe) {
|
|
16943
|
-
|
|
16944
|
-
}
|
|
16954
|
+
// if (!wireframe) {
|
|
16955
|
+
// shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
|
|
16956
|
+
// }
|
|
16945
16957
|
return shader;
|
|
16946
16958
|
}
|
|
16947
16959
|
// TODO: 只有单测用
|
|
@@ -31380,7 +31392,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31380
31392
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31381
31393
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31382
31394
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31383
|
-
var version = "2.1.
|
|
31395
|
+
var version = "2.1.5-alpha.0";
|
|
31384
31396
|
logger.info("Core version: " + version + ".");
|
|
31385
31397
|
|
|
31386
31398
|
exports.AbstractPlugin = AbstractPlugin;
|