@galacean/effects-core 2.4.0-beta.1 → 2.4.0-beta.3

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.mjs 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.4.0-beta.1
6
+ * Version: v2.4.0-beta.3
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -6104,8 +6104,7 @@ function setSideMode(material, side) {
6104
6104
  material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
6105
6105
  }
6106
6106
  }
6107
- function setMaskMode(material, maskMode, colorMask) {
6108
- if (colorMask === void 0) colorMask = false;
6107
+ function setMaskMode(material, maskMode) {
6109
6108
  switch(maskMode){
6110
6109
  case undefined:
6111
6110
  material.stencilTest = false;
@@ -6120,13 +6119,6 @@ function setMaskMode(material, maskMode, colorMask) {
6120
6119
  glContext.REPLACE,
6121
6120
  glContext.REPLACE
6122
6121
  ];
6123
- // 关闭/开启蒙版元素的颜色写入
6124
- material.colorMask = [
6125
- colorMask,
6126
- colorMask,
6127
- colorMask,
6128
- colorMask
6129
- ];
6130
6122
  break;
6131
6123
  case MaskMode.OBSCURED:
6132
6124
  material.stencilTest = true;
@@ -7598,13 +7590,6 @@ var MaterialRenderType;
7598
7590
  set: /**
7599
7591
  * 设置 Material 的通过 alpha 值决定临时覆盖值计算的开关
7600
7592
  * @param value - 是否开启 alpha 抖动
7601
- */ function set(value) {}
7602
- },
7603
- {
7604
- key: "colorMask",
7605
- set: /**
7606
- * 设置 Material 颜色缓冲区的写入开关
7607
- * @param value
7608
7593
  */ function set(value) {}
7609
7594
  },
7610
7595
  {
@@ -7663,10 +7648,15 @@ var MaskProcessor = /*#__PURE__*/ function() {
7663
7648
  } else if (mode === ObscuredMode.OBSCURED || mode === ObscuredMode.REVERSE_OBSCURED) {
7664
7649
  maskMode = mode === ObscuredMode.OBSCURED ? MaskMode.OBSCURED : MaskMode.REVERSE_OBSCURED;
7665
7650
  this.maskRef = ref.maskManager.getRefValue();
7651
+ this.maskable = ref;
7666
7652
  }
7667
7653
  }
7668
7654
  return maskMode;
7669
7655
  };
7656
+ _proto.drawStencilMask = function drawStencilMask(renderer) {
7657
+ var _this_maskable;
7658
+ (_this_maskable = this.maskable) == null ? void 0 : _this_maskable.drawStencilMask(renderer);
7659
+ };
7670
7660
  return MaskProcessor;
7671
7661
  }();
7672
7662
 
@@ -12573,17 +12563,16 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12573
12563
  if (!this.getVisible()) {
12574
12564
  return;
12575
12565
  }
12576
- if (renderer.renderingData.currentFrame.globalUniforms) {
12577
- renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
12578
- }
12579
- for(var i = 0; i < this.materials.length; i++){
12580
- var material = this.materials[i];
12581
- material.setVector2("_Size", this.transform.size);
12582
- if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
12583
- material.setVector3("_Scale", this.transform.scale);
12584
- }
12585
- renderer.drawGeometry(this.geometry, material, i);
12586
- }
12566
+ this.maskManager.drawStencilMask(renderer);
12567
+ this.draw(renderer);
12568
+ };
12569
+ /**
12570
+ * @internal
12571
+ */ _proto.drawStencilMask = function drawStencilMask(renderer) {
12572
+ var previousColorMask = this.material.colorMask;
12573
+ this.material.colorMask = false;
12574
+ this.draw(renderer);
12575
+ this.material.colorMask = previousColorMask;
12587
12576
  };
12588
12577
  _proto.onStart = function onStart() {
12589
12578
  this.item.getHitTestParams = this.getHitTestParams;
@@ -12701,7 +12690,7 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12701
12690
  ] : undefined;
