@galacean/effects-threejs 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 threejs plugin 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';
@@ -1116,39 +1116,39 @@ function _inherits(subClass, superClass) {
1116
1116
  })(MaskMode || (MaskMode = {}));
1117
1117
  /**
1118
1118
  * 发射器形状
1119
- */ var ShapeType;
1120
- (function(ShapeType) {
1119
+ */ var ParticleEmitterShapeType;
1120
+ (function(ParticleEmitterShapeType) {
1121
1121
  /**
1122
1122
  * 没有类型
1123
- */ ShapeType[ShapeType["NONE"] = 0] = "NONE";
1123
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
1124
1124
  /**
1125
1125
  * 圆球
1126
- */ ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
1126
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
1127
1127
  /**
1128
1128
  * 圆锥
1129
- */ ShapeType[ShapeType["CONE"] = 2] = "CONE";
1129
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
1130
1130
  /**
1131
1131
  * 半球
1132
- */ ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1132
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
1133
1133
  /**
1134
1134
  * 圆
1135
- */ ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
1135
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
1136
1136
  /**
1137
1137
  * 圆环
1138
- */ ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
1138
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
1139
1139
  /**
1140
1140
  * 矩形
1141
- */ ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1141
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
1142
1142
  /**
1143
1143
  * 矩形框
1144
- */ ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1144
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
1145
1145
  /**
1146
1146
  * 直线
1147
- */ ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
1147
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
1148
1148
  /**
1149
1149
  * 贴图
1150
- */ ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
1151
- })(ShapeType || (ShapeType = {}));
1150
+ */ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
1151
+ })(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
1152
1152
  /**
1153
1153
  * 插件类型
1154
1154
  */ var PluginType;
@@ -1644,6 +1644,34 @@ var BuiltinObjectGUID = {
1644
1644
  UnlitShader: "unlit000000000000000000000000000"
1645
1645
  };
1646
1646
 
1647
+ /**
1648
+ * 矢量图形类型
1649
+ */ var ShapePrimitiveType;
1650
+ (function(ShapePrimitiveType) {
1651
+ /**
1652
+ * 自定义图形
1653
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1654
+ /**
1655
+ * 矩形
1656
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1657
+ /**
1658
+ * 椭圆
1659
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1660
+ /**
1661
+ * 多边形
1662
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1663
+ /**
1664
+ * 星形
1665
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1666
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1667
+
1668
+ // 本期无该功能 待补充
1669
+ var ShapeConnectType;
1670
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1671
+ // @待补充
1672
+ var ShapePointType;
1673
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1674
+
1647
1675
  /**
1648
1676
  * 动态换图类型
1649
1677
  * @since 1.1.0
@@ -1674,6 +1702,7 @@ var DataType;
1674
1702
  DataType["PostProcessVolume"] = "PostProcessVolume";
1675
1703
  DataType["Geometry"] = "Geometry";
1676
1704
  DataType["Texture"] = "Texture";
1705
+ DataType["Image"] = "Image";
1677
1706
  DataType["AnimationClip"] = "AnimationClip";
1678
1707
  DataType["TextComponent"] = "TextComponent";
1679
1708
  DataType["BinaryAsset"] = "BinaryAsset";
@@ -1705,6 +1734,8 @@ var DataType;
1705
1734
  DataType["VideoComponent"] = "VideoComponent";
1706
1735
  DataType["AudioComponent"] = "AudioComponent";
1707
1736
  DataType["RichTextComponent"] = "RichTextComponent";
1737
+ DataType["OrientationComponent"] = "OrientationComponent";
1738
+ DataType["ShapeComponent"] = "ShapeComponent";
1708
1739
  // Non-EffectObject
1709
1740
  DataType["TimelineClip"] = "TimelineClip";
1710
1741
  })(DataType || (DataType = {}));
@@ -1799,7 +1830,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
1799
1830
  get BlendingMode () { return BlendingMode; },
1800
1831
  get SideMode () { return SideMode; },
1801
1832
  get MaskMode () { return MaskMode; },
1802
- get ShapeType () { return ShapeType; },
1833
+ get ParticleEmitterShapeType () { return ParticleEmitterShapeType; },
1803
1834
  get PluginType () { return PluginType; },
1804
1835
  get InteractType () { return InteractType; },
1805
1836
  get InteractBehavior () { return InteractBehavior; },
@@ -1838,6 +1869,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
1838
1869
  get TextWeight () { return TextWeight; },
1839
1870
  get FontStyle () { return FontStyle; },
1840
1871
  BuiltinObjectGUID: BuiltinObjectGUID,
1872
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1873
+ get ShapeConnectType () { return ShapeConnectType; },
1874
+ get ShapePointType () { return ShapePointType; },
1841
1875
  get BackgroundType () { return BackgroundType; },
1842
1876
  get MultimediaType () { return MultimediaType; },
1843
1877
  get DataType () { return DataType; },
@@ -2158,6 +2192,14 @@ __decorate([
2158
2192
  Component.prototype.setVFXItem.call(this, item);
2159
2193
  this.item.rendererComponents.push(this);
2160
2194
  };
2195
+ _proto.onEnable = function onEnable() {
2196
+ var _this_item_composition;
2197
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
2198
+ };
2199
+ _proto.onDisable = function onDisable() {
2200
+ var _this_item_composition;
2201
+ (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
2202
+ };
2161
2203
  _proto.fromData = function fromData(data) {
2162
2204
  Component.prototype.fromData.call(this, data);
2163
2205
  };
@@ -10678,16 +10720,16 @@ var seed$6 = 1;
10678
10720
  depthAction: exports.TextureLoadAction.clear
10679
10721
  };
10680
10722
  }
10681
- // 创建 drawObjectPass
10723
+ this.drawObjectPass = new RenderPass(renderer, {
10724
+ name: RENDER_PASS_NAME_PREFIX,
10725
+ priority: RenderPassPriorityNormal,
10726
+ meshOrder: exports.OrderType.ascending,
10727
+ depthStencilAttachment: depthStencilAttachment,
10728
+ attachments: attachments,
10729
+ clearAction: drawObjectPassClearAction
10730
+ });
10682
10731
  var renderPasses = [
10683
- new RenderPass(renderer, {
10684
- name: RENDER_PASS_NAME_PREFIX,
10685
- priority: RenderPassPriorityNormal,
10686
- meshOrder: exports.OrderType.ascending,
10687
- depthStencilAttachment: depthStencilAttachment,
10688
- attachments: attachments,
10689
- clearAction: drawObjectPassClearAction
10690
- })
10732
+ this.drawObjectPass
10691
10733
  ];
10692
10734
  this.setRenderPasses(renderPasses);
10693
10735
  if (postProcessingEnabled) {
@@ -10809,216 +10851,15 @@ var seed$6 = 1;
10809
10851
  * 根据 Mesh 优先级添加到 RenderPass
10810
10852
  * @param mesh - 要添加的 Mesh 对象
10811
10853
  */ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
10812
- if (!mesh) {
10813
- return;
10814
- }
10815
- this.renderPasses[0].addMesh(mesh);
10816
- // const renderPasses = this.renderPasses;
10817
- // const infoMap = this.renderPassInfoMap;
10818
- // const { priority } = mesh;
10819
- // for (let i = 1; i < renderPasses.length; i++) {
10820
- // const renderPass = renderPasses[i - 1];
10821
- // const info = infoMap.get(renderPasses[i])!;
10822
- // if (info && info.listStart > priority && (priority > infoMap.get(renderPass)!.listEnd || i === 1)) {
10823
- // return this.addToRenderPass(renderPass, mesh);
10824
- // }
10825
- // }
10826
- // // TODO: diff逻辑待优化,有时会添加进找不到的元素
10827
- // let last = renderPasses[renderPasses.length - 1];
10828
- // // TODO: 是否添加mesh到pass的判断方式需要优化,先通过长度判断是否有postprocess
10829
- // for (const pass of renderPasses) {
10830
- // if (!(pass instanceof HQGaussianDownSamplePass
10831
- // || pass instanceof BloomThresholdPass
10832
- // || pass instanceof ToneMappingPass
10833
- // || pass instanceof HQGaussianUpSamplePass
10834
- // || pass.name === 'mars-final-copy')) {
10835
- // last = pass;
10836
- // }
10837
- // }
10838
- // // if (priority > infoMap.get(last)!.listStart || renderPasses.length === 1) {
10839
- // // return this.addToRenderPass(last, mesh);
10840
- // // }
10841
- // return this.addToRenderPass(last, mesh);
10842
- // if (false) {
10843
- // throw Error('render pass not found');
10844
- // }
10854
+ this.drawObjectPass.addMesh(mesh);
10845
10855
  };
10846
10856
  /**
10847
10857
  * 把 Mesh 从 RenderPass 中移除,
10848
10858
  * 如果 renderPass 中没有 mesh,此 renderPass 会被删除
10849
10859
  * @param mesh - 要删除的 Mesh 对象
10850
10860
  */ _proto.removeMeshFromDefaultRenderPass = function removeMeshFromDefaultRenderPass(mesh) {
10851
- // const renderPasses = this.renderPasses;
10852
- // const infoMap = this.renderPassInfoMap;
10853
- // for (let i = renderPasses.length - 1; i >= 0; i--) {
10854
- // const renderPass = renderPasses[i];
10855
- // const info = infoMap.get(renderPass)!;
10856
- // // 只有渲染场景物体的pass才有 info
10857
- // if (!info) {
10858
- // continue;
10859
- // }
10860
- // if (info.listStart <= mesh.priority && info.listEnd >= mesh.priority) {
10861
- // const idx = renderPass.meshes.indexOf(mesh);
10862
- // if (idx === -1) {
10863
- // return;
10864
- // }
10865
- // // TODO hack: 现在的除了rp1和finalcopy pass,所有renderpass的meshes是一个copy加上一个filter mesh,这里的判断当filter mesh被删除后当前pass需不需要删除,
10866
- // // 判断需要更鲁棒。
10867
- // const shouldRestoreRenderPass = idx === 1 && renderPass.meshes[0].name === MARS_COPY_MESH_NAME;
10868
- // renderPass.removeMesh(mesh);
10869
- // if (shouldRestoreRenderPass) {
10870
- // const nextRenderPass = renderPasses[i + 1];
10871
- // const meshes = renderPass.meshes;
10872
- // if (!info.intermedia) {
10873
- // info.preRenderPass?.resetColorAttachments([]);
10874
- // //this.renderer.extension.resetColorAttachments?.(info.preRenderPass, []);
10875
- // }
10876
- // for (let j = 1; j < meshes.length; j++) {
10877
- // info.preRenderPass?.addMesh(meshes[j]);
10878
- // }
10879
- // const cp = renderPass.attachments[0]?.texture;
10880
- // const keepColor = cp === this.resource.color_a || cp === this.resource.color_b;
10881
- // renderPass.dispose({
10882
- // meshes: DestroyOptions.keep,
10883
- // colorAttachment: keepColor ? RenderPassDestroyAttachmentType.keep : RenderPassDestroyAttachmentType.destroy,
10884
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10885
- // });
10886
- // removeItem(renderPasses, renderPass);
10887
- // this.removeRenderPass(renderPass);
10888
- // infoMap.delete(renderPass);
10889
- // if (nextRenderPass) {
10890
- // this.updateRenderInfo(nextRenderPass);
10891
- // }
10892
- // if (info.preRenderPass) {
10893
- // this.updateRenderInfo(info.preRenderPass);
10894
- // }
10895
- // if (info.prePasses) {
10896
- // info.prePasses.forEach(rp => {
10897
- // this.removeRenderPass(rp.pass);
10898
- // if (rp?.destroyOptions !== false) {
10899
- // rp.pass.attachments.forEach(c => {
10900
- // if (c.texture !== this.resource.color_b || c.texture !== this.resource.color_a) {
10901
- // c.texture.dispose();
10902
- // }
10903
- // });
10904
- // const options: RenderPassDestroyOptions = {
10905
- // ...(rp?.destroyOptions ? rp.destroyOptions as RenderPassDestroyOptions : {}),
10906
- // depthStencilAttachment: RenderPassDestroyAttachmentType.keep,
10907
- // };
10908
- // rp.pass.dispose(options);
10909
- // }
10910
- // });
10911
- // }
10912
- // this.resetRenderPassDefaultAttachment(renderPasses, Math.max(i - 1, 0));
10913
- // if (renderPasses.length === 1) {
10914
- // renderPasses[0].resetColorAttachments([]);
10915
- // //this.renderer.extension.resetColorAttachments?.(renderPasses[0], []);
10916
- // this.removeRenderPass(this.resource.finalCopyRP);
10917
- // }
10918
- // }
10919
- // return this.resetClearActions();
10920
- // }
10921
- // }
10861
+ this.drawObjectPass.removeMesh(mesh);
10922
10862
  };
10923
- // /**
10924
- // * 将 Mesh 所有在 RenderPass 进行切分
10925
- // * @param mesh - 目标 Mesh 对象
10926
- // * @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
10927
- // */
10928
- // splitDefaultRenderPassByMesh (mesh: Mesh, options: RenderPassSplitOptions): RenderPass {
10929
- // const index = this.findMeshRenderPassIndex(mesh);
10930
- // const renderPass = this.renderPasses[index];
10931
- // if (false) {
10932
- // if (!renderPass) {
10933
- // throw Error('RenderPassNotFound');
10934
- // }
10935
- // }
10936
- // this.createResource();
10937
- // const meshIndex = renderPass.meshes.indexOf(mesh);
10938
- // const ms0 = renderPass.meshes.slice(0, meshIndex);
10939
- // const ms1 = renderPass.meshes.slice(meshIndex);
10940
- // const infoMap = this.renderPassInfoMap;
10941
- // // TODO 为什么要加这个判断?
10942
- // // if (renderPass.attachments[0] && this.renderPasses[index + 1] !== this.resource.finalCopyRP) {
10943
- // // throw Error('not implement');
10944
- // // } else {
10945
- // if (!options.attachments?.length) {
10946
- // throw Error('should include at least one color attachment');
10947
- // }
10948
- // const defRPS = this.renderPasses;
10949
- // const defIndex = defRPS.indexOf(renderPass);
10950
- // const lastDefRP = defRPS[defIndex - 1];
10951
- // removeItem(defRPS, renderPass);
10952
- // const lastInfo = infoMap.get(renderPass);
10953
- // infoMap.delete(renderPass);
10954
- // const filter = GPUCapability.getInstance().level === 2 ? glContext.LINEAR : glContext.NEAREST;
10955
- // const rp0 = new RenderPass({
10956
- // name: RENDER_PASS_NAME_PREFIX + defIndex,
10957
- // priority: renderPass.priority,
10958
- // attachments: [{
10959
- // texture: {
10960
- // sourceType: TextureSourceType.framebuffer,
10961
- // format: glContext.RGBA,
10962
- // name: 'frame_a',
10963
- // minFilter: filter,
10964
- // magFilter: filter,
10965
- // },
10966
- // }],
10967
- // clearAction: renderPass.clearAction || { colorAction: TextureLoadAction.clear },
10968
- // storeAction: renderPass.storeAction,
10969
- // depthStencilAttachment: this.resource.depthStencil,
10970
- // meshes: ms0,
10971
- // meshOrder: OrderType.ascending,
10972
- // });
10973
- // ms1.unshift(this.createCopyMesh());
10974
- // const renderPasses = this.renderPasses;
10975
- // renderPasses[index] = rp0;
10976
- // const prePasses: RenderPass[] = [];
10977
- // const restMeshes = ms1.slice();
10978
- // if (options.prePasses) {
10979
- // options.prePasses.forEach((pass, i) => {
10980
- // pass.priority = renderPass.priority + 1 + i;
10981
- // pass.setMeshes(ms1);
10982
- // prePasses.push(pass);
10983
- // });
10984
- // renderPasses.splice(index + 1, 0, ...prePasses);
10985
- // restMeshes.splice(0, 2);
10986
- // }
10987
- // const copyRP = this.resource.finalCopyRP;
10988
- // if (!renderPasses.includes(copyRP)) {
10989
- // renderPasses.push(copyRP);
10990
- // }
10991
- // // let sourcePass = (prePasses.length && !options.useLastDefaultPassColor) ? prePasses[prePasses.length - 1] : rp0;
10992
- // const finalFilterPass = prePasses[prePasses.length - 1];
10993
- // finalFilterPass.initialize(this.renderer);
10994
- // // 不切RT,接着上一个pass的渲染结果渲染
10995
- // const rp1 = new RenderPass({
10996
- // name: RENDER_PASS_NAME_PREFIX + (defIndex + 1),
10997
- // priority: renderPass.priority + 1 + (options.prePasses?.length || 0),
10998
- // meshes: restMeshes,
10999
- // meshOrder: OrderType.ascending,
11000
- // depthStencilAttachment: this.resource.depthStencil,
11001
- // storeAction: options.storeAction,
11002
- // clearAction: {
11003
- // depthAction: TextureLoadAction.whatever,
11004
- // stencilAction: TextureLoadAction.whatever,
11005
- // colorAction: TextureLoadAction.whatever,
11006
- // },
11007
- // });
11008
- // renderPasses.splice(index + 1 + (options.prePasses?.length || 0), 0, rp1);
11009
- // this.setRenderPasses(renderPasses);
11010
- // this.updateRenderInfo(finalFilterPass);
11011
- // this.updateRenderInfo(rp0);
11012
- // this.updateRenderInfo(rp1);
11013
- // // 目的是删除滤镜元素后,把之前滤镜用到的prePass给删除,逻辑有些复杂,考虑优化
11014
- // infoMap.get(rp0)!.prePasses = lastInfo!.prePasses;
11015
- // prePasses.pop();
11016
- // infoMap.get(finalFilterPass)!.prePasses = prePasses.map((pass, i) => {
11017
- // return { pass, destroyOptions: false };
11018
- // });
11019
- // this.resetClearActions();
11020
- // return finalFilterPass;
11021
- // }
11022
10863
  /**
11023
10864
  * 销毁 RenderFrame
11024
10865
  * @param options - 可以有选择销毁一些对象
@@ -11138,45 +10979,6 @@ var seed$6 = 1;
11138
10979
  this.clearAction.colorAction = exports.TextureLoadAction.whatever;
11139
10980
  }
11140
10981
  };
11141
- // protected updateRenderInfo (renderPass: RenderPass): RenderPassInfo {
11142
- // const map = this.renderPassInfoMap;
11143
- // const passes = this.renderPasses;
11144
- // let info: RenderPassInfo;
11145
- // if (!map.has(renderPass)) {
11146
- // info = {
11147
- // intermedia: false,
11148
- // renderPass: renderPass,
11149
- // listStart: 0,
11150
- // listEnd: 0,
11151
- // };
11152
- // map.set(renderPass, info);
11153
- // } else {
11154
- // info = map.get(renderPass)!;
11155
- // }
11156
- // info.intermedia = renderPass.attachments.length > 0;
11157
- // const meshes = renderPass.meshes;
11158
- // if (meshes[0]) {
11159
- // info.listStart = (meshes[0].name === MARS_COPY_MESH_NAME ? meshes[1] : meshes[0]).priority;
11160
- // info.listEnd = meshes[meshes.length - 1].priority;
11161
- // } else {
11162
- // info.listStart = 0;
11163
- // info.listEnd = 0;
11164
- // }
11165
- // const index = passes.indexOf(renderPass);
11166
- // const depthStencilActon = index === 0 ? TextureLoadAction.clear : TextureLoadAction.whatever;
11167
- // if (index === 0) {
11168
- // renderPass.clearAction.colorAction = TextureLoadAction.clear;
11169
- // }
11170
- // renderPass.clearAction.depthAction = depthStencilActon;
11171
- // renderPass.clearAction.stencilAction = depthStencilActon;
11172
- // if (index > -1) {
11173
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', () => this.editorTransform);
11174
- // } else {
11175
- // renderPass.semantics.setSemantic('EDITOR_TRANSFORM', undefined);
11176
- // }
11177
- // info.preRenderPass = passes[index - 1];
11178
- // return info;
11179
- // }
11180
10982
  /**
11181
10983
  * 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
11182
10984
  * @param passes - RenderPass 数组
@@ -11377,7 +11179,7 @@ var FinalCopyRP = /*#__PURE__*/ function(RenderPass) {
11377
11179
  var GlobalUniforms = function GlobalUniforms() {
11378
11180
  this.floats = {};
11379
11181
  this.ints = {};
11380
- // vector3s: Record<string, vec3> = {};
11182
+ this.vector3s = {};
11381
11183
  this.vector4s = {};
11382
11184
  this.matrices = {};
11383
11185
  //...
@@ -11618,6 +11420,9 @@ var Renderer = /*#__PURE__*/ function() {
11618
11420
  _proto.setGlobalVector4 = function setGlobalVector4(name, value) {
11619
11421
  // OVERRIDE
11620
11422
  };
11423
+ _proto.setGlobalVector3 = function setGlobalVector3(name, value) {
11424
+ // OVERRIDE
11425
+ };
11621
11426
  _proto.setGlobalMatrix = function setGlobalMatrix(name, value) {
11622
11427
  // OVERRIDE
11623
11428
  };
@@ -13283,10 +13088,10 @@ var Vector4Curve = /*#__PURE__*/ function(ValueGetter) {
13283
13088
  }
13284
13089
  var _proto = Vector4Curve.prototype;
13285
13090
  _proto.onCreate = function onCreate(arg) {
13286
- this.xCurve = createValueGetter(arg.x);
13287
- this.yCurve = createValueGetter(arg.y);
13288
- this.zCurve = createValueGetter(arg.z);
13289
- this.wCurve = createValueGetter(arg.w);
13091
+ this.xCurve = createValueGetter(arg[0]);
13092
+ this.yCurve = createValueGetter(arg[1]);
13093
+ this.zCurve = createValueGetter(arg[2]);
13094
+ this.wCurve = createValueGetter(arg[3]);
13290
13095
  };
13291
13096
  _proto.getValue = function getValue(t) {
13292
13097
  var x = this.xCurve.getValue(t);
@@ -13306,8 +13111,8 @@ var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
13306
13111
  var SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
13307
13112
  var PLAYER_OPTIONS_ENV_EDITOR = "editor";
13308
13113
  var HELP_LINK = {
13309
- "Item duration can't be less than 0": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13310
- "ValueType: 21/22 is not supported": "https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13114
+ "Item duration can't be less than 0": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS",
13115
+ "ValueType: 21/22 is not supported": "https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"
13311
13116
  };
13312
13117
 
13313
13118
  var _obj$4;
@@ -13386,10 +13191,10 @@ var ColorCurve = /*#__PURE__*/ function(ValueGetter) {
13386
13191
  }
13387
13192
  var _proto = ColorCurve.prototype;
13388
13193
  _proto.onCreate = function onCreate(arg) {
13389
- this.rCurve = createValueGetter(arg.r);
13390
- this.gCurve = createValueGetter(arg.g);
13391
- this.bCurve = createValueGetter(arg.b);
13392
- this.aCurve = createValueGetter(arg.a);
13194
+ this.rCurve = createValueGetter(arg[0]);
13195
+ this.gCurve = createValueGetter(arg[1]);
13196
+ this.bCurve = createValueGetter(arg[2]);
13197
+ this.aCurve = createValueGetter(arg[3]);
13393
13198
  };
13394
13199
  _proto.getValue = function getValue(t) {
13395
13200
  var r = this.rCurve.getValue(t);
@@ -15428,7 +15233,7 @@ var PolyStar = /*#__PURE__*/ function(ShapePrimitive) {
15428
15233
 
15429
15234
  // const tempPoints = [new Point(), new Point(), new Point(), new Point()];
15430
15235
  /**
15431
- * The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
15236
+ * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
15432
15237
  * point (`x`, `y`) and by its `width` and its `height`.
15433
15238
  */ var Rectangle$1 = /*#__PURE__*/ function(ShapePrimitive) {
15434
15239
  _inherits(Rectangle, ShapePrimitive);
@@ -15836,8 +15641,8 @@ var ShapePath = /*#__PURE__*/ function() {
15836
15641
  };
15837
15642
  /**
15838
15643
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15839
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15840
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15644
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15645
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15841
15646
  * @param w - The width of the rectangle.
15842
15647
  * @param h - The height of the rectangle.
15843
15648
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -15982,8 +15787,8 @@ var GraphicsPath = /*#__PURE__*/ function() {
15982
15787
  };
15983
15788
  /**
15984
15789
  * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
15985
- * @param x - The x-coordinate of the top-left corner of the rectangle.
15986
- * @param y - The y-coordinate of the top-left corner of the rectangle.
15790
+ * @param x - The x-coordinate of the upper-left corner of the rectangle.
15791
+ * @param y - The y-coordinate of the upper-left corner of the rectangle.
15987
15792
  * @param w - The width of the rectangle.
15988
15793
  * @param h - The height of the rectangle.
15989
15794
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
@@ -16053,7 +15858,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16053
15858
  _this.curveValues = [];
16054
15859
  _this.animated = true;
16055
15860
  _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";
16056
- _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n gl_FragColor = color;\n}\n";
15861
+ _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";
16057
15862
  if (!_this.geometry) {
16058
15863
  _this.geometry = Geometry.create(engine, {
16059
15864
  attributes: {
@@ -16162,7 +15967,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16162
15967
  this.path.clear();
16163
15968
  var shapeData = data;
16164
15969
  switch(shapeData.type){
16165
- case 0:
15970
+ case ShapePrimitiveType.Custom:
16166
15971
  {
16167
15972
  var customData = shapeData;
16168
15973
  var points = customData.points;
@@ -16199,28 +16004,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16199
16004
  }
16200
16005
  break;
16201
16006
  }
16202
- case 2:
16007
+ case ShapePrimitiveType.Ellipse:
16203
16008
  {
16204
16009
  var ellipseData = shapeData;
16205
16010
  this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
16206
16011
  this.setFillColor(ellipseData.fill);
16207
16012
  break;
16208
16013
  }
16209
- case 1:
16014
+ case ShapePrimitiveType.Rectangle:
16210
16015
  {
16211
16016
  var rectangleData = shapeData;
16212
- this.path.rect(-rectangleData.width / 2, rectangleData.height / 2, rectangleData.width, rectangleData.height);
16017
+ this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
16213
16018
  this.setFillColor(rectangleData.fill);
16214
16019
  break;
16215
16020
  }
16216
- case 4:
16021
+ case ShapePrimitiveType.Star:
16217
16022
  {
16218
16023
  var starData = shapeData;
16219
16024
  this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
16220
16025
  this.setFillColor(starData.fill);
16221
16026
  break;
16222
16027
  }
16223
- case 3:
16028
+ case ShapePrimitiveType.Polygon:
16224
16029
  {
16225
16030
  var polygonData = shapeData;
16226
16031
  this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
@@ -16252,28 +16057,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16252
16057
  exports.ShapeComponent = __decorate([
16253
16058
  effectsClass("ShapeComponent")
16254
16059
  ], exports.ShapeComponent);
16255
- exports.ShapePrimitiveType = void 0;
16256
- (function(ShapePrimitiveType) {
16257
- /**
16258
- * 自定义图形
16259
- */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
16260
- /**
16261
- * 矩形
16262
- */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
16263
- /**
16264
- * 椭圆
16265
- */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
16266
- /**
16267
- * 多边形
16268
- */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
16269
- /**
16270
- * 星形
16271
- */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
16272
- })(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
16273
- exports.ShapeConnectType = void 0;
16274
- (function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
16275
- exports.ShapePointType = void 0;
16276
- (function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
16277
16060
 
16278
16061
  exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
16279
16062
  _inherits(Fake3DComponent, Component);
@@ -16834,6 +16617,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16834
16617
  this.item.getHitTestParams = this.getHitTestParams;
16835
16618
  };
16836
16619
  _proto.onDisable = function onDisable() {
16620
+ RendererComponent.prototype.onDisable.call(this);
16837
16621
  if (this.item && this.item.composition) {
16838
16622
  var _this_previewContent;
16839
16623
  if (this.duringPlay && !this.item.transform.getValid()) {
@@ -16846,6 +16630,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16846
16630
  }
16847
16631
  };
16848
16632
  _proto.onEnable = function onEnable() {
16633
+ RendererComponent.prototype.onEnable.call(this);
16849
16634
  var type = this.interactData.options.type;
16850
16635
  if (type === InteractType.CLICK) {
16851
16636
  this.clickable = true;
@@ -18459,7 +18244,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
18459
18244
  options: {}
18460
18245
  };
18461
18246
  }
18462
- if (duration <= 0) {
18247
+ if (duration < 0) {
18463
18248
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
18464
18249
  }
18465
18250
  this.rendererComponents.length = 0;
@@ -18820,6 +18605,16 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18820
18605
  }
18821
18606
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
18822
18607
  var ta = this.textureSheetAnimation;
18608
+ var video = this.renderer.texture.source.video;
18609
+ if (video) {
18610
+ if (time === 0) {
18611
+ video.pause();
18612
+ } else {
18613
+ video.play().catch(function(e) {
18614
+ _this.engine.renderErrors.add(e);
18615
+ });
18616
+ }
18617
+ }
18823
18618
  if (ta) {
18824
18619
  var _this_material_getVector4;
18825
18620
  var total = ta.total || ta.row * ta.col;
@@ -18874,21 +18669,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18874
18669
  dy
18875
18670
  ]);
18876
18671
  }
18877
- var video = this.renderer.texture.source.video;
18878
- if (video) {
18879
- if (time === 0 || time === this.item.duration) {
18880
- video.pause();
18881
- } else {
18882
- video.play().catch(function(e) {
18883
- _this.engine.renderErrors.add(e);
18884
- });
18885
- }
18886
- }
18887
18672
  };
18888
18673
  _proto.onDestroy = function onDestroy() {
18674
+ var textures = this.getTextures();
18889
18675
  if (this.item && this.item.composition) {
18890
- this.item.composition.destroyTextures(this.getTextures());
18676
+ this.item.composition.destroyTextures(textures);
18891
18677
  }
18678
+ textures.forEach(function(texture) {
18679
+ var source = texture.source;
18680
+ if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
18681
+ source.video.pause();
18682
+ source.video.src = "";
18683
+ source.video.load();
18684
+ }
18685
+ });
18892
18686
  };
18893
18687
  _proto.createGeometry = function createGeometry(mode) {
18894
18688
  var maxVertex = 12 * this.splits.length;
@@ -19327,7 +19121,7 @@ var ShapeNone = /*#__PURE__*/ function() {
19327
19121
  return ShapeNone;
19328
19122
  }();
19329
19123
  var _obj$3;
19330
- var map = (_obj$3 = {}, _obj$3[ShapeType.NONE] = ShapeNone, _obj$3[ShapeType.CONE] = Cone, _obj$3[ShapeType.SPHERE] = Sphere, _obj$3[ShapeType.HEMISPHERE] = Hemisphere, _obj$3[ShapeType.CIRCLE] = Circle, _obj$3[ShapeType.DONUT] = Donut, _obj$3[ShapeType.RECTANGLE] = Rectangle, _obj$3[ShapeType.EDGE] = Edge, _obj$3[ShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$3[ShapeType.TEXTURE] = TextureShape, _obj$3);
19124
+ var map = (_obj$3 = {}, _obj$3[ParticleEmitterShapeType.NONE] = ShapeNone, _obj$3[ParticleEmitterShapeType.CONE] = Cone, _obj$3[ParticleEmitterShapeType.SPHERE] = Sphere, _obj$3[ParticleEmitterShapeType.HEMISPHERE] = Hemisphere, _obj$3[ParticleEmitterShapeType.CIRCLE] = Circle, _obj$3[ParticleEmitterShapeType.DONUT] = Donut, _obj$3[ParticleEmitterShapeType.RECTANGLE] = Rectangle, _obj$3[ParticleEmitterShapeType.EDGE] = Edge, _obj$3[ParticleEmitterShapeType.RECTANGLE_EDGE] = RectangleEdge, _obj$3[ParticleEmitterShapeType.TEXTURE] = TextureShape, _obj$3);
19331
19125
  function createShape(shapeOptions) {
19332
19126
  if (!shapeOptions) {
19333
19127
  return new ShapeNone();
@@ -19344,7 +19138,7 @@ function createShape(shapeOptions) {
19344
19138
  throw new Error("Invalid shape: " + type + ".");
19345
19139
  }
19346
19140
  var ctrl = new Ctrl(options);
19347
- if (type !== ShapeType.NONE) {
19141
+ if (type !== ParticleEmitterShapeType.NONE) {
19348
19142
  var alignSpeedDirection = shapeOptions.alignSpeedDirection, _shapeOptions_upDirection = shapeOptions.upDirection, upDirection = _shapeOptions_upDirection === void 0 ? [
19349
19143
  0,
19350
19144
  0,
@@ -24274,9 +24068,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
24274
24068
  var sceneBinding = _step.value;
24275
24069
  sceneBinding.key.boundObject = sceneBinding.value;
24276
24070
  }
24277
- // 未了通过帧对比,需要保证和原有的 update 时机一致。
24071
+ // 为了通过帧对比,需要保证和原有的 update 时机一致。
24278
24072
  // 因此这边更新一次对象绑定,后续 timeline playable 中 sort tracks 的排序才能和原先的版本对上。
24279
- // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline playable 中的 sortTracks 都能去掉。
24073
+ // 如果不需要严格保证和之前的 updata 时机一致,这边的更新和 timeline asset 中的 sortTracks 都能去掉。
24280
24074
  for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
24281
24075
  var masterTrack = _step1.value;
24282
24076
  this.updateTrackAnimatedObject(masterTrack);
@@ -24380,6 +24174,51 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24380
24174
  return Vector4PropertyMixerPlayable;
24381
24175
  }(Playable);
24382
24176
 
24177
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24178
+ _inherits(ColorPropertyMixerPlayable, Playable);
24179
+ function ColorPropertyMixerPlayable() {
24180
+ var _this;
24181
+ _this = Playable.apply(this, arguments) || this;
24182
+ _this.propertyName = "";
24183
+ return _this;
24184
+ }
24185
+ var _proto = ColorPropertyMixerPlayable.prototype;
24186
+ _proto.processFrame = function processFrame(context) {
24187
+ var boundObject = context.output.getUserData();
24188
+ if (!boundObject) {
24189
+ return;
24190
+ }
24191
+ var hasInput = false;
24192
+ var value = boundObject[this.propertyName];
24193
+ if (!_instanceof1(value, Color)) {
24194
+ return;
24195
+ }
24196
+ value.setZero();
24197
+ // evaluate the curve
24198
+ for(var i = 0; i < this.getInputCount(); i++){
24199
+ var weight = this.getInputWeight(i);
24200
+ if (weight > 0) {
24201
+ var propertyClipPlayable = this.getInput(i);
24202
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24203
+ console.error("ColorPropertyMixerPlayable received incompatible input");
24204
+ continue;
24205
+ }
24206
+ var curveValue = propertyClipPlayable.value;
24207
+ value.r += curveValue.r * weight;
24208
+ value.g += curveValue.g * weight;
24209
+ value.b += curveValue.b * weight;
24210
+ value.a += curveValue.a * weight;
24211
+ hasInput = true;
24212
+ }
24213
+ }
24214
+ // set value
24215
+ if (hasInput) {
24216
+ boundObject[this.propertyName] = value;
24217
+ }
24218
+ };
24219
+ return ColorPropertyMixerPlayable;
24220
+ }(Playable);
24221
+
24383
24222
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24384
24223
  _inherits(PropertyTrack, TrackAsset);
24385
24224
  function PropertyTrack() {
@@ -24539,7 +24378,7 @@ exports.ColorPropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24539
24378
  }
24540
24379
  var _proto = ColorPropertyTrack.prototype;
24541
24380
  _proto.createTrackMixer = function createTrackMixer(graph) {
24542
- var mixer = new FloatPropertyMixerPlayable(graph);
24381
+ var mixer = new ColorPropertyMixerPlayable(graph);
24543
24382
  var propertyNames = this.propertyNames;
24544
24383
  if (propertyNames.length > 0) {
24545
24384
  var propertyName = propertyNames[propertyNames.length - 1];
@@ -24553,6 +24392,27 @@ exports.ColorPropertyTrack = __decorate([
24553
24392
  effectsClass(DataType.ColorPropertyTrack)
24554
24393
  ], exports.ColorPropertyTrack);
24555
24394
 
24395
+ exports.ColorPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24396
+ _inherits(ColorPropertyPlayableAsset, PlayableAsset);
24397
+ function ColorPropertyPlayableAsset() {
24398
+ return PlayableAsset.apply(this, arguments);
24399
+ }
24400
+ var _proto = ColorPropertyPlayableAsset.prototype;
24401
+ _proto.createPlayable = function createPlayable(graph) {
24402
+ var clipPlayable = new PropertyClipPlayable(graph);
24403
+ clipPlayable.curve = createValueGetter(this.curveData);
24404
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24405
+ return clipPlayable;
24406
+ };
24407
+ return ColorPropertyPlayableAsset;
24408
+ }(PlayableAsset);
24409
+ __decorate([
24410
+ serialize()
24411
+ ], exports.ColorPropertyPlayableAsset.prototype, "curveData", void 0);
24412
+ exports.ColorPropertyPlayableAsset = __decorate([
24413
+ effectsClass(DataType.ColorPropertyPlayableAsset)
24414
+ ], exports.ColorPropertyPlayableAsset);
24415
+
24556
24416
  exports.FloatPropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24557
24417
  _inherits(FloatPropertyPlayableAsset, PlayableAsset);
24558
24418
  function FloatPropertyPlayableAsset() {
@@ -24612,6 +24472,7 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24612
24472
  var _this;
24613
24473
  _this = PlayableAsset.apply(this, arguments) || this;
24614
24474
  _this.tracks = [];
24475
+ _this.cacheFlattenedTracks = null;
24615
24476
  return _this;
24616
24477
  }
24617
24478
  var _proto = TimelineAsset.prototype;
@@ -24624,16 +24485,62 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24624
24485
  track.create(this);
24625
24486
  }
24626
24487
  }
24627
- timelinePlayable.compileTracks(graph, this.tracks);
24488
+ this.sortTracks(this.tracks);
24489
+ timelinePlayable.compileTracks(graph, this.flattenedTracks);
24628
24490
  return timelinePlayable;
24629
24491
  };
24630
24492
  _proto.createTrack = function createTrack(classConstructor, parent, name) {
24631
24493
  var newTrack = new classConstructor(this.engine);
24632
24494
  newTrack.name = name ? name : classConstructor.name;
24633
24495
  parent.addChild(newTrack);
24496
+ this.invalidate();
24634
24497
  return newTrack;
24635
24498
  };
24499
+ /**
24500
+ * Invalidates the asset, called when tracks data changed
24501
+ */ _proto.invalidate = function invalidate() {
24502
+ this.cacheFlattenedTracks = null;
24503
+ };
24504
+ _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
24505
+ for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
24506
+ var subTrack = _step.value;
24507
+ allTracks.push(subTrack);
24508
+ }
24509
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
24510
+ var subTrack1 = _step1.value;
24511
+ this.addSubTracksRecursive(subTrack1, allTracks);
24512
+ }
24513
+ };
24514
+ _proto.sortTracks = function sortTracks(tracks) {
24515
+ var sortedTracks = [];
24516
+ for(var i = 0; i < tracks.length; i++){
24517
+ sortedTracks.push(new TrackSortWrapper(tracks[i], i));
24518
+ }
24519
+ sortedTracks.sort(compareTracks);
24520
+ tracks.length = 0;
24521
+ for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
24522
+ var trackWrapper = _step.value;
24523
+ tracks.push(trackWrapper.track);
24524
+ }
24525
+ };
24636
24526
  _proto.fromData = function fromData(data) {};
24527
+ _create_class(TimelineAsset, [
24528
+ {
24529
+ key: "flattenedTracks",
24530
+ get: function get() {
24531
+ if (!this.cacheFlattenedTracks) {
24532
+ this.cacheFlattenedTracks = [];
24533
+ // flatten track tree
24534
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24535
+ var masterTrack = _step.value;
24536
+ this.cacheFlattenedTracks.push(masterTrack);
24537
+ this.addSubTracksRecursive(masterTrack, this.cacheFlattenedTracks);
24538
+ }
24539
+ }
24540
+ return this.cacheFlattenedTracks;
24541
+ }
24542
+ }
24543
+ ]);
24637
24544
  return TimelineAsset;
24638
24545
  }(PlayableAsset);
24639
24546
  __decorate([
@@ -24666,18 +24573,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24666
24573
  }
24667
24574
  };
24668
24575
  _proto.compileTracks = function compileTracks(graph, tracks) {
24669
- this.sortTracks(tracks);
24670
- var outputTrack = [];
24671
- // flatten track tree
24672
- for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
24673
- var masterTrack = _step.value;
24674
- outputTrack.push(masterTrack);
24675
- this.addSubTracksRecursive(masterTrack, outputTrack);
24676
- }
24576
+ var outputTrack = tracks;
24677
24577
  // map for searching track instance with track asset guid
24678
24578
  var trackInstanceMap = {};
24679
- for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
24680
- var track = _step1.value;
24579
+ for(var _iterator = _create_for_of_iterator_helper_loose(outputTrack), _step; !(_step = _iterator()).done;){
24580
+ var track = _step.value;
24681
24581
  // create track mixer and track output
24682
24582
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24683
24583
  this.addInput(trackMixPlayable, 0);
@@ -24693,11 +24593,11 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24693
24593
  }
24694
24594
  }
