@galacean/effects-core 1.2.0 → 2.0.0-alpha.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.
Files changed (78) hide show
  1. package/dist/asset-loader.d.ts +103 -0
  2. package/dist/asset-manager.d.ts +15 -1
  3. package/dist/asset-migrations.d.ts +2 -0
  4. package/dist/comp-vfx-item.d.ts +19 -63
  5. package/dist/components/component.d.ts +63 -0
  6. package/dist/components/effect-component.d.ts +63 -0
  7. package/dist/components/index.d.ts +3 -0
  8. package/dist/components/renderer-component.d.ts +32 -0
  9. package/dist/composition-source-manager.d.ts +7 -6
  10. package/dist/composition.d.ts +40 -41
  11. package/dist/decorators.d.ts +4 -0
  12. package/dist/effects-object.d.ts +25 -0
  13. package/dist/engine.d.ts +23 -4
  14. package/dist/index.d.ts +25 -21
  15. package/dist/index.js +17265 -16811
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +17230 -16783
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/material/material.d.ts +5 -4
  20. package/dist/material/utils.d.ts +1 -1
  21. package/dist/pass-render-level.d.ts +1 -1
  22. package/dist/plugins/cal/animation-mixer-playable.d.ts +4 -0
  23. package/dist/plugins/cal/animation-playable-output.d.ts +4 -0
  24. package/dist/plugins/cal/animation-playable.d.ts +6 -0
  25. package/dist/plugins/cal/animation-stream.d.ts +14 -0
  26. package/dist/plugins/cal/calculate-item.d.ts +34 -57
  27. package/dist/plugins/cal/calculate-vfx-item.d.ts +71 -25
  28. package/dist/plugins/cal/playable-graph.d.ts +62 -0
  29. package/dist/plugins/cal/track.d.ts +35 -0
  30. package/dist/plugins/camera/camera-controller-node.d.ts +11 -8
  31. package/dist/plugins/index.d.ts +2 -5
  32. package/dist/plugins/interact/click-handler.d.ts +3 -3
  33. package/dist/plugins/interact/interact-item.d.ts +27 -1
  34. package/dist/plugins/interact/interact-loader.d.ts +0 -10
  35. package/dist/plugins/interact/interact-vfx-item.d.ts +7 -27
  36. package/dist/plugins/particle/particle-loader.d.ts +2 -11
  37. package/dist/plugins/particle/particle-mesh.d.ts +4 -9
  38. package/dist/plugins/particle/particle-system-renderer.d.ts +36 -0
  39. package/dist/plugins/particle/particle-system.d.ts +22 -21
  40. package/dist/plugins/particle/particle-vfx-item.d.ts +9 -25
  41. package/dist/plugins/particle/trail-mesh.d.ts +3 -5
  42. package/dist/plugins/sprite/sprite-item.d.ts +69 -42
  43. package/dist/plugins/sprite/sprite-loader.d.ts +3 -15
  44. package/dist/plugins/sprite/sprite-mesh.d.ts +4 -36
  45. package/dist/plugins/text/text-item.d.ts +12 -9
  46. package/dist/plugins/text/text-loader.d.ts +0 -15
  47. package/dist/render/geometry.d.ts +5 -14
  48. package/dist/render/mesh.d.ts +5 -16
  49. package/dist/render/render-frame.d.ts +3 -8
  50. package/dist/render/render-pass.d.ts +10 -9
  51. package/dist/render/renderer.d.ts +5 -5
  52. package/dist/render/shader.d.ts +7 -4
  53. package/dist/semantic-map.d.ts +1 -1
  54. package/dist/serialization-helper.d.ts +14 -0
  55. package/dist/texture/texture.d.ts +4 -4
  56. package/dist/transform.d.ts +14 -4
  57. package/dist/utils/asserts.d.ts +1 -1
  58. package/dist/utils/index.d.ts +2 -1
  59. package/dist/utils/timeline-component.d.ts +1 -34
  60. package/dist/vfx-item.d.ts +56 -147
  61. package/package.json +3 -2
  62. package/dist/filter.d.ts +0 -63
  63. package/dist/filters/alpha-frame.d.ts +0 -5
  64. package/dist/filters/alpha-mask.d.ts +0 -5
  65. package/dist/filters/bloom.d.ts +0 -8
  66. package/dist/filters/camera-move.d.ts +0 -5
  67. package/dist/filters/delay.d.ts +0 -14
  68. package/dist/filters/distortion.d.ts +0 -5
  69. package/dist/filters/gaussian.d.ts +0 -27
  70. package/dist/filters/index.d.ts +0 -2
  71. package/dist/filters/lum.d.ts +0 -5
  72. package/dist/filters/utils.d.ts +0 -7
  73. package/dist/plugins/camera/camera-vfx-item.d.ts +0 -13
  74. package/dist/plugins/sprite/filter-sprite-vfx-item.d.ts +0 -13
  75. package/dist/plugins/sprite/sprite-group.d.ts +0 -95
  76. package/dist/plugins/sprite/sprite-vfx-item.d.ts +0 -33
  77. package/dist/plugins/text/text-mesh.d.ts +0 -15
  78. package/dist/plugins/text/text-vfx-item.d.ts +0 -28
