@galacean/effects-core 2.0.0-alpha.2 → 2.0.0-alpha.21
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-loader.d.ts +8 -90
- package/dist/asset-manager.d.ts +1 -80
- package/dist/asset-migrations.d.ts +1 -3
- package/dist/binary-asset.d.ts +6 -0
- package/dist/camera.d.ts +5 -1
- package/dist/canvas-pool.d.ts +10 -0
- package/dist/comp-vfx-item.d.ts +24 -10
- package/dist/components/component.d.ts +5 -5
- package/dist/components/effect-component.d.ts +1 -1
- package/dist/components/renderer-component.d.ts +1 -1
- package/dist/composition-source-manager.d.ts +7 -4
- package/dist/composition.d.ts +64 -36
- package/dist/constants.d.ts +1 -2
- package/dist/decorators.d.ts +5 -4
- package/dist/downloader.d.ts +2 -8
- package/dist/effects-object.d.ts +3 -2
- package/dist/engine.d.ts +11 -7
- package/dist/fallback/camera.d.ts +2 -0
- package/dist/fallback/index.d.ts +12 -0
- package/dist/fallback/interact.d.ts +2 -0
- package/dist/fallback/migration.d.ts +20 -0
- package/dist/fallback/particle.d.ts +2 -0
- package/dist/fallback/sprite.d.ts +3 -0
- package/dist/fallback/utils.d.ts +25 -0
- package/dist/gl/create-gl-context.d.ts +2 -1
- package/dist/gl/index.d.ts +3 -0
- package/dist/image-asset.d.ts +5 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +20033 -20216
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19979 -20157
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +18 -5
- package/dist/material/types.d.ts +0 -5
- package/dist/material/utils.d.ts +4 -4
- package/dist/math/bezier.d.ts +99 -0
- package/dist/math/keyframe-info.d.ts +39 -0
- package/dist/math/translate.d.ts +3 -2
- package/dist/math/utils.d.ts +6 -2
- package/dist/math/value-getter.d.ts +52 -26
- package/dist/pass-render-level.d.ts +3 -1
- package/dist/plugin-system.d.ts +3 -4
- package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
- package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
- package/dist/plugins/cal/animation-playable.d.ts +2 -1
- package/dist/plugins/cal/calculate-item.d.ts +5 -39
- package/dist/plugins/cal/calculate-vfx-item.d.ts +58 -12
- package/dist/plugins/cal/playable-graph.d.ts +73 -18
- package/dist/plugins/cal/timeline-asset.d.ts +27 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -12
- package/dist/plugins/index.d.ts +8 -3
- package/dist/plugins/interact/click-handler.d.ts +3 -3
- package/dist/plugins/interact/event-system.d.ts +0 -2
- package/dist/plugins/interact/interact-item.d.ts +14 -1
- package/dist/plugins/interact/interact-mesh.d.ts +1 -1
- package/dist/plugins/particle/particle-loader.d.ts +1 -1
- package/dist/plugins/particle/particle-mesh.d.ts +7 -7
- package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +3 -3
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
- package/dist/plugins/particle/trail-mesh.d.ts +7 -7
- package/dist/plugins/plugin.d.ts +7 -8
- package/dist/plugins/sprite/sprite-item.d.ts +29 -15
- package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
- package/dist/plugins/text/index.d.ts +4 -0
- package/dist/plugins/text/text-item.d.ts +25 -5
- package/dist/plugins/text/text-layout.d.ts +9 -1
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +7 -0
- package/dist/plugins/timeline/playables/sub-composition-clip-playable.d.ts +5 -0
- package/dist/plugins/timeline/playables/sub-composition-playable-asset.d.ts +5 -0
- package/dist/plugins/timeline/track.d.ts +73 -0
- package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +4 -0
- package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
- package/dist/render/create-copy-shader.d.ts +1 -1
- package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
- package/dist/render/geometry.d.ts +14 -1
- package/dist/render/global-volume.d.ts +3 -0
- package/dist/render/gpu-capability.d.ts +6 -6
- package/dist/render/index.d.ts +3 -2
- package/dist/render/render-frame.d.ts +6 -6
- package/dist/render/render-pass.d.ts +10 -10
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +7 -6
- package/dist/render/semantic-map.d.ts +14 -0
- package/dist/render/shader.d.ts +12 -5
- package/dist/scene.d.ts +86 -4
- package/dist/serialization-helper.d.ts +6 -4
- package/dist/shader/index.d.ts +0 -11
- package/dist/shape/shape.d.ts +1 -1
- package/dist/shape/sphere.d.ts +0 -3
- package/dist/template-image.d.ts +10 -0
- package/dist/texture/texture.d.ts +8 -0
- package/dist/texture/types.d.ts +2 -2
- package/dist/texture/utils.d.ts +2 -1
- package/dist/ticker.d.ts +2 -2
- package/dist/transform.d.ts +3 -3
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/device.d.ts +1 -0
- package/dist/utils/index.d.ts +28 -14
- package/dist/utils/text.d.ts +8 -0
- package/dist/vfx-item.d.ts +36 -54
- package/package.json +5 -5
- package/dist/plugins/cal/track.d.ts +0 -35
- package/dist/semantic-map.d.ts +0 -14
- package/dist/template-image/index.d.ts +0 -67
- package/dist/template-image/qcanvas-viewer.d.ts +0 -21
- package/dist/template-image/qtext.d.ts +0 -96
- package/dist/template-image/template-v1.d.ts +0 -27
- package/dist/template-image/text-metrics.d.ts +0 -18
- package/dist/utils/timeline-component.d.ts +0 -6
package/dist/asset-loader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { EffectsObject } from './effects-object';
|
|
3
3
|
import type { Engine } from './engine';
|
|
4
4
|
import type { VFXItemProps } from './vfx-item';
|
|
@@ -17,96 +17,14 @@ export declare class AssetLoader {
|
|
|
17
17
|
export declare class Database {
|
|
18
18
|
loadGUID(guid: string): Promise<EffectsObject | undefined>;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
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
|
-
vertexData: VertexData;
|
|
77
|
-
indexFormat: number;
|
|
78
|
-
indexOffset: number;
|
|
79
|
-
buffer: string;
|
|
80
|
-
}
|
|
81
|
-
export interface VertexData {
|
|
82
|
-
vertexCount: number;
|
|
83
|
-
channels: VertexChannel[];
|
|
84
|
-
}
|
|
85
|
-
export interface VertexChannel {
|
|
86
|
-
offset: number;
|
|
87
|
-
format: number;
|
|
88
|
-
dimension: number;
|
|
89
|
-
}
|
|
90
|
-
export interface ShaderData extends EffectsObjectData {
|
|
91
|
-
vertex: string;
|
|
92
|
-
fragment: string;
|
|
93
|
-
properties?: string;
|
|
94
|
-
}
|
|
95
|
-
export interface EffectComponentData extends EffectsObjectData {
|
|
20
|
+
export interface EffectComponentData extends spec.EffectsObjectData {
|
|
96
21
|
_priority: number;
|
|
97
|
-
item: DataPath;
|
|
98
|
-
materials: DataPath[];
|
|
99
|
-
geometry: DataPath;
|
|
22
|
+
item: spec.DataPath;
|
|
23
|
+
materials: spec.DataPath[];
|
|
24
|
+
geometry: spec.DataPath;
|
|
100
25
|
}
|
|
101
26
|
export type VFXItemData = VFXItemProps & {
|
|
102
|
-
dataType: DataType;
|
|
103
|
-
components: DataPath[];
|
|
27
|
+
dataType: spec.DataType;
|
|
28
|
+
components: spec.DataPath[];
|
|
104
29
|
};
|
|
105
|
-
export type SceneData = Record<string, EffectsObjectData>;
|
|
106
|
-
export interface EffectsPackageData {
|
|
107
|
-
fileSummary: {
|
|
108
|
-
guid: string;
|
|
109
|
-
assetType: string;
|
|
110
|
-
};
|
|
111
|
-
exportObjects: EffectsObjectData[];
|
|
112
|
-
}
|
|
30
|
+
export type SceneData = Record<string, spec.EffectsObjectData>;
|
package/dist/asset-manager.d.ts
CHANGED
|
@@ -1,86 +1,7 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
1
|
import { Downloader } from './downloader';
|
|
3
|
-
import type { Scene } from './scene';
|
|
2
|
+
import type { Scene, SceneLoadOptions, SceneType } from './scene';
|
|
4
3
|
import type { Disposable } from './utils';
|
|
5
4
|
import type { Renderer } from './render';
|
|
6
|
-
/**
|
|
7
|
-
* 场景加载参数
|
|
8
|
-
*/
|
|
9
|
-
export interface SceneLoadOptions {
|
|
10
|
-
/**
|
|
11
|
-
* 动态数据的参数
|
|
12
|
-
* key 是 JSON 中配置的字段名
|
|
13
|
-
* value 是要使用的值,图片使用 url 链接
|
|
14
|
-
* 图片链接可以使用数组传递,如果第一个加载失败,将尝试使用第二个地址
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ``` ts
|
|
18
|
-
* {
|
|
19
|
-
* variables: {
|
|
20
|
-
* bg: ['url','fallback_url'], // 如果两个图片都失败,将会触发加载失败
|
|
21
|
-
* fg: 'url' // 如果图片加载失败,将会触发加载失败,
|
|
22
|
-
* amount: 88.8,
|
|
23
|
-
* name: 'abc'
|
|
24
|
-
* }
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
variables?: Record<string, number | string | string[]>;
|
|
29
|
-
/**
|
|
30
|
-
* 模板图片缩放倍数
|
|
31
|
-
* @default 1 如果图片比较糊,可以用 2(但会增大图片内存)
|
|
32
|
-
*/
|
|
33
|
-
templateScale?: number;
|
|
34
|
-
/**
|
|
35
|
-
* 是否使用压缩纹理
|
|
36
|
-
*/
|
|
37
|
-
useCompressedTexture?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 渲染分级。
|
|
40
|
-
* 分级之后,只会加载当前渲染等级的资源。
|
|
41
|
-
* 当渲染等级被设置为 B 后,player 的 fps 会降到 30 帧
|
|
42
|
-
* @default 's'
|
|
43
|
-
*/
|
|
44
|
-
renderLevel?: spec.RenderLevel;
|
|
45
|
-
/**
|
|
46
|
-
* 资源加载超时,时间单位秒
|
|
47
|
-
* @default 10s
|
|
48
|
-
*/
|
|
49
|
-
timeout?: number;
|
|
50
|
-
/***
|
|
51
|
-
* 用于给 plugin 的加载数据
|
|
52
|
-
* key/value 的内容由 plugin 自己实现
|
|
53
|
-
*/
|
|
54
|
-
pluginData?: Record<string, any>;
|
|
55
|
-
/**
|
|
56
|
-
* 场景加载时的环境(加载后把 env 结果写入 scene)
|
|
57
|
-
* @default '' - 编辑器中为 'editor'
|
|
58
|
-
*/
|
|
59
|
-
env?: string;
|
|
60
|
-
/**
|
|
61
|
-
* 加载后是否自动播放
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
autoplay?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* 合成播放完成后是否需要再使用,是的话生命周期结束后不会 `dispose`
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
reusable?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* 播放速度,当速度为负数时,合成倒播
|
|
72
|
-
*/
|
|
73
|
-
speed?: number;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 接受用于加载的数据类型
|
|
77
|
-
*/
|
|
78
|
-
export type SceneType = string | Scene | Record<string, unknown>;
|
|
79
|
-
export type SceneWithOptionsType = {
|
|
80
|
-
scene: SceneType;
|
|
81
|
-
options: SceneLoadOptions;
|
|
82
|
-
};
|
|
83
|
-
export type SceneLoadType = SceneType | SceneWithOptionsType;
|
|
84
5
|
/**
|
|
85
6
|
* 资源管理器
|
|
86
7
|
* 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { Scene } from './scene';
|
|
3
|
-
export declare function version3Migration(scene: Record<string, any>): Scene;
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
4
2
|
/**
|
|
5
3
|
* 提取并转换 JSON 数据中的 anchor 值
|
|
6
4
|
*/
|
package/dist/camera.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Euler, Matrix4, Quaternion, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
1
2
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import { Matrix4, Vector3, Euler, Quaternion } from '@galacean/effects-math/es/core/index';
|
|
3
3
|
interface CameraOptionsBase {
|
|
4
4
|
/**
|
|
5
5
|
* 相机近平面
|
|
@@ -58,6 +58,10 @@ export interface CameraOptionsEx extends CameraOptionsBase {
|
|
|
58
58
|
*/
|
|
59
59
|
export declare class Camera {
|
|
60
60
|
name: string;
|
|
61
|
+
/**
|
|
62
|
+
* 编辑器用于缩放画布
|
|
63
|
+
*/
|
|
64
|
+
fovScaleRatio: number;
|
|
61
65
|
private options;
|
|
62
66
|
private viewMatrix;
|
|
63
67
|
private projectionMatrix;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare class CanvasPool {
|
|
2
|
+
readonly elements: HTMLCanvasElement[];
|
|
3
|
+
constructor();
|
|
4
|
+
dispose(): void;
|
|
5
|
+
getCanvas(): HTMLCanvasElement;
|
|
6
|
+
saveCanvas(canvas: HTMLCanvasElement): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const canvasPool: CanvasPool;
|
|
9
|
+
export declare function getDefaultTemplateCanvasPool(): CanvasPool;
|
|
10
|
+
export {};
|
package/dist/comp-vfx-item.d.ts
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import type { VFXItemContent } from './vfx-item';
|
|
5
|
+
import type { ContentOptions } from './composition-source-manager';
|
|
6
|
+
import type { Region, TrackAsset } from './plugins';
|
|
7
7
|
import { VFXItem } from './vfx-item';
|
|
8
|
+
export interface SceneBinding {
|
|
9
|
+
key: TrackAsset;
|
|
10
|
+
value: VFXItem;
|
|
11
|
+
}
|
|
12
|
+
export interface SceneBindingData {
|
|
13
|
+
key: spec.DataPath;
|
|
14
|
+
value: spec.DataPath;
|
|
15
|
+
}
|
|
8
16
|
/**
|
|
9
17
|
* @since 2.0.0
|
|
10
18
|
* @internal
|
|
11
19
|
*/
|
|
12
20
|
export declare class CompositionComponent extends ItemBehaviour {
|
|
21
|
+
time: number;
|
|
13
22
|
startTime: number;
|
|
14
23
|
refId: string;
|
|
15
|
-
items: VFXItem
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
items: VFXItem[];
|
|
25
|
+
data: ContentOptions;
|
|
26
|
+
private reusable;
|
|
27
|
+
private sceneBindings;
|
|
28
|
+
private timelineAsset;
|
|
29
|
+
private timelinePlayable;
|
|
30
|
+
private graph;
|
|
18
31
|
start(): void;
|
|
32
|
+
setReusable(value: boolean): void;
|
|
33
|
+
getReusable(): boolean;
|
|
19
34
|
update(dt: number): void;
|
|
20
|
-
/**
|
|
21
|
-
* 重置元素状态属性
|
|
22
|
-
*/
|
|
23
|
-
resetStatus(): void;
|
|
24
35
|
createContent(): void;
|
|
25
36
|
onDestroy(): void;
|
|
26
37
|
hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
|
|
38
|
+
fromData(data: unknown): void;
|
|
39
|
+
private resolveBindings;
|
|
40
|
+
private resolveTrackBindingsWithRoot;
|
|
27
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EffectsObject } from '../effects-object';
|
|
2
|
-
import type { VFXItem
|
|
2
|
+
import type { VFXItem } from '../vfx-item';
|
|
3
3
|
/**
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
* @internal
|
|
@@ -9,11 +9,11 @@ export declare abstract class Component extends EffectsObject {
|
|
|
9
9
|
/**
|
|
10
10
|
* 附加到的 VFXItem 对象
|
|
11
11
|
*/
|
|
12
|
-
item: VFXItem
|
|
12
|
+
item: VFXItem;
|
|
13
13
|
/**
|
|
14
14
|
* 附加到的 VFXItem 对象 Transform 组件
|
|
15
15
|
*/
|
|
16
|
-
get transform(): import("
|
|
16
|
+
get transform(): import("@galacean/effects-core").Transform;
|
|
17
17
|
onAttached(): void;
|
|
18
18
|
onDestroy(): void;
|
|
19
19
|
fromData(data: any): void;
|
|
@@ -24,7 +24,7 @@ export declare abstract class Component extends EffectsObject {
|
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export declare abstract class Behaviour extends Component {
|
|
27
|
-
_enabled
|
|
27
|
+
private _enabled;
|
|
28
28
|
/**
|
|
29
29
|
* 组件是否可以更新,true 更新,false 不更新
|
|
30
30
|
*/
|
|
@@ -32,7 +32,7 @@ export declare abstract class Behaviour extends Component {
|
|
|
32
32
|
get enabled(): boolean;
|
|
33
33
|
set enabled(value: boolean);
|
|
34
34
|
protected onBehaviourEnable(): void;
|
|
35
|
-
fromData(data:
|
|
35
|
+
fromData(data: unknown): void;
|
|
36
36
|
toData(): void;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -53,7 +53,7 @@ export declare class EffectComponent extends RendererComponent {
|
|
|
53
53
|
setMaterial(material: Material, destroy?: MaterialDestroyOptions | DestroyOptions.keep): void;
|
|
54
54
|
getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
|
|
55
55
|
getBoundingBox(): BoundingBoxTriangle | void;
|
|
56
|
-
fromData(data:
|
|
56
|
+
fromData(data: unknown): void;
|
|
57
57
|
toData(): void;
|
|
58
58
|
/**
|
|
59
59
|
* 销毁当前资源
|
|
@@ -1,8 +1,9 @@
|
|
|
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';
|
|
5
|
-
import type { Scene } from './scene';
|
|
6
|
+
import type { Scene, SceneRenderLevel } from './scene';
|
|
6
7
|
import type { Texture } from './texture';
|
|
7
8
|
import type { Disposable } from './utils';
|
|
8
9
|
import type { VFXItemProps } from './vfx-item';
|
|
@@ -15,16 +16,18 @@ 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
|
* 合成资源管理
|
|
21
24
|
*/
|
|
22
25
|
export declare class CompositionSourceManager implements Disposable {
|
|
23
|
-
composition?: spec.
|
|
24
|
-
refCompositions: Map<string, spec.
|
|
26
|
+
composition?: spec.CompositionData;
|
|
27
|
+
refCompositions: Map<string, spec.CompositionData>;
|
|
25
28
|
sourceContent?: ContentOptions;
|
|
26
29
|
refCompositionProps: Map<string, VFXItemProps>;
|
|
27
|
-
renderLevel?:
|
|
30
|
+
renderLevel?: SceneRenderLevel;
|
|
28
31
|
pluginSystem?: PluginSystem;
|
|
29
32
|
totalTime: number;
|
|
30
33
|
imgUsage: Record<string, number[]>;
|
package/dist/composition.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { Ray } from '@galacean/effects-math/es/core/index';
|
|
2
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { Ray } from '@galacean/effects-math/es/core/ray';
|
|
3
|
+
import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
3
4
|
import { Camera } from './camera';
|
|
4
5
|
import { CompositionComponent } from './comp-vfx-item';
|
|
5
|
-
import
|
|
6
|
+
import { CompositionSourceManager } from './composition-source-manager';
|
|
6
7
|
import type { PluginSystem } from './plugin-system';
|
|
7
|
-
import type { EventSystem, Region } from './plugins';
|
|
8
|
+
import type { EventSystem, Plugin, Region } from './plugins';
|
|
8
9
|
import type { MeshRendererOptions, Renderer } from './render';
|
|
9
10
|
import { RenderFrame } from './render';
|
|
10
|
-
import type { Scene } from './scene';
|
|
11
|
+
import type { Scene, SceneType } from './scene';
|
|
11
12
|
import type { Texture } from './texture';
|
|
12
|
-
import { Transform } from './transform';
|
|
13
13
|
import type { Disposable, LostHandler } from './utils';
|
|
14
|
-
import type {
|
|
14
|
+
import type { VFXItemProps } from './vfx-item';
|
|
15
15
|
import { VFXItem } from './vfx-item';
|
|
16
|
-
import type { SceneType } from './asset-manager';
|
|
17
16
|
export interface CompositionStatistic {
|
|
18
17
|
loadTime: number;
|
|
19
18
|
loadStart: number;
|
|
20
19
|
firstFrameTime: number;
|
|
20
|
+
precompileTime: number;
|
|
21
21
|
}
|
|
22
22
|
export interface MessageItem {
|
|
23
23
|
id: string;
|
|
@@ -25,19 +25,26 @@ export interface MessageItem {
|
|
|
25
25
|
phrase: number;
|
|
26
26
|
compositionId: string;
|
|
27
27
|
}
|
|
28
|
+
export interface CompItemClickedData {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
hitPositions: Vector3[];
|
|
32
|
+
position: Vector3;
|
|
33
|
+
}
|
|
28
34
|
/**
|
|
29
35
|
*
|
|
30
36
|
*/
|
|
31
37
|
export interface CompositionHitTestOptions {
|
|
32
38
|
maxCount?: number;
|
|
33
39
|
stop?: (region: Region) => boolean;
|
|
34
|
-
skip?: (item: VFXItem
|
|
40
|
+
skip?: (item: VFXItem) => boolean;
|
|
35
41
|
}
|
|
36
42
|
export interface CompositionProps {
|
|
37
43
|
reusable?: boolean;
|
|
38
44
|
baseRenderOrder?: number;
|
|
39
45
|
renderer: Renderer;
|
|
40
|
-
onPlayerPause?: (item: VFXItem
|
|
46
|
+
onPlayerPause?: (item: VFXItem) => void;
|
|
47
|
+
onItemClicked?: (item: VFXItem) => void;
|
|
41
48
|
onMessageItem?: (item: MessageItem) => void;
|
|
42
49
|
onEnd?: (composition: Composition) => void;
|
|
43
50
|
event?: EventSystem;
|
|
@@ -51,7 +58,6 @@ export interface CompositionProps {
|
|
|
51
58
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
52
59
|
*/
|
|
53
60
|
export declare class Composition implements Disposable, LostHandler {
|
|
54
|
-
compositionSourceManager: CompositionSourceManager;
|
|
55
61
|
renderer: Renderer;
|
|
56
62
|
/**
|
|
57
63
|
* 当前帧的渲染数据对象
|
|
@@ -70,10 +76,6 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
70
76
|
* 合成渲染顺序,默认按升序渲染
|
|
71
77
|
*/
|
|
72
78
|
renderOrder: number;
|
|
73
|
-
/**
|
|
74
|
-
* 所有合成 Item 的根变换
|
|
75
|
-
*/
|
|
76
|
-
transform: Transform;
|
|
77
79
|
/**
|
|
78
80
|
* 播放完成后是否需要再使用,是的话生命周期结束后不会自动 dispose
|
|
79
81
|
*/
|
|
@@ -82,12 +84,17 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
82
84
|
* 是否播放完成后销毁 texture 对象
|
|
83
85
|
*/
|
|
84
86
|
keepResource: boolean;
|
|
85
|
-
extraCamera: VFXItem
|
|
87
|
+
extraCamera: VFXItem;
|
|
88
|
+
/**
|
|
89
|
+
* 合成内的元素否允许点击、拖拽交互
|
|
90
|
+
* @since 1.6.0
|
|
91
|
+
*/
|
|
92
|
+
interactive: boolean;
|
|
86
93
|
/**
|
|
87
94
|
* 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
|
|
88
95
|
* @internal
|
|
89
96
|
*/
|
|
90
|
-
onPlayerPause?: (item: VFXItem
|
|
97
|
+
onPlayerPause?: (item: VFXItem) => void;
|
|
91
98
|
/**
|
|
92
99
|
* 单个合成结束时的回调
|
|
93
100
|
*/
|
|
@@ -96,6 +103,14 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
96
103
|
* 合成中消息元素创建/销毁时触发的回调
|
|
97
104
|
*/
|
|
98
105
|
onMessageItem?: (item: MessageItem) => void;
|
|
106
|
+
/**
|
|
107
|
+
* 合成中元素点击时触发的回调
|
|
108
|
+
* 注意:此接口随时可能下线,请务使用!
|
|
109
|
+
* @since 1.6.0
|
|
110
|
+
* @ignore
|
|
111
|
+
* @deprecated
|
|
112
|
+
*/
|
|
113
|
+
onItemClicked?: (data: CompItemClickedData) => void;
|
|
99
114
|
/**
|
|
100
115
|
* 合成id
|
|
101
116
|
*/
|
|
@@ -128,10 +143,6 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
128
143
|
* 用于保存与当前合成相关的插件数据
|
|
129
144
|
*/
|
|
130
145
|
readonly loaderData: Record<string, any>;
|
|
131
|
-
/**
|
|
132
|
-
* 渲染等级:S,A+,A,B+,B
|
|
133
|
-
*/
|
|
134
|
-
readonly renderLevel?: spec.RenderLevel;
|
|
135
146
|
/**
|
|
136
147
|
* 场景加载和首帧渲染时间
|
|
137
148
|
*/
|
|
@@ -143,11 +154,11 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
143
154
|
/**
|
|
144
155
|
* 合成根元素
|
|
145
156
|
*/
|
|
146
|
-
rootItem: VFXItem
|
|
157
|
+
readonly rootItem: VFXItem;
|
|
147
158
|
/**
|
|
148
159
|
* 预合成数组
|
|
149
160
|
*/
|
|
150
|
-
readonly refContent: VFXItem
|
|
161
|
+
readonly refContent: VFXItem[];
|
|
151
162
|
/**
|
|
152
163
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
153
164
|
*/
|
|
@@ -171,6 +182,8 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
171
182
|
*/
|
|
172
183
|
protected readonly keepColorBuffer: boolean;
|
|
173
184
|
protected rootComposition: CompositionComponent;
|
|
185
|
+
protected readonly postLoaders: Plugin[];
|
|
186
|
+
protected compositionSourceManager: CompositionSourceManager;
|
|
174
187
|
/**
|
|
175
188
|
* 合成暂停/播放 标识
|
|
176
189
|
*/
|
|
@@ -181,21 +194,17 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
181
194
|
*/
|
|
182
195
|
private readonly globalVolume;
|
|
183
196
|
private readonly texInfo;
|
|
184
|
-
private readonly postLoaders;
|
|
185
|
-
private rootTimeline;
|
|
186
197
|
/**
|
|
187
198
|
* Composition 构造函数
|
|
188
199
|
* @param props - composition 的创建参数
|
|
189
200
|
* @param scene
|
|
190
201
|
* @param compositionSourceManager
|
|
191
202
|
*/
|
|
192
|
-
constructor(props: CompositionProps, scene: Scene
|
|
203
|
+
constructor(props: CompositionProps, scene: Scene);
|
|
193
204
|
/**
|
|
194
|
-
*
|
|
195
|
-
* @param {(composition: Composition) => void} func
|
|
196
|
-
* @deprecated since 2.0 - use `onEnd` instead
|
|
205
|
+
* 所有合成 Item 的根变换
|
|
197
206
|
*/
|
|
198
|
-
|
|
207
|
+
get transform(): import("@galacean/effects-core").Transform;
|
|
199
208
|
/**
|
|
200
209
|
* 获取场景中的纹理数组
|
|
201
210
|
*/
|
|
@@ -203,7 +212,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
203
212
|
/**
|
|
204
213
|
* 获取合成中所有元素
|
|
205
214
|
*/
|
|
206
|
-
get items(): VFXItem
|
|
215
|
+
get items(): VFXItem[];
|
|
207
216
|
/**
|
|
208
217
|
* 获取合成开始渲染的时间
|
|
209
218
|
*/
|
|
@@ -216,6 +225,8 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
216
225
|
* 获取销毁状态
|
|
217
226
|
*/
|
|
218
227
|
get isDestroyed(): boolean;
|
|
228
|
+
set editorScaleRatio(value: number);
|
|
229
|
+
get editorScaleRatio(): number;
|
|
219
230
|
/**
|
|
220
231
|
* 获取合成的时长
|
|
221
232
|
*/
|
|
@@ -239,6 +250,12 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
239
250
|
* @param speed - 速度
|
|
240
251
|
*/
|
|
241
252
|
setSpeed(speed: number): void;
|
|
253
|
+
/**
|
|
254
|
+
* 设置合成的可见性
|
|
255
|
+
* @since 2.0.0
|
|
256
|
+
* @param visible - 是否可见
|
|
257
|
+
*/
|
|
258
|
+
setVisible(visible: boolean): void;
|
|
242
259
|
/**
|
|
243
260
|
* 获取合成的动画速度
|
|
244
261
|
* @returns
|
|
@@ -273,7 +290,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
273
290
|
* @param time - 相对 startTime 的时间
|
|
274
291
|
*/
|
|
275
292
|
setTime(time: number): void;
|
|
276
|
-
addItem(item: VFXItem
|
|
293
|
+
addItem(item: VFXItem): void;
|
|
277
294
|
/**
|
|
278
295
|
* 前进合成到指定时间
|
|
279
296
|
* @param time - 相对0时刻的时间
|
|
@@ -285,6 +302,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
285
302
|
*/
|
|
286
303
|
protected reset(): void;
|
|
287
304
|
prepareRender(): void;
|
|
305
|
+
protected gatherRendererComponent(vfxItem: VFXItem, renderFrame: RenderFrame): void;
|
|
288
306
|
/**
|
|
289
307
|
* 是否合成需要重新播放
|
|
290
308
|
* @returns 重新播放合成标志位
|
|
@@ -301,6 +319,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
301
319
|
* @param skipRender - 是否需要渲染
|
|
302
320
|
*/
|
|
303
321
|
update(deltaTime: number, skipRender?: boolean): void;
|
|
322
|
+
private toLocalTime;
|
|
304
323
|
private getUpdateTime;
|
|
305
324
|
private callStart;
|
|
306
325
|
private callUpdate;
|
|
@@ -330,7 +349,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
330
349
|
* @param name - 元素名称
|
|
331
350
|
* @returns 元素对象
|
|
332
351
|
*/
|
|
333
|
-
getItemByName(name: string): VFXItem
|
|
352
|
+
getItemByName(name: string): VFXItem | undefined;
|
|
334
353
|
/**
|
|
335
354
|
* 获取指定位置和相机连成的射线
|
|
336
355
|
* @param x
|
|
@@ -342,7 +361,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
342
361
|
* 获取 engine 对象
|
|
343
362
|
* @returns
|
|
344
363
|
*/
|
|
345
|
-
getEngine(): import("
|
|
364
|
+
getEngine(): import("@galacean/effects-core").Engine;
|
|
346
365
|
/**
|
|
347
366
|
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,原点在左上角
|
|
348
367
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
|
@@ -356,13 +375,13 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
356
375
|
* @param item - 交互元素
|
|
357
376
|
* @param type - 交互类型
|
|
358
377
|
*/
|
|
359
|
-
addInteractiveItem(item: VFXItem
|
|
378
|
+
addInteractiveItem(item: VFXItem, type: spec.InteractType): string | undefined;
|
|
360
379
|
/**
|
|
361
380
|
* InteractItem 生命周期结束时的调用
|
|
362
381
|
* @param item - 交互元素
|
|
363
382
|
* @param type - 交互类型
|
|
364
383
|
*/
|
|
365
|
-
removeInteractiveItem(item: VFXItem
|
|
384
|
+
removeInteractiveItem(item: VFXItem, type: spec.InteractType): void;
|
|
366
385
|
/**
|
|
367
386
|
* 销毁插件 Item 中保存的纹理数组
|
|
368
387
|
* @internal
|
|
@@ -374,7 +393,7 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
374
393
|
* @internal
|
|
375
394
|
* @param item - 需要销毁的 item
|
|
376
395
|
*/
|
|
377
|
-
destroyItem(item: VFXItem
|
|
396
|
+
destroyItem(item: VFXItem): void;
|
|
378
397
|
lost(e: Event): void;
|
|
379
398
|
/**
|
|
380
399
|
* 合成对象销毁
|
|
@@ -392,6 +411,15 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
392
411
|
* 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
|
|
393
412
|
*/
|
|
394
413
|
translateByPixel(x: number, y: number): void;
|
|
414
|
+
/**
|
|
415
|
+
* 设置合成在画布上的像素位置
|
|
416
|
+
* Tips:
|
|
417
|
+
* - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
|
|
418
|
+
* - 设置后会覆盖原有的位置信息
|
|
419
|
+
* @param x - x 坐标
|
|
420
|
+
* @param y - y 坐标
|
|
421
|
+
*/
|
|
422
|
+
setPositionByPixel(x: number, y: number): void;
|
|
395
423
|
/**
|
|
396
424
|
* 设置合成在 3D 坐标轴上相对当前的位移
|
|
397
425
|
*/
|
package/dist/constants.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ export declare const SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_COLOR_SIZE_0";
|
|
|
4
4
|
export declare const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
|
|
5
5
|
export declare const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
|
|
6
6
|
export declare const PLAYER_OPTIONS_ENV_EDITOR = "editor";
|
|
7
|
-
export declare const FILTER_NAME_NONE = "none";
|
|
8
7
|
export declare const HELP_LINK: {
|
|
9
|
-
'Filter not imported': string;
|
|
10
8
|
'Item duration can\'t be less than 0': string;
|
|
9
|
+
'ValueType: 21/22 is not supported': string;
|
|
11
10
|
};
|