@galacean/effects-core 2.0.0-alpha.11 → 2.0.0-alpha.13

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 (61) hide show
  1. package/dist/asset-loader.d.ts +0 -6
  2. package/dist/binary-asset.d.ts +6 -0
  3. package/dist/comp-vfx-item.d.ts +23 -6
  4. package/dist/components/component.d.ts +2 -2
  5. package/dist/composition-source-manager.d.ts +3 -0
  6. package/dist/composition.d.ts +25 -20
  7. package/dist/decorators.d.ts +1 -1
  8. package/dist/engine.d.ts +7 -4
  9. package/dist/fallback/migration.d.ts +1 -1
  10. package/dist/fallback/utils.d.ts +0 -11
  11. package/dist/gl/create-gl-context.d.ts +2 -1
  12. package/dist/gl/index.d.ts +3 -0
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.js +14219 -13190
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +11976 -10966
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/math/bezier.d.ts +15 -0
  19. package/dist/math/translate.d.ts +3 -2
  20. package/dist/math/value-getter.d.ts +25 -1
  21. package/dist/plugin-system.d.ts +1 -1
  22. package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
  23. package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
  24. package/dist/plugins/cal/animation-playable.d.ts +2 -1
  25. package/dist/plugins/cal/calculate-item.d.ts +7 -26
  26. package/dist/plugins/cal/calculate-vfx-item.d.ts +53 -13
  27. package/dist/plugins/cal/playable-graph.d.ts +72 -21
  28. package/dist/plugins/cal/timeline-asset.d.ts +28 -0
  29. package/dist/plugins/camera/camera-controller-node.d.ts +0 -11
  30. package/dist/plugins/index.d.ts +5 -1
  31. package/dist/plugins/interact/click-handler.d.ts +2 -2
  32. package/dist/plugins/interact/event-system.d.ts +0 -2
  33. package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
  34. package/dist/plugins/particle/particle-system.d.ts +1 -1
  35. package/dist/plugins/particle/particle-vfx-item.d.ts +7 -3
  36. package/dist/plugins/plugin.d.ts +6 -6
  37. package/dist/plugins/sprite/sprite-item.d.ts +14 -9
  38. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +8 -0
  39. package/dist/plugins/timeline/track.d.ts +73 -0
  40. package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
  41. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  42. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  43. package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
  44. package/dist/render/geometry.d.ts +14 -1
  45. package/dist/render/gpu-capability.d.ts +6 -6
  46. package/dist/render/index.d.ts +2 -2
  47. package/dist/render/render-frame.d.ts +4 -4
  48. package/dist/render/render-pass.d.ts +8 -8
  49. package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
  50. package/dist/render/renderer.d.ts +7 -6
  51. package/dist/render/semantic-map.d.ts +1 -1
  52. package/dist/texture/texture.d.ts +2 -0
  53. package/dist/texture/types.d.ts +2 -2
  54. package/dist/ticker.d.ts +2 -2
  55. package/dist/utils/device.d.ts +1 -0
  56. package/dist/utils/index.d.ts +1 -1
  57. package/dist/utils/text.d.ts +8 -0
  58. package/dist/vfx-item.d.ts +27 -44
  59. package/package.json +3 -3
  60. package/dist/plugins/cal/track.d.ts +0 -34
  61. package/dist/utils/timeline-component.d.ts +0 -6
