@galacean/effects-core 2.1.3-alpha.4 → 2.1.4
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 +36 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -30
- 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.4
|
|
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),
|
|
@@ -16939,9 +16944,9 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
|
|
|
16939
16944
|
env: env
|
|
16940
16945
|
});
|
|
16941
16946
|
shader.shared = true;
|
|
16942
|
-
if (!wireframe) {
|
|
16943
|
-
|
|
16944
|
-
}
|
|
16947
|
+
// if (!wireframe) {
|
|
16948
|
+
// shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
|
|
16949
|
+
// }
|
|
16945
16950
|
return shader;
|
|
16946
16951
|
}
|
|
16947
16952
|
// TODO: 只有单测用
|
|
@@ -22194,7 +22199,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
22194
22199
|
var rotation = aRot;
|
|
22195
22200
|
if (!this.rotationOverLifetime) {
|
|
22196
22201
|
aRotationMatrix.setZero();
|
|
22197
|
-
} else
|
|
22202
|
+
} else {
|
|
22198
22203
|
// Adjust rotation based on the specified lifetime components
|
|
22199
22204
|
if (this.rotationOverLifetime.x) {
|
|
22200
22205
|
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
@@ -22217,30 +22222,31 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
22217
22222
|
rotation.z += this.rotationOverLifetime.z.getValue(life);
|
|
22218
22223
|
}
|
|
22219
22224
|
}
|
|
22220
|
-
} else {
|
|
22221
|
-
// Adjust rotation based on the specified lifetime components
|
|
22222
|
-
if (this.rotationOverLifetime.x) {
|
|
22223
|
-
if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
|
|
22224
|
-
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22225
|
-
} else {
|
|
22226
|
-
rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
|
|
22227
|
-
}
|
|
22228
|
-
}
|
|
22229
|
-
if (this.rotationOverLifetime.y) {
|
|
22230
|
-
if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
|
|
22231
|
-
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22232
|
-
} else {
|
|
22233
|
-
rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
|
|
22234
|
-
}
|
|
22235
|
-
}
|
|
22236
|
-
if (this.rotationOverLifetime.z) {
|
|
22237
|
-
if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
|
|
22238
|
-
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22239
|
-
} else {
|
|
22240
|
-
rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
|
|
22241
|
-
}
|
|
22242
|
-
}
|
|
22243
22225
|
}
|
|
22226
|
+
// else {
|
|
22227
|
+
// // Adjust rotation based on the specified lifetime components
|
|
22228
|
+
// if (this.rotationOverLifetime.x) {
|
|
22229
|
+
// if (this.rotationOverLifetime.x instanceof RandomValue) {
|
|
22230
|
+
// rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22231
|
+
// } else {
|
|
22232
|
+
// rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
|
|
22233
|
+
// }
|
|
22234
|
+
// }
|
|
22235
|
+
// if (this.rotationOverLifetime.y) {
|
|
22236
|
+
// if (this.rotationOverLifetime.y instanceof RandomValue) {
|
|
22237
|
+
// rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22238
|
+
// } else {
|
|
22239
|
+
// rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
|
|
22240
|
+
// }
|
|
22241
|
+
// }
|
|
22242
|
+
// if (this.rotationOverLifetime.z) {
|
|
22243
|
+
// if (this.rotationOverLifetime.z instanceof RandomValue) {
|
|
22244
|
+
// rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
|
|
22245
|
+
// } else {
|
|
22246
|
+
// rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
|
|
22247
|
+
// }
|
|
22248
|
+
// }
|
|
22249
|
+
// }
|
|
22244
22250
|
// If the rotation vector is zero, return the identity matrix
|
|
22245
22251
|
if (rotation.dot(rotation) === 0.0) {
|
|
22246
22252
|
aRotationMatrix.identity();
|
|
@@ -31379,7 +31385,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31379
31385
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31380
31386
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31381
31387
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31382
|
-
var version = "2.1.
|
|
31388
|
+
var version = "2.1.4";
|
|
31383
31389
|
logger.info("Core version: " + version + ".");
|
|
31384
31390
|
|
|
31385
31391
|
exports.AbstractPlugin = AbstractPlugin;
|