12702
12691
  setBlendMode(material, blendMode);
12703
12692
  // 兼容旧数据中模板需要渲染的情况
12704
- setMaskMode(material, maskMode, !!this.renderer.shape);
12693
+ setMaskMode(material, maskMode);
12705
12694
  setSideMode(material, side);
12706
12695
  material.shader.shaderData.properties = '_MainTex("_MainTex",2D) = "white" {}';
12707
12696
  material.setColor("_Color", new Color(0, 0, 0, 1));
@@ -12721,6 +12710,19 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12721
12710
  }
12722
12711
  return material;
12723
12712
  };
12713
+ _proto.draw = function draw(renderer) {
12714
+ if (renderer.renderingData.currentFrame.globalUniforms) {
12715
+ renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
12716
+ }
12717
+ for(var i = 0; i < this.materials.length; i++){
12718
+ var material = this.materials[i];
12719
+ material.setVector2("_Size", this.transform.size);
12720
+ if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
12721
+ material.setVector3("_Scale", this.transform.scale);
12722
+ }
12723
+ renderer.drawGeometry(this.geometry, material, i);
12724
+ }
12725
+ };
12724
12726
  _proto.fromData = function fromData(data) {
12725
12727
  RendererComponent.prototype.fromData.call(this, data);
12726
12728
  var _data_renderer;
@@ -15361,6 +15363,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
15361
15363
  };
15362
15364
  _this.duringPlay = false;
15363
15365
  /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
15366
+ _this.lastTime = -1;
15364
15367
  _this.getHitTestParams = function(force) {
15365
15368
  if (!_this.clickable) {
15366
15369
  return;
@@ -15451,11 +15454,21 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
15451
15454
  var _this_previewContent;
15452
15455
  this.duringPlay = true;
15453
15456
  // trigger messageBegin when item enter
15454
- if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
15455
- var _this_item_composition;
15456
- var options = this.item.props.content.options;
15457
- (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
15457
+ if (this.lastTime <= this.item.time) {
15458
+ if (this.item.time >= 0 && this.lastTime < 0) {
15459
+ var _this_item_composition;
15460
+ var options = this.item.props.content.options;
15461
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
15462
+ }
15463
+ } else {
15464
+ // loop trigger
15465
+ if (this.item.time >= 0) {
15466
+ var _this_item_composition1;
15467
+ var options1 = this.item.props.content.options;
15468
+ (_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.addInteractiveItem(this.item, options1.type);
15469
+ }
15458
15470
  }
15471
+ this.lastTime = this.item.time;
15459
15472
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
15460
15473
  if (!this.dragEvent || !this.bouncingArg) {
15461
15474
  return;
@@ -18587,6 +18600,7 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18587
18600
  this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
18588
18601
  };
18589
18602
  _proto.render = function render(renderer) {
18603
+ this.maskManager.drawStencilMask(renderer);
18590
18604
  for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
18591
18605
  var mesh = _step.value;
18592
18606
  mesh.render(renderer);
@@ -19536,6 +19550,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
19536
19550
  }
19537
19551
  this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
19538
19552
  this.renderer.item = this.item;
19553
+ this.renderer.maskManager = this.maskManager;
19539
19554
  this.meshes = this.renderer.meshes;
19540
19555
  var interaction = props.interaction;
19541
19556
  if (interaction) {
@@ -31619,7 +31634,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
31619
31634
  registerPlugin("particle", ParticleLoader, VFXItem);
31620
31635
  registerPlugin("cal", CalculateLoader, VFXItem);
31621
31636
  registerPlugin("interact", InteractLoader, VFXItem);
31622
- var version = "2.4.0-beta.1";
31637
+ var version = "2.4.0-beta.3";
31623
31638
  logger.info("Core version: " + version + ".");
31624
31639
 
31625
31640
  export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Ellipse, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphicsPath, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskRefManager, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PolyStar, Polygon, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StarType, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, buildLine, calculateTranslation, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrame_frag as itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };