@galacean/effects-threejs 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 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
6
+ * Version: v2.1.5-alpha.0
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),
@@ -16599,10 +16604,17 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16599
16604
  ];
16600
16605
  };
16601
16606
  _proto.onStart = function onStart() {
16607
+ var _this = this;
16608
+ var _this_item_composition;
16602
16609
  var options = this.item.props.content.options;
16603
16610
  var env = this.item.engine.renderer.env;
16604
16611
  var composition = this.item.composition;
16605
16612
  var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
16613
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.on("goto", function() {
16614
+ if (_this.item.time > 0) {
16615
+ _this.duringPlay = true;
16616
+ }
16617
+ });
16606
16618
  if (type === InteractType.CLICK) {
16607
16619
  this.clickable = true;
16608
16620
  if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
@@ -16643,12 +16655,12 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16643
16655
  };
16644
16656
  _proto.onUpdate = function onUpdate(dt) {
16645
16657
  var _this_previewContent;
16646
- this.duringPlay = true;
16647
16658
  // trigger messageBegin when item enter
16648
- if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
16659
+ if (this.item.time > 0 && !this.duringPlay) {
16649
16660
  var _this_item_composition;
16650
16661
  var options = this.item.props.content.options;
16651
16662
  (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
16663
+ this.duringPlay = true;
16652
16664
  }
16653
16665
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
16654
16666
  if (!this.dragEvent || !this.bouncingArg) {
@@ -16961,9 +16973,9 @@ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
16961
16973
  env: env
16962
16974
  });
16963
16975
  shader.shared = true;
16964
- if (!wireframe) {
16965
- shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
16966
- }
16976
+ // if (!wireframe) {
16977
+ // shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
16978
+ // }
16967
16979
  return shader;
16968
16980
  }
16969
16981
  // TODO: 只有单测用
@@ -31402,7 +31414,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31402
31414
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31403
31415
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31404
31416
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31405
- var version$1 = "2.1.3";
31417
+ var version$1 = "2.1.5-alpha.0";
31406
31418
  logger.info("Core version: " + version$1 + ".");
31407
31419
 
31408
31420
  var _obj;
@@ -33029,7 +33041,7 @@ setMaxSpriteMeshItemCount(8);
33029
33041
  */ Mesh.create = function(engine, props) {
33030
33042
  return new ThreeMesh(engine, props);
33031
33043
  };
33032
- var version = "2.1.3";
33044
+ var version = "2.1.5-alpha.0";
33033
33045
  logger.info("THREEJS plugin version: " + version + ".");
33034
33046
 
33035
33047
  exports.AbstractPlugin = AbstractPlugin;