24695
24595
  // build trackInstance tree
24696
- for(var _iterator2 = _create_for_of_iterator_helper_loose(outputTrack), _step2; !(_step2 = _iterator2()).done;){
24697
- var track1 = _step2.value;
24596
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
24597
+ var track1 = _step1.value;
24698
24598
  var trackInstance1 = trackInstanceMap[track1.getInstanceId()];
24699
- for(var _iterator3 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step3; !(_step3 = _iterator3()).done;){
24700
- var child = _step3.value;
24599
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(track1.getChildTracks()), _step2; !(_step2 = _iterator2()).done;){
24600
+ var child = _step2.value;
24701
24601
  var childTrackInstance = trackInstanceMap[child.getInstanceId()];
24702
24602
  trackInstance1.addChild(childTrackInstance);
24703
24603
  }
@@ -24714,28 +24614,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24714
24614
  this.updateTrackAnimatedObject(trackInstance.children);
24715
24615
  }
24716
24616
  };
24717
- _proto.sortTracks = function sortTracks(tracks) {
24718
- var sortedTracks = [];
24719
- for(var i = 0; i < tracks.length; i++){
24720
- sortedTracks.push(new TrackSortWrapper(tracks[i], i));
24721
- }
24722
- sortedTracks.sort(compareTracks);
24723
- tracks.length = 0;
24724
- for(var _iterator = _create_for_of_iterator_helper_loose(sortedTracks), _step; !(_step = _iterator()).done;){
24725
- var trackWrapper = _step.value;
24726
- tracks.push(trackWrapper.track);
24727
- }
24728
- };
24729
- _proto.addSubTracksRecursive = function addSubTracksRecursive(track, allTracks) {
24730
- for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
24731
- var subTrack = _step.value;
24732
- allTracks.push(subTrack);
24733
- }
24734
- for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step1; !(_step1 = _iterator1()).done;){
24735
- var subTrack1 = _step1.value;
24736
- this.addSubTracksRecursive(subTrack1, allTracks);
24737
- }
24738
- };
24739
24617
  return TimelinePlayable;
