@galacean/effects-core 2.0.0-alpha.9 → 2.0.0-beta.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/README.md +25 -21
- package/dist/__definations__/fbeffects-object-data.d.ts +28 -0
- package/dist/__definations__/fbeffects-package-data.d.ts +26 -0
- package/dist/__definations__/fbgeometry-data.d.ts +77 -0
- package/dist/__definations__/fbsub-mesh.d.ts +26 -0
- package/dist/__definations__/fbvertex-channel.d.ts +33 -0
- package/dist/__definations__/fbvertex-data.d.ts +27 -0
- package/dist/__definations__/index.d.ts +6 -0
- package/dist/asset-loader.d.ts +0 -13
- package/dist/binary-asset.d.ts +6 -0
- package/dist/camera.d.ts +11 -2
- package/dist/canvas-pool.d.ts +0 -1
- package/dist/comp-vfx-item.d.ts +26 -12
- package/dist/components/component.d.ts +9 -14
- package/dist/components/effect-component.d.ts +3 -23
- package/dist/components/index.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +15 -0
- package/dist/components/renderer-component.d.ts +2 -2
- package/dist/composition-source-manager.d.ts +8 -7
- package/dist/composition.d.ts +65 -62
- package/dist/constants.d.ts +1 -1
- package/dist/decorators.d.ts +4 -3
- package/dist/downloader.d.ts +9 -0
- package/dist/effects-object.d.ts +1 -0
- package/dist/effects-package.d.ts +19 -0
- package/dist/engine.d.ts +7 -4
- package/dist/events/event-emitter.d.ts +46 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/types.d.ts +37 -0
- 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 +9 -4
- package/dist/index.js +19373 -14510
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19333 -14477
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +5 -6
- package/dist/material/utils.d.ts +0 -10
- 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 +5 -4
- package/dist/math/value-getter.d.ts +52 -26
- package/dist/pass-render-level.d.ts +3 -1
- package/dist/plugin-system.d.ts +2 -2
- 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 +54 -13
- package/dist/plugins/cal/playable-graph.d.ts +72 -21
- package/dist/plugins/cal/timeline-asset.d.ts +27 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +2 -13
- 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 +15 -1
- package/dist/plugins/particle/burst.d.ts +10 -3
- package/dist/plugins/particle/link.d.ts +1 -0
- package/dist/plugins/particle/particle-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-mesh.d.ts +5 -9
- package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +13 -6
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
- package/dist/plugins/particle/trail-mesh.d.ts +2 -2
- package/dist/plugins/plugin.d.ts +6 -6
- package/dist/plugins/sprite/sprite-item.d.ts +16 -12
- 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 +32 -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 +72 -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 +2 -2
- 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 +4 -5
- package/dist/render/gpu-capability.d.ts +6 -6
- package/dist/render/index.d.ts +2 -2
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/render-frame.d.ts +11 -10
- package/dist/render/render-pass.d.ts +8 -8
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +9 -7
- package/dist/render/semantic-map.d.ts +1 -1
- package/dist/render/shader.d.ts +4 -4
- package/dist/scene.d.ts +10 -4
- package/dist/serialization-helper.d.ts +6 -4
- package/dist/shader/index.d.ts +1 -3
- package/dist/shader/shader-factory.d.ts +35 -0
- package/dist/shape/shape.d.ts +1 -1
- package/dist/template-image.d.ts +3 -3
- package/dist/texture/texture.d.ts +2 -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 +4 -0
- package/dist/utils/index.d.ts +29 -14
- package/dist/utils/text.d.ts +8 -0
- package/dist/vfx-item.d.ts +75 -62
- package/package.json +7 -5
- package/dist/asset-migrations.d.ts +0 -5
- package/dist/plugins/cal/animation-mixer-playable.d.ts +0 -4
- package/dist/plugins/cal/animation-playable-output.d.ts +0 -4
- package/dist/plugins/cal/track.d.ts +0 -34
- package/dist/utils/timeline-component.d.ts +0 -6
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EffectsObject } from '../../effects-object';
|
|
2
|
+
import type { Disposable } from '../../utils';
|
|
2
3
|
/**
|
|
3
4
|
* 动画图,负责更新所有的动画节点
|
|
4
5
|
* @since 2.0.0
|
|
@@ -6,36 +7,70 @@ import type { VFXItem, VFXItemContent } from '../../vfx-item';
|
|
|
6
7
|
*/
|
|
7
8
|
export declare class PlayableGraph {
|
|
8
9
|
private playableOutputs;
|
|
9
|
-
|
|
10
|
+
private playables;
|
|
10
11
|
evaluate(dt: number): void;
|
|
11
|
-
connect(source: Playable, destination: Playable): void;
|
|
12
|
+
connect(source: Playable, sourceOutputPort: number, destination: Playable, destinationInputPort: number): void;
|
|
12
13
|
addOutput(output: PlayableOutput): void;
|
|
13
|
-
|
|
14
|
+
addPlayable(playable: Playable): void;
|
|
15
|
+
private processFrameWithRoot;
|
|
16
|
+
private prepareFrameWithRoot;
|
|
17
|
+
private updatePlayableTime;
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* 动画图可播放节点对象
|
|
17
21
|
* @since 2.0.0
|
|
18
22
|
* @internal
|
|
19
23
|
*/
|
|
20
|
-
export declare class Playable {
|
|
21
|
-
|
|
24
|
+
export declare class Playable implements Disposable {
|
|
25
|
+
onPlayablePlayFlag: boolean;
|
|
26
|
+
onPlayablePauseFlag: boolean;
|
|
27
|
+
overrideTimeNextEvaluation: boolean;
|
|
28
|
+
private destroyed;
|
|
22
29
|
private inputs;
|
|
30
|
+
private inputOuputPorts;
|
|
31
|
+
private inputWeight;
|
|
32
|
+
private outputs;
|
|
33
|
+
private playState;
|
|
34
|
+
private traversalMode;
|
|
23
35
|
/**
|
|
24
36
|
* 当前本地播放的时间
|
|
25
37
|
*/
|
|
26
38
|
protected time: number;
|
|
27
|
-
constructor();
|
|
28
|
-
|
|
39
|
+
constructor(graph: PlayableGraph, inputCount?: number);
|
|
40
|
+
play(): void;
|
|
41
|
+
pause(): void;
|
|
42
|
+
connectInput(inputPort: number, sourcePlayable: Playable, sourceOutputPort: number, weight?: number): void;
|
|
43
|
+
addInput(sourcePlayable: Playable, sourceOutputPort: number, weight?: number): void;
|
|
44
|
+
getInputCount(): number;
|
|
29
45
|
getInputs(): Playable[];
|
|
30
|
-
getInput(index: number): Playable
|
|
46
|
+
getInput(index: number): Playable;
|
|
47
|
+
getOutputCount(): number;
|
|
48
|
+
getOutputs(): Playable[];
|
|
49
|
+
getOutput(index: number): Playable;
|
|
50
|
+
getInputWeight(inputIndex: number): number;
|
|
51
|
+
setInputWeight(playable: Playable, weight: number): void;
|
|
52
|
+
setInputWeight(inputIndex: number, weight: number): void;
|
|
31
53
|
setTime(time: number): void;
|
|
32
54
|
getTime(): number;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
getPlayState(): PlayState;
|
|
56
|
+
setTraversalMode(mode: PlayableTraversalMode): void;
|
|
57
|
+
getTraversalMode(): PlayableTraversalMode;
|
|
58
|
+
onPlayablePlay(context: FrameContext): void;
|
|
59
|
+
onPlayablePause(context: FrameContext): void;
|
|
60
|
+
prepareFrame(context: FrameContext): void;
|
|
61
|
+
processFrame(context: FrameContext): void;
|
|
37
62
|
onPlayableDestroy(): void;
|
|
38
|
-
|
|
63
|
+
dispose(): void;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
prepareFrameRecursive(context: FrameContext, passthroughPort: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
processFrameRecursive(context: FrameContext, passthroughPort: number): void;
|
|
72
|
+
private setOutput;
|
|
73
|
+
private setInput;
|
|
39
74
|
}
|
|
40
75
|
/**
|
|
41
76
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
@@ -46,21 +81,37 @@ export declare class PlayableOutput {
|
|
|
46
81
|
/**
|
|
47
82
|
* 绑定到的动画 item
|
|
48
83
|
*/
|
|
49
|
-
|
|
84
|
+
userData: object;
|
|
50
85
|
/**
|
|
51
86
|
* 源 playable 对象
|
|
52
87
|
*/
|
|
53
88
|
sourcePlayable: Playable;
|
|
89
|
+
context: FrameContext;
|
|
54
90
|
/**
|
|
55
91
|
* 当前本地播放的时间
|
|
56
92
|
*/
|
|
57
93
|
protected time: number;
|
|
94
|
+
private sourceOutputPort;
|
|
58
95
|
constructor();
|
|
59
|
-
setSourcePlayeble(playable: Playable): void;
|
|
60
|
-
|
|
61
|
-
|
|
96
|
+
setSourcePlayeble(playable: Playable, port?: number): void;
|
|
97
|
+
getSourceOutputPort(): number;
|
|
98
|
+
setUserData(value: object): void;
|
|
99
|
+
getUserData(): object;
|
|
100
|
+
prepareFrame(): void;
|
|
101
|
+
processFrame(): void;
|
|
102
|
+
}
|
|
103
|
+
export declare abstract class PlayableAsset extends EffectsObject {
|
|
104
|
+
abstract createPlayable(graph: PlayableGraph): Playable;
|
|
105
|
+
}
|
|
106
|
+
export interface FrameContext {
|
|
107
|
+
deltaTime: number;
|
|
108
|
+
output: PlayableOutput;
|
|
109
|
+
}
|
|
110
|
+
export declare enum PlayState {
|
|
111
|
+
Playing = 0,
|
|
112
|
+
Paused = 1
|
|
62
113
|
}
|
|
63
|
-
export declare
|
|
64
|
-
|
|
65
|
-
|
|
114
|
+
export declare enum PlayableTraversalMode {
|
|
115
|
+
Mix = 0,
|
|
116
|
+
Passthrough = 1
|
|
66
117
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DataPath, EffectsObjectData } from '@galacean/effects-specification';
|
|
2
|
+
import type { RuntimeClip, TrackAsset } from '../timeline/track';
|
|
3
|
+
import type { FrameContext, PlayableGraph } from './playable-graph';
|
|
4
|
+
import { Playable, PlayableAsset } from './playable-graph';
|
|
5
|
+
import type { Constructor } from '../../utils';
|
|
6
|
+
export interface TimelineAssetData extends EffectsObjectData {
|
|
7
|
+
tracks: DataPath[];
|
|
8
|
+
}
|
|
9
|
+
export declare class TimelineAsset extends PlayableAsset {
|
|
10
|
+
tracks: TrackAsset[];
|
|
11
|
+
createPlayable(graph: PlayableGraph): Playable;
|
|
12
|
+
createTrack<T extends TrackAsset>(classConstructor: Constructor<T>, parent: TrackAsset, name?: string): T;
|
|
13
|
+
fromData(data: TimelineAssetData): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class TimelinePlayable extends Playable {
|
|
16
|
+
clips: RuntimeClip[];
|
|
17
|
+
prepareFrame(context: FrameContext): void;
|
|
18
|
+
evaluate(): void;
|
|
19
|
+
compileTracks(graph: PlayableGraph, tracks: TrackAsset[]): void;
|
|
20
|
+
private sortTracks;
|
|
21
|
+
private addSubTracksRecursive;
|
|
22
|
+
}
|
|
23
|
+
export declare class TrackSortWrapper {
|
|
24
|
+
track: TrackAsset;
|
|
25
|
+
originalIndex: number;
|
|
26
|
+
constructor(track: TrackAsset, originalIndex: number);
|
|
27
|
+
}
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { Euler, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
2
1
|
import * as spec from '@galacean/effects-specification';
|
|
3
|
-
import {
|
|
2
|
+
import { Behaviour } from '../../components';
|
|
4
3
|
import type { Engine } from '../../engine';
|
|
5
|
-
export declare class CameraController extends
|
|
6
|
-
near: number;
|
|
7
|
-
far: number;
|
|
8
|
-
fov: number;
|
|
9
|
-
clipMode?: spec.CameraClipMode;
|
|
10
|
-
position: Vector3;
|
|
11
|
-
rotation: Euler;
|
|
4
|
+
export declare class CameraController extends Behaviour {
|
|
12
5
|
private options;
|
|
13
|
-
private translateOverLifetime?;
|
|
14
|
-
private rotationOverLifetime?;
|
|
15
6
|
constructor(engine: Engine, props?: spec.CameraContent);
|
|
16
|
-
start(): void;
|
|
17
7
|
update(): void;
|
|
18
8
|
fromData(data: spec.CameraContent): void;
|
|
19
|
-
private updateCamera;
|
|
20
9
|
}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export * from './particle/particle-system-renderer';
|
|
|
18
18
|
export * from './cal/calculate-loader';
|
|
19
19
|
export * from './cal/calculate-vfx-item';
|
|
20
20
|
export * from './cal/calculate-item';
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
21
|
+
export * from './timeline/track';
|
|
22
|
+
export * from './timeline/tracks/transform-track';
|
|
23
|
+
export * from './timeline/tracks/activation-track';
|
|
24
|
+
export * from './timeline/tracks/sprite-color-track';
|
|
25
|
+
export * from './timeline/tracks/sub-composition-track';
|
|
26
|
+
export * from './timeline/playables/sub-composition-playable-asset';
|
|
27
|
+
export * from './cal/timeline-asset';
|
|
28
|
+
export * from './text';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Matrix4, Ray, TriangleLike, Vector2, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
2
2
|
import type * as spec from '@galacean/effects-specification';
|
|
3
|
-
import type { VFXItem
|
|
3
|
+
import type { VFXItem } from '../../vfx-item';
|
|
4
4
|
export declare enum HitTestType {
|
|
5
5
|
triangle = 1,
|
|
6
6
|
box = 2,
|
|
@@ -46,13 +46,13 @@ export interface HitTestCustomParams {
|
|
|
46
46
|
behavior?: spec.InteractBehavior;
|
|
47
47
|
}
|
|
48
48
|
export type Region = {
|
|
49
|
-
compContent: VFXItem
|
|
49
|
+
compContent: VFXItem;
|
|
50
50
|
name: string;
|
|
51
51
|
id: string;
|
|
52
52
|
position: Vector3;
|
|
53
53
|
behavior?: spec.InteractBehavior;
|
|
54
54
|
parentId?: string;
|
|
55
|
-
hitPositions
|
|
55
|
+
hitPositions: Vector3[];
|
|
56
56
|
};
|
|
57
57
|
export type HitTestParams = {
|
|
58
58
|
camera: {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
1
|
import type { Disposable } from '../../utils';
|
|
3
2
|
export declare const EVENT_TYPE_CLICK = "click";
|
|
4
3
|
export declare const EVENT_TYPE_TOUCH_START = "touchstart";
|
|
5
4
|
export declare const EVENT_TYPE_TOUCH_MOVE = "touchmove";
|
|
6
5
|
export declare const EVENT_TYPE_TOUCH_END = "touchend";
|
|
7
|
-
export declare const InteractBehavior: typeof spec.InteractBehavior;
|
|
8
6
|
export type TouchEventType = {
|
|
9
7
|
x: number;
|
|
10
8
|
y: number;
|
|
@@ -15,6 +15,19 @@ export declare class InteractComponent extends RendererComponent {
|
|
|
15
15
|
bouncingArg: TouchEventType | null;
|
|
16
16
|
previewContent: InteractMesh | null;
|
|
17
17
|
interactData: spec.InteractContent;
|
|
18
|
+
/**
|
|
19
|
+
* 拖拽的惯性衰减系数,范围[0, 1], 越大惯性越强
|
|
20
|
+
*/
|
|
21
|
+
downgrade: number;
|
|
22
|
+
/**
|
|
23
|
+
* 拖拽的距离映射系数,越大越容易拖动
|
|
24
|
+
*/
|
|
25
|
+
dragRatio: number[];
|
|
26
|
+
/** 是否响应点击和拖拽交互事件 */
|
|
27
|
+
private _interactive;
|
|
28
|
+
private hasBeenAddedToComposition;
|
|
29
|
+
set interactive(enable: boolean);
|
|
30
|
+
get interactive(): boolean;
|
|
18
31
|
start(): void;
|
|
19
32
|
update(dt: number): void;
|
|
20
33
|
render(renderer: Renderer): void;
|
|
@@ -24,5 +37,6 @@ export declare class InteractComponent extends RendererComponent {
|
|
|
24
37
|
beginDragTarget(options: spec.DragInteractOption, eventSystem: EventSystem): void;
|
|
25
38
|
getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
|
|
26
39
|
getBoundingBox(): BoundingBoxTriangle | void;
|
|
27
|
-
fromData(data:
|
|
40
|
+
fromData(data: spec.InteractContent): void;
|
|
41
|
+
canInteract(): boolean;
|
|
28
42
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { ValueGetter } from '../../math';
|
|
2
|
+
interface BurstOptions {
|
|
3
|
+
time: number;
|
|
4
|
+
interval: number;
|
|
5
|
+
count: number | ValueGetter<number>;
|
|
6
|
+
cycles: number;
|
|
7
|
+
probability: number;
|
|
8
|
+
}
|
|
1
9
|
export declare class Burst {
|
|
2
|
-
once: boolean;
|
|
3
|
-
disabled: boolean;
|
|
4
10
|
private now;
|
|
5
11
|
private index;
|
|
6
12
|
private internalCycles;
|
|
@@ -9,7 +15,7 @@ export declare class Burst {
|
|
|
9
15
|
private readonly count;
|
|
10
16
|
private readonly cycles;
|
|
11
17
|
private readonly probability;
|
|
12
|
-
constructor(
|
|
18
|
+
constructor(options: BurstOptions);
|
|
13
19
|
getGeneratorOptions(timePassed: number, lifetime: number): {
|
|
14
20
|
index: number;
|
|
15
21
|
total: number;
|
|
@@ -19,3 +25,4 @@ export declare class Burst {
|
|
|
19
25
|
reset(): void;
|
|
20
26
|
clone(): Burst;
|
|
21
27
|
}
|
|
28
|
+
export {};
|
|
@@ -17,5 +17,6 @@ export declare class Link<T> {
|
|
|
17
17
|
removeNode(node: LinkNode<T>): void;
|
|
18
18
|
forEach(func: (content: T, index: number) => void, thisObj?: any): void;
|
|
19
19
|
forEachReverse(func: (content: T, index: number) => void, thisObj?: any): void;
|
|
20
|
+
getNodeByIndex(index: number): LinkNode<T> | null;
|
|
20
21
|
}
|
|
21
22
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Engine } from '../../engine';
|
|
3
3
|
import type { Renderer } from '../../render';
|
|
4
|
-
import { AbstractPlugin } from '../
|
|
4
|
+
import { AbstractPlugin } from '../plugin';
|
|
5
5
|
import type { PrecompileOptions } from '../../plugin-system';
|
|
6
6
|
export declare class ParticleLoader extends AbstractPlugin {
|
|
7
7
|
engine: Engine;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Matrix4 } from '@galacean/effects-math/es/core/index';
|
|
2
|
-
import { Vector2, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
3
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
3
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
4
|
+
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
4
5
|
import type { Engine } from '../../engine';
|
|
5
|
-
import
|
|
6
|
+
import { ValueGetter } from '../../math';
|
|
6
7
|
import type { GPUCapability, SharedShaderWithSource } from '../../render';
|
|
7
8
|
import { Geometry, Mesh } from '../../render';
|
|
8
9
|
import { Texture } from '../../texture';
|
|
@@ -139,18 +140,13 @@ export declare class ParticleMesh implements ParticleMeshData {
|
|
|
139
140
|
readonly anchor: Vector2;
|
|
140
141
|
constructor(engine: Engine, props: ParticleMeshProps);
|
|
141
142
|
getPointColor(index: number): number[];
|
|
142
|
-
/**
|
|
143
|
-
* 待废弃
|
|
144
|
-
* @deprecated - 使用 `particle-system.getPointPosition` 替代
|
|
145
|
-
*/
|
|
146
|
-
getPointPosition(index: number): Vector3;
|
|
147
143
|
clearPoints(): void;
|
|
148
144
|
resetGeometryData(geometry: Geometry): void;
|
|
149
145
|
minusTime(time: number): void;
|
|
150
146
|
removePoint(index: number): void;
|
|
151
147
|
setPoint(index: number, point: Point): void;
|
|
152
148
|
}
|
|
153
|
-
export declare function getParticleMeshShader(item: spec.ParticleItem,
|
|
149
|
+
export declare function getParticleMeshShader(item: spec.ParticleItem, gpuCapability: GPUCapability, env?: string): {
|
|
154
150
|
shader: SharedShaderWithSource;
|
|
155
151
|
vertex: number;
|
|
156
152
|
fragment: number;
|
|
@@ -15,7 +15,7 @@ export declare class ParticleSystemRenderer extends RendererComponent {
|
|
|
15
15
|
meshes: Mesh[];
|
|
16
16
|
particleMesh: ParticleMesh;
|
|
17
17
|
private trailMesh?;
|
|
18
|
-
constructor(engine: Engine, particleMeshProps
|
|
18
|
+
constructor(engine: Engine, particleMeshProps?: ParticleMeshProps, trailMeshProps?: TrailMeshProps);
|
|
19
19
|
start(): void;
|
|
20
20
|
update(dt: number): void;
|
|
21
21
|
render(renderer: Renderer): void;
|
|
@@ -48,7 +48,7 @@ type ParticleOptions = {
|
|
|
48
48
|
maxCount: number;
|
|
49
49
|
gravity: vec3;
|
|
50
50
|
gravityModifier: ValueGetter<number>;
|
|
51
|
-
renderLevel?:
|
|
51
|
+
renderLevel?: spec.RenderLevel;
|
|
52
52
|
particleFollowParent?: boolean;
|
|
53
53
|
forceTarget?: {
|
|
54
54
|
curve: ValueGetter<number>;
|
|
@@ -112,7 +112,7 @@ type ParticleInteraction = {
|
|
|
112
112
|
multiple?: boolean;
|
|
113
113
|
radius: number;
|
|
114
114
|
};
|
|
115
|
-
interface ParticleSystemOptions extends spec.ParticleOptions {
|
|
115
|
+
export interface ParticleSystemOptions extends spec.ParticleOptions {
|
|
116
116
|
meshSlots?: number[];
|
|
117
117
|
}
|
|
118
118
|
export interface ParticleSystemProps extends Omit<spec.ParticleContent, 'options' | 'renderer' | 'trails'> {
|
|
@@ -141,7 +141,7 @@ export declare class ParticleSystem extends Component {
|
|
|
141
141
|
textureSheetAnimation?: ParticleTextureSheetAnimation;
|
|
142
142
|
interaction?: ParticleInteraction;
|
|
143
143
|
emissionStopped: boolean;
|
|
144
|
-
|
|
144
|
+
destroyed: boolean;
|
|
145
145
|
props: ParticleSystemProps;
|
|
146
146
|
private generatedCount;
|
|
147
147
|
private lastUpdate;
|
|
@@ -158,6 +158,7 @@ export declare class ParticleSystem extends Component {
|
|
|
158
158
|
get timePassed(): number;
|
|
159
159
|
get lifetime(): number;
|
|
160
160
|
get particleCount(): number;
|
|
161
|
+
isFrozen(): boolean;
|
|
161
162
|
initEmitterTransform(): void;
|
|
162
163
|
private updateEmitterTransform;
|
|
163
164
|
private addParticle;
|
|
@@ -181,9 +182,15 @@ export declare class ParticleSystem extends Component {
|
|
|
181
182
|
raycast(options: ParticleSystemRayCastOptions): Vector3[] | undefined;
|
|
182
183
|
clearPointTrail(pointIndex: number): void;
|
|
183
184
|
updatePointTrail(pointIndex: number, emitterLifetime: number, point: Point, startTime: number): void;
|
|
185
|
+
/**
|
|
186
|
+
* 通过索引获取指定index粒子当前时刻的位置
|
|
187
|
+
* @params index - 粒子索引
|
|
188
|
+
*/
|
|
189
|
+
getPointPositionByIndex(index: number): Vector3 | null;
|
|
190
|
+
/**
|
|
191
|
+
* 通过粒子参数获取当前时刻粒子的位置
|
|
192
|
+
*/
|
|
184
193
|
getPointPosition(point: Point): Vector3;
|
|
185
|
-
onEnd(particle: ParticleSystem): void;
|
|
186
|
-
onIterate(particle: ParticleSystem): void;
|
|
187
194
|
initPoint(data: Record<string, any>): Point;
|
|
188
195
|
addBurst(burst: Burst, offsets: vec3[]): number;
|
|
189
196
|
removeBurst(index: number): void;
|
|
@@ -192,6 +199,6 @@ export declare class ParticleSystem extends Component {
|
|
|
192
199
|
resumeParticleEmission(): void;
|
|
193
200
|
getBoundingBox(): void | BoundingBoxSphere;
|
|
194
201
|
getHitTestParams: (force?: boolean) => void | HitTestCustomParams;
|
|
195
|
-
fromData(data:
|
|
202
|
+
fromData(data: unknown): void;
|
|
196
203
|
}
|
|
197
204
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FrameContext, PlayableGraph } from '../cal/playable-graph';
|
|
2
|
+
import { Playable, PlayableAsset } from '../cal/playable-graph';
|
|
2
3
|
import { ParticleSystem } from './particle-system';
|
|
3
4
|
/**
|
|
4
5
|
* @since 2.0.0
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
7
8
|
export declare class ParticleBehaviourPlayable extends Playable {
|
|
9
|
+
lastTime: number;
|
|
8
10
|
particleSystem: ParticleSystem;
|
|
9
|
-
|
|
10
|
-
processFrame(
|
|
11
|
+
start(context: FrameContext): void;
|
|
12
|
+
processFrame(context: FrameContext): void;
|
|
11
13
|
}
|
|
14
|
+
export declare class ParticleBehaviourPlayableAsset extends PlayableAsset {
|
|
15
|
+
createPlayable(graph: PlayableGraph): Playable;
|
|
16
|
+
}
|
|
17
|
+
export declare const particleUniformTypeMap: Record<string, string>;
|
|
@@ -3,7 +3,7 @@ import { Vector3 } from '@galacean/effects-math/es/core/index';
|
|
|
3
3
|
import type * as spec from '@galacean/effects-specification';
|
|
4
4
|
import type { GradientStop, vec4 } from '@galacean/effects-specification';
|
|
5
5
|
import type { Engine } from '../../engine';
|
|
6
|
-
import
|
|
6
|
+
import { ValueGetter } from '../../math';
|
|
7
7
|
import type { GPUCapability, ShaderWithSource } from '../../render';
|
|
8
8
|
import { Geometry, Mesh } from '../../render';
|
|
9
9
|
import { Texture } from '../../texture';
|
|
@@ -56,4 +56,4 @@ export declare class TrailMesh {
|
|
|
56
56
|
setPointStartPos(index: number, pos: Vector3): void;
|
|
57
57
|
onUpdate(escapeTime: number): any;
|
|
58
58
|
}
|
|
59
|
-
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string,
|
|
59
|
+
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string, gpuCapability: GPUCapability, env?: string): ShaderWithSource;
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -21,21 +21,21 @@ export interface Plugin {
|
|
|
21
21
|
* @param composition
|
|
22
22
|
* @param item
|
|
23
23
|
*/
|
|
24
|
-
onCompositionItemLifeBegin: (composition: Composition, item: VFXItem
|
|
24
|
+
onCompositionItemLifeBegin: (composition: Composition, item: VFXItem) => void;
|
|
25
25
|
/**
|
|
26
26
|
* 合成生命周期结束时触发(无论结束行为)
|
|
27
27
|
* 合成播放阶段只触发一次此函数
|
|
28
28
|
* @param composition
|
|
29
29
|
* @param item
|
|
30
30
|
*/
|
|
31
|
-
onCompositionItemLifeEnd: (composition: Composition, item: VFXItem
|
|
31
|
+
onCompositionItemLifeEnd: (composition: Composition, item: VFXItem) => void;
|
|
32
32
|
/**
|
|
33
33
|
* 合成销毁时触发(当合成的结束行为是冻结、循环或合成配置了 reusable 时不触发)
|
|
34
34
|
* 元素销毁应该在合成销毁时调用。
|
|
35
35
|
* @param composition
|
|
36
36
|
* @param item
|
|
37
37
|
*/
|
|
38
|
-
onCompositionItemRemoved: (composition: Composition, item: VFXItem
|
|
38
|
+
onCompositionItemRemoved: (composition: Composition, item: VFXItem) => void;
|
|
39
39
|
/**
|
|
40
40
|
* 合成重播时的回调
|
|
41
41
|
* @param composition
|
|
@@ -112,9 +112,9 @@ export declare abstract class AbstractPlugin implements Plugin {
|
|
|
112
112
|
*/
|
|
113
113
|
static precompile(compositions: spec.Composition[], renderer: Renderer): Promise<void>;
|
|
114
114
|
onCompositionConstructed(composition: Composition, scene: Scene): void;
|
|
115
|
-
onCompositionItemLifeBegin(composition: Composition, item: VFXItem
|
|
116
|
-
onCompositionItemLifeEnd(composition: Composition, item: VFXItem
|
|
117
|
-
onCompositionItemRemoved(composition: Composition, item: VFXItem
|
|
115
|
+
onCompositionItemLifeBegin(composition: Composition, item: VFXItem): void;
|
|
116
|
+
onCompositionItemLifeEnd(composition: Composition, item: VFXItem): void;
|
|
117
|
+
onCompositionItemRemoved(composition: Composition, item: VFXItem): void;
|
|
118
118
|
onCompositionReset(composition: Composition, frame: RenderFrame): void;
|
|
119
119
|
onCompositionWillReset(composition: Composition, frame: RenderFrame): void;
|
|
120
120
|
onCompositionDestroyed(composition: Composition): void;
|
|
@@ -9,9 +9,8 @@ import type { Renderer } from '../../render';
|
|
|
9
9
|
import { Geometry } from '../../render';
|
|
10
10
|
import type { GeometryFromShape } from '../../shape';
|
|
11
11
|
import type { Texture } from '../../texture';
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
14
|
-
import { Playable } from '../cal/playable-graph';
|
|
12
|
+
import type { FrameContext, PlayableGraph } from '../cal/playable-graph';
|
|
13
|
+
import { Playable, PlayableAsset } from '../cal/playable-graph';
|
|
15
14
|
import type { BoundingBoxTriangle, HitTestTriangleParams } from '../interact/click-handler';
|
|
16
15
|
/**
|
|
17
16
|
* 用于创建 spriteItem 的数据类型, 经过处理后的 spec.SpriteContent
|
|
@@ -29,8 +28,8 @@ export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer'> {
|
|
|
29
28
|
*/
|
|
30
29
|
export type SpriteItemOptions = {
|
|
31
30
|
startColor: vec4;
|
|
32
|
-
renderLevel?:
|
|
33
|
-
}
|
|
31
|
+
renderLevel?: spec.RenderLevel;
|
|
32
|
+
};
|
|
34
33
|
/**
|
|
35
34
|
* 图层元素渲染属性, 经过处理后的 spec.SpriteContent.renderer
|
|
36
35
|
*/
|
|
@@ -69,12 +68,16 @@ export declare class SpriteColorPlayable extends Playable {
|
|
|
69
68
|
startColor: spec.RGBAColorValue;
|
|
70
69
|
renderColor: vec4;
|
|
71
70
|
spriteMaterial: Material;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
processFrame(context: FrameContext): void;
|
|
72
|
+
create(clipData: SpriteColorPlayableAssetData): this;
|
|
73
|
+
}
|
|
74
|
+
export declare class SpriteColorPlayableAsset extends PlayableAsset {
|
|
75
|
+
data: SpriteColorPlayableAssetData;
|
|
76
|
+
createPlayable(graph: PlayableGraph): Playable;
|
|
77
|
+
fromData(data: SpriteColorPlayableAssetData): void;
|
|
78
|
+
}
|
|
79
|
+
export interface SpriteColorPlayableAssetData extends spec.EffectsObjectData {
|
|
80
|
+
colorOverLifetime?: spec.ColorOverLifetime;
|
|
78
81
|
}
|
|
79
82
|
export declare class SpriteComponent extends RendererComponent {
|
|
80
83
|
renderer: SpriteItemRenderer;
|
|
@@ -87,8 +90,9 @@ export declare class SpriteComponent extends RendererComponent {
|
|
|
87
90
|
index: number[] | spec.TypedArray;
|
|
88
91
|
};
|
|
89
92
|
anchor?: vec2;
|
|
90
|
-
timelineComponent: TimelineComponent;
|
|
91
93
|
textureSheetAnimation?: spec.TextureSheetAnimation;
|
|
94
|
+
frameAnimationLoop: boolean;
|
|
95
|
+
frameAnimationTime: number;
|
|
92
96
|
splits: splitsDataType;
|
|
93
97
|
emptyTexture: Texture;
|
|
94
98
|
color: vec4;
|
|
@@ -20,16 +20,12 @@ export type SpriteRegionData = {
|
|
|
20
20
|
size: spec.vec2;
|
|
21
21
|
};
|
|
22
22
|
export declare let maxSpriteMeshItemCount: number;
|
|
23
|
-
export declare let maxSpriteTextureCount: number;
|
|
24
23
|
export declare function setSpriteMeshMaxItemCountByGPU(gpuCapability: GPUCapabilityDetail): 16 | 32 | undefined;
|
|
25
24
|
export declare function getImageItemRenderInfo(item: SpriteComponent): SpriteItemRenderInfo;
|
|
26
25
|
export declare function spriteMeshShaderFromFilter(level: number, options?: {
|
|
27
|
-
count?: number;
|
|
28
|
-
ignoreBlend?: boolean;
|
|
29
26
|
wireframe?: boolean;
|
|
30
27
|
env?: string;
|
|
31
28
|
}): SharedShaderWithSource;
|
|
32
29
|
export declare function spriteMeshShaderIdFromRenderInfo(renderInfo: SpriteItemRenderInfo, count: number): string;
|
|
33
30
|
export declare function spriteMeshShaderFromRenderInfo(renderInfo: SpriteItemRenderInfo, count: number, level: number, env?: string): SharedShaderWithSource;
|
|
34
31
|
export declare function setMaxSpriteMeshItemCount(count: number): void;
|
|
35
|
-
export declare function setSpriteMeshMaxFragmentTextures(count: number): void;
|
|
@@ -4,20 +4,43 @@ import type { SpriteItemProps } from '../sprite/sprite-item';
|
|
|
4
4
|
import { SpriteComponent } from '../sprite/sprite-item';
|
|
5
5
|
import { TextLayout } from './text-layout';
|
|
6
6
|
import { TextStyle } from './text-style';
|
|
7
|
+
import type { Material } from '../../material';
|
|
8
|
+
import type { VFXItem } from '../../vfx-item';
|
|
7
9
|
export declare const DEFAULT_FONTS: string[];
|
|
10
|
+
export interface TextComponent extends TextComponentBase {
|
|
11
|
+
}
|
|
8
12
|
/**
|
|
9
13
|
* @since 2.0.0
|
|
10
14
|
* @internal
|
|
11
15
|
*/
|
|
12
16
|
export declare class TextComponent extends SpriteComponent {
|
|
13
|
-
textStyle: TextStyle;
|
|
14
17
|
isDirty: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 文本行数
|
|
20
|
+
*/
|
|
21
|
+
lineCount: number;
|
|
22
|
+
constructor(engine: Engine, props?: spec.TextContent);
|
|
23
|
+
update(dt: number): void;
|
|
24
|
+
fromData(data: SpriteItemProps): void;
|
|
25
|
+
updateWithOptions(options: spec.TextContentOptions): void;
|
|
26
|
+
updateTexture(flipY?: boolean): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class TextComponentBase {
|
|
29
|
+
textStyle: TextStyle;
|
|
15
30
|
canvas: HTMLCanvasElement;
|
|
16
31
|
context: CanvasRenderingContext2D | null;
|
|
17
32
|
textLayout: TextLayout;
|
|
18
33
|
text: string;
|
|
34
|
+
/***** mix 类型兼容用 *****/
|
|
35
|
+
isDirty: boolean;
|
|
36
|
+
engine: Engine;
|
|
37
|
+
material: Material;
|
|
38
|
+
lineCount: number;
|
|
39
|
+
item: VFXItem;
|
|
40
|
+
/***** mix 类型兼容用 *****/
|
|
19
41
|
private char;
|
|
20
|
-
|
|
42
|
+
updateWithOptions(options: spec.TextContentOptions): void;
|
|
43
|
+
private getLineCount;
|
|
21
44
|
/**
|
|
22
45
|
* 设置字号大小
|
|
23
46
|
* @param value - 字号
|
|
@@ -108,13 +131,17 @@ export declare class TextComponent extends SpriteComponent {
|
|
|
108
131
|
* @returns
|
|
109
132
|
*/
|
|
110
133
|
setFontScale(value: number): void;
|
|
111
|
-
|
|
134
|
+
/**
|
|
135
|
+
* 设置自适应宽高开关
|
|
136
|
+
* @param value - 是否自适应宽高开关
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
setAutoWidth(value: boolean): void;
|
|
112
140
|
/**
|
|
113
141
|
* 更新文本
|
|
114
142
|
* @returns
|
|
115
143
|
*/
|
|
116
|
-
updateTexture(): void;
|
|
117
|
-
fromData(data: SpriteItemProps): void;
|
|
144
|
+
updateTexture(flipY?: boolean): void;
|
|
118
145
|
private getFontDesc;
|
|
119
146
|
private setupOutline;
|
|
120
147
|
private setupShadow;
|
|
@@ -17,7 +17,15 @@ export declare class TextLayout {
|
|
|
17
17
|
*/
|
|
18
18
|
lineHeight: number;
|
|
19
19
|
constructor(options: spec.TextContentOptions);
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 获取初始的行高偏移值
|
|
22
|
+
* @param style - 字体基础数据
|
|
23
|
+
* @param lineCount - 渲染行数
|
|
24
|
+
* @param lineHeight - 渲染时的字体行高
|
|
25
|
+
* @param fontSize - 渲染时的字体大小
|
|
26
|
+
* @returns - 行高偏移值
|
|
27
|
+
*/
|
|
28
|
+
getOffsetY(style: TextStyle, lineCount: number, lineHeight: number, fontSize: number): number;
|
|
21
29
|
getOffsetX(style: TextStyle, maxWidth: number): number;
|
|
22
30
|
/**
|
|
23
31
|
* 设置文本框的宽度和高度
|