@galacean/effects-core 2.1.0-beta.0 → 2.1.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 core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-beta.0
6
+ * Version: v2.1.0
7
7
  */
8
8
 
9
9
  'use strict';
@@ -1094,39 +1094,39 @@ function _inherits(subClass, superClass) {
1094
1094
  })(MaskMode || (MaskMode = {}));
1095
1095
  /**
1096
1096
  * 发射器形状
1097
- */ var ShapeType;
1098
- (function(ShapeType) {
1097
+ */ var ParticleEmitterShapeType;
1098
+ (function(ParticleEmitterShapeType) {
1099
1099
  /**
1100
1100
  * 没有类型
1101
- */ ShapeType[ShapeType["NONE"] = 0] = "NONE";
1101
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
1102
1102
  /**
1103
1103
  * 圆球
1104
- */ ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
1104
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
1105
1105
  /**
1106
1106
  * 圆锥
1107
- */ ShapeType[ShapeType["CONE"] = 2] = "CONE";
1107
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
1108
1108
  /**
1109
1109
  * 半球
1110
- */ ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1110
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1111
1111
  /**
1112
1112
  * 圆
1113
- */ ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
1113
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
1114
1114
  /**
1115
1115
  * 圆环
1116
- */ ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
1116
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
1117
1117
  /**
1118
1118
  * 矩形
1119
- */ ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1119
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1120
1120
  /**
1121
1121
  * 矩形框
1122
- */ ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1122
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1123
1123
  /**
1124
1124
  * 直线
1125
- */ ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
1125
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
1126
1126
  /**
1127
1127
  * 贴图
1128
- */ ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
1129
- })(ShapeType || (ShapeType = {}));
1128
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
1129
+ })(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
1130
1130
  /**
1131
1131
  * 插件类型
1132
1132
  */ var PluginType;
@@ -1622,6 +1622,34 @@ var BuiltinObjectGUID = {
1622
1622
  UnlitShader: "unlit000000000000000000000000000"
1623
1623
  };
1624
1624
 
1625
+ /**
1626
+ * 矢量图形类型
1627
+ */ var ShapePrimitiveType;
1628
+ (function(ShapePrimitiveType) {
1629
+ /**
1630
+ * 自定义图形
1631
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1632
+ /**
1633
+ * 矩形
1634
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1635
+ /**
1636
+ * 椭圆
1637
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1638
+ /**
1639
+ * 多边形
1640
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1641
+ /**
1642
+ * 星形
1643
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1644
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1645
+
1646
+ // 本期无该功能 待补充
1647
+ var ShapeConnectType;
1648
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1649
+ // @待补充
1650
+ var ShapePointType;
1651
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1652
+
1625
1653
  /**
1626
1654
  * 动态换图类型
1627
1655
  * @since 1.1.0
@@ -1652,6 +1680,7 @@ var DataType;
1652
1680
  DataType["PostProcessVolume"] = "PostProcessVolume";
1653
1681
  DataType["Geometry"] = "Geometry";
1654
1682
  DataType["Texture"] = "Texture";
1683
+ DataType["Image"] = "Image";
1655
1684
  DataType["AnimationClip"] = "AnimationClip";
1656
1685
  DataType["TextComponent"] = "TextComponent";
1657
1686
  DataType["BinaryAsset"] = "BinaryAsset";
@@ -1683,6 +1712,8 @@ var DataType;
1683
1712
  DataType["VideoComponent"] = "VideoComponent";
1684
1713
  DataType["AudioComponent"] = "AudioComponent";
1685
1714
  DataType["RichTextComponent"] = "RichTextComponent";
1715
+ DataType["OrientationComponent"] = "OrientationComponent";
1716
+ DataType["ShapeComponent"] = "ShapeComponent";
1686
1717
  // Non-EffectObject
1687
1718
  DataType["TimelineClip"] = "TimelineClip";
1688
1719
  })(DataType || (DataType = {}));
@@ -1777,7 +1808,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
1777
1808
  get BlendingMode () { return BlendingMode; },
1778
1809
  get SideMode () { return SideMode; },
1779
1810
  get MaskMode () { return MaskMode; },
1780
- get ShapeType () { return ShapeType; },
1811
+ get ParticleEmitterShapeType () { return ParticleEmitterShapeType; },
1781
1812
  get PluginType () { return PluginType; },
1782
1813
  get InteractType () { return InteractType; },
1783
1814
  get InteractBehavior () { return InteractBehavior; },
@@ -1816,6 +1847,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
1816
1847
  get TextWeight () { return TextWeight; },
1817
1848
  get FontStyle () { return FontStyle; },
1818
1849
  BuiltinObjectGUID: BuiltinObjectGUID,
1850
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1851
+ get ShapeConnectType () { return ShapeConnectType; },
1852
+ get ShapePointType () { return ShapePointType; },
1819
1853
  get BackgroundType () { return BackgroundType; },
1820
1854
  get MultimediaType () { return MultimediaType; },
1821
1855
  get DataType () { return DataType; },
@@ -2136,6 +2170,14 @@ __decorate([
2136
2170
  Component.prototype.setVFXItem.call(this, item);
2137
2171
  this.item.rendererComponents.push(this);
2138
2172
  };
2173
+ _proto.onEnable = function onEnable() {
2174
+ var _this_item_composition;
2175
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
2176
+ };
2177
+ _proto.onDisable = function onDisable() {
2178
+ var _this_item_composition;
2179
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
2180
+ };
2139
2181
  _proto.fromData = function fromData(data) {
2140
2182
  Component.prototype.fromData.call(this, data);
2141
2183
  };
@@ -10656,16 +10698,16 @@ var seed$5 = 1;
10656
10698
  depthAction: exports.TextureLoadAction.clear
10657
10699
  };
10658
10700
  }
10659
- // 创建 drawObjectPass
10701
+ this.drawObjectPass = new RenderPass(renderer, {
10702
+ name: RENDER_PASS_NAME_PREFIX,
10703
+ priority: RenderPassPriorityNormal,
10704
+ meshOrder: exports.OrderType.ascending,
10705
+ depthStencilAttachment: depthStencilAttachment,
10706
+ attachments: attachments,
10707
+ clearAction: drawObjectPassClearAction
10708
+ });
10660
10709
  var renderPasses = [
10661
- new RenderPass(renderer, {
10662
- name: RENDER_PASS_NAME_PREFIX,
10663
- priority: RenderPassPriorityNormal,
10664
- meshOrder: exports.OrderType.ascending,
10665
- depthStencilAttachment: depthStencilAttachment,
10666
- attachments: attachments,
10667
- clearAction: drawObjectPassClearAction
10668
- })
10710
+ this.drawObjectPass
10669
10711
  ];
10670
10712
  this.setRenderPasses(renderPasses);
10671
10713
  if (postProcessingEnabled) {
@@ -10787,216 +10829,15 @@ var seed$5 = 1;
10787
10829
  * 根据 Mesh 优先级添加到 RenderPass
10788
10830
  * @param mesh - 要添加的 Mesh 对象
10789
10831
  */ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
10790
- if (!mesh) {
10791
- return;
10792
- }
10793
- this.renderPasses[0].addMesh(mesh);
10794
- // const renderPasses = this.renderPasses;
10795
- // const infoMap = this.renderPassInfoMap;
10796
- // const { priority } = mesh;
10797
- // for (let i = 1; i < renderPasses.length; i++) {
10798
- // const renderPass = renderPasses[i - 1];
10799
- // const info = infoMap.get(renderPasses[i])!;
10800
- // if (info && info.listStart > priority && (priority > infoMap.get(renderPass)!.listEnd || i === 1)) {
10801
- // return this.addToRenderPass(renderPass, mesh);
10802
- // }
10803
- // }
10804
- // // TODO: diff逻辑待优化,有时会添加进找不到的元素
10805
- // let last = renderPasses[renderPasses.length - 1];
10806
- // // TODO: 是否添加mesh到pass的判断方式需要优化,先通过长度判断是否有postprocess
10807
- // for (const pass of renderPasses) {
10808
- // if (!(pass instanceof HQGaussianDownSamplePass
10809
- // || pass instanceof BloomThresholdPass
10810
- // || pass instanceof ToneMappingPass
10811
- // || pass instanceof HQGaussianUpSamplePass
10812
- // || pass.name === 'mars-final-copy')) {
10813
- // last = pass;
10814
- // }
10815
- // }
10816
- // // if (priority > infoMap.get(last)!.listStart || renderPasses.length === 1) {
10817
- // // return this.addToRenderPass(last, mesh);
10818
- // // }
10819
- // return this.addToRenderPass(last, mesh);
10820
- // if (false) {
10821
- // throw Error('render pass not found');
10822
- // }
10832
+ this.drawObjectPass.addMesh(mesh);
10823
10833
  };
10824
10834
  /**
10825
10835
  * 把 Mesh 从 RenderPass 中移除,
10826
10836
  * 如果 renderPass 中没有 mesh,此 renderPass 会被删除
10827
10837
  * @param mesh - 要删除的 Mesh 对象
10828
10838
  */ _proto.removeMeshFromDefaultRenderPass = function removeMeshFromDefaultRenderPass(mesh) {
10829
- // const renderPasses = this.renderPasses;
10830
- // const infoMap = this.renderPassInfoMap;
10831
- // for (let i = renderPasses.length - 1; i >= 0; i--) {
10832
- // const renderPass = renderPasses[i];
10833
- // const info = infoMap.get(renderPass)!;
10834
- // // 只有渲染场景物体的pass才有 info
10835
- // if (!info) {
10836
- // continue;
10837
- // }
10838
- // if (info.listStart <= mesh.priority && info.listEnd >= mesh.priority) {
10839
- // const idx = renderPass.meshes.indexOf(mesh);
10840
- // if (idx === -1) {
10841
- // return;
10842
- // }
10843
- // // TODO hack: 现在的除了rp1和finalcopy pass,所有renderpass的meshes是一个copy加上一个filter mesh,这里的判断当filter mesh被删除后当前pass需不需要删除,
10844
- // // 判断需要更鲁棒。
10845
- // const shouldRestoreRenderPass = idx === 1 && renderPass.meshes[0].name === MARS_COPY_MESH_NAME;
10846
- // renderPass.removeMesh(mesh);
10847
- // if (shouldRestoreRenderPass) {
10848
- // const nextRenderPass = renderPasses[i + 1];
10849
- // const meshes = renderPass.meshes;
10850
- // if (!info.intermedia) {
10851
- // info.preRenderPass?.resetColorAttachments([]);
10852
- // //this.renderer.extension.resetColorAttachments?.(info.preRenderPass, []);
10853
- // }
10854
- // for (let j = 1; j < meshes.length; j++) {
10855
- // info.preRenderPass?.addMesh(meshes[j]);
10856
- // }
10857
- // const cp = renderPass.attachments[0]?.texture;
10858
- // const keepColor = cp === this.resource.color_a || cp === this.resource.color_b;
10859
- // renderPass.dispose({
10860
- // meshes: DestroyOptions.keep,
10861
- // colorAttachment: keepColor ? RenderPassDestroyAttachmentType.keep : RenderPassDestroyAttachmentType.destroy,
10862
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10863
- // });
10864
- // removeItem(renderPasses, renderPass);
10865
- // this.removeRenderPass(renderPass);
10866
- // infoMap.delete(renderPass);
10867
- // if (nextRenderPass) {
10868
- // this.updateRenderInfo(nextRenderPass);
10869
- // }
10870
- // if (info.preRenderPass) {
10871
- // this.updateRenderInfo(info.preRenderPass);
10872
- // }
10873
- // if (info.prePasses) {
10874
- // info.prePasses.forEach(rp => {
10875
- // this.removeRenderPass(rp.pass);
10876
- // if (rp?.destroyOptions !== false) {
10877
- // rp.pass.attachments.forEach(c => {
10878
- // if (c.texture !== this.resource.color_b || c.texture !== this.resource.color_a) {
10879
- // c.texture.dispose();
10880
- // }
10881
- // });
10882
- // const options: RenderPassDestroyOptions = {
10883
- // ...(rp?.destroyOptions ? rp.destroyOptions as RenderPassDestroyOptions : {}),
10884
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10885
- // };
10886
- // rp.pass.dispose(options);
10887
- // }
10888
- // });
10889
- // }
10890
- // this.resetRenderPassDefaultAttachment(renderPasses, Math.max(i - 1, 0));
10891
- // if (renderPasses.length === 1) {
10892
- // renderPasses[0].resetColorAttachments([]);
10893
- // //this.renderer.extension.resetColorAttachments?.(renderPasses[0], []);
10894
- // this.removeRenderPass(this.resource.finalCopyRP);
10895
- // }
10896
- // }
10897
- // return this.resetClearActions();
10898
- // }
10899
- // }
10839
+ this.drawObjectPass.removeMesh(mesh);
10900
10840
  };
10901
- // /**
10902
- // * 将 Mesh 所有在 RenderPass 进行切分
10903
- // * @param mesh - 目标 Mesh 对象
10904
- // * @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
10905
- // */
10906
- // splitDefaultRenderPassByMesh (mesh: Mesh, options: RenderPassSplitOptions): RenderPass {
10907
- // const index = this.findMeshRenderPassIndex(mesh);
10908
- // const renderPass = this.renderPasses[index];
10909
- // if (false) {
10910
- // if (!renderPass) {
10911
- // throw Error('RenderPassNotFound');
10912
- // }
10913
- // }
10914
- // this.createResource();
10915
- // const meshIndex = renderPass.meshes.indexOf(mesh);
10916
- // const ms0 = renderPass.meshes.slice(0, meshIndex);
10917
- // const ms1 = renderPass.meshes.slice(meshIndex);
10918
- // const infoMap = this.renderPassInfoMap;
10919
- // // TODO 为什么要加这个判断?
10920
- // // if (renderPass.attachments[0] && this.renderPasses[index + 1] !== this.resource.finalCopyRP) {
10921
- // // throw Error('not implement');
10922
- // // } else {
10923
- // if (!options.attachments?.length) {
10924
- // throw Error('should include at least one color attachment');
10925
- // }
10926
- // const defRPS = this.renderPasses;
10927
- // const defIndex = defRPS.indexOf(renderPass);
10928
- // const lastDefRP = defRPS[defIndex - 1];
10929
- // removeItem(defRPS, renderPass);
10930
- // const lastInfo = infoMap.get(renderPass);
10931
- // infoMap.delete(renderPass);
10932
- // const filter = GPUCapability.getInstance().level === 2 ? glContext.LINEAR : glContext.NEAREST;
10933
- // const rp0 = new RenderPass({
10934
- // name: RENDER_PASS_NAME_PREFIX + defIndex,
10935
- // priority: renderPass.priority,
10936
- // attachments: [{
10937
- // texture: {
10938
- // sourceType: TextureSourceType.framebuffer,
10939
- // format: glContext.RGBA,
10940
- // name: 'frame_a',
10941
- // minFilter: filter,
10942
- // magFilter: filter,
10943
- // },
10944
- // }],
10945
- // clearAction: renderPass.clearAction || { colorAction: TextureLoadAction.clear },
10946
- // storeAction: renderPass.storeAction,
10947
- // depthStencilAttachment: this.resource.depthStencil,
10948
- // meshes: ms0,
10949
- // meshOrder: OrderType.ascending,
10950
- // });
10951
- // ms1.unshift(this.createCopyMesh());
10952
- // const renderPasses = this.renderPasses;
10953
- // renderPasses[index] = rp0;
10954
- // const prePasses: RenderPass[] = [];
10955
- // const restMeshes = ms1.slice();
10956
- // if (options.prePasses) {
10957
- // options.prePasses.forEach((pass, i) => {
10958
- // pass.priority = renderPass.priority + 1 + i;
10959
- // pass.setMeshes(ms1);
10960
- // prePasses.push(pass);
10961
- // });
10962
- // renderPasses.splice(index + 1, 0, ...prePasses);
10963
- // restMeshes.splice(0, 2);
10964
- // }
10965
- // const copyRP = this.resource.finalCopyRP;
10966
- // if (!renderPasses.includes(copyRP)) {
10967
- // renderPasses.push(copyRP);
10968
- // }
10969
- // // let sourcePass = (prePasses.length && !options.useLastDefaultPassColor) ? prePasses[prePasses.length - 1] : rp0;
10970
- // const finalFilterPass = prePasses[prePasses.length - 1];
10971
- // finalFilterPass.initialize(this.renderer);
10972
- // // 不切RT,接着上一个pass的渲染结果渲染
10973
- // const rp1 = new RenderPass({
10974
- // name: RENDER_PASS_NAME_PREFIX + (defIndex + 1),
10975
- // priority: renderPass.priority + 1 + (options.prePasses?.length || 0),
10976
- // meshes: restMeshes,
10977
- // meshOrder: OrderType.ascending,
10978
- // depthStencilAttachment: this.resource.depthStencil,
10979
- // storeAction: options.storeAction,
10980
- // clearAction: {
10981
- // depthAction: TextureLoadAction.whatever,
10982
- // stencilAction: TextureLoadAction.whatever,
10983
- // colorAction: TextureLoadAction.whatever,
10984
- // },
10985
- // });
10986
- // renderPasses.splice(index + 1 + (options.prePasses?.length || 0), 0, rp1);
10987
- // this.setRenderPasses(renderPasses);
10988
- // this.updateRenderInfo(finalFilterPass);
10989
- // this.updateRenderInfo(rp0);
10990
- // this.updateRenderInfo(rp1);
10991
- // // 目的是删除滤镜元素后,把之前滤镜用到的prePass给删除,逻辑有些复杂,考虑优化
10992
- // infoMap.get(rp0)!.prePasses = lastInfo!.prePasses;
10993
- // prePasses.pop();
10994
- // infoMap.get(finalFilterPass)!.prePasses = prePasses.map((pass, i) => {
10995
- // return { pass, destroyOptions: false };
10996
- // });
10997
- // this.resetClearActions();
10998
- // return finalFilterPass;
10999
- // }
11000
10841
  /**
11001
10842
  * 销毁 RenderFrame
11002
10843
  * @param options - 可以有选择销毁一些对象
@@ -11116,45 +10957,6 @@ var seed$5 = 1;
11116
10957
  this.clearAction.colorAction = exports.TextureLoadAction.whatever;
11117
10958
  }
11118
10959
  };
11119
- // protected updateRenderInfo (renderPass: RenderPass): RenderPassInfo {
11120
- // const map = this.renderPassInfoMap;
11121
- // const passes = this.renderPasses;
11122
- // let info: RenderPassInfo;
11123
- // if (!map.has(renderPass)) {
11124
- // info = {
11125
- // intermedia: false,
11126
- // renderPass: renderPass,
11127
- // listStart: 0,
11128
- // listEnd: 0,
11129
- // };
11130
- // map.set(renderPass, info);
11131
- // } else {
11132
- // info = map.get(renderPass)!;
11133
- // }
11134
- // info.intermedia = renderPass.attachments.length > 0;
11135
- // const meshes = renderPass.meshes;
11136
- // if (meshes[0]) {
11137
- // info.listStart = (meshes[0].name === MARS_COPY_MESH_NAME ? meshes[1] : meshes[0]).priority;
11138
- // info.listEnd = meshes[meshes.length - 1].priority;
11139
- // } else {
11140
- // info.listStart = 0;
11141
- // info.listEnd = 0;
11142
- // }
11143
- // const index = passes.indexOf(renderPass);
11144
- // const depthStencilActon = index === 0 ? TextureLoadAction.clear : TextureLoadAction.whatever;
11145
- // if (index === 0) {
11146
- // renderPass.clearAction.colorAction = TextureLoadAction.clear;
11147
- // }
11148
- // renderPass.clearAction.depthAction = depthStencilActon;
11149
- // renderPass.clearAction.stencilAction = depthStencilActon;
11150
- // if (index > -1) {
11151
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', () => this.editorTransform);
11152
- // } else {
11153
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', undefined);
11154
- // }
11155
- // info.preRenderPass = passes[index - 1];
11156
- // return info;
11157
- // }
11158
10960
  /**
11159
10961
  * 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
11160
10962
  * @param passes - RenderPass 数组
@@ -11355,7 +11157,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
11355
11157
  var GlobalUniforms = function GlobalUniforms() {
11356
11158
  this.floats = {};
11357
11159
  this.ints = {};
11358
- // vector3s: Record<string, vec3> = {};
11160
+ this.vector3s = {};
11359
11161
  this.vector4s = {};
11360
11162
  this.matrices = {};
11361
11163
  //...
@@ -11596,6 +11398,9 @@ var Renderer = /*#__PURE__*/ function() {
11596
11398
  _proto.setGlobalVector4 = function setGlobalVector4(name, value) {
11597
11399
  // OVERRIDE
11598
11400
  };
11401
+ _proto.setGlobalVector3 = function setGlobalVector3(name, value) {
11402
+ // OVERRIDE
11403
+ };
11599
11404
  _proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
11600
11405
  // OVERRIDE
11601
11406
  };
@@ -13261,10 +13066,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
13261
13066
  }
13262
13067
  var _proto = Vector4Curve.prototype;
13263
13068
  _proto.onCreate = function onCreate(arg) {
13264
- this.xCurve = createValueGetter(arg.x);
13265
- this.yCurve = createValueGetter(arg.y);
13266
- this.zCurve = createValueGetter(arg.z);
13267
- this.wCurve = createValueGetter(arg.w);
13069
+ this.xCurve = createValueGetter(arg[0]);
13070
+ this.yCurve = createValueGetter(arg[1]);
13071
+ this.zCurve = createValueGetter(arg[2]);
13072
+ this.wCurve = createValueGetter(arg[3]);
13268
13073
  };
13269
13074
  _proto.getValue = function getValue(t) {
13270
13075
  var x = this.xCurve.getValue(t);
@@ -13284,8 +13089,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
13284
13089
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
13285
13090
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
13286
13091
  var HELP_LINK = {
13287
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13288
- "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13092
+ "Item duration can't be less than 0": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13093
+ "ValueType: 21/22 is not supported": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13289
13094
  };
13290
13095
 
13291
13096
  var _obj$3;
@@ -13364,10 +13169,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13364
13169
  }
13365
13170
  var _proto = ColorCurve.prototype;
13366
13171
  _proto.onCreate = function onCreate(arg) {
13367
- this.rCurve = createValueGetter(arg.r);
13368
- this.gCurve = createValueGetter(arg.g);
13369
- this.bCurve = createValueGetter(arg.b);
13370
- this.aCurve = createValueGetter(arg.a);
13172
+ this.rCurve = createValueGetter(arg[0]);
13173
+ this.gCurve = createValueGetter(arg[1]);
13174
+ this.bCurve = createValueGetter(arg[2]);
13175
+ this.aCurve = createValueGetter(arg[3]);
13371
13176
  };
13372
13177
  _proto.getValue = function getValue(t) {
13373
13178
  var r = this.rCurve.getValue(t);
@@ -15406,7 +15211,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
15406
15211
 
15407
15212
  // const tempPoints = [new Point(), new Point(), new Point(), new Point()];
15408
15213
  /**
15409
- * The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
15214
+ * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
15410
15215
  * point (`x`, `y`) and by its `width` and its `height`.
15411
15216
  */ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
15412
15217
  _inherits(Rectangle, ShapePrimitive);
@@ -15814,8 +15619,8 @@ var ShapePath = /*#__PURE__*/ function() {
15814
15619
  };
15815
15620
  /**
15816
15621
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15817
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15818
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15622
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15623
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15819
15624
  * @param w - The width of the rectangle.
15820
15625
  * @param h - The height of the rectangle.
15821
15626
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -15960,8 +15765,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
15960
15765
  };
15961
15766
  /**
15962
15767
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15963
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15964
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15768
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15769
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15965
15770
  * @param w - The width of the rectangle.
15966
15771
  * @param h - The height of the rectangle.
15967
15772
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -16031,7 +15836,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16031
15836
  _this.curveValues = [];
16032
15837
  _this.animated = true;
16033
15838
  _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";
16034
- _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n gl_FragColor = color;\n}\n";
15839
+ _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";
16035
15840
  if (!_this.geometry) {
16036
15841
  _this.geometry = Geometry.create(engine, {
16037
15842
  attributes: {
@@ -16140,7 +15945,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16140
15945
  this.path.clear();
16141
15946
  var shapeData = data;
16142
15947
  switch(shapeData.type){
16143
- case 0:
15948
+ case ShapePrimitiveType.Custom:
16144
15949
  {
16145
15950
  var customData = shapeData;
16146
15951
  var points = customData.points;
@@ -16177,28 +15982,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16177
15982
  }
16178
15983
  break;
16179
15984
  }
16180
- case 2:
15985
+ case ShapePrimitiveType.Ellipse:
16181
15986
  {
16182
15987
  var ellipseData = shapeData;
16183
15988
  this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
16184
15989
  this.setFillColor(ellipseData.fill);
16185
15990
  break;
16186
15991
  }
16187
- case 1:
15992
+ case ShapePrimitiveType.Rectangle:
16188
15993
  {
16189
15994
  var rectangleData = shapeData;
16190
- this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
15995
+ this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
16191
15996
  this.setFillColor(rectangleData.fill);
16192
15997
  break;
16193
15998
  }
16194
- case 4:
15999
+ case ShapePrimitiveType.Star:
16195
16000
  {
16196
16001
  var starData = shapeData;
16197
16002
  this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
16198
16003
  this.setFillColor(starData.fill);
16199
16004
  break;
16200
16005
  }
16201
- case 3:
16006
+ case ShapePrimitiveType.Polygon:
16202
16007
  {
16203
16008
  var polygonData = shapeData;
16204
16009
  this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
@@ -16230,28 +16035,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16230
16035
  exports.ShapeComponent = __decorate([
16231
16036
  effectsClass("ShapeComponent")
16232
16037
  ], exports.ShapeComponent);
16233
- exports.ShapePrimitiveType = void 0;
16234
- (function(ShapePrimitiveType) {
16235
- /**
16236
- * 自定义图形
16237
- */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
16238
- /**
16239
- * 矩形
16240
- */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
16241
- /**
16242
- * 椭圆
16243
- */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
16244
- /**
16245
- * 多边形
16246
- */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
16247
- /**
16248
- * 星形
16249
- */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
16250
- })(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
16251
- exports.ShapeConnectType = void 0;
16252
- (function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
16253
- exports.ShapePointType = void 0;
16254
- (function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
16255
16038
 
16256
16039
  exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
16257
16040
  _inherits(Fake3DComponent, Component);
@@ -16812,6 +16595,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16812
16595
  this.item.getHitTestParams = this.getHitTestParams;
16813
16596
  };
16814
16597
  _proto.onDisable = function onDisable() {
16598
+ RendererComponent.prototype.onDisable.call(this);
16815
16599
  if (this.item && this.item.composition) {
16816
16600
  var _this_previewContent;
16817
16601
  if (this.duringPlay && !this.item.transform.getValid()) {
@@ -16824,6 +16608,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16824
16608
  }
16825
16609
  };
16826
16610
  _proto.onEnable = function onEnable() {
16611
+ RendererComponent.prototype.onEnable.call(this);
16827
16612
  var type = this.interactData.options.type;
16828
16613
  if (type === InteractType.CLICK) {
16829
16614
  this.clickable = true;
@@ -18437,7 +18222,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
18437
18222
  options: {}
18438
18223
  };
18439
18224
  }
18440
- if (duration <= 0) {
18225
+ if (duration < 0) {
18441
18226
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
18442
18227
  }
18443
18228
  this.rendererComponents.length = 0;
@@ -18798,6 +18583,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18798
18583
  }
18799
18584
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
18800
18585
  var ta = this.textureSheetAnimation;
18586
+ var video = this.renderer.texture.source.video;
18587
+ if (video) {
18588
+ if (time === 0) {
18589
+ video.pause();
18590
+ } else {
18591
+ video.play().catch(function(e) {
18592
+ _this.engine.renderErrors.add(e);
18593
+ });
18594
+ }
18595
+ }
18801
18596
  if (ta) {
18802
18597
  var _this_material_getVector4;
18803
18598
  var total = ta.total || ta.row * ta.col;
@@ -18852,21 +18647,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18852
18647
  dy
18853
18648
  ]);
18854
18649
  }
18855
- var video = this.renderer.texture.source.video;
18856
- if (video) {
18857
- if (time === 0 || time === this.item.duration) {
18858
- video.pause();
18859
- } else {
18860
- video.play().catch(function(e) {
18861
- _this.engine.renderErrors.add(e);
18862
- });
18863
- }
18864
- }
18865
18650
  };