@@ -0,0 +1,103 @@
1
+ import type * as spec from '@galacean/effects-specification';
2
+ import type { EffectsObject } from './effects-object';
3
+ import type { Engine } from './engine';
4
+ import type { VFXItemProps } from './vfx-item';
5
+ /**
6
+ * @since 2.0.0
7
+ * @internal
8
+ */
9
+ export declare class AssetLoader {
10
+ private engine;
11
+ constructor(engine: Engine);
12
+ loadGUID<T>(guid: string): T;
13
+ loadGUIDAsync<T>(guid: string): Promise<T>;
14
+ private findData;
15
+ private static getClass;
16
+ }
17
+ export declare class Database {
18
+ loadGUID(guid: string): Promise<EffectsObject | undefined>;
19
+ }
20
+ export declare enum DataType {
21
+ VFXItemData = 0,
22
+ EffectComponent = 1,
23
+ Material = 2,
24
+ Shader = 3,
25
+ SpriteComponent = 4,
26
+ ParticleSystem = 5,
27
+ InteractComponent = 6,
28
+ CameraController = 7,
29
+ Geometry = 8,
30
+ Texture = 9,
31
+ TextComponent = 10,
32
+ MeshComponent = 10000,
33
+ SkyboxComponent = 10001,
34
+ LightComponent = 10002,
35
+ CameraComponent = 10003,
36
+ ModelPluginComponent = 10004,
37
+ TreeComponent = 10005
38
+ }
39
+ export interface DataPath {
40
+ id: string;
41
+ }
42
+ export interface EffectsObjectData {
43
+ id: string;
44
+ name?: string;
45
+ dataType: number;
46
+ }
47
+ export interface MaterialData extends EffectsObjectData {
48
+ shader: DataPath;
49
+ blending?: boolean;
50
+ zWrite?: boolean;
51
+ zTest?: boolean;
52
+ floats: Record<string, number>;
53
+ ints: Record<string, number>;
54
+ vector2s?: Record<string, spec.vec2>;
55
+ vector3s?: Record<string, spec.vec3>;
56
+ vector4s: Record<string, {
57
+ x: number;
58
+ y: number;
59
+ z: number;
60
+ w: number;
61
+ }>;
62
+ colors: Record<string, {
63
+ r: number;
64
+ g: number;
65
+ b: number;
66
+ a: number;
67
+ }>;
68
+ matrices?: Record<string, spec.mat4>;
69
+ matrice3s?: Record<string, spec.mat3>;
70
+ textures?: Record<string, DataPath>;
71
+ floatArrays?: Record<string, number[]>;
72
+ vector4Arrays?: Record<string, number[]>;
73
+ matrixArrays?: Record<string, number[]>;
74
+ }
75
+ export interface GeometryData extends EffectsObjectData {
76
+ vertices?: number[];
77
+ uvs?: number[];
78
+ normals?: number[];
79
+ indices?: number[];
80
+ }
81
+ export interface ShaderData extends EffectsObjectData {
82
+ vertex: string;
83
+ fragment: string;
84
+ properties?: string;
85
+ }
86
+ export interface EffectComponentData extends EffectsObjectData {
87
+ _priority: number;
88
+ item: DataPath;
89
+ materials: DataPath[];
90
+ geometry: DataPath;
91
+ }
92
+ export type VFXItemData = VFXItemProps & {
93
+ dataType: DataType;
94
+ components: DataPath[];
95
+ };
96
+ export type SceneData = Record<string, EffectsObjectData>;
97
+ export interface EffectsPackageData {
98
+ fileSummary: {
99
+ guid: string;
100
+ assetType: string;
101
+ };
102
+ exportObjects: EffectsObjectData[];
103
+ }
@@ -1,8 +1,8 @@
1
1
  import type * as spec from '@galacean/effects-specification';
