@galacean/effects-core 2.8.0-alpha.0 → 2.8.0-alpha.2
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 +1 -3
- package/dist/composition.d.ts +0 -14
- package/dist/index.js +642 -958
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +641 -955
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-system.d.ts +12 -20
- package/dist/plugins/plugin.d.ts +8 -64
- package/dist/plugins/text/text-component-base.d.ts +4 -0
- package/dist/plugins/text/text-item.d.ts +5 -2
- package/dist/render/create-copy-shader.d.ts +0 -2
- package/dist/render/draw-object-pass.d.ts +6 -4
- package/dist/render/index.d.ts +1 -0
- package/dist/render/post-process-pass.d.ts +7 -11
- package/dist/render/render-frame.d.ts +9 -118
- package/dist/render/render-pass.d.ts +9 -118
- package/dist/render/render-target-pool.d.ts +22 -0
- package/dist/render/renderer.d.ts +8 -5
- package/dist/scene.d.ts +1 -3
- package/package.json +1 -1
package/dist/plugin-system.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type * as spec from '@galacean/effects-specification';
|
|
2
1
|
import type { Composition } from './composition';
|
|
3
|
-
import type {
|
|
4
|
-
import type { RenderFrame, Renderer } from './render';
|
|
2
|
+
import type { AbstractPlugin, PluginConstructor } from './plugins';
|
|
5
3
|
import type { Scene, SceneLoadOptions } from './scene';
|
|
6
|
-
import type {
|
|
7
|
-
import type { VFXItem } from './vfx-item';
|
|
4
|
+
import type { Engine } from './engine';
|
|
8
5
|
export declare const pluginLoaderMap: Record<string, PluginConstructor>;
|
|
9
|
-
export declare const defaultPlugins: string[];
|
|
10
6
|
/**
|
|
11
7
|
* 注册 plugin
|
|
12
8
|
* @param name
|
|
@@ -14,20 +10,16 @@ export declare const defaultPlugins: string[];
|
|
|
14
10
|
* @param itemClass class of item
|
|
15
11
|
* @param isDefault load
|
|
16
12
|
*/
|
|
17
|
-
export declare function registerPlugin(name: string, pluginClass: PluginConstructor
|
|
13
|
+
export declare function registerPlugin(name: string, pluginClass: PluginConstructor): void;
|
|
14
|
+
/**
|
|
15
|
+
* 注销 plugin
|
|
16
|
+
*/
|
|
18
17
|
export declare function unregisterPlugin(name: string): void;
|
|
19
18
|
export declare class PluginSystem {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
processRawJSON(json: spec.JSONScene, options: SceneLoadOptions): Promise<void[]>;
|
|
26
|
-
processAssets(json: spec.JSONScene, options?: SceneLoadOptions): Promise<{
|
|
27
|
-
assets: spec.AssetBase[];
|
|
28
|
-
loadedAssets: unknown[];
|
|
29
|
-
}[]>;
|
|
30
|
-
precompile(compositions: spec.CompositionData[], renderer: Renderer): void;
|
|
31
|
-
loadResources(scene: Scene, options: SceneLoadOptions): Promise<unknown[]>;
|
|
32
|
-
private callStatic;
|
|
19
|
+
static getPlugins(): AbstractPlugin[];
|
|
20
|
+
static initializeComposition(composition: Composition, scene: Scene): void;
|
|
21
|
+
static destroyComposition(comp: Composition): void;
|
|
22
|
+
static processAssets(scene: Scene, options?: SceneLoadOptions): Promise<void[]>;
|
|
23
|
+
static loadResources(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
|
|
33
24
|
}
|
|
25
|
+
export declare function getPluginUsageInfo(name: string): string;
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -1,92 +1,36 @@
|
|
|
1
|
-
import type * as spec from '@galacean/effects-specification';
|
|
2
1
|
import type { Scene, SceneLoadOptions } from '../scene';
|
|
3
|
-
import type { RenderFrame, Renderer } from '../render';
|
|
4
2
|
import type { Composition } from '../composition';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* plugin 的数组内排序,按照升序排列
|
|
8
|
-
* @default 100
|
|
9
|
-
*/
|
|
10
|
-
order: number;
|
|
11
|
-
name: string;
|
|
12
|
-
/**
|
|
13
|
-
* 在加载到 JSON 后,就可以进行提前编译
|
|
14
|
-
* @param json
|
|
15
|
-
* @param player
|
|
16
|
-
*/
|
|
17
|
-
precompile: (compositions: spec.CompositionData[], renderer: Renderer) => void;
|
|
18
|
-
/**
|
|
19
|
-
* 合成创建时调用,用于触发元素在合成创建时的回调
|
|
20
|
-
* @param composition
|
|
21
|
-
* @param scene
|
|
22
|
-
*/
|
|
23
|
-
onCompositionConstructed: (composition: Composition, scene: Scene) => void;
|
|
24
|
-
/**
|
|
25
|
-
* 合成重播时的回调
|
|
26
|
-
* @param composition
|
|
27
|
-
* @param frame
|
|
28
|
-
*/
|
|
29
|
-
onCompositionReset: (composition: Composition, frame: RenderFrame) => void;
|
|
30
|
-
/**
|
|
31
|
-
* 合成销毁时的会调,需要销毁 composition 中对应的资源
|
|
32
|
-
* @param composition
|
|
33
|
-
*/
|
|
34
|
-
onCompositionDestroyed: (composition: Composition) => void;
|
|
35
|
-
/**
|
|
36
|
-
* 合成更新时的回调,每帧都会进行调用,在每个元素调用 onUpdate 之前被触发
|
|
37
|
-
* @param composition
|
|
38
|
-
* @param dt 更新的毫秒
|
|
39
|
-
*/
|
|
40
|
-
onCompositionUpdate: (composition: Composition, dt: number) => void;
|
|
41
|
-
}
|
|
3
|
+
import type { Engine } from '../engine';
|
|
42
4
|
export interface PluginConstructor {
|
|
43
|
-
new ():
|
|
5
|
+
new (): AbstractPlugin;
|
|
44
6
|
[key: string]: any;
|
|
45
7
|
}
|
|
46
8
|
/**
|
|
47
9
|
* 抽象插件类
|
|
48
10
|
* 注册合成不同生命周期的回调函数
|
|
49
11
|
*/
|
|
50
|
-
export declare abstract class AbstractPlugin
|
|
12
|
+
export declare abstract class AbstractPlugin {
|
|
51
13
|
order: number;
|
|
52
14
|
name: string;
|
|
53
|
-
|
|
54
|
-
* loadScene 函数调用的时候会触发此函数,
|
|
55
|
-
* 此阶段可以对资源 JSON 进行处理,替换调 JSON 中的数据,或者直接终止加载流程
|
|
56
|
-
* 一旦被 reject,加载过程将失败
|
|
57
|
-
* @param json 动画资源
|
|
58
|
-
* @param options 加载参数
|
|
59
|
-
*/
|
|
60
|
-
static processRawJSON: (json: spec.JSONScene, options: SceneLoadOptions) => Promise<void>;
|
|
15
|
+
initialize(): void;
|
|
61
16
|
/**
|
|
62
17
|
* loadScene 函数调用的时候会触发此函数,
|
|
63
18
|
* 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
|
|
64
|
-
* @param
|
|
19
|
+
* @param scene
|
|
65
20
|
* @param options
|
|
66
21
|
* @returns
|
|
67
22
|
*/
|
|
68
|
-
|
|
69
|
-
assets: spec.AssetBase[];
|
|
70
|
-
loadedAssets: unknown[];
|
|
71
|
-
}>;
|
|
23
|
+
processAssets(scene: Scene, options?: SceneLoadOptions): Promise<void>;
|
|
72
24
|
/**
|
|
73
25
|
* loadScene 函数调用的时候会触发此函数,
|
|
74
26
|
* 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
|
|
75
27
|
* 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
|
|
76
28
|
* 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
|
|
77
|
-
* 此阶段晚于
|
|
29
|
+
* 此阶段晚于 processAssets
|
|
78
30
|
* @param {Scene} scene
|
|
79
31
|
* @param {SceneLoadOptions} options
|
|
80
32
|
*/
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 在加载到 JSON 后,就可以进行提前编译
|
|
84
|
-
* @param json
|
|
85
|
-
* @param player
|
|
86
|
-
*/
|
|
87
|
-
precompile(compositions: spec.CompositionData[], renderer: Renderer): void;
|
|
33
|
+
prepareResource(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
|
|
88
34
|
onCompositionConstructed(composition: Composition, scene: Scene): void;
|
|
89
|
-
onCompositionReset(composition: Composition, frame: RenderFrame): void;
|
|
90
35
|
onCompositionDestroyed(composition: Composition): void;
|
|
91
|
-
onCompositionUpdate(composition: Composition, dt: number): void;
|
|
92
36
|
}
|
|
@@ -40,6 +40,10 @@ export declare class TextComponentBase {
|
|
|
40
40
|
setText(value: string): void;
|
|
41
41
|
setTextAlign(value: spec.TextAlignment): void;
|
|
42
42
|
setTextVerticalAlign(value: spec.TextVerticalAlign): void;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated 2.8.0 本方法已废弃,请使用 setTextVerticalAlign 替代。
|
|
45
|
+
*/
|
|
46
|
+
setTextBaseline(value: spec.TextBaseline): void;
|
|
43
47
|
setTextColor(value: spec.RGBAColorValue): void;
|
|
44
48
|
setFontFamily(value: string): void;
|
|
45
49
|
setFontWeight(value: spec.TextWeight): void;
|
|
@@ -33,7 +33,10 @@ export declare class TextComponent extends MaskableGraphic implements ITextCompo
|
|
|
33
33
|
fromData(data: spec.TextComponentData): void;
|
|
34
34
|
private resetState;
|
|
35
35
|
setText(value: string): void;
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* 根据配置更新文本样式和布局
|
|
38
|
+
*/
|
|
39
|
+
protected updateWithOptions(options: spec.TextContentOptions): void;
|
|
37
40
|
getLineCount(text: string): number;
|
|
38
41
|
/**
|
|
39
42
|
* 设置行高
|
|
@@ -82,7 +85,7 @@ export declare class TextComponent extends MaskableGraphic implements ITextCompo
|
|
|
82
85
|
* 更新文本
|
|
83
86
|
* @returns
|
|
84
87
|
*/
|
|
85
|
-
updateTexture(flipY?: boolean): void;
|
|
88
|
+
protected updateTexture(flipY?: boolean): void;
|
|
86
89
|
renderText(options: spec.TextContentOptions): void;
|
|
87
90
|
setAutoWidth(value: boolean): void;
|
|
88
91
|
setFontSize(value: number): void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { SharedShaderWithSource } from './shader';
|
|
2
1
|
export declare const EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
3
2
|
export declare const COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
4
3
|
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
4
|
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
|
-
export declare function createCopyShader(level: number, writeDepth?: boolean): SharedShaderWithSource;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { RenderPassDestroyOptions, RenderPassOptions } from './render-pass';
|
|
2
1
|
import { RenderPass } from './render-pass';
|
|
3
2
|
import type { Renderer } from './renderer';
|
|
4
3
|
export declare class DrawObjectPass extends RenderPass {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
private useRenderTarget;
|
|
5
|
+
constructor(renderer: Renderer);
|
|
6
|
+
setup(useRenderTarget: boolean): void;
|
|
7
|
+
configure(renderer: Renderer): void;
|
|
8
|
+
execute(renderer: Renderer): void;
|
|
9
|
+
onCameraCleanup(renderer: Renderer): void;
|
|
8
10
|
}
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { RenderPassDestroyOptions
|
|
1
|
+
import type { RenderPassDestroyOptions } from './render-pass';
|
|
2
2
|
import { RenderTargetHandle, RenderPass } from './render-pass';
|
|
3
3
|
import type { Renderer } from './renderer';
|
|
4
4
|
export declare class BloomThresholdPass extends RenderPass {
|
|
5
5
|
sceneTextureHandle: RenderTargetHandle;
|
|
6
6
|
private mainTexture;
|
|
7
7
|
private screenMesh;
|
|
8
|
-
constructor(renderer: Renderer
|
|
8
|
+
constructor(renderer: Renderer);
|
|
9
9
|
configure(renderer: Renderer): void;
|
|
10
10
|
execute(renderer: Renderer): void;
|
|
11
|
-
|
|
11
|
+
onCameraCleanup(renderer: Renderer): void;
|
|
12
12
|
dispose(options?: RenderPassDestroyOptions): void;
|
|
13
13
|
}
|
|
14
14
|
export declare class HQGaussianDownSamplePass extends RenderPass {
|
|
@@ -17,24 +17,20 @@ export declare class HQGaussianDownSamplePass extends RenderPass {
|
|
|
17
17
|
private screenMesh;
|
|
18
18
|
private readonly type;
|
|
19
19
|
private readonly level;
|
|
20
|
-
constructor(renderer: Renderer, type: 'V' | 'H', level: number
|
|
21
|
-
initialize(renderer: Renderer): RenderPass;
|
|
20
|
+
constructor(renderer: Renderer, type: 'V' | 'H', level: number);
|
|
22
21
|
configure(renderer: Renderer): void;
|
|
23
22
|
execute(renderer: Renderer): void;
|
|
24
|
-
|
|
25
|
-
dispose(options?: RenderPassDestroyOptions | undefined): void;
|
|
23
|
+
onCameraCleanup(renderer: Renderer): void;
|
|
26
24
|
}
|
|
27
25
|
export declare class HQGaussianUpSamplePass extends RenderPass {
|
|
28
26
|
gaussianDownSampleResult: RenderTargetHandle;
|
|
29
27
|
private mainTexture;
|
|
30
28
|
private screenMesh;
|
|
31
29
|
private readonly level;
|
|
32
|
-
constructor(renderer: Renderer, level: number
|
|
33
|
-
initialize(renderer: Renderer): RenderPass;
|
|
30
|
+
constructor(renderer: Renderer, level: number);
|
|
34
31
|
configure(renderer: Renderer): void;
|
|
35
32
|
execute(renderer: Renderer): void;
|
|
36
|
-
|
|
37
|
-
dispose(options?: RenderPassDestroyOptions): void;
|
|
33
|
+
onCameraCleanup(renderer: Renderer): void;
|
|
38
34
|
}
|
|
39
35
|
export declare class ToneMappingPass extends RenderPass {
|
|
40
36
|
private screenMesh;
|
|
@@ -5,16 +5,11 @@ import { Vector4 } from '@galacean/effects-math/es/core/vector4';
|
|
|
5
5
|
import type { vec4 } from '@galacean/effects-specification';
|
|
6
6
|
import type { Camera } from '../camera';
|
|
7
7
|
import type { PostProcessVolume, RendererComponent } from '../components';
|
|
8
|
-
import type { UniformValue } from '../material';
|
|
9
|
-
import { PassTextureCache } from '../paas-texture-cache';
|
|
10
8
|
import type { Texture } from '../texture';
|
|
11
9
|
import type { Disposable } from '../utils';
|
|
12
10
|
import { DestroyOptions } from '../utils';
|
|
13
|
-
import type {
|
|
14
|
-
import type { RenderPass, RenderPassClearAction, RenderPassColorAttachmentOptions, RenderPassDepthStencilAttachment, RenderPassDestroyOptions, RenderPassStoreAction } from './render-pass';
|
|
11
|
+
import type { RenderPass, RenderPassDestroyOptions } from './render-pass';
|
|
15
12
|
import type { Renderer } from './renderer';
|
|
16
|
-
import type { SemanticFunc } from './semantic-map';
|
|
17
|
-
import { SemanticMap } from './semantic-map';
|
|
18
13
|
/**
|
|
19
14
|
* 渲染数据,保存了当前渲染使用到的数据。
|
|
20
15
|
*/
|
|
@@ -32,72 +27,6 @@ export interface RenderingData {
|
|
|
32
27
|
*/
|
|
33
28
|
currentPass: RenderPass;
|
|
34
29
|
}
|
|
35
|
-
/**
|
|
36
|
-
* RenderPass 信息,记录了 RenderFrame 中 RenderPass 的信息
|
|
37
|
-
*/
|
|
38
|
-
export interface RenderPassInfo {
|
|
39
|
-
/**
|
|
40
|
-
* 内部包含 Mesh 中最小优先级
|
|
41
|
-
*/
|
|
42
|
-
listStart: number;
|
|
43
|
-
/**
|
|
44
|
-
* 内部包含 Mesh 中最大优先级
|
|
45
|
-
*/
|
|
46
|
-
listEnd: number;
|
|
47
|
-
/**
|
|
48
|
-
* 是否绑定 Framebuffer 对象
|
|
49
|
-
*/
|
|
50
|
-
intermedia: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* RenderPass 对象
|
|
53
|
-
*/
|
|
54
|
-
renderPass: RenderPass;
|
|
55
|
-
/**
|
|
56
|
-
* 前面的 RenderPass 对象数组
|
|
57
|
-
*/
|
|
58
|
-
prePasses?: {
|
|
59
|
-
pass: RenderPass;
|
|
60
|
-
destroyOptions?: RenderPassDestroyOptions | boolean;
|
|
61
|
-
}[];
|
|
62
|
-
/**
|
|
63
|
-
* 前一个 RenderPass 对象
|
|
64
|
-
*/
|
|
65
|
-
preRenderPass?: RenderPass;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* RenderFrame 内部保存的多 Pass 相关资源
|
|
69
|
-
*/
|
|
70
|
-
export interface RenderFrameResource {
|
|
71
|
-
/**
|
|
72
|
-
* 纹理对象,用于 Framebuffer 的颜色 Attachment
|
|
73
|
-
*/
|
|
74
|
-
color_a: Texture;
|
|
75
|
-
/**
|
|
76
|
-
* 纹理对象,用于 Framebuffer 的颜色 Attachment
|
|
77
|
-
*/
|
|
78
|
-
color_b: Texture;
|
|
79
|
-
/**
|
|
80
|
-
* 拷贝 RenderPass 对象,将前 RenderPass 的渲染结果拷贝到硬件帧缓存中
|
|
81
|
-
*/
|
|
82
|
-
finalCopyRP: RenderPass;
|
|
83
|
-
/**
|
|
84
|
-
* 资源 RenderPass 对象,为临时生成的 RenderPass 提供 Attachment 资源
|
|
85
|
-
*/
|
|
86
|
-
resRP: RenderPass;
|
|
87
|
-
/**
|
|
88
|
-
* 深度和蒙版,为临时生成的 RenderPass 提供 Attachment 资源
|
|
89
|
-
*/
|
|
90
|
-
depthStencil?: RenderPassDepthStencilAttachment;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* RenderPass 切分时的参数
|
|
94
|
-
*/
|
|
95
|
-
export interface RenderPassSplitOptions {
|
|
96
|
-
attachments?: RenderPassColorAttachmentOptions[];
|
|
97
|
-
storeAction?: RenderPassStoreAction;
|
|
98
|
-
prePasses?: RenderPass[];
|
|
99
|
-
}
|
|
100
|
-
export declare const RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
101
30
|
/**
|
|
102
31
|
* 抽象 RenderFrame 选项
|
|
103
32
|
*/
|
|
@@ -107,23 +36,6 @@ export interface RenderFrameOptions {
|
|
|
107
36
|
* 编辑器整体变换,Player 开发不需要关注
|
|
108
37
|
*/
|
|
109
38
|
editorTransform?: vec4;
|
|
110
|
-
/**
|
|
111
|
-
* 是否每次渲染时清除 RenderFrame 颜色缓存
|
|
112
|
-
*/
|
|
113
|
-
keepColorBuffer?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* 渲染视口大小
|
|
116
|
-
*/
|
|
117
|
-
viewport?: vec4;
|
|
118
|
-
/**
|
|
119
|
-
* RenderFrame 范围内共用的 Shader Uniform 变量,
|
|
120
|
-
* 以及多 Pass 渲染时 ColorAttachment 关联到后面的 Shader Uniform 上
|
|
121
|
-
*/
|
|
122
|
-
semantics?: Record<string, UniformValue | SemanticFunc>;
|
|
123
|
-
/**
|
|
124
|
-
* 每个 RenderPass 使用前进行的 Clear 操作
|
|
125
|
-
*/
|
|
126
|
-
clearAction?: RenderPassClearAction;
|
|
127
39
|
/**
|
|
128
40
|
* 后处理渲染配置
|
|
129
41
|
*/
|
|
@@ -150,45 +62,32 @@ export declare class RenderFrame implements Disposable {
|
|
|
150
62
|
* 当前使用的全部 RenderPass
|
|
151
63
|
*/
|
|
152
64
|
_renderPasses: RenderPass[];
|
|
153
|
-
/**
|
|
154
|
-
* RenderPass 清除帧缓存操作
|
|
155
|
-
*/
|
|
156
|
-
clearAction: RenderPassClearAction;
|
|
157
|
-
/**
|
|
158
|
-
* 滤镜中 RenderPass 用到的纹理缓存器
|
|
159
|
-
*/
|
|
160
|
-
passTextureCache: PassTextureCache;
|
|
161
65
|
/**
|
|
162
66
|
* 渲染时的相机
|
|
163
67
|
*/
|
|
164
68
|
camera: Camera;
|
|
165
|
-
/**
|
|
166
|
-
* Composition中用到的所有纹理缓存
|
|
167
|
-
*/
|
|
168
|
-
cachedTextures: Texture[];
|
|
169
69
|
/**
|
|
170
70
|
* 存放后处理的属性设置
|
|
171
71
|
*/
|
|
172
72
|
globalVolume?: PostProcessVolume;
|
|
173
73
|
renderer: Renderer;
|
|
174
|
-
keepColorBuffer?: boolean;
|
|
175
74
|
editorTransform: Vector4;
|
|
176
|
-
renderQueue: RendererComponent[];
|
|
177
75
|
/**
|
|
178
76
|
* 名称
|
|
179
77
|
*/
|
|
180
78
|
readonly name: string;
|
|
181
|
-
/**
|
|
182
|
-
* 公用 Uniform 变量表
|
|
183
|
-
*/
|
|
184
|
-
readonly semantics: SemanticMap;
|
|
185
79
|
readonly globalUniforms: GlobalUniforms;
|
|
186
|
-
|
|
187
|
-
protected renderPassInfoMap: WeakMap<RenderPass, RenderPassInfo>;
|
|
80
|
+
private disposed;
|
|
188
81
|
private drawObjectPass;
|
|
82
|
+
private postProcessingEnabled;
|
|
83
|
+
private enableHDR;
|
|
189
84
|
constructor(options: RenderFrameOptions);
|
|
190
85
|
get renderPasses(): RenderPass[];
|
|
191
|
-
get
|
|
86
|
+
get isDisposed(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 设置 RenderPasses 参数,此函数每帧调用一次
|
|
89
|
+
*/
|
|
90
|
+
setup(): void;
|
|
192
91
|
/**
|
|
193
92
|
* 根据 Mesh 优先级添加到 RenderPass
|
|
194
93
|
* @param mesh - 要添加的 Mesh 对象
|
|
@@ -205,13 +104,6 @@ export declare class RenderFrame implements Disposable {
|
|
|
205
104
|
* @param options - 可以有选择销毁一些对象
|
|
206
105
|
*/
|
|
207
106
|
dispose(options?: RenderFrameDestroyOptions): void;
|
|
208
|
-
/**
|
|
209
|
-
* 查找 Mesh 所在的 RenderPass 索引,没找到是-1
|
|
210
|
-
* @param mesh - 需要查找的 Mesh
|
|
211
|
-
*/
|
|
212
|
-
findMeshRenderPassIndex(mesh: Mesh): number;
|
|
213
|
-
protected addToRenderPass(renderPass: RenderPass, mesh: Mesh): void;
|
|
214
|
-
protected resetClearActions(): void;
|
|
215
107
|
/**
|
|
216
108
|
* 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
|
|
217
109
|
* @param passes - RenderPass 数组
|
|
@@ -229,7 +121,6 @@ export declare class RenderFrame implements Disposable {
|
|
|
229
121
|
removeRenderPass(pass: RenderPass): void;
|
|
230
122
|
}
|
|
231
123
|
export declare function getTextureSize(tex?: Texture): Vector2;
|
|
232
|
-
export declare function findPreviousRenderPass(renderPasses: RenderPass[], renderPass: RenderPass): RenderPass | undefined;
|
|
233
124
|
export declare class GlobalUniforms {
|
|
234
125
|
floats: Record<string, number>;
|
|
235
126
|
ints: Record<string, number>;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { vec4 } from '@galacean/effects-specification';
|
|
3
|
-
import type { Camera } from '../camera';
|
|
4
3
|
import type { RendererComponent } from '../components';
|
|
5
4
|
import type { Engine } from '../engine';
|
|
6
5
|
import type { MeshDestroyOptions, Renderer } from '../render';
|
|
7
|
-
import { Framebuffer } from '../render';
|
|
8
|
-
import type { SemanticGetter } from './semantic-map';
|
|
9
|
-
import { SemanticMap } from './semantic-map';
|
|
6
|
+
import type { Framebuffer } from '../render';
|
|
10
7
|
import type { TextureConfigOptions, TextureLoadAction } from '../texture';
|
|
11
8
|
import { Texture } from '../texture';
|
|
12
9
|
import type { Disposable, Sortable } from '../utils';
|
|
13
|
-
import { DestroyOptions
|
|
10
|
+
import { DestroyOptions } from '../utils';
|
|
14
11
|
import type { Renderbuffer } from './renderbuffer';
|
|
15
|
-
import type { RenderingData } from './render-frame';
|
|
16
12
|
export declare const RenderPassPriorityPrepare = 0;
|
|
17
13
|
export declare const RenderPassPriorityNormal = 1000;
|
|
18
14
|
export declare const RenderPassPriorityPostprocess = 3000;
|
|
@@ -100,11 +96,6 @@ export declare class RenderTargetHandle implements Disposable {
|
|
|
100
96
|
get width(): number;
|
|
101
97
|
get height(): number;
|
|
102
98
|
}
|
|
103
|
-
export interface RenderPassDepthStencilAttachment {
|
|
104
|
-
readonly storageType: RenderPassAttachmentStorageType;
|
|
105
|
-
readonly storage?: Renderbuffer;
|
|
106
|
-
readonly texture?: Texture;
|
|
107
|
-
}
|
|
108
99
|
export interface RenderPassDepthStencilAttachmentOptions {
|
|
109
100
|
storageType: RenderPassAttachmentStorageType;
|
|
110
101
|
storage?: Renderbuffer;
|
|
@@ -133,56 +124,9 @@ export declare enum RenderPassDestroyAttachmentType {
|
|
|
133
124
|
}
|
|
134
125
|
export type RenderPassDestroyOptions = {
|
|
135
126
|
meshes?: MeshDestroyOptions | DestroyOptions.keep;
|
|
136
|
-
semantics?: DestroyOptions;
|
|
137
127
|
colorAttachment?: RenderPassDestroyAttachmentType;
|
|
138
128
|
depthStencilAttachment?: RenderPassDestroyAttachmentType;
|
|
139
129
|
};
|
|
140
|
-
/**
|
|
141
|
-
* RenderPass 渲染过程回调
|
|
142
|
-
*/
|
|
143
|
-
export interface RenderPassDelegate {
|
|
144
|
-
/**
|
|
145
|
-
* 开始前回调
|
|
146
|
-
* @param renderPass - 当前 RenderPass
|
|
147
|
-
* @param state - 当前渲染状态
|
|
148
|
-
*/
|
|
149
|
-
willBeginRenderPass?: (renderPass: RenderPass, state: RenderingData) => void;
|
|
150
|
-
/**
|
|
151
|
-
* 结束后回调
|
|
152
|
-
* @param renderPass - 当前 RenderPass
|
|
153
|
-
* @param state - 当前渲染状态
|
|
154
|
-
*/
|
|
155
|
-
didEndRenderPass?: (renderPass: RenderPass, state: RenderingData) => void;
|
|
156
|
-
/**
|
|
157
|
-
* Mesh 渲染前回调
|
|
158
|
-
* @param mesh - 当前 Mesh
|
|
159
|
-
* @param state - 当前渲染状态
|
|
160
|
-
*/
|
|
161
|
-
willRenderMesh?: (mesh: RendererComponent, state: RenderingData) => void;
|
|
162
|
-
/**
|
|
163
|
-
* Mesh 渲染后回调
|
|
164
|
-
* @param mesh - 当前 Mesh
|
|
165
|
-
* @param state - 当前渲染状态
|
|
166
|
-
*/
|
|
167
|
-
didRenderMesh?: (mesh: RendererComponent, state: RenderingData) => void;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* RenderPass Attachment 选项
|
|
171
|
-
*/
|
|
172
|
-
export interface RenderPassAttachmentOptions {
|
|
173
|
-
attachments?: RenderPassColorAttachmentOptions[];
|
|
174
|
-
depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions;
|
|
175
|
-
}
|
|
176
|
-
export interface RenderPassOptions extends RenderPassAttachmentOptions {
|
|
177
|
-
name?: string;
|
|
178
|
-
meshes?: RendererComponent[];
|
|
179
|
-
priority?: number;
|
|
180
|
-
meshOrder?: OrderType;
|
|
181
|
-
clearAction?: RenderPassClearAction;
|
|
182
|
-
storeAction?: RenderPassStoreAction;
|
|
183
|
-
semantics?: Record<string, SemanticGetter>;
|
|
184
|
-
delegate?: RenderPassDelegate;
|
|
185
|
-
}
|
|
186
130
|
/**
|
|
187
131
|
* RenderPass 抽象类
|
|
188
132
|
*/
|
|
@@ -191,63 +135,22 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
191
135
|
* 优先级
|
|
192
136
|
*/
|
|
193
137
|
priority: number;
|
|
194
|
-
/**
|
|
195
|
-
* 渲染时的回调函数
|
|
196
|
-
*/
|
|
197
|
-
delegate: RenderPassDelegate;
|
|
198
|
-
/**
|
|
199
|
-
* ColorAttachment 数组
|
|
200
|
-
*/
|
|
201
|
-
attachments: RenderTargetHandle[];
|
|
202
|
-
framebuffer: Framebuffer | null;
|
|
203
138
|
/**
|
|
204
139
|
* 名称
|
|
205
140
|
*/
|
|
206
|
-
|
|
141
|
+
name: string;
|
|
207
142
|
/**
|
|
208
143
|
* 包含的 Mesh 列表
|
|
209
144
|
*/
|
|
210
145
|
readonly meshes: RendererComponent[];
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*/
|
|
214
|
-
readonly meshOrder: OrderType;
|
|
215
|
-
/**
|
|
216
|
-
* 相机
|
|
217
|
-
*/
|
|
218
|
-
readonly camera?: Camera;
|
|
219
|
-
/**
|
|
220
|
-
* 深度和蒙版 Attachment 类型,注意区分纹理和 Renderbuffer
|
|
221
|
-
*/
|
|
222
|
-
readonly depthStencilType: RenderPassAttachmentStorageType;
|
|
223
|
-
/**
|
|
224
|
-
* 渲染前清除缓冲区操作
|
|
225
|
-
*/
|
|
226
|
-
readonly clearAction: RenderPassClearAction;
|
|
227
|
-
/**
|
|
228
|
-
* 渲染后清除缓冲区操作,iOS 上有性能提升, 默认关闭
|
|
229
|
-
*/
|
|
230
|
-
readonly storeAction: RenderPassStoreAction;
|
|
231
|
-
/**
|
|
232
|
-
* RenderPass 公用的 Shader Uniform 变量
|
|
233
|
-
*/
|
|
234
|
-
readonly semantics: SemanticMap;
|
|
235
|
-
protected destroyed: boolean;
|
|
236
|
-
protected options: RenderPassAttachmentOptions;
|
|
146
|
+
protected disposed: boolean;
|
|
147
|
+
protected framebuffer: Framebuffer | null;
|
|
237
148
|
protected renderer: Renderer;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
private stencilTexture?;
|
|
241
|
-
private isCustomViewport;
|
|
242
|
-
private customViewport?;
|
|
243
|
-
constructor(renderer: Renderer, options: RenderPassOptions);
|
|
244
|
-
get isDestroyed(): boolean;
|
|
149
|
+
constructor(renderer: Renderer);
|
|
150
|
+
get isDisposed(): boolean;
|
|
245
151
|
get viewport(): spec.vec4;
|
|
246
|
-
get stencilAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
247
|
-
get depthAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
248
152
|
addMesh(mesh: RendererComponent): void;
|
|
249
153
|
removeMesh(mesh: RendererComponent): void;
|
|
250
|
-
setMeshes(meshes: RendererComponent[]): RendererComponent[];
|
|
251
154
|
/**
|
|
252
155
|
* 配置当前pass的RT,在每帧渲染前调用
|
|
253
156
|
*/
|
|
@@ -257,25 +160,13 @@ export declare class RenderPass implements Disposable, Sortable {
|
|
|
257
160
|
*/
|
|
258
161
|
execute(renderer: Renderer): void;
|
|
259
162
|
/**
|
|
260
|
-
* 每帧所有的pass
|
|
163
|
+
* 每帧所有的pass渲染完后调用,用于清空临时的RT资源
|
|
261
164
|
*/
|
|
262
|
-
|
|
263
|
-
private _resetAttachments;
|
|
165
|
+
onCameraCleanup(renderer: Renderer): void;
|
|
264
166
|
/**
|
|
265
167
|
* 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
|
|
266
168
|
*/
|
|
267
169
|
getViewport(): vec4;
|
|
268
|
-
/**
|
|
269
|
-
* 获取深度 Attachment,可能没有
|
|
270
|
-
*/
|
|
271
|
-
getDepthAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
272
|
-
/**
|
|
273
|
-
* 获取蒙版 Attachment,可能没有
|
|
274
|
-
*/
|
|
275
|
-
getStencilAttachment(): RenderPassDepthStencilAttachment | undefined;
|
|
276
|
-
private getDepthTexture;
|
|
277
|
-
private getStencilTexture;
|
|
278
|
-
initialize(renderer: Renderer): RenderPass;
|
|
279
170
|
/**
|
|
280
171
|
* 销毁 RenderPass
|
|
281
172
|
* @param options - 有选择销毁内部对象
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Engine } from '../engine';
|
|
2
|
+
import { FilterMode, Framebuffer, RenderTextureFormat } from './framebuffer';
|
|
3
|
+
export declare class RenderTargetPool {
|
|
4
|
+
engine: Engine;
|
|
5
|
+
private temporaryRTs;
|
|
6
|
+
private currentFrame;
|
|
7
|
+
private readonly maxUnusedFrames;
|
|
8
|
+
constructor(engine: Engine);
|
|
9
|
+
/**
|
|
10
|
+
* 清理 RenderTarget 池
|
|
11
|
+
* @param force - 是否强制清理所有未占用的 RT
|
|
12
|
+
* @param framesOffset - 自定义未使用帧数阈值,-1 表示使用默认值
|
|
13
|
+
*/
|
|
14
|
+
flush(force?: boolean, framesOffset?: number): void;
|
|
15
|
+
get(name: string, width: number, height: number, depthBuffer?: number, filter?: FilterMode, format?: RenderTextureFormat): Framebuffer;
|
|
16
|
+
/**
|
|
17
|
+
* 释放 RenderTarget,使其可以被复用
|
|
18
|
+
* @param rt - 要释放的 Framebuffer
|
|
19
|
+
*/
|
|
20
|
+
release(rt: Framebuffer): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|