18866
18651
  _proto.onDestroy = function onDestroy() {
18652
+ var textures = this.getTextures();
18867
18653
  if (this.item && this.item.composition) {
18868
- this.item.composition.destroyTextures(this.getTextures());
18654
+ this.item.composition.destroyTextures(textures);
18869
18655
  }
18656
+ textures.forEach(function(texture) {
18657
+ var source = texture.source;
18658
+ if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
18659
+ source.video.pause();
18660
+ source.video.src = "";
18661
+ source.video.load();
18662
+ }
18663
+ });
18870
18664
  };
18871
18665
  _proto.createGeometry = function createGeometry(mode) {
18872
18666
  var maxVertex = 12 * this.splits.length;
@@ -19305,7 +19099,7 @@ var ShapeNone = /*#__PURE__*/ function() {
19305
19099
  return ShapeNone;
19306
19100
  }();
19307
19101
  var _obj$2;
19308
- var map = (_obj$2 = {}, _obj$2[ShapeType.NONE] = ShapeNone, _obj$2[ShapeType.CONE] = Cone, _obj$2[ShapeType.SPHERE] = Sphere, _obj$2[ShapeType.HEMISPHERE] = Hemisphere, _obj$2[ShapeType.CIRCLE] = Circle, _obj$2[ShapeType.DONUT] = Donut, _obj$2[ShapeType.RECTANGLE] = Rectangle, _obj$2[ShapeType.EDGE] = Edge, _obj$2[ShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$2[ShapeType.TEXTURE] = TextureShape, _obj$2);
19102
+ var map = (_obj$2 = {}, _obj$2[ParticleEmitterShapeType.NONE] = ShapeNone, _obj$2[ParticleEmitterShapeType.CONE] = Cone, _obj$2[ParticleEmitterShapeType.SPHERE] = Sphere, _obj$2[ParticleEmitterShapeType.HEMISPHERE] = Hemisphere, _obj$2[ParticleEmitterShapeType.CIRCLE] = Circle, _obj$2[ParticleEmitterShapeType.DONUT] = Donut, _obj$2[ParticleEmitterShapeType.RECTANGLE] = Rectangle, _obj$2[ParticleEmitterShapeType.EDGE] = Edge, _obj$2[ParticleEmitterShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$2[ParticleEmitterShapeType.TEXTURE] = TextureShape, _obj$2);
19309
19103
  function createShape(shapeOptions) {
19310
19104
  if (!shapeOptions) {
19311
19105
  return new ShapeNone();
@@ -19322,7 +19116,7 @@ function createShape(shapeOptions) {
19322
19116
  throw new Error("Invalid shape: " + type + ".");
19323
19117
  }
19324
19118
  var ctrl = new Ctrl(options);
19325
- if (type !== ShapeType.NONE) {
19119
+ if (type !== ParticleEmitterShapeType.NONE) {
19326
19120
  var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
19327
19121
  0,
19328
19122
  0,
@@ -24252,9 +24046,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
24252
24046
  var sceneBinding = _step.value;
24253
24047
  sceneBinding.key.boundObject = sceneBinding.value;
24254
24048
  }
24255
- // 未了通过帧对比,需要保证和原有的 update 时机一致。
24049
+ // 为了通过帧对比,需要保证和原有的 update 时机一致。
24256
24050
  // 因此这边更新一次对象绑定,后续 timeline playable 中 sort tracks 的排序才能和原先的版本对上。
24257
- // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline playable 中的 sortTracks 都能去掉。
24051
+ // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline asset 中的 sortTracks 都能去掉。
24258
24052
  for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
24259
24053
  var masterTrack = _step1.value;
24260
24054
  this.updateTrackAnimatedObject(masterTrack);
@@ -24358,6 +24152,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24358
24152
  return Vector4PropertyMixerPlayable;
24359
24153
  }(Playable);
24360
24154
 
24155
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24156
+ _inherits(ColorPropertyMixerPlayable, Playable);
24157
+ function ColorPropertyMixerPlayable() {
24158
+ var _this;
24159
+ _this = Playable.apply(this, arguments) || this;
24160
+ _this.propertyName = "";
24161
+ return _this;
24162
+ }
24163
+ var _proto = ColorPropertyMixerPlayable.prototype;
24164
+ _proto.processFrame = function processFrame(context) {
24165
+ var boundObject = context.output.getUserData();
24166
+ if (!boundObject) {
24167
+ return;
24168
+ }
24169
+ var hasInput = false;
24170
+ var value = boundObject[this.propertyName];
24171
+ if (!_instanceof1(value, Color)) {
24172
+ return;
24173
+ }
24174
+ value.setZero();
24175
+ // evaluate the curve
24176
+ for(var i = 0; i < this.getInputCount(); i++){
24177
+ var weight = this.getInputWeight(i);
24178
+ if (weight > 0) {
24179
+ var propertyClipPlayable = this.getInput(i);
24180
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24181
+ console.error("ColorPropertyMixerPlayable received incompatible input");
24182
+ continue;
24183
+ }
24184
+ var curveValue = propertyClipPlayable.value;
24185
+ value.r += curveValue.r * weight;
24186
+ value.g += curveValue.g * weight;
24187
+ value.b += curveValue.b * weight;
24188
+ value.a += curveValue.a * weight;
24189
+ hasInput = true;
24190
+ }
24191
+ }
24192
+ // set value
24193
+ if (hasInput) {
24194
+ boundObject[this.propertyName] = value;
24195
+ }
24196
+ };
24197
+ return ColorPropertyMixerPlayable;
24198
+ }(Playable);
24199
+
24361
24200
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24362
24201
  _inherits(PropertyTrack, TrackAsset);
24363
24202
  function PropertyTrack() {
@@ -24517,7 +24356,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24517
24356
  }
24518
24357
  var _proto = ColorPropertyTrack.prototype;
24519
24358
  _proto.createTrackMixer = function createTrackMixer(graph) {
24520
- var mixer = new FloatPropertyMixerPlayable(graph);
24359
+ var mixer = new ColorPropertyMixerPlayable(graph);
24521
24360
  var propertyNames = this.propertyNames;
24522
24361
  if (propertyNames.length > 0) {
24523
24362
  var propertyName = propertyNames[propertyNames.length - 1];
@@ -24531,6 +24370,27 @@ exports.ColorPropertyTrack = __decorate([
24531
24370
  effectsClass(DataType.ColorPropertyTrack)
24532
24371
  ], exports.ColorPropertyTrack);
24533
24372
 
24373
+ exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24374
+ _inherits(ColorPropertyPlayableAsset, PlayableAsset);
24375
+ function ColorPropertyPlayableAsset() {
24376
+ return PlayableAsset.apply(this, arguments);
24377
+ }
24378
+ var _proto = ColorPropertyPlayableAsset.prototype;
24379
+ _proto.createPlayable = function createPlayable(graph) {
24380
+ var clipPlayable = new PropertyClipPlayable(graph);
24381
+ clipPlayable.curve = createValueGetter(this.curveData);
24382
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24383
+ return clipPlayable;
24384
+ };
24385
+ return ColorPropertyPlayableAsset;
24386
+ }(PlayableAsset);
24387
+ __decorate([
24388
+ serialize()
24389
+ ], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
24390
+ exports.ColorPropertyPlayableAsset = __decorate([
24391
+ effectsClass(DataType.ColorPropertyPlayableAsset)
24392
+ ], exports.ColorPropertyPlayableAsset);
24393
+
24534
24394
  exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24535
24395
  _inherits(FloatPropertyPlayableAsset, PlayableAsset);
24536
24396
  function FloatPropertyPlayableAsset() {
@@ -24590,6 +24450,7 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24590
24450
  var _this;
24591
24451
  _this = PlayableAsset.apply(this, arguments) || this;
24592
24452
  _this.tracks = [];
24453
+ _this.cacheFlattenedTracks = null;
24593
24454
  return _this;
24594
24455
  }
24595
24456
  var _proto = TimelineAsset.prototype;
@@ -24602,16 +24463,62 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24602
24463
  track.create(this);
24603
24464
  }
24604
24465
  }
24605
- timelinePlayable.compileTracks(graph, this.tracks);
24466
+ this.sortTracks(this.tracks);
24467
+ timelinePlayable.compileTracks(graph, this.flattenedTracks);
24606
24468
  return timelinePlayable;
24607
24469
  };
24608
24470
  _proto.createTrack = function createTrack(classConstructor, parent, name) {
24609
24471
  var newTrack = new classConstructor(this.engine);
24610
24472
  newTrack.name = name ? name : classConstructor.name;
24611
24473
  parent.addChild(newTrack);
24474
+ this.invalidate();
24612
24475
  return newTrack;
24613
24476
  };
24477
+ /**
24478
+ * Invalidates the asset, called when tracks data changed
24479
+ */ _proto.invalidate = function invalidate() {
24480
+ this.cacheFlattenedTracks = null;
24481
+ };
24482
+ _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
24483
+ for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
24484
+ var subTrack = _step.value;
24485
+ allTracks.push(subTrack);
24486
+ }
24487
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
24488
+ var subTrack1 = _step1.value;
24489
+ this.addSubTracksRecursive(subTrack1, allTracks);
24490
+ }
24491
+ };
24492
+ _proto.sortTracks = function sortTracks(tracks) {
24493
+ var sortedTracks = [];
24494
+ for(var i = 0; i < tracks.length; i++){
24495
+ sortedTracks.push(new TrackSortWrapper(tracks[i], i));
24496
+ }
24497
+ sortedTracks.sort(compareTracks);
24498
+ tracks.length = 0;
24499
+ for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
24500
+ var trackWrapper = _step.value;
24501
+ tracks.push(trackWrapper.track);
24502
+ }
24503
+ };
24614
24504
  _proto.fromData = function fromData(data) {};