2
2
  import type { JSONValue } from './downloader';
3
3
  import { Downloader } from './downloader';
4
- import type { Disposable } from './utils';
5
4
  import type { Scene } from './scene';
5
+ import type { Disposable } from './utils';
6
6
  import type { Renderer } from './render';
7
7
  /**
8
8
  * 场景加载参数
@@ -73,6 +73,15 @@ export interface SceneLoadOptions {
73
73
  */
74
74
  speed?: number;
75
75
  }
76
+ /**
77
+ * 场景类型
78
+ */
79
+ export type SceneType = string | JSONValue | Scene;
80
+ export type SceneWithOptionsType = {
81
+ scene: SceneType;
82
+ options: SceneLoadOptions;
83
+ };
84
+ export type SceneLoadType = SceneType | SceneWithOptionsType;
76
85
  /**
77
86
  * 资源管理器
78
87
  * 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
@@ -98,6 +107,10 @@ export declare class AssetManager implements Disposable {
98
107
  * @default 10
99
108
  */
100
109
  private timeout;
110
+ /**
111
+ * 场景加载的超时定时器
112
+ */
113
+ private timers;
101
114
  /**
102
115
  * 构造函数
103
116
  * @param options - 场景加载参数
@@ -123,6 +136,7 @@ export declare class AssetManager implements Disposable {
123
136
  private processTextures;
124
137
  private loadJSON;
125
138
  private loadBins;
139
+ private removeTimer;
126
140
  /**
127
141
  * 销毁方法
128
142
  */
@@ -0,0 +1,2 @@
1
+ import type { Scene } from './scene';
2
+ export declare function version3Migration(scene: Record<string, any>): Scene;
@@ -1,71 +1,27 @@
1
- import type { Ray } from '@galacean/effects-math/es';
2
- import * as spec from '@galacean/effects-specification';
3
- import { CalculateItem } from './plugins';
1
+ import type { Ray } from '@galacean/effects-math/es/core/ray';
2
+ import { ItemBehaviour } from './components';
3
+ import type { CompositionHitTestOptions } from './composition';
4
4
  import type { Region } from './plugins';
5
- import type { VFXItemContent, VFXItemProps } from './vfx-item';
5
+ import { TimelineComponent } from './plugins';
6
+ import type { VFXItemContent } from './vfx-item';
6
7
  import { VFXItem } from './vfx-item';
