@galacean/effects-core 2.3.0 → 2.3.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.3.0
6
+ * Version: v2.3.2
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
  }
@@ -17936,6 +17929,7 @@ var seed$3 = 1;
17936
17929
  this.rotation.y = y;
17937
17930
  this.rotation.z = z;
17938
17931
  this.quat.setFromEuler(this.rotation);
17932
+ // TODO 修正 GE 四元数旋转共轭问题
17939
17933
  this.quat.conjugate();
17940
17934
  this.dirtyFlags.localData = true;
17941
17935
  this.dispatchValueChange();
@@ -26650,14 +26644,36 @@ function getStandardInteractContent(ui) {
26650
26644
  // @ts-expect-error
26651
26645
  customShapeComponent.fill = customShapeComponent.shapes[0].fill;
26652
26646
  }
26647
+ // easingIn 和 easingOut 绝对坐标转相对坐标
26648
+ var easingInFlag = new Array(customShapeComponent.easingIns.length);
26649
+ var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
26650
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
26651
+ var shape = _step1.value;
26652
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
26653
+ var index = _step2.value;
26654
+ var point = customShapeComponent.points[index.point];
26655
+ var easingIn = customShapeComponent.easingIns[index.easingIn];
26656
+ var easingOut = customShapeComponent.easingOuts[index.easingOut];
26657
+ if (!easingInFlag[index.easingIn]) {
26658
+ easingIn.x -= point.x;
26659
+ easingIn.y -= point.y;
26660
+ easingInFlag[index.easingIn] = true;
26661
+ }
26662
+ if (!easingOutFlag[index.easingOut]) {
26663
+ easingOut.x -= point.x;
26664
+ easingOut.y -= point.y;
26665
+ easingOutFlag[index.easingOut] = true;
26666
+ }
26667
+ }
26668
+ }
26653
26669
  }
26654
26670
  }
26655
26671
  }
26656
26672
  // Composition id 转 guid
26657
26673
  var compositionId = json.compositionId;
26658
26674
  var compositionIdToGUIDMap = {};
26659
- for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
26660
- var composition = _step1.value;
26675
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
26676
+ var composition = _step3.value;
26661
26677
  var guid = generateGUID();
26662
26678
  compositionIdToGUIDMap[composition.id] = guid;
26663
26679
  if (composition.id === compositionId) {
@@ -26666,8 +26682,8 @@ function getStandardInteractContent(ui) {
26666
26682
  composition.id = guid;
26667
26683
  }
26668
26684
  // 预合成元素 refId 同步改为生成的合成 guid
26669
- for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
26670
- var item = _step2.value;
26685
+ for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
26686
+ var item = _step4.value;
26671
26687
  if (item.content) {
26672
26688
  var compositionOptions = item.content.options;
26673
26689
  if (compositionOptions && compositionOptions.refId !== undefined) {
@@ -27521,8 +27537,10 @@ function getStandardJSON(json) {
27521
27537
  json = version30Migration(version21Migration(json));
27522
27538
  }
27523
27539
  // 3.x 版本格式转换
27524
- if (mainVersion < 4 || mainVersion === 4 && minorVersion < 2) {
27525
- json = version31Migration(json);
27540
+ if (mainVersion < 4) {
27541
+ if (mainVersion === 3 && minorVersion < 2) {
27542
+ json = version31Migration(json);
27543
+ }
27526
27544
  }
27527
27545
  return json;
27528
27546
  }
@@ -28813,6 +28831,8 @@ var tmpScale = new Vector3(1, 1, 1);
28813
28831
  0,
28814
28832
  0
28815
28833
  ] : _options_rotation;
28834
+ var euler = new Euler(rotation[0], rotation[1], rotation[2]);
28835
+ var quat = new Quaternion().setFromEuler(euler);
28816
28836
  this.options = {
28817
28837
  near: near,
28818
28838
  far: far,
@@ -28821,7 +28841,7 @@ var tmpScale = new Vector3(1, 1, 1);
28821
28841
  clipMode: clipMode
28822
28842
  };
28823
28843
  this.transform.setPosition(position[0], position[1], position[2]);
28824
- this.transform.setRotation(rotation[0], rotation[1], rotation[2]);
28844
+ this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
28825
28845
  this.dirty = true;
28826
28846
  this.updateMatrix();
28827
28847
  }
@@ -32075,7 +32095,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
32075
32095
  registerPlugin("particle", ParticleLoader, VFXItem);
32076
32096
  registerPlugin("cal", CalculateLoader, VFXItem);
32077
32097
  registerPlugin("interact", InteractLoader, VFXItem);
32078
- var version = "2.3.0";
32098
+ var version = "2.3.2";
32079
32099
  logger.info("Core version: " + version + ".");
32080
32100
 
32081
32101
  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 };