@galacean/effects-core 2.7.4 → 2.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-manager.d.ts +5 -5
- package/dist/components/index.d.ts +1 -0
- package/dist/components/position-constraint.d.ts +92 -0
- package/dist/composition.d.ts +6 -7
- package/dist/constants.d.ts +4 -0
- package/dist/downloader.d.ts +7 -0
- package/dist/engine.d.ts +67 -6
- package/dist/events/types.d.ts +31 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2834 -2241
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2828 -2238
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/interact/click-handler.d.ts +14 -2
- package/dist/plugins/interact/event-system.d.ts +16 -3
- package/dist/plugins/particle/particle-system.d.ts +1 -2
- package/dist/plugins/plugin.d.ts +0 -49
- package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
- package/dist/plugins/text/base-layout.d.ts +13 -0
- package/dist/plugins/text/index.d.ts +2 -0
- package/dist/plugins/text/text-component-base.d.ts +61 -0
- package/dist/plugins/text/text-item.d.ts +25 -100
- package/dist/plugins/text/text-layout.d.ts +9 -19
- package/dist/plugins/text/text-style.d.ts +2 -1
- package/dist/render/draw-object-pass.d.ts +8 -0
- package/dist/render/framebuffer.d.ts +0 -4
- package/dist/render/gpu-capability.d.ts +17 -5
- package/dist/render/index.d.ts +1 -0
- package/dist/render/post-process-pass.d.ts +14 -5
- package/dist/render/render-frame.d.ts +8 -31
- package/dist/render/render-pass.d.ts +0 -26
- package/dist/render/renderer.d.ts +5 -18
- package/dist/scene-loader.d.ts +7 -0
- package/dist/texture/index.d.ts +1 -1
- package/dist/texture/texture-loader.d.ts +60 -0
- package/dist/transform.d.ts +8 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/vfx-item.d.ts +10 -3
- package/package.json +2 -2
- package/dist/texture/ktx-texture.d.ts +0 -21
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { Matrix4, Ray, TriangleLike,
|
|
1
|
+
import type { Matrix4, Ray, TriangleLike, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
2
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
2
3
|
import type * as spec from '@galacean/effects-specification';
|
|
3
4
|
import type { VFXItem } from '../../vfx-item';
|
|
5
|
+
import type { Composition } from '../../composition';
|
|
4
6
|
export declare enum HitTestType {
|
|
5
7
|
triangle = 1,
|
|
6
8
|
box = 2,
|
|
@@ -46,13 +48,14 @@ export interface HitTestCustomParams {
|
|
|
46
48
|
behavior?: spec.InteractBehavior;
|
|
47
49
|
}
|
|
48
50
|
export type Region = {
|
|
49
|
-
compContent: VFXItem;
|
|
50
51
|
name: string;
|
|
51
52
|
id: string;
|
|
52
53
|
position: Vector3;
|
|
53
54
|
behavior?: spec.InteractBehavior;
|
|
54
55
|
parentId?: string;
|
|
55
56
|
hitPositions: Vector3[];
|
|
57
|
+
item: VFXItem;
|
|
58
|
+
composition: Composition;
|
|
56
59
|
};
|
|
57
60
|
export type HitTestParams = {
|
|
58
61
|
camera: {
|
|
@@ -64,3 +67,12 @@ export type HitTestParams = {
|
|
|
64
67
|
y: number;
|
|
65
68
|
inRect: (position: Vector3, width: number, height: number) => boolean;
|
|
66
69
|
};
|
|
70
|
+
export declare class PointerEventData {
|
|
71
|
+
position: Vector2;
|
|
72
|
+
delta: Vector2;
|
|
73
|
+
pointerCurrentRaycast: RaycastResult;
|
|
74
|
+
}
|
|
75
|
+
export declare class RaycastResult {
|
|
76
|
+
point: Vector3 | null;
|
|
77
|
+
item: VFXItem | null;
|
|
78
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Engine } from '../../engine';
|
|
1
2
|
import type { Disposable } from '../../utils';
|
|
2
3
|
export declare const EVENT_TYPE_CLICK = "click";
|
|
3
4
|
export declare const EVENT_TYPE_TOUCH_START = "touchstart";
|
|
@@ -20,16 +21,28 @@ export type TouchParams = {
|
|
|
20
21
|
clientY: number;
|
|
21
22
|
target: EventTarget;
|
|
22
23
|
};
|
|
24
|
+
export declare enum PointerEventType {
|
|
25
|
+
PointerDown = 0,
|
|
26
|
+
PointerUp = 1,
|
|
27
|
+
PointerMove = 2
|
|
28
|
+
}
|
|
23
29
|
export declare class EventSystem implements Disposable {
|
|
24
|
-
|
|
30
|
+
engine: Engine;
|
|
25
31
|
allowPropagation: boolean;
|
|
26
32
|
enabled: boolean;
|
|
33
|
+
skipPointerMovePicking: boolean;
|
|
27
34
|
private handlers;
|
|
28
35
|
private nativeHandlers;
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
private target;
|
|
37
|
+
constructor(engine: Engine, allowPropagation?: boolean);
|
|
38
|
+
bindListeners(target: HTMLCanvasElement | null): void;
|
|
31
39
|
dispatchEvent(type: string, event: TouchEventType): void;
|
|
32
40
|
addEventListener(type: string, callback: (event: TouchEventType) => void): () => void;
|
|
33
41
|
removeEventListener(type: string, callback: (event: TouchEventType) => void): void;
|
|
42
|
+
private onClick;
|
|
43
|
+
private onPointerDown;
|
|
44
|
+
private onPointerUp;
|
|
45
|
+
private onPointerMove;
|
|
46
|
+
private handlePointerEvent;
|
|
34
47
|
dispose(): void;
|
|
35
48
|
}
|
|
@@ -183,8 +183,7 @@ export declare class ParticleSystem extends Component implements Maskable {
|
|
|
183
183
|
reset(): void;
|
|
184
184
|
onStart(): void;
|
|
185
185
|
onUpdate(dt: number): void;
|
|
186
|
-
|
|
187
|
-
private update;
|
|
186
|
+
update(delta: number): void;
|
|
188
187
|
drawStencilMask(renderer: Renderer): void;
|
|
189
188
|
onDestroy(): void;
|
|
190
189
|
getParticleBoxes(): {
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Scene, SceneLoadOptions } from '../scene';
|
|
3
|
-
import type { VFXItem } from '../vfx-item';
|
|
4
3
|
import type { RenderFrame, Renderer } from '../render';
|
|
5
4
|
import type { Composition } from '../composition';
|
|
6
5
|
export interface Plugin {
|
|
@@ -22,38 +21,12 @@ export interface Plugin {
|
|
|
22
21
|
* @param scene
|
|
23
22
|
*/
|
|
24
23
|
onCompositionConstructed: (composition: Composition, scene: Scene) => void;
|
|
25
|
-
/**
|
|
26
|
-
* 合成 delay 结束后触发,合成播放阶段只触发一次此函数
|
|
27
|
-
* @param composition
|
|
28
|
-
* @param item
|
|
29
|
-
*/
|
|
30
|
-
onCompositionItemLifeBegin: (composition: Composition, item: VFXItem) => void;
|
|
31
|
-
/**
|
|
32
|
-
* 合成生命周期结束时触发(无论结束行为)
|
|
33
|
-
* 合成播放阶段只触发一次此函数
|
|
34
|
-
* @param composition
|
|
35
|
-
* @param item
|
|
36
|
-
*/
|
|
37
|
-
onCompositionItemLifeEnd: (composition: Composition, item: VFXItem) => void;
|
|
38
|
-
/**
|
|
39
|
-
* 合成销毁时触发(当合成的结束行为是冻结、循环或合成配置了 reusable 时不触发)
|
|
40
|
-
* 元素销毁应该在合成销毁时调用。
|
|
41
|
-
* @param composition
|
|
42
|
-
* @param item
|
|
43
|
-
*/
|
|
44
|
-
onCompositionItemRemoved: (composition: Composition, item: VFXItem) => void;
|
|
45
24
|
/**
|
|
46
25
|
* 合成重播时的回调
|
|
47
26
|
* @param composition
|
|
48
27
|
* @param frame
|
|
49
28
|
*/
|
|
50
29
|
onCompositionReset: (composition: Composition, frame: RenderFrame) => void;
|
|
51
|
-
/**
|
|
52
|
-
* 合成即将重播,此函数后 frame 会被销毁
|
|
53
|
-
* @param composition
|
|
54
|
-
* @param frame
|
|
55
|
-
*/
|
|
56
|
-
onCompositionWillReset: (composition: Composition, frame: RenderFrame) => void;
|
|
57
30
|
/**
|
|
58
31
|
* 合成销毁时的会调,需要销毁 composition 中对应的资源
|
|
59
32
|
* @param composition
|
|
@@ -65,22 +38,6 @@ export interface Plugin {
|
|
|
65
38
|
* @param dt 更新的毫秒
|
|
66
39
|
*/
|
|
67
40
|
onCompositionUpdate: (composition: Composition, dt: number) => void;
|
|
68
|
-
/**
|
|
69
|
-
* 合成更新后,在渲染前进行 RenderFrame 的配置,添加渲染的 Mesh 到 renderFrame 中,
|
|
70
|
-
* 如果此函数返回 true,将进行 renderFrame 后处理函数配置
|
|
71
|
-
* mesh 的 priority 必须等于 item.listIndex,否则渲染顺序将不符合 Galacean Effects 的规则
|
|
72
|
-
* @param composition
|
|
73
|
-
* @param frame
|
|
74
|
-
* @return 默认 false,为 true 时才会执行 postProcessFrame
|
|
75
|
-
*/
|
|
76
|
-
prepareRenderFrame(composition: Composition, frame: RenderFrame): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* 当所有的 plugin 都调用过 prepareRenderFrame 后,对于需要进行后处理的 plugin,调用此函数,
|
|
79
|
-
* 此函数一般用于切割 renderPass,如果对于 renderPass 有切割,记得在销毁时还原切割
|
|
80
|
-
* @param composition
|
|
81
|
-
* @param frame
|
|
82
|
-
*/
|
|
83
|
-
postProcessFrame: (composition: Composition, frame: RenderFrame) => void;
|
|
84
41
|
}
|
|
85
42
|
export interface PluginConstructor {
|
|
86
43
|
new (): Plugin;
|
|
@@ -129,13 +86,7 @@ export declare abstract class AbstractPlugin implements Plugin {
|
|
|
129
86
|
*/
|
|
130
87
|
precompile(compositions: spec.CompositionData[], renderer: Renderer): void;
|
|
131
88
|
onCompositionConstructed(composition: Composition, scene: Scene): void;
|
|
132
|
-
onCompositionItemLifeBegin(composition: Composition, item: VFXItem): void;
|
|
133
|
-
onCompositionItemLifeEnd(composition: Composition, item: VFXItem): void;
|
|
134
|
-
onCompositionItemRemoved(composition: Composition, item: VFXItem): void;
|
|
135
89
|
onCompositionReset(composition: Composition, frame: RenderFrame): void;
|
|
136
|
-
onCompositionWillReset(composition: Composition, frame: RenderFrame): void;
|
|
137
90
|
onCompositionDestroyed(composition: Composition): void;
|
|
138
91
|
onCompositionUpdate(composition: Composition, dt: number): void;
|
|
139
|
-
prepareRenderFrame(composition: Composition, frame: RenderFrame): boolean;
|
|
140
|
-
postProcessFrame(composition: Composition, frame: RenderFrame): void;
|
|
141
92
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
2
2
|
import type * as spec from '@galacean/effects-specification';
|
|
3
|
-
import type { GPUCapabilityDetail } from '../../render';
|
|
4
3
|
import type { Transform } from '../../transform';
|
|
5
4
|
export type SpriteRenderData = {
|
|
6
5
|
life: number;
|
|
@@ -18,6 +17,3 @@ export type SpriteRegionData = {
|
|
|
18
17
|
quat: spec.vec4;
|
|
19
18
|
size: spec.vec2;
|
|
20
19
|
};
|
|
21
|
-
export declare let maxSpriteMeshItemCount: number;
|
|
22
|
-
export declare function setSpriteMeshMaxItemCountByGPU(gpuCapability: GPUCapabilityDetail): 16 | 32 | undefined;
|
|
23
|
-
export declare function setMaxSpriteMeshItemCount(count: number): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { TextStyle } from './text-style';
|
|
3
|
+
export interface BaseLayout {
|
|
4
|
+
textVerticalAlign: spec.TextVerticalAlign;
|
|
5
|
+
textAlign: spec.TextAlignment;
|
|
6
|
+
letterSpace: number;
|
|
7
|
+
overflow: spec.TextOverflow;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
setSize(width: number, height: number): void;
|
|
11
|
+
getOffsetY(style: TextStyle, lineCount: number, lineHeight: number, fontSize: number, totalLineHeight?: number): number;
|
|
12
|
+
getOffsetX(style: TextStyle, maxWidth: number): number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { Engine } from '../../engine';
|
|
3
|
+
import type { Material } from '../../material';
|
|
4
|
+
import type { ItemRenderer } from '../../components';
|
|
5
|
+
import type { VFXItem } from '../../vfx-item';
|
|
6
|
+
import type { BaseLayout } from './base-layout';
|
|
7
|
+
import type { TextStyle } from './text-style';
|
|
8
|
+
/**
|
|
9
|
+
* 纯文本组件特有 API
|
|
10
|
+
*/
|
|
11
|
+
export interface ITextComponent {
|
|
12
|
+
setOutlineWidth(value: number): void;
|
|
13
|
+
setShadowBlur(value: number): void;
|
|
14
|
+
setShadowColor(value: spec.RGBAColorValue): void;
|
|
15
|
+
setShadowOffsetX(value: number): void;
|
|
16
|
+
setShadowOffsetY(value: number): void;
|
|
17
|
+
setAutoWidth(value: boolean): void;
|
|
18
|
+
setFontSize(value: number): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 富文本组件特有 API
|
|
22
|
+
*/
|
|
23
|
+
export interface IRichTextComponent extends ITextComponent {
|
|
24
|
+
}
|
|
25
|
+
export declare class TextComponentBase {
|
|
26
|
+
textStyle: TextStyle;
|
|
27
|
+
textLayout: BaseLayout;
|
|
28
|
+
text: string;
|
|
29
|
+
canvas: HTMLCanvasElement;
|
|
30
|
+
context: CanvasRenderingContext2D | null;
|
|
31
|
+
isDirty: boolean;
|
|
32
|
+
engine: Engine;
|
|
33
|
+
material: Material;
|
|
34
|
+
item: VFXItem;
|
|
35
|
+
renderer: ItemRenderer;
|
|
36
|
+
lineCount: number;
|
|
37
|
+
protected maxLineWidth: number;
|
|
38
|
+
protected readonly SCALE_FACTOR = 0.1;
|
|
39
|
+
protected readonly ALPHA_FIX_VALUE: number;
|
|
40
|
+
setText(value: string): void;
|
|
41
|
+
setTextAlign(value: spec.TextAlignment): void;
|
|
42
|
+
setTextVerticalAlign(value: spec.TextVerticalAlign): void;
|
|
43
|
+
setTextColor(value: spec.RGBAColorValue): void;
|
|
44
|
+
setFontFamily(value: string): void;
|
|
45
|
+
setFontWeight(value: spec.TextWeight): void;
|
|
46
|
+
setFontStyle(value: spec.FontStyle): void;
|
|
47
|
+
setOutlineColor(value: spec.RGBAColorValue): void;
|
|
48
|
+
setFontScale(value: number): void;
|
|
49
|
+
setOverflow(overflow: spec.TextOverflow): void;
|
|
50
|
+
protected getFontDesc(size?: number): string;
|
|
51
|
+
protected setupOutline(): void;
|
|
52
|
+
protected setupShadow(): void;
|
|
53
|
+
protected disposeTextTexture(): void;
|
|
54
|
+
/**
|
|
55
|
+
* 通用纹理渲染辅助方法
|
|
56
|
+
*/
|
|
57
|
+
protected renderToTexture(width: number, height: number, flipY: boolean, drawCallback: (ctx: CanvasRenderingContext2D) => void, options?: {
|
|
58
|
+
disposeOld?: boolean;
|
|
59
|
+
}): void;
|
|
60
|
+
protected initTextBase(engine: Engine): void;
|
|
61
|
+
}
|
|
@@ -1,61 +1,46 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { ItemRenderer } from '../../components';
|
|
3
2
|
import { MaskableGraphic } from '../../components';
|
|
4
3
|
import type { Engine } from '../../engine';
|
|
5
|
-
import type { Material } from '../../material';
|
|
6
|
-
import type { VFXItem } from '../../vfx-item';
|
|
7
4
|
import { TextLayout } from './text-layout';
|
|
8
5
|
import { TextStyle } from './text-style';
|
|
6
|
+
import type { ITextComponent } from './text-component-base';
|
|
7
|
+
import { TextComponentBase } from './text-component-base';
|
|
9
8
|
export declare const DEFAULT_FONTS: string[];
|
|
10
9
|
export interface TextComponent extends TextComponentBase {
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* @since 2.0.0
|
|
14
13
|
*/
|
|
15
|
-
export declare class TextComponent extends MaskableGraphic {
|
|
14
|
+
export declare class TextComponent extends MaskableGraphic implements ITextComponent {
|
|
16
15
|
isDirty: boolean;
|
|
17
16
|
/**
|
|
18
17
|
* 文本行数
|
|
19
18
|
*/
|
|
20
19
|
lineCount: number;
|
|
20
|
+
textStyle: TextStyle;
|
|
21
|
+
canvas: HTMLCanvasElement;
|
|
22
|
+
context: CanvasRenderingContext2D | null;
|
|
23
|
+
textLayout: TextLayout;
|
|
24
|
+
text: string;
|
|
21
25
|
/**
|
|
22
26
|
* 每一行文本的最大宽度
|
|
23
27
|
*/
|
|
24
28
|
protected maxLineWidth: number;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(engine: Engine, props?: spec.TextComponentData);
|
|
29
|
+
private getDefaultProps;
|
|
30
|
+
constructor(engine: Engine);
|
|
28
31
|
onUpdate(dt: number): void;
|
|
29
32
|
onDestroy(): void;
|
|
30
33
|
fromData(data: spec.TextComponentData): void;
|
|
34
|
+
private resetState;
|
|
35
|
+
setText(value: string): void;
|
|
31
36
|
updateWithOptions(options: spec.TextContentOptions): void;
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
export declare class TextComponentBase {
|
|
35
|
-
textStyle: TextStyle;
|
|
36
|
-
canvas: HTMLCanvasElement;
|
|
37
|
-
context: CanvasRenderingContext2D | null;
|
|
38
|
-
textLayout: TextLayout;
|
|
39
|
-
text: string;
|
|
40
|
-
/***** mix 类型兼容用 *****/
|
|
41
|
-
isDirty: boolean;
|
|
42
|
-
engine: Engine;
|
|
43
|
-
material: Material;
|
|
44
|
-
lineCount: number;
|
|
45
|
-
item: VFXItem;
|
|
46
|
-
renderer: ItemRenderer;
|
|
47
|
-
/***** mix 类型兼容用 *****/
|
|
48
|
-
protected maxLineWidth: number;
|
|
49
|
-
private char;
|
|
50
|
-
protected renderText(options: spec.TextContentOptions): void;
|
|
51
|
-
updateWithOptions(options: spec.TextContentOptions): void;
|
|
52
|
-
private getLineCount;
|
|
37
|
+
getLineCount(text: string): number;
|
|
53
38
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
39
|
+
* 设置行高
|
|
40
|
+
* 行高表示每行占用的总高度
|
|
41
|
+
* @param value - 行高像素值
|
|
57
42
|
*/
|
|
58
|
-
|
|
43
|
+
setLineHeight(value: number): void;
|
|
59
44
|
/**
|
|
60
45
|
* 设置字重
|
|
61
46
|
* @param value - 字重类型
|
|
@@ -69,101 +54,41 @@ export declare class TextComponentBase {
|
|
|
69
54
|
* @returns
|
|
70
55
|
*/
|
|
71
56
|
setFontStyle(value: spec.FontStyle): void;
|
|
72
|
-
/**
|
|
73
|
-
* 设置文本
|
|
74
|
-
* @param value - 文本内容
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
setText(value: string): void;
|
|
78
57
|
/**
|
|
79
58
|
* 设置文本水平布局
|
|
80
59
|
* @param value - 布局选项
|
|
81
60
|
* @returns
|
|
82
61
|
*/
|
|
83
62
|
setTextAlign(value: spec.TextAlignment): void;
|
|
84
|
-
/**
|
|
85
|
-
* 设置文本垂直布局
|
|
86
|
-
* @param value - 布局选项
|
|
87
|
-
* @returns
|
|
88
|
-
*/
|
|
89
|
-
setTextBaseline(value: spec.TextBaseline): void;
|
|
90
63
|
/**
|
|
91
64
|
* 设置文本颜色
|
|
92
65
|
* @param value - 颜色内容
|
|
93
66
|
* @returns
|
|
94
67
|
*/
|
|
95
68
|
setTextColor(value: spec.RGBAColorValue): void;
|
|
96
|
-
/**
|
|
97
|
-
* 设置文本字体
|
|
98
|
-
* @param value - 文本字体
|
|
99
|
-
* @returns
|
|
100
|
-
*/
|
|
101
|
-
setFontFamily(value: string): void;
|
|
102
69
|
/**
|
|
103
70
|
* 设置外描边文本颜色
|
|
104
71
|
* @param value - 颜色内容
|
|
105
72
|
* @returns
|
|
106
73
|
*/
|
|
107
74
|
setOutlineColor(value: spec.RGBAColorValue): void;
|
|
108
|
-
/**
|
|
109
|
-
* 设置外描边文本宽度
|
|
110
|
-
* @param value - 外描边宽度
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
setOutlineWidth(value: number): void;
|
|
114
|
-
/**
|
|
115
|
-
* 设置阴影模糊
|
|
116
|
-
* @param value - 阴影模糊强度
|
|
117
|
-
* @returns
|
|
118
|
-
*/
|
|
119
|
-
setShadowBlur(value: number): void;
|
|
120
|
-
/**
|
|
121
|
-
* 设置文本溢出模式
|
|
122
|
-
*
|
|
123
|
-
* - clip: 当文本内容超出边界框时,多余的会被截断。
|
|
124
|
-
* - display: 该模式下会显示所有文本,会自动调整文本字号以保证显示完整。
|
|
125
|
-
* > 当存在多行时,部分行内文本可能存在文本字号变小的情况,其他行为正常情况
|
|
126
|
-
*
|
|
127
|
-
* @param overflow - 文本溢出模式
|
|
128
|
-
*/
|
|
129
|
-
setOverflow(overflow: spec.TextOverflow): void;
|
|
130
|
-
/**
|
|
131
|
-
* 设置阴影颜色
|
|
132
|
-
* @param value - 阴影颜色
|
|
133
|
-
* @returns
|
|
134
|
-
*/
|
|
135
|
-
setShadowColor(value: spec.RGBAColorValue): void;
|
|
136
|
-
/**
|
|
137
|
-
* 设置阴影水平偏移距离
|
|
138
|
-
* @param value - 水平偏移距离
|
|
139
|
-
* @returns
|
|
140
|
-
*/
|
|
141
|
-
setShadowOffsetX(value: number): void;
|
|
142
|
-
/**
|
|
143
|
-
* 设置阴影水平偏移距离
|
|
144
|
-
* @param value - 水平偏移距离
|
|
145
|
-
* @returns
|
|
146
|
-
*/
|
|
147
|
-
setShadowOffsetY(value: number): void;
|
|
148
75
|
/**
|
|
149
76
|
* 设置字体清晰度
|
|
150
77
|
* @param value - 字体清晰度
|
|
151
78
|
* @returns
|
|
152
79
|
*/
|
|
153
80
|
setFontScale(value: number): void;
|
|
154
|
-
/**
|
|
155
|
-
* 设置自适应宽高开关
|
|
156
|
-
* @param value - 是否自适应宽高开关
|
|
157
|
-
* @returns
|
|
158
|
-
*/
|
|
159
|
-
setAutoWidth(value: boolean): void;
|
|
160
81
|
/**
|
|
161
82
|
* 更新文本
|
|
162
83
|
* @returns
|
|
163
84
|
*/
|
|
164
85
|
updateTexture(flipY?: boolean): void;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
86
|
+
renderText(options: spec.TextContentOptions): void;
|
|
87
|
+
setAutoWidth(value: boolean): void;
|
|
88
|
+
setFontSize(value: number): void;
|
|
89
|
+
setOutlineWidth(value: number): void;
|
|
90
|
+
setShadowBlur(value: number): void;
|
|
91
|
+
setShadowColor(value: spec.RGBAColorValue): void;
|
|
92
|
+
setShadowOffsetX(value: number): void;
|
|
93
|
+
setShadowOffsetY(value: number): void;
|
|
169
94
|
}
|
|
@@ -1,49 +1,39 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { TextStyle } from './text-style';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { BaseLayout } from './base-layout';
|
|
4
|
+
export declare class TextLayout implements BaseLayout {
|
|
5
|
+
textVerticalAlign: spec.TextVerticalAlign;
|
|
5
6
|
textAlign: spec.TextAlignment;
|
|
6
7
|
letterSpace: number;
|
|
7
|
-
lineGap: number;
|
|
8
8
|
overflow: spec.TextOverflow;
|
|
9
|
-
/**
|
|
10
|
-
* 兼容旧版富文本的排版方式
|
|
11
|
-
*/
|
|
12
|
-
useLegacyRichText: boolean;
|
|
13
9
|
width: number;
|
|
14
10
|
height: number;
|
|
15
11
|
/**
|
|
16
12
|
* 自适应宽高开关
|
|
17
13
|
*/
|
|
18
14
|
autoWidth: boolean;
|
|
19
|
-
|
|
15
|
+
maxTextWidth: number;
|
|
20
16
|
/**
|
|
21
17
|
* 行高
|
|
22
18
|
*/
|
|
23
19
|
lineHeight: number;
|
|
24
20
|
constructor(options: spec.TextContentOptions);
|
|
21
|
+
update(options: spec.TextContentOptions): void;
|
|
25
22
|
/**
|
|
26
23
|
* 获取初始的行高偏移值
|
|
27
24
|
* @param style - 字体基础数据
|
|
28
25
|
* @param lineCount - 渲染行数
|
|
29
26
|
* @param lineHeight - 渲染时的字体行高
|
|
30
27
|
* @param fontSize - 渲染时的字体大小
|
|
28
|
+
* @param totalLineHeight - 可选的实际总行高,用于替代默认计算
|
|
31
29
|
* @returns - 行高偏移值
|
|
32
30
|
*/
|
|
33
|
-
getOffsetY(style: TextStyle, lineCount: number, lineHeight: number, fontSize: number): number;
|
|
31
|
+
getOffsetY(style: TextStyle, lineCount: number, lineHeight: number, fontSize: number, totalLineHeight?: number): number;
|
|
34
32
|
getOffsetX(style: TextStyle, maxWidth: number): number;
|
|
35
|
-
/**
|
|
36
|
-
* 富文本垂直对齐计算
|
|
37
|
-
* @param style - 字体样式
|
|
38
|
-
* @param lineHeights - 每行高度数组
|
|
39
|
-
* @param fontSize - 字体大小
|
|
40
|
-
* @returns 第一行基线的 Y 坐标
|
|
41
|
-
*/
|
|
42
|
-
getOffsetYRich(style: TextStyle, lineHeights: number[], fontSize: number): number;
|
|
43
33
|
/**
|
|
44
34
|
* 设置文本框的宽度和高度
|
|
45
|
-
* @param width 文本框宽度
|
|
46
|
-
* @param height 文本框高度
|
|
35
|
+
* @param width - 文本框宽度
|
|
36
|
+
* @param height - 文本框高度
|
|
47
37
|
*/
|
|
48
38
|
setSize(width: number, height: number): void;
|
|
49
39
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RenderPassDestroyOptions, RenderPassOptions } from './render-pass';
|
|
2
|
+
import { RenderPass } from './render-pass';
|
|
3
|
+
import type { Renderer } from './renderer';
|
|
4
|
+
export declare class DrawObjectPass extends RenderPass {
|
|
5
|
+
constructor(renderer: Renderer, options: RenderPassOptions);
|
|
6
|
+
onResize(): void;
|
|
7
|
+
dispose(options?: RenderPassDestroyOptions): void;
|
|
8
|
+
}
|
|
@@ -6,9 +6,7 @@ import type { Renderer } from './renderer';
|
|
|
6
6
|
export interface FramebufferProps {
|
|
7
7
|
attachments: Texture[];
|
|
8
8
|
depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions;
|
|
9
|
-
isCustomViewport?: boolean;
|
|
10
9
|
viewport: [x: number, y: number, width: number, height: number];
|
|
11
|
-
viewportScale?: number;
|
|
12
10
|
storeAction: RenderPassStoreAction;
|
|
13
11
|
name?: string;
|
|
14
12
|
}
|
|
@@ -26,12 +24,10 @@ export declare enum RenderTextureFormat {
|
|
|
26
24
|
export declare class Framebuffer {
|
|
27
25
|
depthStencilStorageType: RenderPassAttachmentStorageType;
|
|
28
26
|
name: string;
|
|
29
|
-
viewportScale: number;
|
|
30
27
|
viewport: [x: number, y: number, width: number, height: number];
|
|
31
28
|
ready: boolean;
|
|
32
29
|
externalStorage: boolean;
|
|
33
30
|
storeAction: RenderPassStoreAction;
|
|
34
|
-
isCustomViewport: boolean;
|
|
35
31
|
static create: (props: FramebufferProps, renderer: Renderer) => Framebuffer;
|
|
36
32
|
resize(x: number, y: number, width: number, height: number): void;
|
|
37
33
|
resetColorTextures(textures: Texture[]): void;
|
|
@@ -12,9 +12,9 @@ export interface GPUCapabilityDetail {
|
|
|
12
12
|
maxShaderTexCount: number;
|
|
13
13
|
maxTextureSize: number;
|
|
14
14
|
maxTextureAnisotropy: number;
|
|
15
|
-
compressedTexture: number;
|
|
16
15
|
shaderTextureLod: boolean;
|
|
17
16
|
instanceDraw?: boolean;
|
|
17
|
+
ktx2Support: boolean;
|
|
18
18
|
drawBuffers?: boolean;
|
|
19
19
|
asyncShaderCompile: boolean;
|
|
20
20
|
intIndexElementBuffer?: boolean;
|
|
@@ -29,6 +29,7 @@ export declare class GPUCapability {
|
|
|
29
29
|
type: GLType;
|
|
30
30
|
level: number;
|
|
31
31
|
detail: Immutable<GPUCapabilityDetail>;
|
|
32
|
+
private compressTextureCapabilityList;
|
|
32
33
|
UNSIGNED_INT_24_8: number;
|
|
33
34
|
internalFormatDepth16: number;
|
|
34
35
|
internalFormatDepth24_stencil8: number;
|
|
@@ -37,13 +38,24 @@ export declare class GPUCapability {
|
|
|
37
38
|
glAsyncCompileExt: KHR_parallel_shader_compile | null;
|
|
38
39
|
vaoExt: OES_vertex_array_object | null;
|
|
39
40
|
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
41
|
+
get isWebGL2(): boolean;
|
|
42
|
+
isCompressedFormatSupported(cap: CompressTextureCapabilityType): boolean;
|
|
40
43
|
private setupCapability;
|
|
41
44
|
framebufferTexture2D(gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, index: number, textarget: number, texture: WebGLTexture | null): void;
|
|
42
45
|
drawBuffers(gl: WebGLRenderingContext | WebGL2RenderingContext, bufferStates: boolean[]): void;
|
|
43
46
|
setTextureAnisotropic(gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, level: number): void;
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* GL Capabilities
|
|
50
|
+
* Some capabilities can be smoothed out by extension, and some capabilities must use WebGL 2.0.
|
|
51
|
+
* */
|
|
52
|
+
export declare enum CompressTextureCapabilityType {
|
|
53
|
+
astc = "WEBGL_compressed_texture_astc",
|
|
54
|
+
astc_webkit = "WEBKIT_WEBGL_compressed_texture_astc",
|
|
55
|
+
etc = "WEBGL_compressed_texture_etc",
|
|
56
|
+
etc_webkit = "WEBKIT_WEBGL_compressed_texture_etc",
|
|
57
|
+
etc1 = "WEBGL_compressed_texture_etc1",
|
|
58
|
+
pvrtc = "WEBGL_compressed_texture_pvrtc",
|
|
59
|
+
pvrtc_webkit = "WEBKIT_WEBGL_compressed_texture_pvrtc",
|
|
60
|
+
sRGB = "EXT_sRGB"
|
|
49
61
|
}
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { RenderPassOptions } from './render-pass';
|
|
2
|
-
import { RenderTargetHandle } from './render-pass';
|
|
3
|
-
import { RenderPass } from './render-pass';
|
|
1
|
+
import type { RenderPassDestroyOptions, RenderPassOptions } from './render-pass';
|
|
2
|
+
import { RenderTargetHandle, RenderPass } from './render-pass';
|
|
4
3
|
import type { Renderer } from './renderer';
|
|
5
4
|
export declare class BloomThresholdPass extends RenderPass {
|
|
6
5
|
sceneTextureHandle: RenderTargetHandle;
|
|
@@ -9,23 +8,33 @@ export declare class BloomThresholdPass extends RenderPass {
|
|
|
9
8
|
constructor(renderer: Renderer, option: RenderPassOptions);
|
|
10
9
|
configure(renderer: Renderer): void;
|
|
11
10
|
execute(renderer: Renderer): void;
|
|
11
|
+
private onResize;
|
|
12
|
+
dispose(options?: RenderPassDestroyOptions): void;
|
|
12
13
|
}
|
|
13
14
|
export declare class HQGaussianDownSamplePass extends RenderPass {
|
|
14
15
|
gaussianResult: RenderTargetHandle;
|
|
15
16
|
private mainTexture;
|
|
16
17
|
private screenMesh;
|
|
17
18
|
private readonly type;
|
|
18
|
-
|
|
19
|
+
private readonly level;
|
|
20
|
+
constructor(renderer: Renderer, type: 'V' | 'H', level: number, options: RenderPassOptions);
|
|
21
|
+
initialize(renderer: Renderer): RenderPass;
|
|
19
22
|
configure(renderer: Renderer): void;
|
|
20
23
|
execute(renderer: Renderer): void;
|
|
24
|
+
private onResize;
|
|
25
|
+
dispose(options?: RenderPassDestroyOptions | undefined): void;
|
|
21
26
|
}
|
|
22
27
|
export declare class HQGaussianUpSamplePass extends RenderPass {
|
|
23
28
|
gaussianDownSampleResult: RenderTargetHandle;
|
|
24
29
|
private mainTexture;
|
|
25
30
|
private screenMesh;
|
|
26
|
-
|
|
31
|
+
private readonly level;
|
|
32
|
+
constructor(renderer: Renderer, level: number, options: RenderPassOptions);
|
|
33
|
+
initialize(renderer: Renderer): RenderPass;
|
|
27
34
|
configure(renderer: Renderer): void;
|
|
28
35
|
execute(renderer: Renderer): void;
|
|
36
|
+
private onResize;
|
|
37
|
+
dispose(options?: RenderPassDestroyOptions): void;
|
|
29
38
|
}
|
|
30
39
|
export declare class ToneMappingPass extends RenderPass {
|
|
31
40
|
private screenMesh;
|