24505
+ _create_class(TimelineAsset, [
24506
+ {
24507
+ key: "flattenedTracks",
24508
+ get: function get() {
24509
+ if (!this.cacheFlattenedTracks) {
24510
+ this.cacheFlattenedTracks = [];
24511
+ // flatten track tree
24512
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24513
+ var masterTrack = _step.value;
24514
+ this.cacheFlattenedTracks.push(masterTrack);
24515
+ this.addSubTracksRecursive(masterTrack, this.cacheFlattenedTracks);
24516
+ }
24517
+ }
24518
+ return this.cacheFlattenedTracks;
24519
+ }
24520
+ }
24521
+ ]);
24615
24522
  return TimelineAsset;
24616
24523
  }(PlayableAsset);
24617
24524
  __decorate([
@@ -24644,18 +24551,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24644
24551
  }
24645
24552
  };
24646
24553
  _proto.compileTracks = function compileTracks(graph, tracks) {
24647
- this.sortTracks(tracks);
24648
- var outputTrack = [];
24649
- // flatten track tree
24650
- for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
24651
- var masterTrack = _step.value;
24652
- outputTrack.push(masterTrack);
24653
- this.addSubTracksRecursive(masterTrack, outputTrack);
24654
- }
24554
+ var outputTrack = tracks;
24655
24555
  // map for searching track instance with track asset guid
