@galacean/effects-core 2.3.0 → 2.3.1

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.3.0
6
+ * Version: v2.3.1
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -926,10 +926,10 @@ var PluginSystem = /*#__PURE__*/ function() {
926
926
  });
927
927
  })();
928
928
  };
929
- _proto.precompile = function precompile(compositions, renderer, options) {
929
+ _proto.precompile = function precompile(compositions, renderer) {
930
930
  for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
931
931
  var plugin = _step.value;
932
- plugin.precompile(compositions, renderer, options);
932
+ plugin.precompile(compositions, renderer);
933
933
  }
934
934
  };
935
935
  _proto.loadResources = function loadResources(scene, options) {
@@ -1004,7 +1004,7 @@ function getPluginUsageInfo(name) {
1004
1004
  * 在加载到 JSON 后,就可以进行提前编译
1005
1005
  * @param json
1006
1006
  * @param player
1007
- */ _proto.precompile = function precompile(compositions, renderer, options) {};
1007
+ */ _proto.precompile = function precompile(compositions, renderer) {};
1008
1008
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
1009
1009
  _proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
1010
1010
  _proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
@@ -16323,7 +16323,6 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16323
16323
  _this.hasFill = false;
16324
16324
  _this.shapeDirty = true;
16325
16325
  _this.graphicsPath = new GraphicsPath();
16326
- _this.curveValues = [];
16327
16326
  _this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
16328
16327
  _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
16329
16328
  if (!_this.geometry) {
@@ -16505,31 +16504,25 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16505
16504
  var easingOuts = customShapeAtribute.easingOuts;
16506
16505
  for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
16507
16506
  var shape = _step.value;
16508
- this.curveValues = [];
16509
16507
  var indices = shape.indexes;
16508
+ var startPoint = points[indices[0].point];
16509
+ this.graphicsPath.moveTo(startPoint.x, startPoint.y);
16510
16510
  for(var i = 1; i < indices.length; i++){
16511
16511
  var pointIndex = indices[i];
16512
16512
  var lastPointIndex = indices[i - 1];
16513
- this.curveValues.push({
16514
- point: points[pointIndex.point],
16515
- controlPoint1: easingOuts[lastPointIndex.easingOut],
16516
- controlPoint2: easingIns[pointIndex.easingIn]
16517
- });
16518
- }
16519
- // Push the last curve
16520
- this.curveValues.push({
16521
- point: points[indices[0].point],
16522
- controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
16523
- controlPoint2: easingIns[indices[0].easingIn]
16524
- });
16525
- this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
16526
- for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
16527
- var curveValue = _step1.value;
16528
- var point = curveValue.point;
16529
- var control1 = curveValue.controlPoint1;
16530
- var control2 = curveValue.controlPoint2;
16531
- this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
16513
+ var point = points[pointIndex.point];
16514
+ var lastPoint = points[lastPointIndex.point];
16515
+ var control1 = easingOuts[lastPointIndex.easingOut];
16516
+ var control2 = easingIns[pointIndex.easingIn];
16517
+ this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
16532
16518
  }
16519
+ var pointIndex1 = indices[0];
16520
+ var lastPointIndex1 = indices[indices.length - 1];
16521
+ var point1 = points[pointIndex1.point];
16522
+ var lastPoint1 = points[lastPointIndex1.point];
16523
+ var control11 = easingOuts[lastPointIndex1.easingOut];
16524
+ var control21 = easingIns[pointIndex1.easingIn];
16525
+ this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
16533
16526
  if (shape.close) {
16534
16527
  this.graphicsPath.closePath();
16535
16528
  }
@@ -26650,14 +26643,36 @@ function getStandardInteractContent(ui) {
26650
26643
  // @ts-expect-error
26651
26644
  customShapeComponent.fill = customShapeComponent.shapes[0].fill;
26652
26645
  }
26646
+ // easingIn 和 easingOut 绝对坐标转相对坐标
26647
+ var easingInFlag = new Array(customShapeComponent.easingIns.length);
26648
+ var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
26649
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
26650
+ var shape = _step1.value;
26651
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
26652
+ var index = _step2.value;
26653
+ var point = customShapeComponent.points[index.point];
26654
+ var easingIn = customShapeComponent.easingIns[index.easingIn];
26655
+ var easingOut = customShapeComponent.easingOuts[index.easingOut];
26656
+ if (!easingInFlag[index.easingIn]) {
26657
+ easingIn.x -= point.x;
26658
+ easingIn.y -= point.y;
26659
+ easingInFlag[index.easingIn] = true;
26660
+ }
26661
+ if (!easingOutFlag[index.easingOut]) {
26662
+ easingOut.x -= point.x;
26663
+ easingOut.y -= point.y;
26664
+ easingOutFlag[index.easingOut] = true;
26665
+ }
26666
+ }
26667
+ }
26653
26668
  }
26654
26669
  }
26655
26670
  }
26656
26671
  // Composition id 转 guid
26657
26672
  var compositionId = json.compositionId;
26658
26673
  var compositionIdToGUIDMap = {};
26659
- for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
26660
- var composition = _step1.value;
26674
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
26675
+ var composition = _step3.value;
26661
26676
  var guid = generateGUID();
26662
26677
  compositionIdToGUIDMap[composition.id] = guid;
26663
26678
  if (composition.id === compositionId) {
@@ -26666,8 +26681,8 @@ function getStandardInteractContent(ui) {
26666
26681
  composition.id = guid;
26667
26682
  }
26668
26683
  // 预合成元素 refId 同步改为生成的合成 guid
26669
- for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
26670
- var item = _step2.value;
26684
+ for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
26685
+ var item = _step4.value;
26671
26686
  if (item.content) {
26672
26687
  var compositionOptions = item.content.options;
26673
26688
  if (compositionOptions && compositionOptions.refId !== undefined) {
@@ -27521,8 +27536,10 @@ function getStandardJSON(json) {
27521
27536
  json = version30Migration(version21Migration(json));
27522
27537
  }
27523
27538
  // 3.x 版本格式转换
27524
- if (mainVersion < 4 || mainVersion === 4 && minorVersion < 2) {
27525
- json = version31Migration(json);
27539
+ if (mainVersion < 4) {
27540
+ if (mainVersion === 3 && minorVersion < 2) {
27541
+ json = version31Migration(json);
27542
+ }
27526
27543
  }
27527
27544
  return json;
27528
27545
  }
@@ -32075,7 +32092,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
32075
32092
  registerPlugin("particle", ParticleLoader, VFXItem);
32076
32093
  registerPlugin("cal", CalculateLoader, VFXItem);
32077
32094
  registerPlugin("interact", InteractLoader, VFXItem);
32078
- var version = "2.3.0";
32095
+ var version = "2.3.1";
32079
32096
  logger.info("Core version: " + version + ".");
32080
32097
 
32081
32098
  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, CompositionSourceManager, 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, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, 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, 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, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, 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, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, 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, getImageItemRenderInfo, 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, 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, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };