@galacean/effects-core 2.0.0-alpha.12 → 2.0.0-alpha.14

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 (53) hide show
  1. package/dist/binary-asset.d.ts +6 -0
  2. package/dist/comp-vfx-item.d.ts +23 -6
  3. package/dist/components/component.d.ts +2 -2
  4. package/dist/composition-source-manager.d.ts +3 -0
  5. package/dist/composition.d.ts +25 -14
  6. package/dist/decorators.d.ts +1 -1
  7. package/dist/engine.d.ts +7 -4
  8. package/dist/fallback/migration.d.ts +1 -1
  9. package/dist/gl/create-gl-context.d.ts +2 -1
  10. package/dist/index.d.ts +5 -4
  11. package/dist/index.js +9851 -9070
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +9832 -9064
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/math/bezier.d.ts +15 -0
  16. package/dist/math/translate.d.ts +3 -2
  17. package/dist/math/value-getter.d.ts +18 -1
  18. package/dist/plugin-system.d.ts +1 -1
  19. package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
  20. package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
  21. package/dist/plugins/cal/animation-playable.d.ts +2 -1
  22. package/dist/plugins/cal/calculate-item.d.ts +7 -28
  23. package/dist/plugins/cal/calculate-vfx-item.d.ts +29 -23
  24. package/dist/plugins/cal/playable-graph.d.ts +72 -21
  25. package/dist/plugins/cal/timeline-asset.d.ts +28 -0
  26. package/dist/plugins/camera/camera-controller-node.d.ts +0 -11
  27. package/dist/plugins/index.d.ts +5 -1
  28. package/dist/plugins/interact/click-handler.d.ts +2 -2
  29. package/dist/plugins/interact/event-system.d.ts +0 -2
  30. package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
  31. package/dist/plugins/particle/particle-system.d.ts +1 -1
  32. package/dist/plugins/particle/particle-vfx-item.d.ts +7 -3
  33. package/dist/plugins/plugin.d.ts +6 -6
  34. package/dist/plugins/sprite/sprite-item.d.ts +13 -7
  35. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +8 -0
  36. package/dist/plugins/timeline/track.d.ts +72 -0
  37. package/dist/plugins/timeline/tracks/activation-track.d.ts +6 -0
  38. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  39. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  40. package/dist/render/framebuffer.d.ts +1 -1
  41. package/dist/render/geometry.d.ts +10 -5
  42. package/dist/render/gpu-capability.d.ts +6 -6
  43. package/dist/render/renderer.d.ts +2 -1
  44. package/dist/render/semantic-map.d.ts +1 -1
  45. package/dist/texture/texture.d.ts +1 -0
  46. package/dist/ticker.d.ts +2 -2
  47. package/dist/utils/device.d.ts +1 -0
  48. package/dist/utils/index.d.ts +1 -1
  49. package/dist/utils/text.d.ts +8 -0
  50. package/dist/vfx-item.d.ts +27 -44
  51. package/package.json +2 -2
  52. package/dist/plugins/cal/track.d.ts +0 -34
  53. package/dist/utils/timeline-component.d.ts +0 -6
@@ -0,0 +1,6 @@
1
+ import type { EffectsObjectData } from '@galacean/effects-specification';
2
+ import { EffectsObject } from './effects-object';
3
+ export declare class BinaryAsset extends EffectsObject {
4
+ buffer: ArrayBuffer;
5
+ fromData(data: EffectsObjectData): void;
6
+ }
@@ -1,21 +1,37 @@
1
1
  import type { Ray } from '@galacean/effects-math/es/core/ray';
2
+ import * as spec from '@galacean/effects-specification';
2
3
  import { ItemBehaviour } from './components';
3
4
  import type { CompositionHitTestOptions } from './composition';
4
- import type { Region } from './plugins';
5
- import { TimelineComponent } from './plugins';
6
- import type { VFXItemContent } from './vfx-item';
5
+ import type { ContentOptions } from './composition-source-manager';
6
+ import type { Region, TrackAsset } from './plugins';
7
+ import { ObjectBindingTrack } from './plugins';
7
8
  import { VFXItem } from './vfx-item';
9
+ export interface SceneBinding {
10
+ key: ObjectBindingTrack;
11
+ value: VFXItem;
12
+ }
13
+ export interface SceneBindingData {
14
+ key: spec.DataPath;
15
+ value: spec.DataPath;
16
+ }
8
17
  /**
9
18
  * @since 2.0.0
10
19
  * @internal
11
20
  */
12
21
  export declare class CompositionComponent extends ItemBehaviour {
22
+ time: number;
13
23
  startTime: number;
14
24
  refId: string;
15
- items: VFXItem<VFXItemContent>[];
16
- timelineComponents: TimelineComponent[];
17
- timelineComponent: TimelineComponent;
25
+ items: VFXItem[];
26
+ data: ContentOptions;
27
+ private reusable;
28
+ private sceneBindings;
29
+ private masterTracks;
30
+ private timelineAsset;
31
+ private timelinePlayable;
32
+ private graph;
18
33
  start(): void;
34
+ initializeTrackBindings(masterTracks: TrackAsset[]): void;
19
35
  update(dt: number): void;
20
36
  /**
21
37
  * 重置元素状态属性
@@ -24,4 +40,5 @@ export declare class CompositionComponent extends ItemBehaviour {
24
40
  createContent(): void;
25
41
  onDestroy(): void;
26
42
  hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
43
+ fromData(data: any): void;
27
44
  }
@@ -1,5 +1,5 @@
1
1
  import { EffectsObject } from '../effects-object';
2
- import type { VFXItem, VFXItemContent } from '../vfx-item';
2
+ import type { VFXItem } from '../vfx-item';
3
3
  /**
4
4
  * @since 2.0.0
5
5
  * @internal
@@ -9,7 +9,7 @@ export declare abstract class Component extends EffectsObject {
9
9
  /**
10
10
  * 附加到的 VFXItem 对象
11
11
  */
12
- item: VFXItem<VFXItemContent>;
12
+ item: VFXItem;
13
13
  /**
14
14
  * 附加到的 VFXItem 对象 Transform 组件
15
15
  */
@@ -1,4 +1,5 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { SceneBindingData } from './comp-vfx-item';
2
3
  import type { Engine } from './engine';
3
4
  import type { PluginSystem } from './plugin-system';
4
5
  import type { GlobalVolume } from './render';
@@ -15,6 +16,8 @@ export interface ContentOptions {
15
16
  camera: spec.CameraOptions;
16
17
  startTime: number;
17
18
  globalVolume: GlobalVolume;
19
+ timelineAsset: spec.DataPath;
20
+ sceneBindings: SceneBindingData[];
18
21
  }
19
22
  /**
20
23
  * 合成资源管理
@@ -11,7 +11,7 @@ import type { Scene, SceneType } from './scene';
11
11
  import type { Texture } from './texture';
12
12
  import { Transform } from './transform';
13
13
  import type { Disposable, LostHandler } from './utils';
14
- import type { VFXItemContent, VFXItemProps } from './vfx-item';
14
+ import type { VFXItemProps } from './vfx-item';
15
15
  import { VFXItem } from './vfx-item';
16
16
  export interface CompositionStatistic {
17
17
  loadTime: number;
@@ -30,13 +30,13 @@ export interface MessageItem {
30
30
  export interface CompositionHitTestOptions {
31
31
  maxCount?: number;
32
32
  stop?: (region: Region) => boolean;
33
- skip?: (item: VFXItem<VFXItemContent>) => boolean;
33
+ skip?: (item: VFXItem) => boolean;
34
34
  }
35
35
  export interface CompositionProps {
36
36
  reusable?: boolean;
37
37
  baseRenderOrder?: number;
38
38
  renderer: Renderer;
39
- onPlayerPause?: (item: VFXItem<any>) => void;
39
+ onPlayerPause?: (item: VFXItem) => void;
40
40
  onMessageItem?: (item: MessageItem) => void;
41
41
  onEnd?: (composition: Composition) => void;
42
42
  event?: EventSystem;
@@ -81,12 +81,12 @@ export declare class Composition implements Disposable, LostHandler {
81
81
  * 是否播放完成后销毁 texture 对象
82
82
  */
83
83
  keepResource: boolean;
84
- extraCamera: VFXItem<VFXItemContent>;
84
+ extraCamera: VFXItem;
85
85
  /**
86
86
  * 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
87
87
  * @internal
88
88
  */
89
- onPlayerPause?: (item: VFXItem<any>) => void;
89
+ onPlayerPause?: (item: VFXItem) => void;
90
90
  /**
91
91
  * 单个合成结束时的回调
92
92
  */
@@ -142,11 +142,11 @@ export declare class Composition implements Disposable, LostHandler {
142
142
  /**
143
143
  * 合成根元素
144
144
  */
145
- rootItem: VFXItem<VFXItemContent>;
145
+ rootItem: VFXItem;
146
146
  /**
147
147
  * 预合成数组
148
148
  */
149
- readonly refContent: VFXItem<VFXItemContent>[];
149
+ readonly refContent: VFXItem[];
150
150
  /**
151
151
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
152
152
  */
@@ -159,6 +159,7 @@ export declare class Composition implements Disposable, LostHandler {
159
159
  * 合成全局时间
160
160
  */
161
161
  globalTime: number;
162
+ editorScaleRatio: number;
162
163
  protected rendererOptions: MeshRendererOptions | null;
163
164
  protected assigned: boolean;
164
165
  /**
@@ -181,7 +182,6 @@ export declare class Composition implements Disposable, LostHandler {
181
182
  private readonly globalVolume;
182
183
  private readonly texInfo;
183
184
  private readonly postLoaders;
184
- private rootTimeline;
185
185
  /**
186
186
  * Composition 构造函数
187
187
  * @param props - composition 的创建参数
@@ -196,7 +196,7 @@ export declare class Composition implements Disposable, LostHandler {
196
196
  /**
197
197
  * 获取合成中所有元素
198
198
  */
199
- get items(): VFXItem<VFXItemContent>[];
199
+ get items(): VFXItem[];
200
200
  /**
201
201
  * 获取合成开始渲染的时间
202
202
  */
@@ -272,7 +272,7 @@ export declare class Composition implements Disposable, LostHandler {
272
272
  * @param time - 相对 startTime 的时间
273
273
  */
274
274
  setTime(time: number): void;
275
- addItem(item: VFXItem<VFXItemContent>): void;
275
+ addItem(item: VFXItem): void;
276
276
  /**
277
277
  * 前进合成到指定时间
278
278
  * @param time - 相对0时刻的时间
@@ -284,6 +284,7 @@ export declare class Composition implements Disposable, LostHandler {
284
284
  */
285
285
  protected reset(): void;
286
286
  prepareRender(): void;
287
+ private gatherRendererComponent;
287
288
  /**
288
289
  * 是否合成需要重新播放
289
290
  * @returns 重新播放合成标志位
@@ -300,6 +301,7 @@ export declare class Composition implements Disposable, LostHandler {
300
301
  * @param skipRender - 是否需要渲染
301
302
  */
302
303
  update(deltaTime: number, skipRender?: boolean): void;
304
+ private toLocalTime;
303
305
  private getUpdateTime;
304
306
  private callStart;
305
307
  private callUpdate;
@@ -329,7 +331,7 @@ export declare class Composition implements Disposable, LostHandler {
329
331
  * @param name - 元素名称
330
332
  * @returns 元素对象
331
333
  */
332
- getItemByName(name: string): VFXItem<VFXItemContent> | undefined;
334
+ getItemByName(name: string): VFXItem | undefined;
333
335
  /**
334
336
  * 获取指定位置和相机连成的射线
335
337
  * @param x
@@ -355,13 +357,13 @@ export declare class Composition implements Disposable, LostHandler {
355
357
  * @param item - 交互元素
356
358
  * @param type - 交互类型
357
359
  */
358
- addInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): string | undefined;
360
+ addInteractiveItem(item: VFXItem, type: spec.InteractType): string | undefined;
359
361
  /**
360
362
  * InteractItem 生命周期结束时的调用
361
363
  * @param item - 交互元素
362
364
  * @param type - 交互类型
363
365
  */
364
- removeInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): void;
366
+ removeInteractiveItem(item: VFXItem, type: spec.InteractType): void;
365
367
  /**
366
368
  * 销毁插件 Item 中保存的纹理数组
367
369
  * @internal
@@ -373,7 +375,7 @@ export declare class Composition implements Disposable, LostHandler {
373
375
  * @internal
374
376
  * @param item - 需要销毁的 item
375
377
  */
376
- destroyItem(item: VFXItem<VFXItemContent>): void;
378
+ destroyItem(item: VFXItem): void;
377
379
  lost(e: Event): void;
378
380
  /**
379
381
  * 合成对象销毁
@@ -391,6 +393,15 @@ export declare class Composition implements Disposable, LostHandler {
391
393
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
392
394
  */
393
395
  translateByPixel(x: number, y: number): void;
396
+ /**
397
+ * 设置合成在画布上的像素位置
398
+ * Tips:
399
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
400
+ * - 设置后会覆盖原有的位置信息
401
+ * @param x - x 坐标
402
+ * @param y - y 坐标
403
+ */
404
+ setPositionByPixel(x: number, y: number): void;
394
405
  /**
395
406
  * 设置合成在 3D 坐标轴上相对当前的位移
396
407
  */
@@ -1,4 +1,4 @@
1
1
  export declare const effectsClassStore: Record<string, any>;
2
2
  export declare function getMergedStore(target: any): any;
3
- export declare function serialize(sourceName?: string): (target: any, propertyKey: any) => void;
3
+ export declare function serialize(type?: string, sourceName?: string): (target: any, propertyKey: any) => void;
4
4
  export declare function effectsClass(className: any): (target: any, context?: any) => void;
package/dist/engine.d.ts CHANGED
@@ -5,10 +5,10 @@ import type { EffectsObject } from './effects-object';
5
5
  import type { Material } from './material';
6
6
  import type { GPUCapability, Geometry, Mesh, RenderPass, Renderer, ShaderLibrary } from './render';
7
7
  import type { Scene } from './scene';
8
- import { Texture } from './texture';
8
+ import type { Texture } from './texture';
9
9
  import type { Disposable } from './utils';
10
10
  /**
11
- * Engine 基类,负责维护所有 GPU 资源的销毁
11
+ * Engine 基类,负责维护所有 GPU 资源的管理及销毁
12
12
  */
13
13
  export declare class Engine implements Disposable {
14
14
  renderer: Renderer;
@@ -19,6 +19,10 @@ export declare class Engine implements Disposable {
19
19
  objectInstance: Record<string, EffectsObject>;
20
20
  assetLoader: AssetLoader;
21
21
  database?: Database;
22
+ /**
23
+ * 渲染过程中错误队列
24
+ */
25
+ renderErrors: Set<Error>;
22
26
  protected destroyed: boolean;
23
27
  protected textures: Texture[];
24
28
  protected materials: Material[];
@@ -37,7 +41,7 @@ export declare class Engine implements Disposable {
37
41
  getInstance(id: string): EffectsObject;
38
42
  removeInstance(id: string): void;
39
43
  addPackageDatas(scene: Scene): void;
40
- createVFXItemsAsync(scene: Scene): Promise<void>;
44
+ createVFXItems(scene: Scene): Promise<void>;
41
45
  addTexture(tex: Texture): void;
42
46
  removeTexture(tex: Texture): void;
43
47
  addMaterial(mat: Material): void;
@@ -50,7 +54,6 @@ export declare class Engine implements Disposable {
50
54
  removeRenderPass(pass: RenderPass): void;
51
55
  get isDestroyed(): boolean;
52
56
  getShaderLibrary(): ShaderLibrary;
53
- private createDefaultTexture;
54
57
  /**
55
58
  * 销毁所有缓存的资源
56
59
  */
@@ -1,4 +1,4 @@
1
- import type { JSONScene, JSONSceneLegacy, BaseContent } from '@galacean/effects-specification';
1
+ import type { BaseContent, JSONScene, JSONSceneLegacy } from '@galacean/effects-specification';
2
2
  /**
3
3
  * 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
4
4
  */
@@ -1,3 +1,4 @@
1
+ export type GLType = 'webgl' | 'webgl2';
1
2
  /**
2
3
  * Helper class to create a WebGL Context
3
4
  *
@@ -6,4 +7,4 @@
6
7
  * @param options
7
8
  * @returns
8
9
  */
9
- export declare function createGLContext(canvas: HTMLCanvasElement | OffscreenCanvas, glType: "webgl" | "webgl2" | undefined, options: WebGLContextAttributes): WebGLRenderingContext | WebGL2RenderingContext;
10
+ export declare function createGLContext(canvas: HTMLCanvasElement | OffscreenCanvas, glType: GLType | undefined, options: WebGLContextAttributes): WebGLRenderingContext | WebGL2RenderingContext;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export * as math from '@galacean/effects-math/es/core/index';
2
2
  export * as spec from '@galacean/effects-specification';
3
- export { getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, ensureFixedNumber, normalizeColor, } from './fallback';
3
+ export * from './asset-loader';
4
4
  export * from './asset-manager';
5
5
  export * from './camera';
6
+ export * from './canvas-pool';
6
7
  export * from './comp-vfx-item';
7
8
  export * from './components';
8
9
  export * from './composition';
@@ -10,10 +11,10 @@ export * from './composition-source-manager';
10
11
  export * from './config';
11
12
  export * from './constants';
12
13
  export * from './decorators';
13
- export * from './asset-loader';
14
14
  export * from './downloader';
15
15
  export * from './effects-object';
16
16
  export * from './engine';
17
+ export { ensureFixedNumber, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, normalizeColor } from './fallback';
17
18
  export * from './gl';
18
19
  export * from './material';
19
20
  export * from './math';
@@ -22,13 +23,13 @@ export * from './plugin-system';
22
23
  export * from './plugins';
23
24
  export * from './render';
24
25
  export * from './scene';
26
+ export * from './serialization-helper';
25
27
  export * from './shader';
26
28
  export * from './shape';
27
29
  export * from './template-image';
28
30
  export * from './texture';
29
- export * from './serialization-helper';
30
31
  export * from './ticker';
31
32
  export * from './transform';
32
33
  export * from './utils';
33
34
  export * from './vfx-item';
34
- export * from './canvas-pool';
35
+ export * from './binary-asset';