7
- import type { Composition, CompositionHitTestOptions } from './composition';
8
- export interface ItemNode {
9
- id: string;
10
- item: VFXItem<VFXItemContent>;
11
- children: ItemNode[];
12
- parentId?: string;
13
- }
14
- export declare class CompVFXItem extends VFXItem<void | CalculateItem> {
15
- /**
16
- * 创建好的元素数组
17
- */
18
- items: VFXItem<VFXItemContent>[];
19
- /**
20
- * 根据父子关系构建的元素树
21
- */
22
- itemTree: ItemNode[];
8
+ /**
9
+ * @since 2.0.0
10
+ * @internal
11
+ */
12
+ export declare class CompositionComponent extends ItemBehaviour {
23
13
  startTime: number;
24
- contentProps: any;
25
- timeInms: number;
14
+ refId: string;
15
+ items: VFXItem<VFXItemContent>[];
16
+ timelineComponents: TimelineComponent[];
17
+ timelineComponent: TimelineComponent;
18
+ start(): void;
19
+ update(dt: number): void;
26
20
  /**
27
- * id和元素的映射关系Map,方便查找
21
+ * 重置元素状态属性
28
22
  */
29
- readonly itemCacheMap: Map<string, ItemNode>;
30
- private itemProps;
31
- private freezeOnEnd;
32
- private startTimeInms;
33
- private itemsToRemove;
34
- private tempQueue;
35
- private extraCamera;
36
- private refId;
37
- get type(): spec.ItemType;
38
- onConstructed(props: VFXItemProps): void;
23
+ resetStatus(): void;
39
24
  createContent(): void;
40
- protected doCreateContent(): CalculateItem;
41
- onLifetimeBegin(): void;
42
- doStop(): void;
43
- onItemUpdate(dt: number, lifetime: number): void;
44
- onItemRemoved(composition: Composition): void;
45
- reset(): void;
46
- handleVisibleChanged(visible: boolean): void;
47
- getUpdateTime(t: number): number;
48
- removeItem(item: VFXItem<VFXItemContent>): boolean;
49
- /**
50
- * 设置指定元素的父元素
51
- * @param item
52
- * @param parentItem - 为 undefined 时表示设置父变换为合成的变换
53
- */
54
- setItemParent(item: VFXItem<VFXItemContent>, parentItem?: VFXItem<VFXItemContent>): void;
55
- /**
56
- * 获取指定元素当前时刻真正起作用的父元素, 需要在元素生命周期内获取
57
- * @internal
58
- * @param item - 指定元素
59
- * @return 当父元素生命周期结束时,返回空
60
- */
61
- getItemCurrentParent(item: VFXItem<VFXItemContent>): VFXItem<VFXItemContent> | void;
62
- getItemByName(name: string): VFXItem<VFXItemContent>[];
25
+ onDestroy(): void;
63
26
  hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
64
- protected isEnded(now: number): boolean;
65
- /**
66
- * 构建父子树,同时保存到 itemCacheMap 中便于查找
67
- */
68
- private buildItemTree;
69
- private getParentIdWithoutSuffix;
70
- private restart;
71
27
  }
@@ -0,0 +1,63 @@
1
+ import { EffectsObject } from '../effects-object';
2
+ import type { VFXItem, VFXItemContent } from '../vfx-item';
3
+ /**
4
+ * @since 2.0.0
5
+ * @internal
6
+ */
7
+ export declare abstract class Component extends EffectsObject {
8
+ name: string;
9
+ /**
10
+ * 附加到的 VFXItem 对象
11
+ */
12
+ item: VFXItem<VFXItemContent>;
13
+ /**
14
+ * 附加到的 VFXItem 对象 Transform 组件
15
+ */
16
+ get transform(): import("..").Transform;
17
+ onAttached(): void;
18
+ onDestroy(): void;
19
+ fromData(data: any): void;
20
+ dispose(): void;
21
+ }
22
+ /**
23
+ * @since 2.0.0
24
+ * @internal
25
+ */
26
+ export declare abstract class Behaviour extends Component {
27
+ _enabled: boolean;
28
+ /**
29
+ * 组件是否可以更新,true 更新,false 不更新
30
+ */
31
+ get isActiveAndEnabled(): boolean;
32
+ get enabled(): boolean;
33
+ set enabled(value: boolean);
34
+ protected onBehaviourEnable(): void;
35
+ fromData(data: any): void;
36
+ toData(): void;
37
+ }
38
+ /**
39
+ * @since 2.0.0
40
+ * @internal
41
+ */
42
+ export declare abstract class ItemBehaviour extends Behaviour {
43
+ started: boolean;
44
+ /**
45
+ * 在每次设置 enabled 为 true 时触发
46
+ */
47
+ onEnable(): void;
48
+ /**
49
+ * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
50
+ */
51
+ start(): void;
52
+ /**
53
+ * 生命周期函数,每帧调用一次
54
+ */
55
+ update(dt: number): void;
56
+ /**
57
+ * 生命周期函数,每帧调用一次,在 update 之后调用
58
+ */
59
+ lateUpdate(dt: number): void;
60
+ onAttached(): void;
61
+ dispose(): void;
62
+ protected onBehaviourEnable(): void;
63
+ }
@@ -0,0 +1,63 @@
1
+ import { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
2
+ import type { TriangleLike } from '@galacean/effects-math/es/core/type';
3
+ import type { Engine } from '../engine';
4
+ import type { Material, MaterialDestroyOptions } from '../material';
5
+ import type { BoundingBoxTriangle, HitTestTriangleParams } from '../plugins';
6
+ import type { MeshDestroyOptions, Renderer } from '../render';
7
+ import { Geometry } from '../render';
8
+ import { DestroyOptions } from '../utils';
9
+ import { RendererComponent } from './renderer-component';
10
+ /**
11
+ * @since 2.0.0
12
+ * @internal
13
+ */
14
+ export declare class EffectComponent extends RendererComponent {
15
+ /**
16
+ * Mesh 的全局唯一 id
17
+ */
18
+ readonly id: string;
19
+ /**
20
+ * Mesh 的世界矩阵
21
+ */
22
+ worldMatrix: Matrix4;
23
+ /**
24
+ * Mesh 的 Geometry
25
+ */
26
+ geometry: Geometry;
27
+ triangles: TriangleLike[];
28
+ protected destroyed: boolean;
29
+ private visible;
30
+ private hitTestGeometry;
31
+ constructor(engine: Engine);
32
+ get isDestroyed(): boolean;
33
+ /**
34
+ * 设置当前 Mesh 的可见性。
35
+ * @param visible - true:可见,false:不可见
36
+ */
37
+ setVisible(visible: boolean): void;
38
+ start(): void;
39
+ render(renderer: Renderer): void;
40
+ /**
41
+ * 获取当前 Mesh 的可见性。
42
+ */
43
+ getVisible(): boolean;
44
+ /**
45
+ * 获取当前 Mesh 的第一个 geometry。
46
+ */
47
+ firstGeometry(): Geometry;
48
+ /**
49
+ * 设置当前 Mesh 的材质
50
+ * @param material - 要设置的材质
51
+ * @param destroy - 可选的材质销毁选项
52
+ */
53
+ setMaterial(material: Material, destroy?: MaterialDestroyOptions | DestroyOptions.keep): void;
54
+ getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
55
+ getBoundingBox(): BoundingBoxTriangle | void;
56
+ fromData(data: any): void;
57
+ toData(): void;
58
+ /**
59
+ * 销毁当前资源
60
+ * @param options - 可选的销毁选项
61
+ */
62
+ dispose(options?: MeshDestroyOptions): void;
63
+ }
@@ -0,0 +1,3 @@
1
+ export * from './renderer-component';
2
+ export * from './component';
3
+ export * from './effect-component';
@@ -0,0 +1,32 @@
1
+ import type { Material } from '../material';
2
+ import type { Renderer } from '../render';
3
+ import { Component } from './component';
4
+ /**
5
+ * 所有渲染组件的基类
6
+ * @since 2.0.0
7
+ */
8
+ export declare class RendererComponent extends Component {
9
+ started: boolean;
10
+ materials: Material[];
11
+ protected _priority: number;
12
+ protected _enabled: boolean;
13
+ get priority(): number;
14
+ set priority(value: number);
15
+ get enabled(): boolean;
16
+ set enabled(value: boolean);
17
+ /**
18
+ * 组件是否可以更新,true 更新,false 不更新
19
+ */
20
+ get isActiveAndEnabled(): boolean;
21
+ get material(): Material;
22
+ set material(material: Material);
23
+ onEnable(): void;
24
+ start(): void;
25
+ update(dt: number): void;
26
+ lateUpdate(dt: number): void;
27
+ render(renderer: Renderer): void;
28
+ onAttached(): void;
29
+ fromData(data: any): void;
30
+ toData(): void;
31
+ dispose(): void;
32
+ }
@@ -1,17 +1,17 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
- import { Texture } from './texture';
3
- import type { Disposable } from './utils';
4
- import type { Scene } from './scene';
5
- import type { PluginSystem } from './plugin-system';
6
2
  import type { Engine } from './engine';
3
+ import type { PluginSystem } from './plugin-system';
7
4
  import type { GlobalVolume } from './render';
5
+ import type { Scene } from './scene';
6
+ import type { Texture } from './texture';
7
+ import type { Disposable } from './utils';
8
8
  import type { VFXItemProps } from './vfx-item';
9
9
  export interface ContentOptions {
10
10
  id: string;
11
11
  duration: number;
12
12
  name: string;
13
13
  endBehavior: spec.CompositionEndBehavior;
14
- items: any[];
14
+ items: VFXItemProps[];
15
15
  camera: spec.CameraOptions;
16
16
  startTime: number;
17
17
  globalVolume: GlobalVolume;
@@ -31,10 +31,11 @@ export declare class CompositionSourceManager implements Disposable {
31
31
  textures: Texture[];
32
32
  jsonScene?: spec.JSONScene;
33
33
  mask: number;
34
- textureOptions: Record<string, any>[];
34
+ engine: Engine;
35
35
  constructor(scene: Scene, engine: Engine);
36
36
  private getContent;
37
37
  private assembleItems;
38
+ private preProcessItemContent;
38
39
  private changeTex;
39
40
  private addTextureUsage;
40
41
  /**
@@ -1,19 +1,19 @@
1
- import * as spec from '@galacean/effects-specification';
2
1
  import type { Ray } from '@galacean/effects-math/es/core/index';
2
+ import * as spec from '@galacean/effects-specification';
3
+ import { Camera } from './camera';
4
+ import { CompositionComponent } from './comp-vfx-item';
5
+ import type { CompositionSourceManager } from './composition-source-manager';
3
6
  import type { JSONValue } from './downloader';
4
- import type { Scene } from './scene';
5
- import type { Disposable, LostHandler } from './utils';
6
- import { Transform } from './transform';
7
- import type { VFXItem, VFXItemContent, VFXItemProps } from './vfx-item';
8
- import { CompVFXItem } from './comp-vfx-item';
9
- import type { InteractVFXItem, EventSystem } from './plugins';
10
7
  import type { PluginSystem } from './plugin-system';
8
+ import type { EventSystem, Region } from './plugins';
11
9
  import type { MeshRendererOptions, Renderer } from './render';
12
- import type { Texture } from './texture';
13
10
  import { RenderFrame } from './render';
14
- import { Camera } from './camera';
15
- import type { Region } from './plugins';
16
- import { CompositionSourceManager } from './composition-source-manager';
11
+ import type { Scene } from './scene';
12
+ import type { Texture } from './texture';
13
+ import { Transform } from './transform';
14
+ import type { Disposable, LostHandler } from './utils';
15
+ import type { VFXItemContent, VFXItemProps } from './vfx-item';
16
+ import { VFXItem } from './vfx-item';
17
17
  export interface CompositionStatistic {
18
18
  loadTime: number;
19
19
  loadStart: number;
@@ -51,6 +51,7 @@ export interface CompositionProps {
51
51
  * 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
52
52
  */
53
53
  export declare class Composition implements Disposable, LostHandler {
54
+ compositionSourceManager: CompositionSourceManager;
54
55
  renderer: Renderer;
55
56
  /**
56
57
  * 当前帧的渲染数据对象
@@ -65,7 +66,6 @@ export declare class Composition implements Disposable, LostHandler {
65
66
  */
66
67
  textureOffloaded: boolean;
67
68
  videoState: (number | undefined)[];
68
- compositionSourceManager: CompositionSourceManager;
69
69
  /**
70
70
  * 合成渲染顺序,默认按升序渲染
71
71
  */
@@ -82,6 +82,7 @@ export declare class Composition implements Disposable, LostHandler {
82
82
  * 是否播放完成后销毁 texture 对象
83
83
  */
84
84
  keepResource: boolean;
85
+ extraCamera: VFXItem<VFXItemContent>;
85
86
  /**
86
87
  * 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
87
88
  * @internal
@@ -140,13 +141,13 @@ export declare class Composition implements Disposable, LostHandler {
140
141
  */
141
142
  readonly url: string | JSONValue;
142
143
  /**
143
- * 合成对象
144
+ * 合成根元素
144
145
  */
145
- readonly content: CompVFXItem;
146
+ rootItem: VFXItem<VFXItemContent>;
146
147
  /**
147
148
  * 预合成数组
148
149
  */
149
- readonly refContent: CompVFXItem[];
150
+ readonly refContent: VFXItem<VFXItemContent>[];
150
151
  /**
151
152
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
152
153
  */
@@ -155,6 +156,10 @@ export declare class Composition implements Disposable, LostHandler {
155
156
  * 合成的相机对象
156
157
  */
157
158
  readonly camera: Camera;
159
+ /**
160
+ * 合成全局时间
161
+ */
162
+ globalTime: number;
158
163
  protected rendererOptions: MeshRendererOptions | null;
159
164
  protected assigned: boolean;
160
165
  /**
@@ -165,6 +170,7 @@ export declare class Composition implements Disposable, LostHandler {
165
170
  * 是否是否每次渲染时清除 RenderFrame 颜色缓存
166
171
  */
167
172
  protected readonly keepColorBuffer: boolean;
173
+ protected rootComposition: CompositionComponent;
168
174
  /**
169
175
  * 合成暂停/播放 标识
170
176
  */
@@ -176,11 +182,14 @@ export declare class Composition implements Disposable, LostHandler {
176
182
  private readonly globalVolume;
177
183
  private readonly texInfo;
178
184
  private readonly postLoaders;
185
+ private rootTimeline;
179
186
  /**
180
187
  * Composition 构造函数
181
188
  * @param props - composition 的创建参数
189
+ * @param scene
190
+ * @param compositionSourceManager
182
191
  */
183
- constructor(props: CompositionProps, scene: Scene);
192
+ constructor(props: CompositionProps, scene: Scene, compositionSourceManager: CompositionSourceManager);
184
193
  /**
185
194
  * 合成结束回调
186
195
  * @param {(composition: Composition) => void} func
@@ -240,6 +249,7 @@ export declare class Composition implements Disposable, LostHandler {
240
249
  * 暂停合成的播放
241
250
  */
242
251
  pause(): void;
252
+ getPaused(): boolean;
243
253
  /**
244
254
  * 恢复合成的播放
245
255
  */
@@ -263,6 +273,7 @@ export declare class Composition implements Disposable, LostHandler {
263
273
  * @param time - 相对 startTime 的时间
264
274
  */
265
275
  setTime(time: number): void;
276
+ addItem(item: VFXItem<VFXItemContent>): void;
266
277
  /**
267
278
  * 前进合成到指定时间
268
279
  * @param time - 相对0时刻的时间
@@ -273,7 +284,7 @@ export declare class Composition implements Disposable, LostHandler {
273
284
  * 重置状态函数
274
285
  */
275
286
  protected reset(): void;
276
- private prepareRender;
287
+ prepareRender(): void;
277
288
  /**
278
289
  * 是否合成需要重新播放
279
290
  * @returns 重新播放合成标志位
@@ -290,6 +301,15 @@ export declare class Composition implements Disposable, LostHandler {
290
301
  * @param skipRender - 是否需要渲染
291
302
  */
292
303
  update(deltaTime: number, skipRender?: boolean): void;
304
+ private getUpdateTime;
305
+ private callStart;
306
+ private callUpdate;
307
+ private callLateUpdate;
308
+ /**
309
+ * 构建父子树,同时保存到 itemCacheMap 中便于查找
310
+ */
311
+ private buildItemTree;
312
+ private getParentIdWithoutSuffix;
293
313
  /**
294
314
  * 更新视频数据到纹理
295
315
  * @override
@@ -308,30 +328,9 @@ export declare class Composition implements Disposable, LostHandler {
308
328
  /**
309
329
  * 通过名称获取元素
310
330
  * @param name - 元素名称
311
- * @param type - 元素类型
312
331
  * @returns 元素对象
313
332
  */
314
- getItemByName(name: string, type?: spec.ItemType): VFXItem<VFXItemContent> | undefined;
315
- /**
316
- * 通过 id 获取元素
317
- * @param id - 元素 id
318
- * @return
319
- */
320
- getItemByID(id: string): VFXItem<VFXItemContent> | null;
321
- /**
322
- * 获取指定元素当前时刻真正起作用的父元素, 需要在元素生命周期内获取
323
- * @internal
324
- * @param item - 指定元素
325
- * @return 当父元素生命周期结束时,返回空
326
- */
327
- getItemCurrentParent(item: VFXItem<VFXItemContent>): VFXItem<VFXItemContent> | void;
328
- /**
329
- * Item 的起始和结束事件
330
- * @internal
331
- * @param item - 合成元素
332
- * @param start - 是起始事件
333
- */
334
- itemLifetimeEvent(item: VFXItem<any>, start: boolean): void;
333
+ getItemByName(name: string): VFXItem<VFXItemContent> | undefined;
335
334
  /**
336
335
  * 获取指定位置和相机连成的射线
337
336
  * @param x
@@ -357,13 +356,13 @@ export declare class Composition implements Disposable, LostHandler {
357
356
  * @param item - 交互元素
358
357
  * @param type - 交互类型
359
358
  */
360
- addInteractiveItem(item: InteractVFXItem, type: spec.InteractType): string | undefined;
359
+ addInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): string | undefined;
361
360
  /**
362
361
  * InteractItem 生命周期结束时的调用
363
362
  * @param item - 交互元素
364
363
  * @param type - 交互类型
365
364
  */
366
- removeInteractiveItem(item: InteractVFXItem, type: spec.InteractType): void;
365
+ removeInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): void;
367
366
  /**
368
367
  * 销毁插件 Item 中保存的纹理数组
369
368
  * @internal
@@ -0,0 +1,4 @@
1
+ export declare const effectsClassStore: Record<number, any>;
2
+ export declare function getMergedStore(target: any): any;
3
+ export declare function serialize(sourceName?: string): (target: any, propertyKey: any) => void;
4
+ export declare function effectsClass(className: any): (target: any, context?: any) => void;
@@ -0,0 +1,25 @@
1
+ import type { EffectsObjectData } from './asset-loader';
2
+ import type { Engine } from './engine';
3
+ /**
4
+ * @since 2.0.0
5
+ * @internal
6
+ */
7
+ export declare abstract class EffectsObject {
8
+ engine: Engine;
9
+ protected guid: string;
10
+ /**
11
+ * 存储需要序列化的数据
12
+ */
13
+ readonly taggedProperties: Record<string, any>;
14
+ constructor(engine: Engine);
15
+ getInstanceId(): string;
16
+ setInstanceId(guid: string): void;
17
+ toData(): void;
18
+ /**
19
+ * 反序列化函数
20
+ *
21
+ * @param data - 对象的序列化的数据
22
+ */
23
+ fromData(data: EffectsObjectData): void;
24
+ dispose(): void;
25
+ }