@galacean/effects-core 2.9.0-alpha.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/animation-events.d.ts +3 -5
- package/dist/components/base-render-component.d.ts +6 -1
- package/dist/components/component.d.ts +6 -1
- package/dist/components/composition-component.d.ts +2 -5
- package/dist/components/frame-component.d.ts +6 -1
- package/dist/components/mesh-component.d.ts +6 -1
- package/dist/components/renderer-component.d.ts +8 -1
- package/dist/components/shape-component.d.ts +2 -0
- package/dist/composition.d.ts +15 -25
- package/dist/effects-object.d.ts +1 -1
- package/dist/engine.d.ts +49 -2
- package/dist/index.js +3064 -1835
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3054 -1835
- package/dist/index.mjs.map +1 -1
- package/dist/material/index.d.ts +1 -0
- package/dist/material/material-state.d.ts +50 -0
- package/dist/material/material.d.ts +109 -285
- package/dist/material/types.d.ts +2 -0
- package/dist/math/index.d.ts +1 -0
- package/dist/math/shape/build-adaptive-bezier.d.ts +1 -1
- package/dist/math/shape/circle.d.ts +1 -1
- package/dist/math/shape/ellipse.d.ts +1 -1
- package/dist/math/shape/graphics-path.d.ts +1 -1
- package/dist/math/shape/poly-star.d.ts +1 -1
- package/dist/math/shape/polygon.d.ts +1 -1
- package/dist/math/shape/rectangle.d.ts +1 -1
- package/dist/math/shape/shape-path.d.ts +1 -1
- package/dist/math/shape/shape-primitive.d.ts +1 -1
- package/dist/math/shape/triangle.d.ts +1 -1
- package/dist/plugin-system.d.ts +1 -1
- package/dist/plugins/camera/camera-controller-node.d.ts +5 -2
- package/dist/plugins/interact/click-handler.d.ts +5 -0
- package/dist/plugins/interact/interact-item.d.ts +1 -1
- package/dist/plugins/particle/particle-mesh.d.ts +0 -1
- package/dist/plugins/particle/particle-system-renderer.d.ts +3 -3
- package/dist/plugins/particle/particle-system.d.ts +6 -23
- package/dist/plugins/particle/trail-mesh.d.ts +1 -2
- package/dist/plugins/plugin.d.ts +1 -1
- package/dist/plugins/text/text-component-base.d.ts +1 -1
- package/dist/plugins/text/text-item.d.ts +1 -1
- package/dist/plugins/text/text-layout.d.ts +7 -0
- package/dist/plugins/timeline/track.d.ts +1 -1
- package/dist/plugins/timeline/tracks/property-track.d.ts +2 -2
- package/dist/render/renderer.d.ts +15 -23
- package/dist/render/shader.d.ts +19 -0
- package/dist/scene-loader.d.ts +2 -0
- package/dist/scene.d.ts +0 -1
- package/dist/texture/texture.d.ts +1 -1
- package/dist/vfx-item.d.ts +18 -3
- package/package.json +2 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { AnimationClip } from './animation-clip';
|
|
2
1
|
import type { VFXItem } from '../vfx-item';
|
|
3
2
|
export interface AnimationEventReference {
|
|
4
|
-
|
|
3
|
+
data: AnimationEventInfo;
|
|
5
4
|
currentTime: number;
|
|
6
5
|
deltaTime: number;
|
|
7
6
|
}
|
|
@@ -10,7 +9,6 @@ export interface AnimationEventInfo {
|
|
|
10
9
|
startTime: number;
|
|
11
10
|
duration: number;
|
|
12
11
|
event: AnimationEvent;
|
|
13
|
-
clip: AnimationClip;
|
|
14
12
|
}
|
|
15
13
|
export interface AnimationEventData {
|
|
16
14
|
typeName: string;
|
|
@@ -22,8 +20,8 @@ export interface AnimationEventInfoData {
|
|
|
22
20
|
eventData?: AnimationEventData;
|
|
23
21
|
}
|
|
24
22
|
export declare class AnimationEvent {
|
|
25
|
-
onEvent(item: VFXItem,
|
|
23
|
+
onEvent(item: VFXItem, eventReference: AnimationEventReference): void;
|
|
26
24
|
}
|
|
27
25
|
export declare class NotifyEvent extends AnimationEvent {
|
|
28
|
-
onEvent(item: VFXItem,
|
|
26
|
+
onEvent(item: VFXItem, eventReference: AnimationEventReference): void;
|
|
29
27
|
}
|
|
@@ -14,6 +14,10 @@ export interface ItemRenderer extends Required<Omit<spec.RendererOptions, 'textu
|
|
|
14
14
|
texture: Texture;
|
|
15
15
|
mask: number;
|
|
16
16
|
}
|
|
17
|
+
interface MaskableGraphicData extends spec.ComponentData {
|
|
18
|
+
renderer: spec.RendererOptions;
|
|
19
|
+
mask?: spec.MaskOptions;
|
|
20
|
+
}
|
|
17
21
|
/**
|
|
18
22
|
* @since 2.7.0
|
|
19
23
|
*/
|
|
@@ -89,5 +93,6 @@ export declare class MaskableGraphic extends RendererComponent implements Maskab
|
|
|
89
93
|
getBoundingBoxInfo(): BoundingBoxInfo;
|
|
90
94
|
private configureMaterial;
|
|
91
95
|
private draw;
|
|
92
|
-
fromData(data:
|
|
96
|
+
fromData(data: MaskableGraphicData): void;
|
|
93
97
|
}
|
|
98
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
1
2
|
import { EffectsObject } from '../effects-object';
|
|
2
3
|
import type { VFXItem } from '../vfx-item';
|
|
3
4
|
/**
|
|
@@ -59,8 +60,12 @@ export declare abstract class Component extends EffectsObject {
|
|
|
59
60
|
* 当属性被动画修改时调用
|
|
60
61
|
*/
|
|
61
62
|
onApplyAnimationProperties(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 当父级或间接父级发生改变时调用
|
|
65
|
+
*/
|
|
66
|
+
onParentChanged(): void;
|
|
62
67
|
setVFXItem(item: VFXItem): void;
|
|
63
|
-
fromData(data:
|
|
68
|
+
fromData(data: spec.ComponentData): void;
|
|
64
69
|
dispose(): void;
|
|
65
70
|
private start;
|
|
66
71
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { Ray } from '@galacean/effects-math/es/core/ray';
|
|
2
1
|
import * as spec from '@galacean/effects-specification';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Region, TrackAsset } from '../plugins';
|
|
2
|
+
import type { TrackAsset } from '../plugins';
|
|
5
3
|
import { VFXItem } from '../vfx-item';
|
|
6
4
|
import { Component } from './component';
|
|
7
5
|
export interface SceneBinding {
|
|
@@ -47,10 +45,9 @@ export declare class CompositionComponent extends Component {
|
|
|
47
45
|
onEnable(): void;
|
|
48
46
|
onDisable(): void;
|
|
49
47
|
onDestroy(): void;
|
|
50
|
-
hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): boolean;
|
|
51
48
|
/**
|
|
52
49
|
* 递归收集场景树中的直接子元素(DFS 前序)
|
|
53
50
|
*/
|
|
54
51
|
private collectChildren;
|
|
55
|
-
fromData(data:
|
|
52
|
+
fromData(data: spec.CompositionComponentData): void;
|
|
56
53
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
1
2
|
import { RendererComponent } from './renderer-component';
|
|
2
3
|
import { type Maskable } from '../material';
|
|
3
4
|
import type { Renderer } from '../render';
|
|
4
5
|
import { Color } from '@galacean/effects-math/es/core/color';
|
|
6
|
+
interface FrameComponentData extends spec.ComponentData {
|
|
7
|
+
color?: spec.ColorData;
|
|
8
|
+
}
|
|
5
9
|
export declare class FrameComponent extends RendererComponent implements Maskable {
|
|
6
10
|
color: Color;
|
|
7
11
|
private clipGeometry;
|
|
@@ -12,8 +16,9 @@ export declare class FrameComponent extends RendererComponent implements Maskabl
|
|
|
12
16
|
render(renderer: Renderer): void;
|
|
13
17
|
onDestroy(): void;
|
|
14
18
|
drawStencilMask(maskRef: number): void;
|
|
15
|
-
fromData(data:
|
|
19
|
+
fromData(data: FrameComponentData): void;
|
|
16
20
|
private getHitTestParams;
|
|
17
21
|
private setClipRectangle;
|
|
18
22
|
private setClipRectangleRecursive;
|
|
19
23
|
}
|
|
24
|
+
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
1
2
|
import type { Engine } from '../engine';
|
|
2
3
|
import type { Maskable } from '../material';
|
|
3
4
|
import type { BoundingBoxTriangle, HitTestTriangleParams, BoundingBoxInfo } from '../plugins';
|
|
4
5
|
import type { Geometry, Renderer } from '../render';
|
|
5
6
|
import { RendererComponent } from './renderer-component';
|
|
7
|
+
interface MeshComponentData extends spec.ComponentData {
|
|
8
|
+
mask?: spec.MaskOptions;
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Mesh 组件
|
|
8
12
|
*/
|
|
@@ -17,5 +21,6 @@ export declare class MeshComponent extends RendererComponent implements Maskable
|
|
|
17
21
|
getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
|
|
18
22
|
getBoundingBox(): BoundingBoxTriangle | void;
|
|
19
23
|
getBoundingBoxInfo(): BoundingBoxInfo;
|
|
20
|
-
fromData(data:
|
|
24
|
+
fromData(data: MeshComponentData): void;
|
|
21
25
|
}
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Material } from '../material';
|
|
1
|
+
import type { Material, Maskable } from '../material';
|
|
2
2
|
import { MaskProcessor } from '../material';
|
|
3
3
|
import { BoundingBoxInfo } from '../plugins/interact/mesh-collider';
|
|
4
4
|
import { Component } from './component';
|
|
@@ -9,6 +9,12 @@ import type { Renderer } from '../render/renderer';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare class RendererComponent extends Component {
|
|
11
11
|
materials: Material[];
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
* Internal utility.
|
|
15
|
+
* Not part of the public API — do not rely on this in your code.
|
|
16
|
+
*/
|
|
17
|
+
frameClipMasks: Maskable[];
|
|
12
18
|
/**
|
|
13
19
|
* @hidden
|
|
14
20
|
* Internal utility.
|
|
@@ -26,6 +32,7 @@ export declare class RendererComponent extends Component {
|
|
|
26
32
|
set material(material: Material);
|
|
27
33
|
onEnable(): void;
|
|
28
34
|
onDisable(): void;
|
|
35
|
+
onParentChanged(): void;
|
|
29
36
|
/**
|
|
30
37
|
* 获取包围盒信息
|
|
31
38
|
*/
|
|
@@ -123,6 +123,7 @@ export interface PolygonAttribute extends ShapeAttributes {
|
|
|
123
123
|
* @since 2.1.0
|
|
124
124
|
*/
|
|
125
125
|
export declare class ShapeComponent extends RendererComponent implements Maskable {
|
|
126
|
+
private static readonly tempMVP;
|
|
126
127
|
private shapeDirty;
|
|
127
128
|
private materialDirty;
|
|
128
129
|
private graphicsPath;
|
|
@@ -151,6 +152,7 @@ export declare class ShapeComponent extends RendererComponent implements Maskabl
|
|
|
151
152
|
getBoundingBox(): BoundingBoxTriangle;
|
|
152
153
|
getBoundingBoxInfo(): BoundingBoxInfo;
|
|
153
154
|
private buildGeometryFromPath;
|
|
155
|
+
private computeScreenScale;
|
|
154
156
|
private buildPath;
|
|
155
157
|
private updateMaterials;
|
|
156
158
|
private updatePaintMaterial;
|
package/dist/composition.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { Camera } from './camera';
|
|
|
5
5
|
import type { Component, PostProcessVolume } from './components';
|
|
6
6
|
import { CompositionComponent } from './components';
|
|
7
7
|
import type { EventSystem, Region } from './plugins';
|
|
8
|
-
import type { Renderer } from './render';
|
|
9
8
|
import { RenderFrame } from './render';
|
|
10
9
|
import type { Scene } from './scene';
|
|
11
10
|
import type { Texture } from './texture';
|
|
@@ -14,6 +13,7 @@ import { VFXItem } from './vfx-item';
|
|
|
14
13
|
import type { CompositionEvent } from './events';
|
|
15
14
|
import { EventEmitter } from './events';
|
|
16
15
|
import { SceneTicking } from './composition/scene-ticking';
|
|
16
|
+
import type { Engine } from './engine';
|
|
17
17
|
/**
|
|
18
18
|
* 合成统计信息
|
|
19
19
|
*/
|
|
@@ -86,10 +86,6 @@ export interface CompositionProps {
|
|
|
86
86
|
*
|
|
87
87
|
*/
|
|
88
88
|
baseRenderOrder?: number;
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
*/
|
|
92
|
-
renderer: Renderer;
|
|
93
89
|
/**
|
|
94
90
|
*
|
|
95
91
|
* @param message
|
|
@@ -100,14 +96,6 @@ export interface CompositionProps {
|
|
|
100
96
|
*
|
|
101
97
|
*/
|
|
102
98
|
event?: EventSystem;
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
width: number;
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
height: number;
|
|
111
99
|
/**
|
|
112
100
|
*
|
|
113
101
|
*/
|
|
@@ -119,7 +107,7 @@ export interface CompositionProps {
|
|
|
119
107
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
120
108
|
*/
|
|
121
109
|
export declare class Composition extends EventEmitter<CompositionEvent<Composition>> implements Disposable, LostHandler {
|
|
122
|
-
|
|
110
|
+
engine: Engine;
|
|
123
111
|
/**
|
|
124
112
|
*
|
|
125
113
|
*/
|
|
@@ -159,14 +147,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
159
147
|
* 合成id
|
|
160
148
|
*/
|
|
161
149
|
readonly id: string;
|
|
162
|
-
/**
|
|
163
|
-
* 画布宽度
|
|
164
|
-
*/
|
|
165
|
-
readonly width: number;
|
|
166
|
-
/**
|
|
167
|
-
* 画布高度
|
|
168
|
-
*/
|
|
169
|
-
readonly height: number;
|
|
170
150
|
/**
|
|
171
151
|
* 鼠标和触屏处理系统
|
|
172
152
|
*/
|
|
@@ -228,11 +208,20 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
228
208
|
private _textures;
|
|
229
209
|
/**
|
|
230
210
|
* Composition 构造函数
|
|
211
|
+
* @param engine - 引擎实例
|
|
231
212
|
* @param props - composition 的创建参数
|
|
232
213
|
* @param scene
|
|
233
214
|
*/
|
|
234
|
-
constructor(
|
|
235
|
-
|
|
215
|
+
constructor(engine: Engine, props?: CompositionProps, scene?: Scene);
|
|
216
|
+
/**
|
|
217
|
+
* 画布宽度
|
|
218
|
+
*/
|
|
219
|
+
get width(): number;
|
|
220
|
+
/**
|
|
221
|
+
* 画布高度
|
|
222
|
+
*/
|
|
223
|
+
get height(): number;
|
|
224
|
+
get renderer(): import("packages/effects-core/src/render/renderer").Renderer;
|
|
236
225
|
/**
|
|
237
226
|
* 所有合成 Item 的根变换
|
|
238
227
|
*/
|
|
@@ -373,9 +362,10 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
373
362
|
getHitTestRay(x: number, y: number): Ray;
|
|
374
363
|
/**
|
|
375
364
|
* 获取 engine 对象
|
|
365
|
+
* @deprecated 2.9.0 Please use composition.engine instead.
|
|
376
366
|
* @returns
|
|
377
367
|
*/
|
|
378
|
-
getEngine():
|
|
368
|
+
getEngine(): Engine;
|
|
379
369
|
/**
|
|
380
370
|
* Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,x 向右,y 向上
|
|
381
371
|
* @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
|
package/dist/effects-object.d.ts
CHANGED
package/dist/engine.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import * as spec from '@galacean/effects-specification';
|
|
|
2
2
|
import type { Database, SceneData } from './asset-loader';
|
|
3
3
|
import type { EffectsObject } from './effects-object';
|
|
4
4
|
import type { Material } from './material';
|
|
5
|
-
import type { GPUCapability, Geometry, Mesh, RenderPass, Renderer, ShaderLibrary } from './render';
|
|
5
|
+
import type { GPUCapability, Geometry, Mesh, RenderPass, RenderPassClearAction, Renderer, RenderingData, ShaderLibrary } from './render';
|
|
6
|
+
import { RenderTargetPool } from './render';
|
|
6
7
|
import type { Scene, SceneRenderLevel } from './scene';
|
|
7
8
|
import type { Texture } from './texture';
|
|
8
9
|
import type { Disposable } from './utils';
|
|
@@ -14,6 +15,7 @@ import { EventSystem } from './plugins/interact/event-system';
|
|
|
14
15
|
import type { GLType } from './gl/create-gl-context';
|
|
15
16
|
import type { PointerEventData, Region } from './plugins/interact/click-handler';
|
|
16
17
|
import { EventEmitter } from './events';
|
|
18
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
17
19
|
export interface EngineOptions extends WebGLContextAttributes {
|
|
18
20
|
name?: string;
|
|
19
21
|
glType?: GLType;
|
|
@@ -82,6 +84,16 @@ export declare class Engine extends EventEmitter<EngineEvent> implements Disposa
|
|
|
82
84
|
* 引擎的像素比
|
|
83
85
|
*/
|
|
84
86
|
pixelRatio: number;
|
|
87
|
+
/**
|
|
88
|
+
* @hidden
|
|
89
|
+
* Internal utility.
|
|
90
|
+
* Not part of the public API — do not rely on this in your code.
|
|
91
|
+
*/
|
|
92
|
+
renderTargetPool: RenderTargetPool;
|
|
93
|
+
/**
|
|
94
|
+
* 存放渲染需要用到的数据
|
|
95
|
+
*/
|
|
96
|
+
renderingData: RenderingData;
|
|
85
97
|
protected _disposed: boolean;
|
|
86
98
|
protected textures: Texture[];
|
|
87
99
|
protected materials: Material[];
|
|
@@ -129,7 +141,42 @@ export declare class Engine extends EventEmitter<EngineEvent> implements Disposa
|
|
|
129
141
|
removeRenderPass(pass: RenderPass): void;
|
|
130
142
|
addComposition(composition: Composition): void;
|
|
131
143
|
removeComposition(composition: Composition): void;
|
|
132
|
-
|
|
144
|
+
getWidth(): number;
|
|
145
|
+
getHeight(): number;
|
|
146
|
+
getShaderLibrary(): ShaderLibrary | null;
|
|
147
|
+
bindSystemFramebuffer(): void;
|
|
148
|
+
/**
|
|
149
|
+
* 用来设置视口,即指定从标准设备到窗口坐标的x、y仿射变换。
|
|
150
|
+
* @param x
|
|
151
|
+
* @param y
|
|
152
|
+
* @param width
|
|
153
|
+
* @param height
|
|
154
|
+
* example:
|
|
155
|
+
* gl.viewport(0, 0, width, height);
|
|
156
|
+
*/
|
|
157
|
+
viewport(x: number, y: number, width: number, height: number): void;
|
|
158
|
+
clear(action: RenderPassClearAction): void;
|
|
159
|
+
drawGeometry(geometry: Geometry, matrix: Matrix4, material: Material, subMeshIndex?: number): void;
|
|
160
|
+
/*** 渲染状态控制 ***/
|
|
161
|
+
setSampleAlphaToCoverage(enable: boolean): void;
|
|
162
|
+
setBlending(enable: boolean): void;
|
|
163
|
+
setDepthTest(enable: boolean): void;
|
|
164
|
+
setStencilTest(enable: boolean): void;
|
|
165
|
+
setCulling(enable: boolean): void;
|
|
166
|
+
setPolygonOffsetFill(enable: boolean): void;
|
|
167
|
+
blendColor(r: number, g: number, b: number, a: number): void;
|
|
168
|
+
blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;
|
|
169
|
+
blendEquationSeparate(modeRGB: number, modeAlpha: number): void;
|
|
170
|
+
colorMask(r: boolean, g: boolean, b: boolean, a: boolean): void;
|
|
171
|
+
depthMask(flag: boolean): void;
|
|
172
|
+
depthFunc(func: number): void;
|
|
173
|
+
depthRange(near: number, far: number): void;
|
|
174
|
+
polygonOffset(factor: number, units: number): void;
|
|
175
|
+
cullFace(mode: number): void;
|
|
176
|
+
frontFace(mode: number): void;
|
|
177
|
+
stencilMaskSeparate(face: number, mask: number): void;
|
|
178
|
+
stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;
|
|
179
|
+
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
|
133
180
|
/**
|
|
134
181
|
* 销毁所有缓存的资源
|
|
135
182
|
*/
|