@galacean/effects-core 1.2.3 → 2.0.0-alpha.1
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 +112 -0
- package/dist/asset-manager.d.ts +7 -2
- package/dist/asset-migrations.d.ts +7 -0
- package/dist/comp-vfx-item.d.ts +19 -63
- package/dist/components/component.d.ts +63 -0
- package/dist/components/effect-component.d.ts +63 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/renderer-component.d.ts +32 -0
- package/dist/composition-source-manager.d.ts +7 -6
- package/dist/composition.d.ts +43 -44
- package/dist/decorators.d.ts +4 -0
- package/dist/effects-object.d.ts +25 -0
- package/dist/engine.d.ts +23 -4
- package/dist/index.d.ts +25 -21
- package/dist/index.js +18164 -17680
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18129 -17651
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +5 -4
- package/dist/material/utils.d.ts +1 -1
- package/dist/math/utils.d.ts +0 -5
- package/dist/pass-render-level.d.ts +1 -1
- package/dist/plugins/cal/animation-mixer-playable.d.ts +4 -0
- package/dist/plugins/cal/animation-playable-output.d.ts +4 -0
- package/dist/plugins/cal/animation-playable.d.ts +6 -0
- package/dist/plugins/cal/animation-stream.d.ts +14 -0
- package/dist/plugins/cal/calculate-item.d.ts +34 -57
- package/dist/plugins/cal/calculate-vfx-item.d.ts +71 -25
- package/dist/plugins/cal/playable-graph.d.ts +62 -0
- package/dist/plugins/cal/track.d.ts +35 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +11 -8
- package/dist/plugins/index.d.ts +2 -5
- package/dist/plugins/interact/click-handler.d.ts +3 -3
- package/dist/plugins/interact/interact-item.d.ts +27 -1
- package/dist/plugins/interact/interact-loader.d.ts +0 -10
- package/dist/plugins/interact/interact-vfx-item.d.ts +7 -27
- package/dist/plugins/particle/particle-loader.d.ts +2 -11
- package/dist/plugins/particle/particle-mesh.d.ts +4 -9
- package/dist/plugins/particle/particle-system-renderer.d.ts +36 -0
- package/dist/plugins/particle/particle-system.d.ts +22 -21
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -25
- package/dist/plugins/particle/trail-mesh.d.ts +3 -5
- package/dist/plugins/sprite/sprite-item.d.ts +69 -42
- package/dist/plugins/sprite/sprite-loader.d.ts +3 -15
- package/dist/plugins/sprite/sprite-mesh.d.ts +4 -36
- package/dist/plugins/text/text-item.d.ts +12 -9
- package/dist/plugins/text/text-loader.d.ts +0 -15
- package/dist/render/geometry.d.ts +5 -14
- package/dist/render/mesh.d.ts +5 -16
- package/dist/render/render-frame.d.ts +3 -8
- package/dist/render/render-pass.d.ts +11 -10
- package/dist/render/renderer.d.ts +5 -5
- package/dist/render/shader.d.ts +7 -4
- package/dist/semantic-map.d.ts +1 -1
- package/dist/serialization-helper.d.ts +15 -0
- package/dist/texture/texture.d.ts +4 -4
- package/dist/ticker.d.ts +5 -0
- package/dist/transform.d.ts +17 -7
- package/dist/utils/asserts.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/timeline-component.d.ts +1 -34
- package/dist/vfx-item.d.ts +57 -147
- package/package.json +3 -2
- package/dist/filter.d.ts +0 -63
- package/dist/filters/alpha-frame.d.ts +0 -5
- package/dist/filters/alpha-mask.d.ts +0 -5
- package/dist/filters/bloom.d.ts +0 -8
- package/dist/filters/camera-move.d.ts +0 -5
- package/dist/filters/delay.d.ts +0 -14
- package/dist/filters/distortion.d.ts +0 -5
- package/dist/filters/gaussian.d.ts +0 -27
- package/dist/filters/index.d.ts +0 -2
- package/dist/filters/lum.d.ts +0 -5
- package/dist/filters/utils.d.ts +0 -7
- package/dist/plugins/camera/camera-vfx-item.d.ts +0 -13
- package/dist/plugins/sprite/filter-sprite-vfx-item.d.ts +0 -13
- package/dist/plugins/sprite/sprite-group.d.ts +0 -95
- package/dist/plugins/sprite/sprite-vfx-item.d.ts +0 -33
- package/dist/plugins/text/text-mesh.d.ts +0 -15
- package/dist/plugins/text/text-vfx-item.d.ts +0 -28
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { vec4 } from '@galacean/effects-specification';
|
|
3
3
|
import type { Camera } from '../camera';
|
|
4
|
-
import type {
|
|
4
|
+
import type { RendererComponent } from '../components';
|
|
5
|
+
import type { Engine } from '../engine';
|
|
6
|
+
import type { MeshDestroyOptions, Renderer } from '../render';
|
|
5
7
|
import { FrameBuffer } from '../render';
|
|
6
8
|
import type { SemanticGetter } from '../semantic-map';
|
|
7
9
|
import { SemanticMap } from '../semantic-map';
|
|
@@ -11,7 +13,6 @@ import type { Disposable, Sortable } from '../utils';
|
|
|
11
13
|
import { DestroyOptions, OrderType } from '../utils';
|
|
12
14
|
import type { RenderBuffer } from './render-buffer';
|
|
13
15
|
import type { RenderingData } from './render-frame';
|
|
14
|
-
import type { Engine } from '../engine';
|
|
15
16
|
export declare const RenderPassPriorityPrepare = 0;
|
|
16
17
|
export declare const RenderPassPriorityNormal = 1000;
|
|
17
18
|
export declare const RenderPassPriorityPostprocess = 3000;
|
|
@@ -157,13 +158,13 @@ export interface RenderPassDelegate {
|
|
|
157
158
|
* @param mesh - 当前 Mesh
|
|
158
159
|
* @param state - 当前渲染状态
|
|
159
160
|
*/
|
|
160
|
-
willRenderMesh?: (mesh:
|
|
161
|
+
willRenderMesh?: (mesh: RendererComponent, state: RenderingData) => void;
|
|
161
162
|
/**
|
|
162
163
|
* Mesh 渲染后回调
|
|
163
164
|
* @param mesh - 当前 Mesh
|
|
164
165
|
* @param state - 当前渲染状态
|
|
165
166
|
*/
|
|
166
|
-
didRenderMesh?: (mesh:
|
|
167
|
+
didRenderMesh?: (mesh: RendererComponent, state: RenderingData) => void;
|
|
167
168
|
}
|
|
168
169
|
/**
|
|
169
170
|
* RenderPass Attachment 选项
|
|
@@ -184,7 +185,7 @@ export interface RenderPassAttachmentOptions {
|
|
|
184
185
|
}
|
|
185
186
|
export interface RenderPassOptions extends RenderPassAttachmentOptions {
|
|
186
187
|
name?: string;
|
|
187
|
-
meshes?:
|
|
188
|
+
meshes?: RendererComponent[];
|
|
188
189
|
priority?: number;
|
|
189
190
|
meshOrder?: OrderType;
|
|
190
191
|
clearAction?: RenderPassClearAction;
|
|
@@ -216,7 +217,7 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
216
217
|
/**
|
|
217
218
|
* 包含的 Mesh 列表
|
|
218
219
|
*/
|
|
219
|
-
readonly meshes:
|
|
220
|
+
readonly meshes: RendererComponent[];
|
|
220
221
|
/**
|
|
221
222
|
* Mesh 渲染顺序,按照优先级升序或降序
|
|
222
223
|
*/
|
|
@@ -255,13 +256,13 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
255
256
|
get viewport(): spec.vec4;
|
|
256
257
|
get stencilAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
257
258
|
get depthAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
258
|
-
addMesh(mesh:
|
|
259
|
-
removeMesh(mesh:
|
|
260
|
-
setMeshes(meshes:
|
|
259
|
+
addMesh(mesh: RendererComponent): void;
|
|
260
|
+
removeMesh(mesh: RendererComponent): void;
|
|
261
|
+
setMeshes(meshes: RendererComponent[]): RendererComponent[];
|
|
261
262
|
/**
|
|
262
263
|
* 获取当前 Attachment 数组,注意 RenderPass 可能没有创建完成
|
|
263
264
|
*/
|
|
264
|
-
getInitAttachments():
|
|
265
|
+
getInitAttachments(): RenderPassColorAttachmentOptions[] | RenderTargetHandle[] | undefined;
|
|
265
266
|
/**
|
|
266
267
|
* 配置当前pass的RT,在每帧渲染前调用
|
|
267
268
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Matrix4 } from '@galacean/effects-math/es/core/index';
|
|
2
|
+
import type { RendererComponent } from '../components/renderer-component';
|
|
3
|
+
import type { Engine } from '../engine';
|
|
4
|
+
import type { Material } from '../material';
|
|
2
5
|
import type { LostHandler, RestoreHandler } from '../utils';
|
|
3
6
|
import type { FilterMode, FrameBuffer, RenderTextureFormat } from './frame-buffer';
|
|
4
|
-
import type {
|
|
7
|
+
import type { Geometry } from './geometry';
|
|
5
8
|
import type { RenderFrame, RenderingData } from './render-frame';
|
|
6
9
|
import type { RenderPassClearAction, RenderPassStoreAction } from './render-pass';
|
|
7
10
|
import type { ShaderLibrary } from './shader';
|
|
8
|
-
import type { Geometry } from './geometry';
|
|
9
|
-
import type { Material } from '../material';
|
|
10
|
-
import type { Engine } from '../engine';
|
|
11
11
|
export declare class Renderer implements LostHandler, RestoreHandler {
|
|
12
12
|
static create: (canvas: HTMLCanvasElement | OffscreenCanvas, framework: 'webgl' | 'webgl2', renderOptions?: WebGLContextAttributes) => Renderer;
|
|
13
13
|
engine: Engine;
|
|
@@ -55,7 +55,7 @@ export declare class Renderer implements LostHandler, RestoreHandler {
|
|
|
55
55
|
*/
|
|
56
56
|
getShaderLibrary(): ShaderLibrary | undefined;
|
|
57
57
|
renderRenderFrame(renderFrame: RenderFrame): void;
|
|
58
|
-
renderMeshes(meshes:
|
|
58
|
+
renderMeshes(meshes: RendererComponent[]): void;
|
|
59
59
|
drawGeometry(geometry: Geometry, material: Material): void;
|
|
60
60
|
getTemporaryRT(name: string, width: number, height: number, depthBuffer: number, filter: FilterMode, format: RenderTextureFormat): FrameBuffer | null;
|
|
61
61
|
dispose(haltGL?: boolean): void;
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EffectsObject } from '../effects-object';
|
|
2
|
+
import type { Engine } from '../engine';
|
|
1
3
|
export type ShaderMarcos = [key: string, value: string | number | boolean][];
|
|
2
4
|
export declare enum ShaderCompileResultStatus {
|
|
3
5
|
noShader = 0,
|
|
@@ -40,7 +42,7 @@ export interface InstancedShaderWithSource {
|
|
|
40
42
|
/**
|
|
41
43
|
* shader是否共享
|
|
42
44
|
*/
|
|
43
|
-
shared?:
|
|
45
|
+
shared?: boolean;
|
|
44
46
|
}
|
|
45
47
|
export interface SharedShaderWithSource {
|
|
46
48
|
/**
|
|
@@ -69,22 +71,23 @@ export interface SharedShaderWithSource {
|
|
|
69
71
|
* 如果提供了cacheId,cacheId相同的shader会共用一个GLProgram
|
|
70
72
|
* 如果没有提供cacheId,会根据字符串hash计算出cacheId,字符串相同的shader将会使用同一个GLProgram
|
|
71
73
|
*/
|
|
72
|
-
shared?:
|
|
74
|
+
shared?: boolean;
|
|
73
75
|
/**
|
|
74
76
|
* 相同cacheId的shader会使用同一个GLProgram
|
|
75
77
|
*/
|
|
76
78
|
cacheId?: string;
|
|
77
79
|
}
|
|
78
80
|
export type ShaderWithSource = InstancedShaderWithSource | SharedShaderWithSource;
|
|
79
|
-
export declare abstract class Shader {
|
|
81
|
+
export declare abstract class Shader extends EffectsObject {
|
|
80
82
|
readonly source: ShaderWithSource;
|
|
81
|
-
constructor(source: ShaderWithSource);
|
|
83
|
+
constructor(engine: Engine, source: ShaderWithSource);
|
|
82
84
|
}
|
|
83
85
|
export interface ShaderLibrary {
|
|
84
86
|
readonly shaderResults: {
|
|
85
87
|
[cacheId: string]: ShaderCompileResult;
|
|
86
88
|
};
|
|
87
89
|
addShader(shader: ShaderWithSource): void;
|
|
90
|
+
createShader(shaderSource: ShaderWithSource): Shader;
|
|
88
91
|
/**
|
|
89
92
|
* @param cacheId
|
|
90
93
|
*/
|
package/dist/semantic-map.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class SemanticMap implements Disposable {
|
|
|
8
8
|
constructor(semantics?: Record<string, SemanticGetter>);
|
|
9
9
|
toObject(): Record<string, SemanticGetter>;
|
|
10
10
|
setSemantic(name: string, value?: SemanticGetter): void;
|
|
11
|
-
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-math/es").
|
|
11
|
+
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-math/es/core").Vector3 | import("./texture").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("./texture").Texture[] | import("./material").UniformStruct | import("./material").UniformStruct[] | SemanticFunc | undefined;
|
|
12
12
|
hasSemanticValue(name: string): boolean;
|
|
13
13
|
dispose(): void;
|
|
14
14
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EffectsObject } from './effects-object';
|
|
2
|
+
export declare class SerializationHelper {
|
|
3
|
+
static collectSerializableObject(effectsObject: EffectsObject, res: Record<string, EffectsObject>): void;
|
|
4
|
+
static serializeEffectObject(effectsObject: EffectsObject): Record<string, any>;
|
|
5
|
+
static serializeTaggedProperties(effectsObject: EffectsObject, serializedData?: Record<string, any>): Record<string, any>;
|
|
6
|
+
static deserializeTaggedProperties(serializedData: Record<string, any>, effectsObject: EffectsObject): void;
|
|
7
|
+
static deserializeTaggedPropertiesAsync(serializedData: Record<string, any>, effectsObject: EffectsObject): Promise<void>;
|
|
8
|
+
static checkTypedArray(obj: any): boolean;
|
|
9
|
+
static checkDataPath(value: any): boolean;
|
|
10
|
+
static checkGLTFNode(value: any): boolean;
|
|
11
|
+
private static deserializeProperty;
|
|
12
|
+
private static deserializePropertyAsync;
|
|
13
|
+
private static serializeObjectProperty;
|
|
14
|
+
private static serializeArrayProperty;
|
|
15
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { TextureSourceType } from './types';
|
|
2
2
|
import type { TextureFactorySourceFrom, TextureSourceOptions, TextureDataType } from './types';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
|
+
import { EffectsObject } from '../effects-object';
|
|
4
5
|
/**
|
|
5
6
|
* Texture 抽象类
|
|
6
7
|
*/
|
|
7
|
-
export declare abstract class Texture {
|
|
8
|
+
export declare abstract class Texture extends EffectsObject {
|
|
8
9
|
/**
|
|
9
10
|
* Texture 名称
|
|
10
11
|
*/
|
|
@@ -12,7 +13,6 @@ export declare abstract class Texture {
|
|
|
12
13
|
sourceFrom?: TextureFactorySourceFrom;
|
|
13
14
|
sourceType?: TextureSourceType;
|
|
14
15
|
source: TextureSourceOptions;
|
|
15
|
-
engine: Engine;
|
|
16
16
|
/**
|
|
17
17
|
* Texture 高度
|
|
18
18
|
*/
|
|
@@ -30,14 +30,14 @@ export declare abstract class Texture {
|
|
|
30
30
|
/**
|
|
31
31
|
* 创建一个新的 Texture 对象。
|
|
32
32
|
*/
|
|
33
|
-
static create: (engine: Engine, options
|
|
33
|
+
static create: (engine: Engine, options?: TextureSourceOptions) => Texture;
|
|
34
34
|
/**
|
|
35
35
|
* 通过数据创建 Texture 对象。
|
|
36
36
|
* @param data - 要创建的 Texture 数据
|
|
37
37
|
* @param options - 可选的 Texture 选项
|
|
38
38
|
*/
|
|
39
39
|
static createWithData: (engine: Engine, data?: TextureDataType, options?: Record<string, any>) => Texture;
|
|
40
|
-
constructor();
|
|
40
|
+
constructor(engine: Engine);
|
|
41
41
|
get isDestroyed(): boolean;
|
|
42
42
|
/**
|
|
43
43
|
* 获取 Texture 的宽度。
|
package/dist/ticker.d.ts
CHANGED
package/dist/transform.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { Euler, Matrix4, Quaternion, Vector2, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
1
2
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import { Vector3, Matrix4, Quaternion, Euler } from '@galacean/effects-math/es/core/index';
|
|
3
3
|
import type { Disposable } from './utils';
|
|
4
|
+
import type { Engine } from './engine';
|
|
4
5
|
export interface TransformProps {
|
|
5
6
|
position?: spec.vec3 | Vector3;
|
|
6
7
|
rotation?: spec.vec3 | Euler;
|
|
7
8
|
quat?: spec.vec4 | Quaternion;
|
|
8
9
|
scale?: spec.vec3 | Vector3;
|
|
10
|
+
size?: Vector2;
|
|
9
11
|
name?: string;
|
|
10
|
-
anchor?: spec.vec2 |
|
|
12
|
+
anchor?: spec.vec2 | Vector2;
|
|
11
13
|
valid?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare class Transform implements Disposable {
|
|
@@ -18,7 +20,9 @@ export declare class Transform implements Disposable {
|
|
|
18
20
|
* @returns
|
|
19
21
|
*/
|
|
20
22
|
static getRotation(quat: Quaternion, out: Euler): Euler;
|
|
23
|
+
engine: Engine;
|
|
21
24
|
name: string;
|
|
25
|
+
taggedProperties: Record<string, any>;
|
|
22
26
|
/**
|
|
23
27
|
* 自身位移
|
|
24
28
|
*/
|
|
@@ -39,6 +43,10 @@ export declare class Transform implements Disposable {
|
|
|
39
43
|
* 自身锚点
|
|
40
44
|
*/
|
|
41
45
|
readonly anchor: Vector3;
|
|
46
|
+
/**
|
|
47
|
+
* 元素矩形宽高
|
|
48
|
+
*/
|
|
49
|
+
readonly size: Vector2;
|
|
42
50
|
/**
|
|
43
51
|
* 子变换,可以有多个
|
|
44
52
|
*/
|
|
@@ -113,6 +121,7 @@ export declare class Transform implements Disposable {
|
|
|
113
121
|
* @param z
|
|
114
122
|
*/
|
|
115
123
|
setScale(x: number, y: number, z: number): void;
|
|
124
|
+
setSize(x: number, y: number): void;
|
|
116
125
|
/**
|
|
117
126
|
* 在当前旋转的基础上使用四元素添加旋转
|
|
118
127
|
* @param quat
|
|
@@ -129,9 +138,8 @@ export declare class Transform implements Disposable {
|
|
|
129
138
|
* 设置锚点
|
|
130
139
|
* @param x
|
|
131
140
|
* @param y
|
|
132
|
-
* @param z
|
|
133
141
|
*/
|
|
134
|
-
setAnchor(x: number, y: number
|
|
142
|
+
setAnchor(x: number, y: number): void;
|
|
135
143
|
/**
|
|
136
144
|
* 批量设置 transform 属性
|
|
137
145
|
* @param props - 要设置的属性
|
|
@@ -195,9 +203,9 @@ export declare class Transform implements Disposable {
|
|
|
195
203
|
getWorldRotation(): Euler;
|
|
196
204
|
/**
|
|
197
205
|
* 根据世界变换矩阵计算位移、旋转、缩放向量
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
206
|
+
* @param position
|
|
207
|
+
* @param quat
|
|
208
|
+
* @param scale
|
|
201
209
|
*/
|
|
202
210
|
assignWorldTRS(position?: Vector3, quat?: Quaternion, scale?: Vector3): void;
|
|
203
211
|
/**
|
|
@@ -215,6 +223,8 @@ export declare class Transform implements Disposable {
|
|
|
215
223
|
* 获取 Transform 是否生效
|
|
216
224
|
*/
|
|
217
225
|
getValid(): boolean;
|
|
226
|
+
toData(): Record<string, any>;
|
|
227
|
+
fromData(data: any): void;
|
|
218
228
|
dispose(): void;
|
|
219
229
|
private updateTRSCache;
|
|
220
230
|
private dispatchValueChange;
|
package/dist/utils/asserts.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function assertExist<T>(item
|
|
1
|
+
export declare function assertExist<T>(item?: T | void | null, msg?: string): asserts item is T;
|
|
2
2
|
export declare function asserts(condition: any, msg?: string): asserts condition;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -66,3 +66,4 @@ export declare function isObject(obj: any): boolean;
|
|
|
66
66
|
export declare function deepClone(obj: any): any;
|
|
67
67
|
export declare function random(min: number, max: number): number;
|
|
68
68
|
export declare function throwDestroyedError(): void;
|
|
69
|
+
export declare function generateGUID(): string;
|
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { ValueGetter } from '../math';
|
|
3
|
-
import type { Transform } from '../transform';
|
|
4
|
-
import type { VFXItem } from '../vfx-item';
|
|
5
|
-
import type { SpriteItemOptions, ItemBasicTransform, ItemLinearVelOverLifetime, SpriteRenderData } from '../plugins';
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
6
2
|
export interface TimelineComponentOptions {
|
|
7
3
|
sizeOverLifetime?: spec.SizeOverLifetime;
|
|
8
4
|
rotationOverLifetime?: spec.RotationOverLifetime;
|
|
9
5
|
positionOverLifetime?: spec.PositionOverLifetime;
|
|
10
6
|
}
|
|
11
|
-
export declare class TimelineComponent {
|
|
12
|
-
options: Omit<SpriteItemOptions, 'delay'>;
|
|
13
|
-
sizeSeparateAxes: boolean;
|
|
14
|
-
speedOverLifetime?: ValueGetter<number>;
|
|
15
|
-
basicTransform: ItemBasicTransform;
|
|
16
|
-
gravityModifier: ValueGetter<number>;
|
|
17
|
-
readonly transform: Transform;
|
|
18
|
-
readonly linearVelOverLifetime: ItemLinearVelOverLifetime;
|
|
19
|
-
readonly orbitalVelOverLifetime: {
|
|
20
|
-
x?: ValueGetter<number>;
|
|
21
|
-
y?: ValueGetter<number>;
|
|
22
|
-
z?: ValueGetter<number>;
|
|
23
|
-
center: [x: number, y: number, z: number];
|
|
24
|
-
asRotation?: boolean;
|
|
25
|
-
enabled?: boolean;
|
|
26
|
-
};
|
|
27
|
-
private velocity;
|
|
28
|
-
private readonly rotationOverLifetime;
|
|
29
|
-
private readonly sizeXOverLifetime;
|
|
30
|
-
private readonly sizeYOverLifetime;
|
|
31
|
-
private readonly sizeZOverLifetime;
|
|
32
|
-
private readonly positionOverLifetime;
|
|
33
|
-
constructor(options: TimelineComponentOptions, ownerItem: VFXItem<any>);
|
|
34
|
-
private getVelocity;
|
|
35
|
-
private willTranslate;
|
|
36
|
-
updatePosition(x: number, y: number, z: number): void;
|
|
37
|
-
updateRotation(x: number, y: number, z: number): void;
|
|
38
|
-
getRenderData(_time: number, init?: boolean): SpriteRenderData;
|
|
39
|
-
}
|
package/dist/vfx-item.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
1
2
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import type { HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, ParticleSystem, SpriteItem, CalculateItem, CameraController, InteractItem, BoundingBoxData, SpriteRenderData, ParticleVFXItem, FilterSpriteVFXItem, SpriteVFXItem, CameraVFXItem } from './plugins';
|
|
3
|
+
import { RendererComponent } from './components';
|
|
4
|
+
import type { Component } from './components/component';
|
|
5
|
+
import { ItemBehaviour } from './components/component';
|
|
6
6
|
import type { Composition } from './composition';
|
|
7
|
-
import type
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { type VFXItemData } from './asset-loader';
|
|
8
|
+
import { EffectsObject } from './effects-object';
|
|
9
|
+
import type { Engine } from './engine';
|
|
10
|
+
import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, ParticleSystem, SpriteComponent } from './plugins';
|
|
11
|
+
import { TimelineComponent } from './plugins';
|
|
12
|
+
import { Transform } from './transform';
|
|
13
|
+
import { type Disposable } from './utils';
|
|
14
|
+
export type VFXItemContent = ParticleSystem | SpriteComponent | TimelineComponent | CameraController | InteractComponent | void | {};
|
|
15
|
+
export type VFXItemConstructor = new (enigne: Engine, props: VFXItemProps, composition: Composition) => VFXItem<VFXItemContent>;
|
|
10
16
|
export type VFXItemProps = spec.Item & {
|
|
11
|
-
items:
|
|
17
|
+
items: VFXItemProps[];
|
|
12
18
|
startTime: number;
|
|
13
19
|
relative?: boolean;
|
|
14
20
|
listIndex?: number;
|
|
@@ -17,7 +23,7 @@ export type VFXItemProps = spec.Item & {
|
|
|
17
23
|
/**
|
|
18
24
|
* 所有元素的继承的抽象类
|
|
19
25
|
*/
|
|
20
|
-
export declare
|
|
26
|
+
export declare class VFXItem<T extends VFXItemContent> extends EffectsObject implements Disposable {
|
|
21
27
|
/**
|
|
22
28
|
* 元素绑定的父元素,
|
|
23
29
|
* 1. 当元素没有绑定任何父元素时,parent为空,transform.parentTransform 为 composition.transform
|
|
@@ -26,6 +32,7 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
26
32
|
* 4. 当元素绑定 TreeItem 本身时,行为表现和绑定 nullItem 相同
|
|
27
33
|
*/
|
|
28
34
|
parent?: VFXItem<VFXItemContent>;
|
|
35
|
+
children: VFXItem<VFXItemContent>[];
|
|
29
36
|
/**
|
|
30
37
|
* 元素的变换包含位置、旋转、缩放。
|
|
31
38
|
*/
|
|
@@ -49,7 +56,7 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
49
56
|
/**
|
|
50
57
|
* 元素动画的开始时间
|
|
51
58
|
*/
|
|
52
|
-
|
|
59
|
+
start: number;
|
|
53
60
|
/**
|
|
54
61
|
* 元素动画结束时行为(如何处理元素)
|
|
55
62
|
*/
|
|
@@ -61,27 +68,33 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
61
68
|
/**
|
|
62
69
|
* 元素在合成中的索引
|
|
63
70
|
*/
|
|
64
|
-
|
|
71
|
+
listIndex: number;
|
|
65
72
|
/**
|
|
66
73
|
* 元素名称
|
|
67
74
|
*/
|
|
68
|
-
|
|
75
|
+
name: string;
|
|
69
76
|
/**
|
|
70
77
|
* 元素 id 唯一
|
|
71
78
|
*/
|
|
72
|
-
|
|
79
|
+
id: string;
|
|
80
|
+
oldId: number;
|
|
73
81
|
/**
|
|
74
|
-
*
|
|
82
|
+
* 元素创建的数据图层/粒子/模型等
|
|
75
83
|
*/
|
|
76
|
-
|
|
84
|
+
_content?: T;
|
|
77
85
|
/**
|
|
78
|
-
*
|
|
86
|
+
* 元素动画是否延迟播放
|
|
79
87
|
*/
|
|
80
|
-
|
|
88
|
+
delaying: boolean;
|
|
81
89
|
/**
|
|
82
|
-
*
|
|
90
|
+
* 元素动画的速度
|
|
83
91
|
*/
|
|
84
|
-
|
|
92
|
+
type: spec.ItemType;
|
|
93
|
+
stopped: boolean;
|
|
94
|
+
props: VFXItemProps;
|
|
95
|
+
components: Component[];
|
|
96
|
+
itemBehaviours: ItemBehaviour[];
|
|
97
|
+
rendererComponents: RendererComponent[];
|
|
85
98
|
/**
|
|
86
99
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
87
100
|
* @protected
|
|
@@ -92,77 +105,23 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
92
105
|
* @protected
|
|
93
106
|
*/
|
|
94
107
|
protected _contentVisible: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* 合成元素当前的时间,单位毫秒
|
|
97
|
-
* @protected
|
|
98
|
-
*/
|
|
99
|
-
protected timeInms: number;
|
|
100
|
-
/**
|
|
101
|
-
* 合成元素当前的时间,单位秒,兼容旧 player 使用秒的时间更新数据
|
|
102
|
-
* @protected
|
|
103
|
-
*/
|
|
104
|
-
protected time: number;
|
|
105
|
-
/**
|
|
106
|
-
* 元素动画持续时间,单位毫秒
|
|
107
|
-
*/
|
|
108
|
-
protected readonly durInms: number;
|
|
109
|
-
/**
|
|
110
|
-
* 元素动画延迟/开始播放时间,单位毫秒
|
|
111
|
-
*/
|
|
112
|
-
protected readonly delayInms: number;
|
|
113
|
-
/**
|
|
114
|
-
* 元素动画是否延迟播放
|
|
115
|
-
*/
|
|
116
|
-
protected delaying: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* 元素冻结属性,冻结后停止计算/更新数据
|
|
119
|
-
*/
|
|
120
|
-
private _frozen;
|
|
121
|
-
/**
|
|
122
|
-
* 元素动画结束回调是否被调用
|
|
123
|
-
*/
|
|
124
|
-
private callEnd;
|
|
125
|
-
/**
|
|
126
|
-
* 元素动画的速度
|
|
127
|
-
*/
|
|
128
108
|
private speed;
|
|
129
|
-
static isComposition(item: VFXItem<VFXItemContent>): item is
|
|
130
|
-
static isSprite(item: VFXItem<VFXItemContent>): item is
|
|
131
|
-
static isParticle(item: VFXItem<VFXItemContent>): item is
|
|
132
|
-
static isFilterSprite(item: VFXItem<VFXItemContent>): item is FilterSpriteVFXItem;
|
|
109
|
+
static isComposition(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
|
|
110
|
+
static isSprite(item: VFXItem<VFXItemContent>): item is VFXItem<SpriteComponent>;
|
|
111
|
+
static isParticle(item: VFXItem<VFXItemContent>): item is VFXItem<ParticleSystem>;
|
|
133
112
|
static isNull(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
|
|
134
113
|
static isTree(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
|
|
135
114
|
static isCamera(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
|
|
136
|
-
static isExtraCamera(item: VFXItem<VFXItemContent>): item is
|
|
137
|
-
constructor(
|
|
138
|
-
/**
|
|
139
|
-
* 元素内容可见性
|
|
140
|
-
*/
|
|
141
|
-
get contentVisible(): boolean;
|
|
115
|
+
static isExtraCamera(item: VFXItem<VFXItemContent>): item is VFXItem<CameraController>;
|
|
116
|
+
constructor(engine: Engine, props?: VFXItemProps);
|
|
142
117
|
/**
|
|
143
118
|
* 返回元素创建的数据
|
|
144
119
|
*/
|
|
145
120
|
get content(): T;
|
|
146
|
-
/**
|
|
147
|
-
* 设置元素数据
|
|
148
|
-
*/
|
|
149
|
-
set content(t: T);
|
|
150
121
|
/**
|
|
151
122
|
* 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
|
|
152
123
|
*/
|
|
153
124
|
get reusable(): boolean;
|
|
154
|
-
/**
|
|
155
|
-
* 获取元素类型
|
|
156
|
-
*/
|
|
157
|
-
get type(): spec.ItemType | string;
|
|
158
|
-
/**
|
|
159
|
-
* 获取元素冻结属性
|
|
160
|
-
*/
|
|
161
|
-
get frozen(): boolean;
|
|
162
|
-
/**
|
|
163
|
-
* 设置元素冻结属性
|
|
164
|
-
*/
|
|
165
|
-
set frozen(v: boolean);
|
|
166
125
|
/**
|
|
167
126
|
* 获取元素生命周期是否开始
|
|
168
127
|
*/
|
|
@@ -178,59 +137,27 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
178
137
|
*/
|
|
179
138
|
getSpeed(): number;
|
|
180
139
|
/**
|
|
181
|
-
*
|
|
140
|
+
* 添加组件
|
|
141
|
+
* @param classConstructor - 要添加的组件类型
|
|
182
142
|
*/
|
|
183
|
-
|
|
143
|
+
addComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T;
|
|
184
144
|
/**
|
|
185
|
-
*
|
|
145
|
+
* 获取某一类型的组件。如果当前元素绑定了多个同类型的组件只返回第一个
|
|
146
|
+
* @param classConstructor - 要获取的组件类型
|
|
147
|
+
* @returns 查询结果中符合类型的第一个组件
|
|
186
148
|
*/
|
|
187
|
-
|
|
188
|
-
doStop(): void;
|
|
149
|
+
getComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T | undefined;
|
|
189
150
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @returns
|
|
151
|
+
* 获取某一类型的所有组件
|
|
152
|
+
* @param classConstructor - 要获取的组件
|
|
153
|
+
* @returns 一个组件列表,包含所有符合类型的组件
|
|
193
154
|
*/
|
|
194
|
-
|
|
155
|
+
getComponents<T extends Component>(classConstructor: new (engine: Engine) => T): T[];
|
|
156
|
+
setParent(vfxItem: VFXItem<VFXItemContent>): void;
|
|
195
157
|
/**
|
|
196
|
-
*
|
|
197
|
-
* @override
|
|
198
|
-
* @param composition
|
|
199
|
-
* @returns
|
|
200
|
-
*/
|
|
201
|
-
protected doCreateContent(composition: Composition | null): T;
|
|
202
|
-
/**
|
|
203
|
-
* 元素构造函数调用时将调用该函数
|
|
204
|
-
* @param options
|
|
205
|
-
* @override
|
|
206
|
-
*/
|
|
207
|
-
onConstructed(options: spec.Item): void;
|
|
208
|
-
/**
|
|
209
|
-
* 内部使用的更新回调,请不要重写此方法,重写 `onItemUpdate` 方法
|
|
210
|
-
* @param deltaTime
|
|
211
|
-
*/
|
|
212
|
-
onUpdate(deltaTime: number): void;
|
|
213
|
-
/**
|
|
214
|
-
* 元素结束时的回调
|
|
215
|
-
* @override
|
|
216
|
-
* @param composition
|
|
217
|
-
* @param content
|
|
218
|
-
*/
|
|
219
|
-
protected onItemRemoved(composition: Composition, content?: T): void;
|
|
220
|
-
/**
|
|
221
|
-
* 元素更新函数,在 Composition 对象的 tick 函数中被调用
|
|
222
|
-
* @override
|
|
223
|
-
* @param dt
|
|
224
|
-
* @param lifetime
|
|
225
|
-
*/
|
|
226
|
-
onItemUpdate(dt: number, lifetime: number): void;
|
|
227
|
-
/**
|
|
228
|
-
* 元素 doCreateContent 函数调用后会立即调用该函数用于初始化数据
|
|
229
|
-
* @override
|
|
230
|
-
* @param composition
|
|
231
|
-
* @param content
|
|
158
|
+
* 停止播放元素动画
|
|
232
159
|
*/
|
|
233
|
-
|
|
160
|
+
stop(): void;
|
|
234
161
|
/**
|
|
235
162
|
* 元素动画结束播放时回调函数
|
|
236
163
|
* @override
|
|
@@ -258,18 +185,6 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
258
185
|
* 设置元素显隐属性 会触发 `handleVisibleChanged` 回调
|
|
259
186
|
*/
|
|
260
187
|
setVisible(visible: boolean): void;
|
|
261
|
-
/**
|
|
262
|
-
* 元素显隐属性改变时调用的函数,当 visible 为 true 时,务必显示元素
|
|
263
|
-
* @param visible
|
|
264
|
-
* @override
|
|
265
|
-
*/
|
|
266
|
-
protected handleVisibleChanged(visible: boolean): void;
|
|
267
|
-
/**
|
|
268
|
-
* 元素冻结属性改变时调用的函数
|
|
269
|
-
* @param frozen
|
|
270
|
-
* @override
|
|
271
|
-
*/
|
|
272
|
-
protected handleFrozenChanged(frozen: boolean): void;
|
|
273
188
|
/**
|
|
274
189
|
* 获取元素变换包括位置、旋转、缩放
|
|
275
190
|
* @param transform 将元素变换拷贝到该对象,并将其作为返回值
|
|
@@ -321,11 +236,6 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
321
236
|
* @param force 元素没有开启交互也返回参数
|
|
322
237
|
*/
|
|
323
238
|
getHitTestParams(force?: boolean): void | HitTestBoxParams | HitTestTriangleParams | HitTestSphereParams | HitTestCustomParams;
|
|
324
|
-
/**
|
|
325
|
-
* 获取元素的 transform、当前生命周期、可见性,当子元素需要时可继承
|
|
326
|
-
* @override
|
|
327
|
-
*/
|
|
328
|
-
getRenderData(): SpriteRenderData;
|
|
329
239
|
/**
|
|
330
240
|
* 获取元素当前世界坐标
|
|
331
241
|
*/
|
|
@@ -335,16 +245,16 @@ export declare abstract class VFXItem<T extends VFXItemContent> implements Dispo
|
|
|
335
245
|
* @param now
|
|
336
246
|
* @returns
|
|
337
247
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
reset(): void;
|
|
248
|
+
isEnded(now: number): boolean;
|
|
249
|
+
find(name: string): VFXItem<VFXItemContent> | undefined;
|
|
250
|
+
fromData(data: VFXItemData): void;
|
|
251
|
+
toData(): void;
|
|
343
252
|
translateByPixel(x: number, y: number): void;
|
|
344
253
|
/**
|
|
345
254
|
* 销毁元素
|
|
346
255
|
*/
|
|
347
256
|
dispose(): void;
|
|
257
|
+
private resetChildrenParent;
|
|
348
258
|
}
|
|
349
259
|
export declare namespace Item {
|
|
350
260
|
function is<T extends spec.Item>(item: spec.Item, type: spec.ItemType): item is T;
|
|
@@ -354,7 +264,7 @@ export declare namespace Item {
|
|
|
354
264
|
function isNull(item: spec.Item): item is spec.NullItem;
|
|
355
265
|
}
|
|
356
266
|
/**
|
|
357
|
-
* 根据元素的类型创建对应的 `VFXItem` 实例
|
|
267
|
+
* (待废弃) 根据元素的类型创建对应的 `VFXItem` 实例
|
|
358
268
|
* @param props
|
|
359
269
|
* @param composition
|
|
360
270
|
*/
|