24656
24556
  var trackInstanceMap = {};
24657
- for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
24658
- var track = _step1.value;
24557
+ for(var _iterator = _create_for_of_iterator_helper_loose(outputTrack), _step; !(_step = _iterator()).done;){
24558
+ var track = _step.value;
24659
24559
  // create track mixer and track output
24660
24560
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24661
24561
  this.addInput(trackMixPlayable, 0);
@@ -24671,11 +24571,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24671
24571
  }
24672
24572
  }
24673
24573
  // build trackInstance tree
24674
- for(var _iterator2 = _create_for_of_iterator_helper_loose(outputTrack), _step2; !(_step2 = _iterator2()).done;){
24675
- var track1 = _step2.value;
24574
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
24575
+ var track1 = _step1.value;
24676
24576
  var trackInstance1 = trackInstanceMap[track1.getInstanceId()];
24677
- for(var _iterator3 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step3; !(_step3 = _iterator3()).done;){
24678
- var child = _step3.value;
24577
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step2; !(_step2 = _iterator2()).done;){
24578
+ var child = _step2.value;
24679
24579
  var childTrackInstance = trackInstanceMap[child.getInstanceId()];
24680
24580
  trackInstance1.addChild(childTrackInstance);
24681
24581
  }
@@ -24692,28 +24592,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24692
24592
  this.updateTrackAnimatedObject(trackInstance.children);
24693
24593
  }
