@galacean/effects-threejs 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 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.3-alpha.4
6
+ * Version: v2.1.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -10171,7 +10171,7 @@ var integrate = "float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4
10171
10171
 
10172
10172
  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}";
10173
10173
 
10174
- 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));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}";
10174
+ 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;}";
10175
10175
 
10176
10176
  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";
10177
10177
 
@@ -13370,6 +13370,11 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13370
13370
  texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
13371
13371
  texParams.y = +this.preMultiAlpha;
13372
13372
  texParams.z = renderer.renderMode;
13373
+ if (texParams.x === 0) {
13374
+ this.material.enableMacro("ALPHA_CLIP");
13375
+ } else {
13376
+ this.material.disableMacro("ALPHA_CLIP");
13377
+ }
13373
13378
  }
13374
13379
  var attributes = {
13375
13380
  atlasOffset: new Float32Array(data.atlasOffset.length),
@@ -16961,9 +16966,9 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
16961
16966
  env: env
16962
16967
  });
16963
16968
  shader.shared = true;
16964
- if (!wireframe) {
16965
- shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
16966
- }
16969
+ // if (!wireframe) {
16970
+ // shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
16971
+ // }
16967
16972
  return shader;
16968
16973
  }
16969
16974
  // TODO: 只有单测用
@@ -22216,7 +22221,7 @@ var ParticleMesh = /*#__PURE__*/ function() {
22216
22221
  var rotation = aRot;
22217
22222
  if (!this.rotationOverLifetime) {
22218
22223
  aRotationMatrix.setZero();
22219
- } else if (this.rotationOverLifetime.asRotation) {
22224
+ } else {
22220
22225
  // Adjust rotation based on the specified lifetime components
22221
22226
  if (this.rotationOverLifetime.x) {
22222
22227
  if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
@@ -22239,30 +22244,31 @@ var ParticleMesh = /*#__PURE__*/ function() {
22239
22244
  rotation.z += this.rotationOverLifetime.z.getValue(life);
22240
22245
  }
22241
22246
  }
22242
- } else {
22243
- // Adjust rotation based on the specified lifetime components
22244
- if (this.rotationOverLifetime.x) {
22245
- if (_instanceof1(this.rotationOverLifetime.x, RandomValue)) {
22246
- rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
22247
- } else {
22248
- rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
22249
- }
22250
- }
22251
- if (this.rotationOverLifetime.y) {
22252
- if (_instanceof1(this.rotationOverLifetime.y, RandomValue)) {
22253
- rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
22254
- } else {
22255
- rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
22256
- }
22257
- }
22258
- if (this.rotationOverLifetime.z) {
22259
- if (_instanceof1(this.rotationOverLifetime.z, RandomValue)) {
22260
- rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
22261
- } else {
22262
- rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
22263
- }
22264
- }
22265
22247
  }
22248
+ // else {
22249
+ // // Adjust rotation based on the specified lifetime components
22250
+ // if (this.rotationOverLifetime.x) {
22251
+ // if (this.rotationOverLifetime.x instanceof RandomValue) {
22252
+ // rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, aSeed) * duration;
22253
+ // } else {
22254
+ // rotation.x += this.rotationOverLifetime.x.getIntegrateValue(0.0, life, duration) * duration;
22255
+ // }
22256
+ // }
22257
+ // if (this.rotationOverLifetime.y) {
22258
+ // if (this.rotationOverLifetime.y instanceof RandomValue) {
22259
+ // rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, aSeed) * duration;
22260
+ // } else {
22261
+ // rotation.y += this.rotationOverLifetime.y.getIntegrateValue(0.0, life, duration) * duration;
22262
+ // }
22263
+ // }
22264
+ // if (this.rotationOverLifetime.z) {
22265
+ // if (this.rotationOverLifetime.z instanceof RandomValue) {
22266
+ // rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, aSeed) * duration;
22267
+ // } else {
22268
+ // rotation.z += this.rotationOverLifetime.z.getIntegrateValue(0.0, life, duration) * duration;
22269
+ // }
22270
+ // }
22271
+ // }
22266
22272
  // If the rotation vector is zero, return the identity matrix
22267
22273
  if (rotation.dot(rotation) === 0.0) {
22268
22274
  aRotationMatrix.identity();
@@ -31401,7 +31407,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31401
31407
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31402
31408
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31403
31409
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31404
- var version$1 = "2.1.3-alpha.4";
31410
+ var version$1 = "2.1.4";
31405
31411
  logger.info("Core version: " + version$1 + ".");
31406
31412
 
31407
31413
  var _obj;
@@ -33028,7 +33034,7 @@ setMaxSpriteMeshItemCount(8);
33028
33034
  */ Mesh.create = function(engine, props) {
33029
33035
  return new ThreeMesh(engine, props);
33030
33036
  };
33031
- var version = "2.1.3-alpha.4";
33037
+ var version = "2.1.4";
33032
33038
  logger.info("THREEJS plugin version: " + version + ".");
33033
33039
 
33034
33040
  exports.AbstractPlugin = AbstractPlugin;