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

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.2
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -6121,12 +6121,7 @@ function setMaskMode(material, maskMode, colorMask) {
6121
6121
  glContext.REPLACE
6122
6122
  ];
6123
6123
  // 关闭/开启蒙版元素的颜色写入
6124
- material.colorMask = [
6125
- colorMask,
6126
- colorMask,
6127
- colorMask,
6128
- colorMask
6129
- ];
6124
+ material.colorMask = colorMask;
6130
6125
  break;
6131
6126
  case MaskMode.OBSCURED:
6132
6127
  material.stencilTest = true;
@@ -7598,13 +7593,6 @@ var MaterialRenderType;
7598
7593
  set: /**
7599
7594
  * 设置 Material 的通过 alpha 值决定临时覆盖值计算的开关
7600
7595
  * @param value - 是否开启 alpha 抖动
7601
- */ function set(value) {}
7602
- },
7603
- {
7604
- key: "colorMask",
7605
- set: /**
7606
- * 设置 Material 颜色缓冲区的写入开关
7607
- * @param value
7608
7596
  */ function set(value) {}
7609
7597
  },
7610
7598
  {
@@ -7663,10 +7651,15 @@ var MaskProcessor = /*#__PURE__*/ function() {
7663
7651
  } else if (mode === ObscuredMode.OBSCURED || mode === ObscuredMode.REVERSE_OBSCURED) {
7664
7652
  maskMode = mode === ObscuredMode.OBSCURED ? MaskMode.OBSCURED : MaskMode.REVERSE_OBSCURED;
7665
7653
  this.maskRef = ref.maskManager.getRefValue();
7654
+ this.maskable = ref;
7666
7655
  }
7667
7656
  }
7668
7657
  return maskMode;
7669
7658
  };
7659
+ _proto.drawStencilMask = function drawStencilMask(renderer) {
7660
+ var _this_maskable;
7661
+ (_this_maskable = this.maskable) == null ? void 0 : _this_maskable.drawStencilMask(renderer);
7662
+ };
7670
7663
  return MaskProcessor;
7671
7664
  }();
7672
7665
 
@@ -12573,17 +12566,16 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12573
12566
  if (!this.getVisible()) {
12574
12567
  return;
12575
12568
  }
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
- }
12569
+ this.maskManager.drawStencilMask(renderer);
12570
+ this.draw(renderer);
12571
+ };
12572
+ /**
12573
+ * @internal
12574
+ */ _proto.drawStencilMask = function drawStencilMask(renderer) {
12575
+ var previousColorMask = this.material.colorMask;
12576
+ this.material.colorMask = false;
12577
+ this.draw(renderer);
12578
+ this.material.colorMask = previousColorMask;
12587
12579
  };
12588
12580
  _proto.onStart = function onStart() {
12589
12581
  this.item.getHitTestParams = this.getHitTestParams;
@@ -12721,6 +12713,19 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12721
12713
  }
12722
12714
  return material;
12723
12715
  };
12716
+ _proto.draw = function draw(renderer) {
12717
+ if (renderer.renderingData.currentFrame.globalUniforms) {
12718
+ renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
12719
+ }
12720
+ for(var i = 0; i < this.materials.length; i++){
12721
+ var material = this.materials[i];
12722
+ material.setVector2("_Size", this.transform.size);
12723
+ if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
12724
+ material.setVector3("_Scale", this.transform.scale);
12725
+ }
12726
+ renderer.drawGeometry(this.geometry, material, i);
12727
+ }
12728
+ };
12724
12729
  _proto.fromData = function fromData(data) {
12725
12730
  RendererComponent.prototype.fromData.call(this, data);
12726
12731
  var _data_renderer;
@@ -15361,6 +15366,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
15361
15366
  };
15362
15367
  _this.duringPlay = false;
15363
15368
  /** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
15369
+ _this.lastTime = -1;
15364
15370
  _this.getHitTestParams = function(force) {
15365
15371
  if (!_this.clickable) {
15366
15372
  return;
@@ -15451,11 +15457,21 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
15451
15457
  var _this_previewContent;
15452
15458
  this.duringPlay = true;
15453
15459
  // 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);
15460
+ if (this.lastTime <= this.item.time) {
15461
+ if (this.item.time >= 0 && this.lastTime < 0) {
15462
+ var _this_item_composition;
15463
+ var options = this.item.props.content.options;
15464
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
15465
+ }
15466
+ } else {
15467
+ // loop trigger
15468
+ if (this.item.time >= 0) {
15469
+ var _this_item_composition1;
15470
+ var options1 = this.item.props.content.options;
15471
+ (_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.addInteractiveItem(this.item, options1.type);
15472
+ }
15458
15473
  }
15474
+ this.lastTime = this.item.time;
15459
15475
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
15460
15476
  if (!this.dragEvent || !this.bouncingArg) {
15461
15477
  return;
@@ -18587,6 +18603,7 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
18587
18603
  this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
18588
18604
  };
18589
18605
  _proto.render = function render(renderer) {
18606
+ this.maskManager.drawStencilMask(renderer);
18590
18607
  for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
18591
18608
  var mesh = _step.value;
18592
18609
  mesh.render(renderer);
@@ -19536,6 +19553,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
19536
19553
  }
19537
19554
  this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
19538
19555
  this.renderer.item = this.item;
19556
+ this.renderer.maskManager = this.maskManager;
19539
19557
  this.meshes = this.renderer.meshes;
19540
19558
  var interaction = props.interaction;
19541
19559
  if (interaction) {
@@ -31619,7 +31637,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
31619
31637
  registerPlugin("particle", ParticleLoader, VFXItem);
31620
31638
  registerPlugin("cal", CalculateLoader, VFXItem);
31621
31639
  registerPlugin("interact", InteractLoader, VFXItem);
31622
- var version = "2.4.0-beta.1";
31640
+ var version = "2.4.0-beta.2";
31623
31641
  logger.info("Core version: " + version + ".");
31624
31642
 
31625
31643
  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 };