24694
24594
  };
24695
- _proto.sortTracks = function sortTracks(tracks) {
24696
- var sortedTracks = [];
24697
- for(var i = 0; i < tracks.length; i++){
24698
- sortedTracks.push(new TrackSortWrapper(tracks[i], i));
24699
- }
24700
- sortedTracks.sort(compareTracks);
24701
- tracks.length = 0;
24702
- for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
24703
- var trackWrapper = _step.value;
24704
- tracks.push(trackWrapper.track);
24705
- }
24706
- };
24707
- _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
24708
- for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
24709
- var subTrack = _step.value;
24710
- allTracks.push(subTrack);
24711
- }
24712
- for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
24713
- var subTrack1 = _step1.value;
24714
- this.addSubTracksRecursive(subTrack1, allTracks);
24715
- }
24716
- };
24717
24595
  return TimelinePlayable;
24718
24596
  }(Playable);
24719
24597
  var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
@@ -24735,6 +24613,27 @@ function compareTracks(a, b) {
24735
24613
  }
24736
24614
  }
24737
24615
 
24616
+ exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24617
+ _inherits(Vector4PropertyPlayableAsset, PlayableAsset);
24618
+ function Vector4PropertyPlayableAsset() {
24619
+ return PlayableAsset.apply(this, arguments);
24620
+ }
24621
+ var _proto = Vector4PropertyPlayableAsset.prototype;
24622
+ _proto.createPlayable = function createPlayable(graph) {
24623
+ var clipPlayable = new PropertyClipPlayable(graph);
24624
+ clipPlayable.curve = createValueGetter(this.curveData);
24625
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24626
+ return clipPlayable;
24627
+ };
24628
+ return Vector4PropertyPlayableAsset;
24629
+ }(PlayableAsset);
24630
+ __decorate([
24631
+ serialize()
24632
+ ], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
24633
+ exports.Vector4PropertyPlayableAsset = __decorate([
24634
+ effectsClass("Vector4PropertyPlayableAsset")
24635
+ ], exports.Vector4PropertyPlayableAsset);
24636
+
24738
24637
  exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24739
24638
  _inherits(ObjectBindingTrack, TrackAsset1);
24740
24639
  function ObjectBindingTrack() {
@@ -24772,7 +24671,7 @@ var TextLayout = /*#__PURE__*/ function() {
24772
24671
  function TextLayout(options) {
24773
24672
  this.width = 0;
24774
24673
  this.height = 0;
24775
- var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, text = options.text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24674
+ var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24776
24675
  var tempWidth = fontSize + letterSpace;
24777
24676
  this.autoWidth = autoWidth;
24778
24677
  this.maxTextWidth = text.length * tempWidth;
@@ -26667,13 +26566,13 @@ function getStandardParticleContent(particle) {
26667
26566
  var options = particle.options;
26668
26567
  var transform = particle.transform;
26669
26568
  var shape = {
26670
- type: ShapeType.NONE
26569
+ type: ParticleEmitterShapeType.NONE
26671
26570
  };
26672
26571
  if (particle.shape) {
26673
26572
  var _particle_shape_shape;
26674
26573
  var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
26675
26574
  shape = _extends({}, particle.shape, {
26676
- type: ShapeType[shapeType]
26575
+ type: ParticleEmitterShapeType[shapeType]
26677
26576
  });
26678
26577
  if (particle.shape.upDirection) {
26679
26578
  var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
@@ -28537,7 +28436,8 @@ var listOrder = 0;
28537
28436
  var itemProps = sourceItemData;
28538
28437
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
28539
28438
  itemProps.listIndex = listOrder++;
28540
- if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
28439
+ if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28440
+ itemProps.type === ItemType.shape) {
28541
28441
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
28542
28442
  var componentPath = _step2.value;
28543
28443
  var componentData = componentMap[componentPath.id];
@@ -28577,8 +28477,10 @@ var listOrder = 0;
28577
28477
  shapeData = shape;
28578
28478
  }
28579
28479
  if (shapeData !== undefined) {
28580
- // @ts-expect-error 类型转换问题
28581
- renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28480
+ if (!("aPoint" in shapeData && "index" in shapeData)) {
28481
+ // @ts-expect-error 类型转换问题
28482
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28483
+ }
28582
28484
  }
28583
28485
  }
28584
28486
  if ("trails" in renderContent && renderContent.trails !== undefined) {
@@ -28945,16 +28847,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28945
28847
  if (pause) {
28946
28848
  this.resume();
28947
28849
  }
28948
- if (!this.rootComposition.isStartCalled) {
28949
- this.rootComposition.onStart();
28950
- this.rootComposition.isStartCalled = true;
28951
- }
28952
28850
  this.setSpeed(1);
28953
28851
  this.forwardTime(time + this.startTime);
28954
28852
  this.setSpeed(speed);
28955
28853
  if (pause) {
28956
28854
  this.pause();
28957
28855
  }
28856
+ this.emit("goto", {
28857
+ time: time
28858
+ });
28958
28859
  };
28959
28860
  _proto.addItem = function addItem(item) {
28960
28861
  this.items.push(item);
@@ -28986,30 +28887,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28986
28887
  _proto.prepareRender = function prepareRender() {
28987
28888
  var _this = this;
28988
28889
  var frame = this.renderFrame;
28989
- frame._renderPasses[0].meshes.length = 0;
28990
28890
  this.postLoaders.length = 0;
28991
28891
  this.pluginSystem.plugins.forEach(function(loader) {
28992
28892
  if (loader.prepareRenderFrame(_this, frame)) {
28993
28893
  _this.postLoaders.push(loader);
28994
28894
  }
28995
28895
  });
28996
- this.gatherRendererComponent(this.rootItem, frame);
28997
28896
  this.postLoaders.forEach(function(loader) {
28998
28897
  return loader.postProcessFrame(_this, frame);
28999
28898
  });
29000
28899
  };
29001
- _proto.gatherRendererComponent = function gatherRendererComponent(vfxItem, renderFrame) {
29002
- for(var _iterator = _create_for_of_iterator_helper_loose(vfxItem.rendererComponents), _step; !(_step = _iterator()).done;){
29003
- var rendererComponent = _step.value;
29004
- if (rendererComponent.isActiveAndEnabled) {
29005
- renderFrame.addMeshToDefaultRenderPass(rendererComponent);
29006
- }
29007
- }
29008
- for(var _iterator1 = _create_for_of_iterator_helper_loose(vfxItem.children), _step1; !(_step1 = _iterator1()).done;){
29009
- var item = _step1.value;
29010
- this.gatherRendererComponent(item, renderFrame);
29011
- }
29012
- };
29013
28900
  /**
29014
28901
  * 合成更新,针对所有 item 的更新
29015
28902
  * @param deltaTime - 更新的时间步长
@@ -31494,7 +31381,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31494
31381
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31495
31382
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31496
31383
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31497
- var version = "2.1.0-beta.0";
31384
+ var version = "2.1.0";
31498
31385
  logger.info("Core version: " + version + ".");
31499
31386
 
31500
31387
  exports.AbstractPlugin = AbstractPlugin;