@galacean/effects-core 2.0.0-alpha.8 → 2.0.0-beta.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/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/asset-manager.d.ts +1 -75
- package/dist/binary-asset.d.ts +6 -0
- package/dist/camera.d.ts +10 -1
- package/dist/canvas-pool.d.ts +9 -0
- package/dist/comp-vfx-item.d.ts +26 -12
- package/dist/components/component.d.ts +4 -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 +71 -64
- 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 +4 -1
- 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 +18920 -14116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19155 -14360
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +17 -7
- 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 +3 -4
- 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 +14 -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 +7 -8
- package/dist/plugins/sprite/sprite-item.d.ts +29 -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 +33 -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 +3 -2
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/render-frame.d.ts +13 -12
- package/dist/render/render-pass.d.ts +10 -10
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +9 -7
- package/dist/{semantic-map.d.ts → render/semantic-map.d.ts} +4 -4
- package/dist/render/shader.d.ts +4 -4
- package/dist/scene.d.ts +86 -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 -14
- package/dist/texture/texture.d.ts +8 -0
- package/dist/texture/types.d.ts +2 -2
- package/dist/texture/utils.d.ts +2 -1
- package/dist/ticker.d.ts +2 -2
- package/dist/transform.d.ts +3 -3
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/device.d.ts +4 -0
- package/dist/utils/index.d.ts +29 -14
- package/dist/utils/text.d.ts +8 -0
- package/dist/vfx-item.d.ts +37 -61
- 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
|
@@ -4,19 +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';
|
|
9
|
+
export declare const DEFAULT_FONTS: string[];
|
|
10
|
+
export interface TextComponent extends TextComponentBase {
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* @since 2.0.0
|
|
9
14
|
* @internal
|
|
10
15
|
*/
|
|
11
16
|
export declare class TextComponent extends SpriteComponent {
|
|
12
|
-
textStyle: TextStyle;
|
|
13
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;
|
|
14
30
|
canvas: HTMLCanvasElement;
|
|
15
31
|
context: CanvasRenderingContext2D | null;
|
|
16
32
|
textLayout: TextLayout;
|
|
17
33
|
text: string;
|
|
34
|
+
/***** mix 类型兼容用 *****/
|
|
35
|
+
isDirty: boolean;
|
|
36
|
+
engine: Engine;
|
|
37
|
+
material: Material;
|
|
38
|
+
lineCount: number;
|
|
39
|
+
item: VFXItem;
|
|
40
|
+
/***** mix 类型兼容用 *****/
|
|
18
41
|
private char;
|
|
19
|
-
|
|
42
|
+
updateWithOptions(options: spec.TextContentOptions): void;
|
|
43
|
+
private getLineCount;
|
|
20
44
|
/**
|
|
21
45
|
* 设置字号大小
|
|
22
46
|
* @param value - 字号
|
|
@@ -107,13 +131,17 @@ export declare class TextComponent extends SpriteComponent {
|
|
|
107
131
|
* @returns
|
|
108
132
|
*/
|
|
109
133
|
setFontScale(value: number): void;
|
|
110
|
-
|
|
134
|
+
/**
|
|
135
|
+
* 设置自适应宽高开关
|
|
136
|
+
* @param value - 是否自适应宽高开关
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
setAutoWidth(value: boolean): void;
|
|
111
140
|
/**
|
|
112
141
|
* 更新文本
|
|
113
142
|
* @returns
|
|
114
143
|
*/
|
|
115
|
-
updateTexture(): void;
|
|
116
|
-
fromData(data: SpriteItemProps): void;
|
|
144
|
+
updateTexture(flipY?: boolean): void;
|
|
117
145
|
private getFontDesc;
|
|
118
146
|
private setupOutline;
|
|
119
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
|
* 设置文本框的宽度和高度
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FrameContext } from '../../cal/playable-graph';
|
|
2
|
+
import { Playable } from '../../cal/playable-graph';
|
|
3
|
+
export declare class ActivationMixerPlayable extends Playable {
|
|
4
|
+
processFrame(context: FrameContext): void;
|
|
5
|
+
private hideRendererComponents;
|
|
6
|
+
private showRendererComponents;
|
|
7
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EndBehavior } from '@galacean/effects-specification';
|
|
2
|
+
import type { PlayableGraph } from '../cal/playable-graph';
|
|
3
|
+
import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
|
|
4
|
+
import { ParticleSystem } from '../particle/particle-system';
|
|
5
|
+
import type { Constructor } from '../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* @since 2.0.0
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class TimelineClip {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
start: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
asset: PlayableAsset;
|
|
16
|
+
endBehavior: EndBehavior;
|
|
17
|
+
constructor();
|
|
18
|
+
toLocalTime(time: number): number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @since 2.0.0
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare class TrackAsset extends PlayableAsset {
|
|
25
|
+
name: string;
|
|
26
|
+
binding: object;
|
|
27
|
+
trackType: TrackType;
|
|
28
|
+
private clipSeed;
|
|
29
|
+
private clips;
|
|
30
|
+
protected children: TrackAsset[];
|
|
31
|
+
/**
|
|
32
|
+
* 重写该方法以获取自定义对象绑定
|
|
33
|
+
*/
|
|
34
|
+
resolveBinding(parentBinding: object): object;
|
|
35
|
+
/**
|
|
36
|
+
* 重写该方法以创建自定义混合器
|
|
37
|
+
*/
|
|
38
|
+
createTrackMixer(graph: PlayableGraph): Playable;
|
|
39
|
+
createOutput(): PlayableOutput;
|
|
40
|
+
createPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
|
|
41
|
+
createMixerPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
|
|
42
|
+
compileClips(graph: PlayableGraph, timelineClips: TimelineClip[], runtimeClips: RuntimeClip[]): Playable;
|
|
43
|
+
createPlayable(graph: PlayableGraph): Playable;
|
|
44
|
+
getChildTracks(): TrackAsset[];
|
|
45
|
+
addChild(child: TrackAsset): void;
|
|
46
|
+
createClip<T extends PlayableAsset>(classConstructor: Constructor<T>, name?: string): TimelineClip;
|
|
47
|
+
getClips(): TimelineClip[];
|
|
48
|
+
findClip(name: string): TimelineClip | undefined;
|
|
49
|
+
addClip(clip: TimelineClip): void;
|
|
50
|
+
private createClipPlayable;
|
|
51
|
+
}
|
|
52
|
+
export declare enum TrackType {
|
|
53
|
+
MasterTrack = 0,
|
|
54
|
+
ObjectTrack = 1
|
|
55
|
+
}
|
|
56
|
+
export declare class RuntimeClip {
|
|
57
|
+
clip: TimelineClip;
|
|
58
|
+
playable: Playable;
|
|
59
|
+
parentMixer: Playable;
|
|
60
|
+
track: TrackAsset;
|
|
61
|
+
particleSystem: ParticleSystem;
|
|
62
|
+
constructor(clip: TimelineClip, clipPlayable: Playable, parentMixer: Playable, track: TrackAsset);
|
|
63
|
+
set enable(value: boolean);
|
|
64
|
+
evaluateAt(localTime: number): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @since 2.0.0
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export interface TimelineClipData {
|
|
71
|
+
asset: PlayableAsset;
|
|
72
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SharedShaderWithSource } from './shader';
|
|
2
2
|
export declare const EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
3
3
|
export declare const COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
4
|
-
export declare const COPY_VERTEX_SHADER = "\
|
|
5
|
-
export declare const COPY_FRAGMENT_SHADER = "precision mediump float;\
|
|
4
|
+
export declare const COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
5
|
+
export declare const COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
6
6
|
export declare function createCopyShader(level: number, writeDepth?: boolean): SharedShaderWithSource;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Texture } from '../texture';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Renderbuffer } from './renderbuffer';
|
|
3
3
|
import type { RenderPassAttachmentStorageType, RenderPassDepthStencilAttachmentOptions } from './render-pass';
|
|
4
4
|
import type { RenderPassDestroyAttachmentType, RenderPassStoreAction } from './render-pass';
|
|
5
5
|
import type { Renderer } from './renderer';
|
|
6
|
-
export interface
|
|
6
|
+
export interface FramebufferProps {
|
|
7
7
|
attachments: Texture[];
|
|
8
8
|
depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions;
|
|
9
9
|
isCustomViewport?: boolean;
|
|
@@ -23,7 +23,7 @@ export declare enum RenderTextureFormat {
|
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
export declare class
|
|
26
|
+
export declare class Framebuffer {
|
|
27
27
|
depthStencilStorageType: RenderPassAttachmentStorageType;
|
|
28
28
|
name: string;
|
|
29
29
|
viewportScale: number;
|
|
@@ -32,17 +32,17 @@ export declare class FrameBuffer {
|
|
|
32
32
|
externalStorage: boolean;
|
|
33
33
|
storeAction: RenderPassStoreAction;
|
|
34
34
|
isCustomViewport: boolean;
|
|
35
|
-
static create: (props:
|
|
35
|
+
static create: (props: FramebufferProps, renderer: Renderer) => Framebuffer;
|
|
36
36
|
resize(x: number, y: number, width: number, height: number): void;
|
|
37
37
|
resetColorTextures(textures: Texture[]): void;
|
|
38
38
|
unbind(): void;
|
|
39
39
|
bind(): void;
|
|
40
|
-
get stencilStorage():
|
|
41
|
-
get depthStorage():
|
|
40
|
+
get stencilStorage(): Renderbuffer | undefined;
|
|
41
|
+
get depthStorage(): Renderbuffer | undefined;
|
|
42
42
|
getDepthTexture(): Texture | undefined;
|
|
43
43
|
getStencilTexture(): Texture | undefined;
|
|
44
44
|
getColorTextures(): Texture[];
|
|
45
|
-
dispose(
|
|
45
|
+
dispose(options?: {
|
|
46
46
|
depthStencilAttachment?: RenderPassDestroyAttachmentType;
|
|
47
47
|
}): void;
|
|
48
48
|
}
|
|
@@ -24,6 +24,11 @@ export interface GeometryProps {
|
|
|
24
24
|
*/
|
|
25
25
|
maxVertex?: number;
|
|
26
26
|
}
|
|
27
|
+
export interface SkinProps {
|
|
28
|
+
boneNames?: string[];
|
|
29
|
+
rootBoneName?: string;
|
|
30
|
+
inverseBindMatrices?: number[];
|
|
31
|
+
}
|
|
27
32
|
/**
|
|
28
33
|
* Geometry 抽象类
|
|
29
34
|
*/
|
|
@@ -32,6 +37,10 @@ export declare abstract class Geometry extends EffectsObject {
|
|
|
32
37
|
* Geometry 的名称
|
|
33
38
|
*/
|
|
34
39
|
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* 子网格数据
|
|
42
|
+
*/
|
|
43
|
+
subMeshes: spec.SubMesh[];
|
|
35
44
|
/**
|
|
36
45
|
* Geometry 创建函数
|
|
37
46
|
*/
|
|
@@ -96,6 +105,10 @@ export declare abstract class Geometry extends EffectsObject {
|
|
|
96
105
|
* 获取当前 Geometry 的 drawcount
|
|
97
106
|
*/
|
|
98
107
|
abstract getDrawCount(): number;
|
|
108
|
+
/**
|
|
109
|
+
* 获取当前 Geometry 关联的蒙皮数据
|
|
110
|
+
*/
|
|
111
|
+
abstract getSkinProps(): SkinProps;
|
|
99
112
|
/**
|
|
100
113
|
* 初始化 GPU 资源
|
|
101
114
|
* @override
|
|
@@ -106,4 +119,4 @@ export declare abstract class Geometry extends EffectsObject {
|
|
|
106
119
|
*/
|
|
107
120
|
flush(): void;
|
|
108
121
|
}
|
|
109
|
-
export declare function generateEmptyTypedArray(type: number): Float32Array |
|
|
122
|
+
export declare function generateEmptyTypedArray(type: number): Float32Array | Int16Array | Int32Array;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 后处理配置
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
5
|
-
usePostProcessing: boolean;
|
|
4
|
+
export interface PostProcessVolumeData {
|
|
6
5
|
useHDR: boolean;
|
|
7
|
-
useBloom:
|
|
6
|
+
useBloom: boolean;
|
|
8
7
|
threshold: number;
|
|
9
8
|
bloomIntensity: number;
|
|
10
9
|
brightness: number;
|
|
@@ -13,6 +12,6 @@ export interface GlobalVolume {
|
|
|
13
12
|
vignetteIntensity: number;
|
|
14
13
|
vignetteSmoothness: number;
|
|
15
14
|
vignetteRoundness: number;
|
|
16
|
-
useToneMapping:
|
|
15
|
+
useToneMapping: boolean;
|
|
17
16
|
}
|
|
18
|
-
export declare const defaultGlobalVolume:
|
|
17
|
+
export declare const defaultGlobalVolume: PostProcessVolumeData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { GLType } from '../gl';
|
|
1
2
|
import type { Immutable } from '../utils';
|
|
2
|
-
export type GLType = 'webgl' | 'webgl2';
|
|
3
3
|
export interface GPUCapabilityDetail {
|
|
4
4
|
floatTexture: number;
|
|
5
5
|
halfFloatTexture: number;
|
|
@@ -42,8 +42,8 @@ export declare class GPUCapability {
|
|
|
42
42
|
drawBuffers(gl: WebGLRenderingContext | WebGL2RenderingContext, bufferStates: boolean[]): void;
|
|
43
43
|
setTextureAnisotropic(gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, level: number): void;
|
|
44
44
|
}
|
|
45
|
-
export declare
|
|
46
|
-
NONE
|
|
47
|
-
PVRTC
|
|
48
|
-
ASTC
|
|
49
|
-
}
|
|
45
|
+
export declare enum COMPRESSED_TEXTURE {
|
|
46
|
+
NONE = 0,
|
|
47
|
+
PVRTC = 1,
|
|
48
|
+
ASTC = 2
|
|
49
|
+
}
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from './create-copy-shader';
|
|
2
2
|
export * from './render-frame';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './renderbuffer';
|
|
4
4
|
export * from './render-pass';
|
|
5
5
|
export * from './shader';
|
|
6
6
|
export * from './gpu-capability';
|
|
7
7
|
export * from './mesh';
|
|
8
8
|
export * from './types';
|
|
9
9
|
export * from './geometry';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './framebuffer';
|
|
11
11
|
export * from './renderer';
|
|
12
12
|
export * from './global-volume';
|
|
13
|
+
export * from './semantic-map';
|
package/dist/render/mesh.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface GeometryMeshProps extends MeshOptionsBase {
|
|
|
16
16
|
}
|
|
17
17
|
export interface MeshDestroyOptions {
|
|
18
18
|
geometries?: DestroyOptions;
|
|
19
|
-
material?: MaterialDestroyOptions | DestroyOptions
|
|
19
|
+
material?: MaterialDestroyOptions | DestroyOptions;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Mesh 抽象类
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { vec4 } from '@galacean/effects-specification';
|
|
2
|
-
import type { Matrix4 } from '@galacean/effects-math/es/core/
|
|
3
|
-
import { Vector2
|
|
2
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
3
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
4
|
+
import { Vector4 } from '@galacean/effects-math/es/core/vector4';
|
|
4
5
|
import type { Camera } from '../camera';
|
|
5
6
|
import type { UniformValue } from '../material';
|
|
6
7
|
import { PassTextureCache } from '../paas-texture-cache';
|
|
7
|
-
import type { SemanticFunc } from '
|
|
8
|
-
import { SemanticMap } from '
|
|
8
|
+
import type { SemanticFunc } from './semantic-map';
|
|
9
|
+
import { SemanticMap } from './semantic-map';
|
|
9
10
|
import { Texture } from '../texture';
|
|
10
11
|
import type { Disposable } from '../utils';
|
|
11
12
|
import { DestroyOptions } from '../utils';
|
|
@@ -13,8 +14,7 @@ import { Mesh } from './mesh';
|
|
|
13
14
|
import type { RenderPassClearAction, RenderPassColorAttachmentOptions, RenderPassDepthStencilAttachment, RenderPassDestroyOptions, RenderPassStoreAction } from './render-pass';
|
|
14
15
|
import { RenderPass } from './render-pass';
|
|
15
16
|
import type { Renderer } from './renderer';
|
|
16
|
-
import type {
|
|
17
|
-
import type { RendererComponent } from '../components';
|
|
17
|
+
import type { PostProcessVolume, RendererComponent } from '../components';
|
|
18
18
|
/**
|
|
19
19
|
* 渲染数据,保存了当前渲染使用到的数据。
|
|
20
20
|
*/
|
|
@@ -69,11 +69,11 @@ export interface RenderPassInfo {
|
|
|
69
69
|
*/
|
|
70
70
|
export interface RenderFrameResource {
|
|
71
71
|
/**
|
|
72
|
-
* 纹理对象,用于
|
|
72
|
+
* 纹理对象,用于 Framebuffer 的颜色 Attachment
|
|
73
73
|
*/
|
|
74
74
|
color_a: Texture;
|
|
75
75
|
/**
|
|
76
|
-
* 纹理对象,用于
|
|
76
|
+
* 纹理对象,用于 Framebuffer 的颜色 Attachment
|
|
77
77
|
*/
|
|
78
78
|
color_b: Texture;
|
|
79
79
|
/**
|
|
@@ -127,7 +127,7 @@ export interface RenderFrameOptions {
|
|
|
127
127
|
/**
|
|
128
128
|
* 后处理渲染配置
|
|
129
129
|
*/
|
|
130
|
-
globalVolume?:
|
|
130
|
+
globalVolume?: PostProcessVolume;
|
|
131
131
|
/**
|
|
132
132
|
* 名称
|
|
133
133
|
*/
|
|
@@ -165,7 +165,7 @@ export declare class RenderFrame implements Disposable {
|
|
|
165
165
|
/**
|
|
166
166
|
* 存放后处理的属性设置
|
|
167
167
|
*/
|
|
168
|
-
globalVolume:
|
|
168
|
+
globalVolume: PostProcessVolume;
|
|
169
169
|
renderer: Renderer;
|
|
170
170
|
resource: RenderFrameResource;
|
|
171
171
|
keepColorBuffer?: boolean;
|
|
@@ -210,7 +210,7 @@ export declare class RenderFrame implements Disposable {
|
|
|
210
210
|
*/
|
|
211
211
|
dispose(options?: RenderFrameDestroyOptions): void;
|
|
212
212
|
/**
|
|
213
|
-
* 重置 RenderPass ColorAttachment,解决
|
|
213
|
+
* 重置 RenderPass ColorAttachment,解决 Framebuffer 即读又写的问题
|
|
214
214
|
* @param renderPasses - RenderPass 对象数组
|
|
215
215
|
* @param startIndex - 开始重置的索引
|
|
216
216
|
*/
|
|
@@ -239,7 +239,7 @@ export declare class RenderFrame implements Disposable {
|
|
|
239
239
|
createResource(): void;
|
|
240
240
|
/**
|
|
241
241
|
* 创建拷贝 RenderPass 用到的 Mesh 对象
|
|
242
|
-
* @param semantics - RenderPass 渲染时
|
|
242
|
+
* @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
|
|
243
243
|
*/
|
|
244
244
|
createCopyMesh(semantics?: {
|
|
245
245
|
tex?: string;
|
|
@@ -258,6 +258,7 @@ export declare function findPreviousRenderPass(renderPasses: RenderPass[], rende
|
|
|
258
258
|
export declare class GlobalUniforms {
|
|
259
259
|
floats: Record<string, number>;
|
|
260
260
|
ints: Record<string, number>;
|
|
261
|
+
vector4s: Record<string, Vector4>;
|
|
261
262
|
matrices: Record<string, Matrix4>;
|
|
262
263
|
samplers: string[];
|
|
263
264
|
uniforms: string[];
|
|
@@ -4,14 +4,14 @@ import type { Camera } from '../camera';
|
|
|
4
4
|
import type { RendererComponent } from '../components';
|
|
5
5
|
import type { Engine } from '../engine';
|
|
6
6
|
import type { MeshDestroyOptions, Renderer } from '../render';
|
|
7
|
-
import {
|
|
8
|
-
import type { SemanticGetter } from '
|
|
9
|
-
import { SemanticMap } from '
|
|
7
|
+
import { Framebuffer } from '../render';
|
|
8
|
+
import type { SemanticGetter } from './semantic-map';
|
|
9
|
+
import { SemanticMap } from './semantic-map';
|
|
10
10
|
import type { TextureConfigOptions, TextureLoadAction } from '../texture';
|
|
11
11
|
import { Texture } from '../texture';
|
|
12
12
|
import type { Disposable, Sortable } from '../utils';
|
|
13
13
|
import { DestroyOptions, OrderType } from '../utils';
|
|
14
|
-
import type {
|
|
14
|
+
import type { Renderbuffer } from './renderbuffer';
|
|
15
15
|
import type { RenderingData } from './render-frame';
|
|
16
16
|
export declare const RenderPassPriorityPrepare = 0;
|
|
17
17
|
export declare const RenderPassPriorityNormal = 1000;
|
|
@@ -76,9 +76,9 @@ export interface RenderPassColorAttachmentOptions {
|
|
|
76
76
|
/**
|
|
77
77
|
* ColorAttachment 的 Buffer 参数
|
|
78
78
|
*/
|
|
79
|
-
buffer?:
|
|
79
|
+
buffer?: Renderbuffer;
|
|
80
80
|
/**
|
|
81
|
-
* WebGL2 下
|
|
81
|
+
* WebGL2 下 Renderbuffer 超采数目。默认是0,即不启用超采。
|
|
82
82
|
* @default 0
|
|
83
83
|
*/
|
|
84
84
|
multiSample?: number;
|
|
@@ -102,12 +102,12 @@ export declare class RenderTargetHandle implements Disposable {
|
|
|
102
102
|
}
|
|
103
103
|
export interface RenderPassDepthStencilAttachment {
|
|
104
104
|
readonly storageType: RenderPassAttachmentStorageType;
|
|
105
|
-
readonly storage?:
|
|
105
|
+
readonly storage?: Renderbuffer;
|
|
106
106
|
readonly texture?: Texture;
|
|
107
107
|
}
|
|
108
108
|
export interface RenderPassDepthStencilAttachmentOptions {
|
|
109
109
|
storageType: RenderPassAttachmentStorageType;
|
|
110
|
-
storage?:
|
|
110
|
+
storage?: Renderbuffer;
|
|
111
111
|
texture?: Texture;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
@@ -209,7 +209,7 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
209
209
|
* ColorAttachment 数组
|
|
210
210
|
*/
|
|
211
211
|
attachments: RenderTargetHandle[];
|
|
212
|
-
|
|
212
|
+
framebuffer: Framebuffer | null;
|
|
213
213
|
/**
|
|
214
214
|
* 名称
|
|
215
215
|
*/
|
|
@@ -227,7 +227,7 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
227
227
|
*/
|
|
228
228
|
readonly camera?: Camera;
|
|
229
229
|
/**
|
|
230
|
-
* 深度和蒙版 Attachment 类型,注意区分纹理和
|
|
230
|
+
* 深度和蒙版 Attachment 类型,注意区分纹理和 Renderbuffer
|
|
231
231
|
*/
|
|
232
232
|
readonly depthStencilType: RenderPassAttachmentStorageType;
|
|
233
233
|
/**
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { Disposable } from '../utils';
|
|
2
2
|
import type { RenderPassAttachmentStorageType } from './render-pass';
|
|
3
|
-
export interface
|
|
3
|
+
export interface RenderbufferProps {
|
|
4
4
|
storageType: RenderPassAttachmentStorageType;
|
|
5
5
|
format: GLenum;
|
|
6
6
|
attachment: GLenum;
|
|
7
7
|
}
|
|
8
|
-
export declare abstract class
|
|
8
|
+
export declare abstract class Renderbuffer implements Disposable {
|
|
9
9
|
readonly size: [x: number, y: number];
|
|
10
10
|
readonly multiSample = 1;
|
|
11
11
|
readonly storageType: RenderPassAttachmentStorageType;
|
|
12
12
|
readonly format: GLenum;
|
|
13
13
|
readonly attachment: GLenum;
|
|
14
14
|
protected destroyed: boolean;
|
|
15
|
-
static create: (props:
|
|
16
|
-
constructor(props:
|
|
15
|
+
static create: (props: RenderbufferProps) => Renderbuffer;
|
|
16
|
+
constructor(props: RenderbufferProps);
|
|
17
17
|
get isDestroyed(): boolean;
|
|
18
18
|
abstract setSize(width: number, height: number): void;
|
|
19
19
|
abstract dispose(): void;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type { Matrix4 } from '@galacean/effects-math/es/core/index';
|
|
1
|
+
import type { Matrix4, Vector4 } from '@galacean/effects-math/es/core/index';
|
|
2
2
|
import type { RendererComponent } from '../components/renderer-component';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
4
|
import type { Material } from '../material';
|
|
5
5
|
import type { LostHandler, RestoreHandler } from '../utils';
|
|
6
|
-
import type { FilterMode,
|
|
6
|
+
import type { FilterMode, Framebuffer, RenderTextureFormat } from './framebuffer';
|
|
7
7
|
import type { Geometry } from './geometry';
|
|
8
8
|
import type { RenderFrame, RenderingData } from './render-frame';
|
|
9
9
|
import type { RenderPassClearAction, RenderPassStoreAction } from './render-pass';
|
|
10
10
|
import type { ShaderLibrary } from './shader';
|
|
11
|
+
import type { GLType } from '../gl';
|
|
11
12
|
export declare class Renderer implements LostHandler, RestoreHandler {
|
|
12
|
-
static create: (canvas: HTMLCanvasElement | OffscreenCanvas, framework:
|
|
13
|
+
static create: (canvas: HTMLCanvasElement | OffscreenCanvas, framework: GLType, renderOptions?: WebGLContextAttributes) => Renderer;
|
|
13
14
|
engine: Engine;
|
|
14
15
|
env: string;
|
|
15
16
|
/**
|
|
@@ -19,9 +20,10 @@ export declare class Renderer implements LostHandler, RestoreHandler {
|
|
|
19
20
|
constructor();
|
|
20
21
|
setGlobalFloat(name: string, value: number): void;
|
|
21
22
|
setGlobalInt(name: string, value: number): void;
|
|
23
|
+
setGlobalVector4(name: string, value: Vector4): void;
|
|
22
24
|
setGlobalMatrix(name: string, value: Matrix4): void;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
getFramebuffer(): Framebuffer | null;
|
|
26
|
+
setFramebuffer(framebuffer: Framebuffer | null): void;
|
|
25
27
|
setViewport(x: number, y: number, width: number, height: number): void;
|
|
26
28
|
resize(canvasWidth: number, canvasHeight: number): void;
|
|
27
29
|
clear(action: RenderPassClearAction | RenderPassStoreAction): void;
|
|
@@ -56,7 +58,7 @@ export declare class Renderer implements LostHandler, RestoreHandler {
|
|
|
56
58
|
getShaderLibrary(): ShaderLibrary | undefined;
|
|
57
59
|
renderRenderFrame(renderFrame: RenderFrame): void;
|
|
58
60
|
renderMeshes(meshes: RendererComponent[]): void;
|
|
59
|
-
drawGeometry(geometry: Geometry, material: Material): void;
|
|
60
|
-
getTemporaryRT(name: string, width: number, height: number, depthBuffer: number, filter: FilterMode, format: RenderTextureFormat):
|
|
61
|
+
drawGeometry(geometry: Geometry, material: Material, subMeshIndex?: number): void;
|
|
62
|
+
getTemporaryRT(name: string, width: number, height: number, depthBuffer: number, filter: FilterMode, format: RenderTextureFormat): Framebuffer | null;
|
|
61
63
|
dispose(haltGL?: boolean): void;
|
|
62
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UniformValue } from '
|
|
2
|
-
import type { RenderingData } from '
|
|
3
|
-
import type { Disposable } from '
|
|
1
|
+
import type { UniformValue } from '../material';
|
|
2
|
+
import type { RenderingData } from '.';
|
|
3
|
+
import type { Disposable } from '../utils';
|
|
4
4
|
export type SemanticFunc = (state: RenderingData) => UniformValue | undefined;
|
|
5
5
|
export type SemanticGetter = UniformValue | SemanticFunc;
|
|
6
6
|
export declare class SemanticMap implements Disposable {
|
|
@@ -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 |
|
|
11
|
+
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | Int32Array | number[] | number[][] | import("@galacean/effects-core").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector3 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("@galacean/effects-core").Texture[] | import("packages/effects-core/src/material/types").UniformStruct | import("packages/effects-core/src/material/types").UniformStruct[] | SemanticFunc | undefined;
|
|
12
12
|
hasSemanticValue(name: string): boolean;
|
|
13
13
|
dispose(): void;
|
|
14
14
|
}
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import { EffectsObject } from '../effects-object';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
|
-
export type
|
|
4
|
+
export type ShaderMacros = [key: string, value: string | number | boolean][];
|
|
5
5
|
export declare enum ShaderCompileResultStatus {
|
|
6
6
|
noShader = 0,
|
|
7
7
|
success = 1,
|
|
@@ -39,7 +39,7 @@ export interface InstancedShaderWithSource {
|
|
|
39
39
|
/**
|
|
40
40
|
* shader的宏定义
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
macros?: ShaderMacros;
|
|
43
43
|
/**
|
|
44
44
|
* shader是否共享
|
|
45
45
|
*/
|
|
@@ -65,7 +65,7 @@ export interface SharedShaderWithSource {
|
|
|
65
65
|
/**
|
|
66
66
|
* shader的宏定义
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
macros?: ShaderMacros;
|
|
69
69
|
/**
|
|
70
70
|
* 是否共用GLProgram
|
|
71
71
|
* shared为true时,
|
|
@@ -94,7 +94,7 @@ export interface ShaderLibrary {
|
|
|
94
94
|
[cacheId: string]: ShaderCompileResult;
|
|
95
95
|
};
|
|
96
96
|
addShader(shader: ShaderWithSource): void;
|
|
97
|
-
createShader(shaderSource: ShaderWithSource, macros?:
|
|
97
|
+
createShader(shaderSource: ShaderWithSource, macros?: ShaderMacros): ShaderVariant;
|
|
98
98
|
/**
|
|
99
99
|
* @param cacheId
|
|
100
100
|
*/
|