@@ -17,12 +17,6 @@ export declare class AssetLoader {
17
17
  export declare class Database {
18
18
  loadGUID(guid: string): Promise<EffectsObject | undefined>;
19
19
  }
20
- export interface GeometryData extends spec.EffectsObjectData {
21
- vertexData: spec.VertexData;
22
- indexFormat: number;
23
- indexOffset: number;
24
- buffer: string;
25
- }
26
20
  export interface EffectComponentData extends spec.EffectsObjectData {
27
21
  _priority: number;
28
22
  item: spec.DataPath;
@@ -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 的创建参数
@@ -189,12 +189,6 @@ export declare class Composition implements Disposable, LostHandler {
189
189
  * @param compositionSourceManager
190
190
  */
191
191
  constructor(props: CompositionProps, scene: Scene, compositionSourceManager: CompositionSourceManager);
192
- /**
193
- * 合成结束回调
194
- * @param {(composition: Composition) => void} func
195
- * @deprecated since 2.0 - use `onEnd` instead
196
- */
197
- set handleEnd(func: (composition: Composition) => void);
198
192
  /**
199
193
  * 获取场景中的纹理数组
200
194
  */
@@ -202,7 +196,7 @@ export declare class Composition implements Disposable, LostHandler {
202
196
  /**
203
197
  * 获取合成中所有元素
204
198
  */
205
- get items(): VFXItem<VFXItemContent>[];
199
+ get items(): VFXItem[];
206
200
  /**
207
201
  * 获取合成开始渲染的时间
208
202
  */
@@ -278,7 +272,7 @@ export declare class Composition implements Disposable, LostHandler {
278
272
  * @param time - 相对 startTime 的时间
279
273
  */
280
274
  setTime(time: number): void;
281
- addItem(item: VFXItem<VFXItemContent>): void;
275
+ addItem(item: VFXItem): void;
282
276
  /**
283
277
  * 前进合成到指定时间
284
278
  * @param time - 相对0时刻的时间
@@ -290,6 +284,7 @@ export declare class Composition implements Disposable, LostHandler {
290
284
  */
291
285
  protected reset(): void;
292
286
  prepareRender(): void;
287
+ private gatherRendererComponent;
293
288
  /**
294
289
  * 是否合成需要重新播放
295
290
  * @returns 重新播放合成标志位
@@ -306,6 +301,7 @@ export declare class Composition implements Disposable, LostHandler {
306
301
  * @param skipRender - 是否需要渲染
307
302
  */
308
303
  update(deltaTime: number, skipRender?: boolean): void;
304
+ private toLocalTime;
309
305
  private getUpdateTime;
310
306
  private callStart;
311
307
  private callUpdate;
@@ -335,7 +331,7 @@ export declare class Composition implements Disposable, LostHandler {
335
331
  * @param name - 元素名称
336
332
  * @returns 元素对象
337
333
  */
338
- getItemByName(name: string): VFXItem<VFXItemContent> | undefined;
334
+ getItemByName(name: string): VFXItem | undefined;
339
335
  /**
340
336
  * 获取指定位置和相机连成的射线
341
337
  * @param x
@@ -361,13 +357,13 @@ export declare class Composition implements Disposable, LostHandler {
361
357
  * @param item - 交互元素
362
358
  * @param type - 交互类型
363
359
  */
364
- addInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): string | undefined;
360
+ addInteractiveItem(item: VFXItem, type: spec.InteractType): string | undefined;
365
361
  /**
366
362
  * InteractItem 生命周期结束时的调用
367
363
  * @param item - 交互元素
368
364
  * @param type - 交互类型
369
365
  */
370
- removeInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): void;
366
+ removeInteractiveItem(item: VFXItem, type: spec.InteractType): void;
371
367
  /**
372
368
  * 销毁插件 Item 中保存的纹理数组
373
369
  * @internal
@@ -379,7 +375,7 @@ export declare class Composition implements Disposable, LostHandler {
379
375
  * @internal
380
376
  * @param item - 需要销毁的 item
381
377
  */
382
- destroyItem(item: VFXItem<VFXItemContent>): void;
378
+ destroyItem(item: VFXItem): void;
383
379
  lost(e: Event): void;
384
380
  /**
385
381
  * 合成对象销毁
@@ -397,6 +393,15 @@ export declare class Composition implements Disposable, LostHandler {
397
393
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
398
394
  */
399
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;
400
405
  /**
401
406
  * 设置合成在 3D 坐标轴上相对当前的位移
402
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,17 +1,6 @@
1
1
  import type { FixedNumberExpression, RGBAColorValue, ColorExpression, NumberExpression, GradientColor, FixedVec3Expression, vec4, vec3, BezierKeyframeValue, vec2 } from '@galacean/effects-specification';
2
2
  import { ParticleOrigin } from '@galacean/effects-specification';
3
3
  export declare function arrAdd<T>(arr: T[], item: T): boolean | undefined;
4
- /**
5
- * @deprecated 请直接使用 Array.prototype.forEach 或 for...of
6
- * @param object
7
- * @param callback
8
- * @returns the mutated input object
9
- */
10
- export declare function forEach<T>(object: null | undefined | {
11
- [key: string]: T | Record<any, T>;
12
- }, callback: (val: T, key: string) => void, thisObj?: any): {
13
- [key: string]: T | Record<any, T>;
14
- } | null | undefined;
15
4
  export declare function ensureFixedNumber(a: any): FixedNumberExpression | undefined;
16
5
  export declare function ensureFixedNumberWithRandom(a: any, p: number): FixedNumberExpression | undefined;
17
6
  export declare function ensureRGBAValue(a: any): RGBAColorValue;
@@ -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;
@@ -1,6 +1,9 @@
1
+ import * as spec from '@galacean/effects-specification';
1
2
  export * from './create-gl-context';
2
3
  export * from './gpu-time';
3
4
  export declare const initErrors: string[];
4
5
  export declare const glContext: WebGL2RenderingContext;
5
6
  export declare function initGLContext(): void;
6
7
  export declare function isWebGL2(gl: WebGLRenderingContext | WebGL2RenderingContext): gl is WebGL2RenderingContext;
8
+ export declare function vertexFormatType2GLType(formatType: spec.VertexFormatType): spec.BufferType;
9
+ export declare function glType2VertexFormatType(webglType: spec.BufferType): spec.VertexFormatType;
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';