24740
24618
  }(Playable);
24741
24619
  var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
@@ -24757,6 +24635,27 @@ function compareTracks(a, b) {
24757
24635
  }
24758
24636
  }
24759
24637
 
24638
+ exports.Vector4PropertyPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
24639
+ _inherits(Vector4PropertyPlayableAsset, PlayableAsset);
24640
+ function Vector4PropertyPlayableAsset() {
24641
+ return PlayableAsset.apply(this, arguments);
24642
+ }
24643
+ var _proto = Vector4PropertyPlayableAsset.prototype;
24644
+ _proto.createPlayable = function createPlayable(graph) {
24645
+ var clipPlayable = new PropertyClipPlayable(graph);
24646
+ clipPlayable.curve = createValueGetter(this.curveData);
24647
+ clipPlayable.value = clipPlayable.curve.getValue(0);
24648
+ return clipPlayable;
24649
+ };
24650
+ return Vector4PropertyPlayableAsset;
24651
+ }(PlayableAsset);
24652
+ __decorate([
24653
+ serialize()
24654
+ ], exports.Vector4PropertyPlayableAsset.prototype, "curveData", void 0);
24655
+ exports.Vector4PropertyPlayableAsset = __decorate([
24656
+ effectsClass("Vector4PropertyPlayableAsset")
24657
+ ], exports.Vector4PropertyPlayableAsset);
24658
+
24760
24659
  exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24761
