@galacean/effects-core 2.7.3 → 2.8.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.
- package/dist/asset-manager.d.ts +5 -5
- package/dist/components/index.d.ts +1 -0
- package/dist/components/position-constraint.d.ts +92 -0
- package/dist/composition.d.ts +6 -7
- package/dist/constants.d.ts +4 -0
- package/dist/downloader.d.ts +7 -0
- package/dist/engine.d.ts +67 -6
- package/dist/events/types.d.ts +31 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2726 -2126
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2720 -2123
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/interact/click-handler.d.ts +14 -2
- package/dist/plugins/interact/event-system.d.ts +16 -3
- package/dist/plugins/plugin.d.ts +0 -49
- package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
- package/dist/plugins/text/base-layout.d.ts +13 -0
- package/dist/plugins/text/index.d.ts +2 -0
- package/dist/plugins/text/text-component-base.d.ts +61 -0
- package/dist/plugins/text/text-item.d.ts +25 -100
- package/dist/plugins/text/text-layout.d.ts +9 -19
- package/dist/plugins/text/text-style.d.ts +2 -1
- package/dist/render/draw-object-pass.d.ts +8 -0
- package/dist/render/framebuffer.d.ts +0 -4
- package/dist/render/gpu-capability.d.ts +17 -5
- package/dist/render/index.d.ts +1 -0
- package/dist/render/post-process-pass.d.ts +14 -5
- package/dist/render/render-frame.d.ts +8 -31
- package/dist/render/render-pass.d.ts +0 -26
- package/dist/render/renderer.d.ts +5 -18
- package/dist/scene-loader.d.ts +7 -0
- package/dist/texture/index.d.ts +1 -1
- package/dist/texture/texture-loader.d.ts +60 -0
- package/dist/transform.d.ts +8 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/vfx-item.d.ts +10 -3
- package/package.json +2 -2
- package/dist/texture/ktx-texture.d.ts +0 -21
package/dist/asset-manager.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { Renderer } from './render';
|
|
|
9
9
|
* 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
|
|
10
10
|
*/
|
|
11
11
|
export declare class AssetManager implements Disposable {
|
|
12
|
-
options:
|
|
12
|
+
options: SceneLoadOptions;
|
|
13
13
|
private readonly downloader;
|
|
14
14
|
/**
|
|
15
15
|
* 相对 url 的基本路径
|
|
@@ -40,16 +40,16 @@ export declare class AssetManager implements Disposable {
|
|
|
40
40
|
/**
|
|
41
41
|
* 字体加载方法
|
|
42
42
|
* @param fonts - 字体定义数组
|
|
43
|
-
* @param [
|
|
43
|
+
* @param [baseUrl=location.href] - URL 的 base 字段
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
|
-
static loadFontFamily(fonts: spec.FontDefine[],
|
|
46
|
+
static loadFontFamily(fonts: spec.FontDefine[], baseUrl?: string): Promise<void[] | undefined>;
|
|
47
47
|
/**
|
|
48
48
|
* 构造函数
|
|
49
49
|
* @param options - 场景加载参数
|
|
50
50
|
* @param downloader - 资源下载对象
|
|
51
51
|
*/
|
|
52
|
-
constructor(options?:
|
|
52
|
+
constructor(options?: SceneLoadOptions, downloader?: Downloader);
|
|
53
53
|
updateOptions(options?: SceneLoadOptions): void;
|
|
54
54
|
/**
|
|
55
55
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
@@ -59,7 +59,7 @@ export declare class AssetManager implements Disposable {
|
|
|
59
59
|
* @returns
|
|
60
60
|
*/
|
|
61
61
|
loadScene(url: Scene.LoadType, renderer?: Renderer, options?: {
|
|
62
|
-
env
|
|
62
|
+
env?: string;
|
|
63
63
|
}): Promise<Scene>;
|
|
64
64
|
getAssets(): Record<string, ImageLike>;
|
|
65
65
|
private processJSON;
|
|
@@ -2,6 +2,7 @@ export * from './animator';
|
|
|
2
2
|
export * from './renderer-component';
|
|
3
3
|
export * from './component';
|
|
4
4
|
export * from './effect-component';
|
|
5
|
+
export * from './position-constraint';
|
|
5
6
|
export * from './post-process-volume';
|
|
6
7
|
export * from './base-render-component';
|
|
7
8
|
export * from './shape-component';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { VFXItem } from '../vfx-item';
|
|
2
|
+
import { Component } from './component';
|
|
3
|
+
import type { ComponentData } from '@galacean/effects-specification';
|
|
4
|
+
import type * as spec from '@galacean/effects-specification';
|
|
5
|
+
export declare class ConstraintTarget {
|
|
6
|
+
target: VFXItem | null;
|
|
7
|
+
weight: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ConstraintTargetData {
|
|
10
|
+
target: spec.DataPath;
|
|
11
|
+
weight: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PositionConstraintData extends ComponentData {
|
|
14
|
+
positionAtRest: spec.Vector3Data;
|
|
15
|
+
positionOffset: spec.Vector3Data;
|
|
16
|
+
weight: number;
|
|
17
|
+
constrainX: boolean;
|
|
18
|
+
constrainY: boolean;
|
|
19
|
+
constrainZ: boolean;
|
|
20
|
+
targets: ConstraintTargetData[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 位置约束组件
|
|
24
|
+
* 用于约束物体跟随目标对象的位置
|
|
25
|
+
*/
|
|
26
|
+
export declare class PositionConstraint extends Component {
|
|
27
|
+
/**
|
|
28
|
+
* 初始位置(当前元素的初始世界位置)
|
|
29
|
+
*/
|
|
30
|
+
private positionAtRest;
|
|
31
|
+
/**
|
|
32
|
+
* 位置偏移
|
|
33
|
+
*/
|
|
34
|
+
private positionOffset;
|
|
35
|
+
/**
|
|
36
|
+
* 约束权重 (0-1)
|
|
37
|
+
*/
|
|
38
|
+
private weight;
|
|
39
|
+
/**
|
|
40
|
+
* 是否约束 X 轴
|
|
41
|
+
*/
|
|
42
|
+
private constrainX;
|
|
43
|
+
/**
|
|
44
|
+
* 是否约束 Y 轴
|
|
45
|
+
*/
|
|
46
|
+
private constrainY;
|
|
47
|
+
/**
|
|
48
|
+
* 是否约束 Z 轴
|
|
49
|
+
*/
|
|
50
|
+
private constrainZ;
|
|
51
|
+
/**
|
|
52
|
+
* 约束目标
|
|
53
|
+
*/
|
|
54
|
+
private targets;
|
|
55
|
+
onStart(): void;
|
|
56
|
+
onUpdate(dt: number): void;
|
|
57
|
+
/**
|
|
58
|
+
* 添加约束目标
|
|
59
|
+
* @param target - 目标元素
|
|
60
|
+
* @param weight - 权重值 (0-1)
|
|
61
|
+
*/
|
|
62
|
+
addTarget(target: VFXItem, weight?: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* 移除约束目标
|
|
65
|
+
* @param target - 要移除的目标元素
|
|
66
|
+
*/
|
|
67
|
+
removeTarget(target: VFXItem): void;
|
|
68
|
+
/**
|
|
69
|
+
* 清除所有约束目标
|
|
70
|
+
*/
|
|
71
|
+
clearTargets(): void;
|
|
72
|
+
/**
|
|
73
|
+
* 设置位置偏移
|
|
74
|
+
* @param x - X 轴偏移
|
|
75
|
+
* @param y - Y 轴偏移
|
|
76
|
+
* @param z - Z 轴偏移
|
|
77
|
+
*/
|
|
78
|
+
setPositionOffset(x: number, y: number, z: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* 设置全局约束权重
|
|
81
|
+
* @param weight - 权重值 (0-1),0 表示保持初始位置,1 表示完全跟随目标
|
|
82
|
+
*/
|
|
83
|
+
setWeight(weight: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* 线性插值
|
|
86
|
+
* @param start - 起始值
|
|
87
|
+
* @param end - 结束值
|
|
88
|
+
* @param t - 插值因子 (0-1)
|
|
89
|
+
*/
|
|
90
|
+
private lerp;
|
|
91
|
+
fromData(data: PositionConstraintData): void;
|
|
92
|
+
}
|
package/dist/composition.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
|
4
4
|
import { Camera } from './camera';
|
|
5
5
|
import { CompositionComponent } from './comp-vfx-item';
|
|
6
6
|
import type { PluginSystem } from './plugin-system';
|
|
7
|
-
import type { EventSystem,
|
|
7
|
+
import type { EventSystem, Region } from './plugins';
|
|
8
8
|
import type { Renderer } from './render';
|
|
9
9
|
import { RenderFrame } from './render';
|
|
10
10
|
import type { Scene } from './scene';
|
|
@@ -96,7 +96,7 @@ export interface CompositionProps {
|
|
|
96
96
|
* @param message
|
|
97
97
|
* @returns
|
|
98
98
|
*/
|
|
99
|
-
|
|
99
|
+
onItemMessage?: (message: MessageItem) => void;
|
|
100
100
|
/**
|
|
101
101
|
*
|
|
102
102
|
*/
|
|
@@ -215,6 +215,10 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
215
215
|
* 是否开启后处理
|
|
216
216
|
*/
|
|
217
217
|
postProcessingEnabled: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* 合成中消息元素创建/销毁时触发的回调
|
|
220
|
+
*/
|
|
221
|
+
onItemMessage?: (message: MessageItem) => void;
|
|
218
222
|
/**
|
|
219
223
|
* 销毁状态位
|
|
220
224
|
*/
|
|
@@ -223,7 +227,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
223
227
|
* 是否是否每次渲染时清除 RenderFrame 颜色缓存
|
|
224
228
|
*/
|
|
225
229
|
protected readonly keepColorBuffer: boolean;
|
|
226
|
-
protected readonly postLoaders: Plugin[];
|
|
227
230
|
protected rootComposition: CompositionComponent;
|
|
228
231
|
/**
|
|
229
232
|
* 合成暂停/播放 标识
|
|
@@ -232,10 +235,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
232
235
|
private isEndCalled;
|
|
233
236
|
private _textures;
|
|
234
237
|
private videos;
|
|
235
|
-
/**
|
|
236
|
-
* 合成中消息元素创建/销毁时触发的回调
|
|
237
|
-
*/
|
|
238
|
-
private handleItemMessage;
|
|
239
238
|
/**
|
|
240
239
|
* Composition 构造函数
|
|
241
240
|
* @param props - composition 的创建参数
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,4 +7,8 @@ export declare const PLAYER_OPTIONS_ENV_EDITOR = "editor";
|
|
|
7
7
|
export declare const HELP_LINK: {
|
|
8
8
|
'Item duration can\'t be less than 0': string;
|
|
9
9
|
'ValueType: 21/22 is not supported': string;
|
|
10
|
+
'Container size overflowed': string;
|
|
11
|
+
'Container is not an HTMLElement': string;
|
|
12
|
+
'Invalid container size': string;
|
|
13
|
+
'DPI overflowed': string;
|
|
10
14
|
};
|
package/dist/downloader.d.ts
CHANGED
|
@@ -52,6 +52,13 @@ export declare class Downloader {
|
|
|
52
52
|
* @param onError - 下载失败后的回调函数
|
|
53
53
|
*/
|
|
54
54
|
downloadBlob(url: string, onSuccess: SuccessHandler<Blob>, onError: ErrorHandler): void;
|
|
55
|
+
/**
|
|
56
|
+
* 下载一个文本文件
|
|
57
|
+
* @param url - 要下载的文本文件的 URL
|
|
58
|
+
* @param onSuccess - 下载成功后的回调函数
|
|
59
|
+
* @param onError - 下载失败后的回调函数
|
|
60
|
+
*/
|
|
61
|
+
downloadText(url: string, onSuccess: SuccessHandler<string>, onError: ErrorHandler): void;
|
|
55
62
|
private download;
|
|
56
63
|
private start;
|
|
57
64
|
private finish;
|
package/dist/engine.d.ts
CHANGED
|
@@ -6,10 +6,46 @@ import type { GPUCapability, Geometry, Mesh, RenderPass, Renderer, ShaderLibrary
|
|
|
6
6
|
import type { Scene, SceneRenderLevel } from './scene';
|
|
7
7
|
import type { Texture } from './texture';
|
|
8
8
|
import type { Disposable } from './utils';
|
|
9
|
+
import type { Composition } from './composition';
|
|
10
|
+
import type { AssetManager } from './asset-manager';
|
|
11
|
+
import { AssetService } from './asset-service';
|
|
12
|
+
import { Ticker } from './ticker';
|
|
13
|
+
import { EventSystem } from './plugins/interact/event-system';
|
|
14
|
+
import type { GLType } from './gl/create-gl-context';
|
|
15
|
+
import type { PointerEventData, Region } from './plugins/interact/click-handler';
|
|
16
|
+
import { EventEmitter } from './events';
|
|
17
|
+
export interface EngineOptions extends WebGLContextAttributes {
|
|
18
|
+
name?: string;
|
|
19
|
+
glType?: GLType;
|
|
20
|
+
fps?: number;
|
|
21
|
+
env?: string;
|
|
22
|
+
manualRender?: boolean;
|
|
23
|
+
pixelRatio?: number;
|
|
24
|
+
notifyTouch?: boolean;
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
}
|
|
27
|
+
type EngineEvent = {
|
|
28
|
+
contextlost: [eventData: {
|
|
29
|
+
engine: Engine;
|
|
30
|
+
e: Event;
|
|
31
|
+
}];
|
|
32
|
+
contextrestored: [engine: Engine];
|
|
33
|
+
rendererror: [e: Event | Error];
|
|
34
|
+
resize: [Engine];
|
|
35
|
+
click: [eventData: Region];
|
|
36
|
+
pointerdown: [eventData: PointerEventData];
|
|
37
|
+
pointerup: [eventData: PointerEventData];
|
|
38
|
+
pointermove: [eventData: PointerEventData];
|
|
39
|
+
};
|
|
9
40
|
/**
|
|
10
41
|
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
11
42
|
*/
|
|
12
|
-
export declare class Engine implements Disposable {
|
|
43
|
+
export declare class Engine extends EventEmitter<EngineEvent> implements Disposable {
|
|
44
|
+
name: string;
|
|
45
|
+
speed: number;
|
|
46
|
+
displayAspect: number;
|
|
47
|
+
displayScale: number;
|
|
48
|
+
offscreenMode: boolean;
|
|
13
49
|
/**
|
|
14
50
|
* 渲染器
|
|
15
51
|
*/
|
|
@@ -31,21 +67,37 @@ export declare class Engine implements Disposable {
|
|
|
31
67
|
* 渲染过程中错误队列
|
|
32
68
|
*/
|
|
33
69
|
renderErrors: Set<Error>;
|
|
34
|
-
|
|
70
|
+
compositions: Composition[];
|
|
71
|
+
assetManagers: AssetManager[];
|
|
72
|
+
assetService: AssetService;
|
|
73
|
+
eventSystem: EventSystem;
|
|
74
|
+
env: string;
|
|
75
|
+
/**
|
|
76
|
+
* 计时器
|
|
77
|
+
* 手动渲染 `manualRender=true` 时不创建计时器
|
|
78
|
+
*/
|
|
79
|
+
ticker: Ticker | null;
|
|
80
|
+
canvas: HTMLCanvasElement;
|
|
81
|
+
/**
|
|
82
|
+
* 引擎的像素比
|
|
83
|
+
*/
|
|
84
|
+
pixelRatio: number;
|
|
85
|
+
protected _disposed: boolean;
|
|
35
86
|
protected textures: Texture[];
|
|
36
87
|
protected materials: Material[];
|
|
37
88
|
protected geometries: Geometry[];
|
|
38
89
|
protected meshes: Mesh[];
|
|
39
90
|
protected renderPasses: RenderPass[];
|
|
40
91
|
private assetLoader;
|
|
92
|
+
get disposed(): boolean;
|
|
41
93
|
/**
|
|
42
94
|
*
|
|
43
95
|
*/
|
|
44
|
-
constructor();
|
|
96
|
+
constructor(canvas: HTMLCanvasElement, options?: EngineOptions);
|
|
45
97
|
/**
|
|
46
98
|
* 创建 Engine 对象。
|
|
47
99
|
*/
|
|
48
|
-
static create: (
|
|
100
|
+
static create: (canvas: HTMLCanvasElement, options?: EngineOptions) => Engine;
|
|
49
101
|
clearResources(): void;
|
|
50
102
|
addEffectsObjectData(data: spec.EffectsObjectData): void;
|
|
51
103
|
findEffectsObjectData(uuid: string): spec.EffectsObjectData;
|
|
@@ -56,7 +108,14 @@ export declare class Engine implements Disposable {
|
|
|
56
108
|
findObject<T>(guid: spec.DataPath): T;
|
|
57
109
|
removeInstance(id: string): void;
|
|
58
110
|
addPackageDatas(scene: Scene): void;
|
|
59
|
-
|
|
111
|
+
runRenderLoop(renderFunction: (dt: number) => void): void;
|
|
112
|
+
render(dt: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* 将渲染器重新和父容器大小对齐
|
|
115
|
+
*/
|
|
116
|
+
resize(): void;
|
|
117
|
+
setSize(width: number, height: number): void;
|
|
118
|
+
private getTargetSize;
|
|
60
119
|
addTexture(tex: Texture): void;
|
|
61
120
|
removeTexture(tex: Texture): void;
|
|
62
121
|
addMaterial(mat: Material): void;
|
|
@@ -67,10 +126,12 @@ export declare class Engine implements Disposable {
|
|
|
67
126
|
removeMesh(mesh: Mesh): void;
|
|
68
127
|
addRenderPass(pass: RenderPass): void;
|
|
69
128
|
removeRenderPass(pass: RenderPass): void;
|
|
70
|
-
|
|
129
|
+
addComposition(composition: Composition): void;
|
|
130
|
+
removeComposition(composition: Composition): void;
|
|
71
131
|
getShaderLibrary(): ShaderLibrary;
|
|
72
132
|
/**
|
|
73
133
|
* 销毁所有缓存的资源
|
|
74
134
|
*/
|
|
75
135
|
dispose(): void;
|
|
76
136
|
}
|
|
137
|
+
export {};
|
package/dist/events/types.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { MessageItem } from '../composition';
|
|
2
|
-
import type { Region } from '../plugins';
|
|
2
|
+
import type { PointerEventData, Region } from '../plugins';
|
|
3
|
+
export type PointerEvent = {
|
|
4
|
+
/**
|
|
5
|
+
* 按下事件
|
|
6
|
+
*/
|
|
7
|
+
['pointerdown']: [eventData: PointerEventData];
|
|
8
|
+
/**
|
|
9
|
+
* 抬起事件
|
|
10
|
+
*/
|
|
11
|
+
['pointerup']: [eventData: PointerEventData];
|
|
12
|
+
/**
|
|
13
|
+
* 移动事件
|
|
14
|
+
*/
|
|
15
|
+
['pointermove']: [eventData: PointerEventData];
|
|
16
|
+
};
|
|
3
17
|
/**
|
|
4
18
|
* Item 可以绑定的事件
|
|
5
19
|
*/
|
|
6
|
-
export type ItemEvent = {
|
|
20
|
+
export type ItemEvent = PointerEvent & {
|
|
7
21
|
/**
|
|
8
22
|
* 元素点击事件(编辑器设置交互行为“消息通知”)
|
|
9
23
|
*/
|
|
@@ -17,13 +31,19 @@ export type ItemEvent = {
|
|
|
17
31
|
/**
|
|
18
32
|
* Composition 可以绑定的事件
|
|
19
33
|
*/
|
|
20
|
-
export type CompositionEvent<C> = {
|
|
34
|
+
export type CompositionEvent<C> = PointerEvent & {
|
|
21
35
|
/**
|
|
22
36
|
* 合成点击事件
|
|
23
37
|
*/
|
|
24
38
|
['click']: [
|
|
25
39
|
clickInfo: Region & {
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated 2.8.0
|
|
42
|
+
*/
|
|
26
43
|
compositionName: string;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated 2.8.0
|
|
46
|
+
*/
|
|
27
47
|
compositionId: string;
|
|
28
48
|
}
|
|
29
49
|
];
|
|
@@ -44,9 +64,14 @@ export type CompositionEvent<C> = {
|
|
|
44
64
|
* 合成行为为循环时每次循环结束都会触发
|
|
45
65
|
* 合成行为为销毁/冻结时只会触发一次
|
|
46
66
|
*/
|
|
47
|
-
['end']: [
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
['end']: [
|
|
68
|
+
endInfo: {
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated 2.8.0
|
|
71
|
+
*/
|
|
72
|
+
composition: C;
|
|
73
|
+
}
|
|
74
|
+
];
|
|
50
75
|
/**
|
|
51
76
|
* 时间跳转事件
|
|
52
77
|
* 用于在合成中跳转到指定时间
|
package/dist/index.d.ts
CHANGED