24660
  _inherits(ObjectBindingTrack, TrackAsset1);
24762
24661
  function ObjectBindingTrack() {
@@ -24794,7 +24693,7 @@ var TextLayout = /*#__PURE__*/ function() {
24794
24693
  function TextLayout(options) {
24795
24694
  this.width = 0;
24796
24695
  this.height = 0;
24797
- 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;
24696
+ 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;
24798
24697
  var tempWidth = fontSize + letterSpace;
24799
24698
  this.autoWidth = autoWidth;
24800
24699
  this.maxTextWidth = text.length * tempWidth;
@@ -26689,13 +26588,13 @@ function getStandardParticleContent(particle) {
26689
26588
  var options = particle.options;
26690
26589
  var transform = particle.transform;
26691
26590
  var shape = {
26692
- type: ShapeType.NONE
26591
+ type: ParticleEmitterShapeType.NONE
26693
26592
  };
26694
26593
  if (particle.shape) {
26695
26594
  var _particle_shape_shape;
26696
26595
  var shapeType = (_particle_shape_shape = particle.shape.shape) == null ? void 0 : _particle_shape_shape.replace(/([A-Z])/g, "_$1").toUpperCase().replace(/^_/, "");
26697
26596
  shape = _extends({}, particle.shape, {
26698
- type: ShapeType[shapeType]
26597
+ type: ParticleEmitterShapeType[shapeType]
26699
26598
  });
26700
26599
  if (particle.shape.upDirection) {
26701
26600
  var _particle_shape_upDirection = particle.shape.upDirection, x = _particle_shape_upDirection[0], y = _particle_shape_upDirection[1], z = _particle_shape_upDirection[2];
@@ -28559,7 +28458,8 @@ var listOrder = 0;
28559
28458
  var itemProps = sourceItemData;
28560
28459
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
28561
28460
  itemProps.listIndex = listOrder++;
28562
- if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine) {
28461
+ if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28462
+ itemProps.type === ItemType.shape) {
28563
28463
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
28564
28464
  var componentPath = _step2.value;
28565
28465
  var componentData = componentMap[componentPath.id];
@@ -28599,8 +28499,10 @@ var listOrder = 0;
28599
28499
  shapeData = shape;
28600
28500
  }
28601
28501
  if (shapeData !== undefined) {
28602
- // @ts-expect-error 类型转换问题
28603
- renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28502
+ if (!("aPoint" in shapeData && "index" in shapeData)) {
28503
+ // @ts-expect-error 类型转换问题
28504
+ renderContent.renderer.shape = getGeometryByShape(shapeData, split);
28505
+ }
28604
28506
  }
28605
28507
  }
28606
28508
  if ("trails" in renderContent && renderContent.trails !== undefined) {
@@ -28967,16 +28869,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28967
28869
  if (pause) {
28968
28870
  this.resume();
28969
28871
  }
28970
- if (!this.rootComposition.isStartCalled) {
28971
- this.rootComposition.onStart();
28972
- this.rootComposition.isStartCalled = true;
28973
- }
28974
28872
  this.setSpeed(1);
28975
28873
  this.forwardTime(time + this.startTime);
28976
28874
  this.setSpeed(speed);
28977
28875
  if (pause) {
28978
28876
  this.pause();
28979
28877
  }
28878
+ this.emit("goto", {
28879
+ time: time
28880
+ });
28980
28881
  };
28981
28882
  _proto.addItem = function addItem(item) {
28982
28883
  this.items.push(item);
@@ -29008,30 +28909,16 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
29008
28909
  _proto.prepareRender = function prepareRender() {
29009
28910
  var _this = this;
29010
28911
  var frame = this.renderFrame;
29011
- frame._renderPasses[0].meshes.length = 0;
29012
28912
  this.postLoaders.length = 0;
29013
28913
  this.pluginSystem.plugins.forEach(function(loader) {
29014
28914
  if (loader.prepareRenderFrame(_this, frame)) {
29015
28915
  _this.postLoaders.push(loader);
29016
28916
  }
29017
28917
  });
29018
- this.gatherRendererComponent(this.rootItem, frame);
29019
28918
  this.postLoaders.forEach(function(loader) {
29020
28919
  return loader.postProcessFrame(_this, frame);
29021
28920
  });
29022
28921
  };
29023
- _proto.gatherRendererComponent = function gatherRendererComponent(vfxItem, renderFrame) {
29024
- for(var _iterator = _create_for_of_iterator_helper_loose(vfxItem.rendererComponents), _step; !(_step = _iterator()).done;){
29025
- var rendererComponent = _step.value;
29026
- if (rendererComponent.isActiveAndEnabled) {
29027
- renderFrame.addMeshToDefaultRenderPass(rendererComponent);
29028
- }
29029
- }
29030
- for(var _iterator1 = _create_for_of_iterator_helper_loose(vfxItem.children), _step1; !(_step1 = _iterator1()).done;){
29031
- var item = _step1.value;
29032
- this.gatherRendererComponent(item, renderFrame);
29033
- }
29034
- };
29035
28922
  /**
29036
28923
  * 合成更新,针对所有 item 的更新
29037
28924
  * @param deltaTime - 更新的时间步长
@@ -31516,7 +31403,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31516
31403
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31517
31404
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31518
31405
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31519
- var version$1 = "2.1.0-beta.0";
31406
+ var version$1 = "2.1.0";
31520
31407
  logger.info("Core version: " + version$1 + ".");
31521
31408
 
31522
31409
  var _obj;
@@ -33143,7 +33030,7 @@ setMaxSpriteMeshItemCount(8);
33143
33030
  */ Mesh.create = function(engine, props) {
33144
33031
  return new ThreeMesh(engine, props);
33145
33032
  };
33146
- var version = "2.1.0-beta.0";
33033
+ var version = "2.1.0";
33147
33034
  logger.info("THREEJS plugin version: " + version + ".");
33148
33035
 
33149
33036
  exports.AbstractPlugin = AbstractPlugin;