import type * as spec from '@galacean/effects-specification'; import type { vec4 } from '@galacean/effects-specification'; import type { RendererComponent } from '../components'; import type { Engine } from '../engine'; import type { MeshDestroyOptions, Renderer } from '../render'; import type { Framebuffer } from '../render'; import type { TextureConfigOptions, TextureLoadAction } from '../texture'; import { Texture } from '../texture'; import type { Disposable, Sortable } from '../utils'; import { DestroyOptions } from '../utils'; import type { Renderbuffer } from './renderbuffer'; export declare const RenderPassPriorityPrepare = 0; export declare const RenderPassPriorityNormal = 1000; export declare const RenderPassPriorityPostprocess = 3000; /** * RenderPass Attachment 存储类型 */ export declare enum RenderPassAttachmentStorageType { none = 0, color = 1, stencil_8_opaque = 2, depth_16_opaque = 3, depth_stencil_opaque = 4, depth_16_texture = 5, depth_24_stencil_8_texture = 6 } /** * Attachment 结束后清除行为 */ export declare enum TextureStoreAction { /** * 不清除 Attachment */ store = 0, /** * 清除 Attachment */ clear = 2 } /** * RenderPass 开始前的清除行为 */ export interface RenderPassClearAction { clearColor?: vec4; colorAction?: TextureLoadAction; clearDepth?: number; depthAction?: TextureLoadAction; clearStencil?: number; stencilAction?: TextureLoadAction; } /** * RenderPass 结束后的清除行为 */ export interface RenderPassStoreAction { colorAction?: TextureStoreAction; depthAction?: TextureStoreAction; stencilAction?: TextureStoreAction; } export interface RenderPassColorAttachmentTextureOptions extends spec.TextureFormatOptions, TextureConfigOptions { size?: [x: number, y: number]; } /** * RenderPass ColorAttachment 选项 */ export interface RenderPassColorAttachmentOptions { size?: [x: number, y: number]; name?: string; /** * ColorAttachment 的纹理参数 */ texture?: Texture | RenderPassColorAttachmentTextureOptions; /** * ColorAttachment 的 Buffer 参数 */ buffer?: Renderbuffer; /** * WebGL2 下 Renderbuffer 超采数目。默认是0,即不启用超采。 * @default 0 */ multiSample?: number; /** * 是否持久的对象 */ persistent?: boolean; } export declare class RenderTargetHandle implements Disposable { texture: Texture; readonly textureOptions?: RenderPassColorAttachmentTextureOptions; readonly externalTexture: boolean; protected destroyed: boolean; constructor(engine: Engine, options?: RenderPassColorAttachmentOptions); dispose(): void; get isDestroyed(): boolean; get storageType(): RenderPassAttachmentStorageType; get size(): [x: number, y: number]; get width(): number; get height(): number; } export interface RenderPassDepthStencilAttachmentOptions { storageType: RenderPassAttachmentStorageType; storage?: Renderbuffer; texture?: Texture; } /** * RenderPass Attachment 销毁类型 */ export declare enum RenderPassDestroyAttachmentType { /** * 强制销毁 */ force = 0, /** * 保留,不销毁 */ keep = 1, /** * 如果是外部传入的 Attachment,就不销毁 */ keepExternal = 2, /** * 强制销毁 */ destroy = 0 } export type RenderPassDestroyOptions = { meshes?: MeshDestroyOptions | DestroyOptions.keep; colorAttachment?: RenderPassDestroyAttachmentType; depthStencilAttachment?: RenderPassDestroyAttachmentType; }; /** * RenderPass 抽象类 */ export declare class RenderPass implements Disposable, Sortable { /** * 优先级 */ priority: number; /** * 名称 */ name: string; /** * 包含的 Mesh 列表 */ readonly meshes: RendererComponent[]; protected disposed: boolean; protected framebuffer: Framebuffer | null; protected renderer: Renderer; constructor(renderer: Renderer); get isDisposed(): boolean; get viewport(): spec.vec4; addMesh(mesh: RendererComponent): void; removeMesh(mesh: RendererComponent): void; /** * 配置当前pass的RT,在每帧渲染前调用 */ configure(renderer: Renderer): void; /** * 执行当前pass,每帧调用一次 */ execute(renderer: Renderer): void; /** * 每帧所有的pass渲染完后调用,用于清空临时的RT资源 */ onCameraCleanup(renderer: Renderer): void; /** * 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度] */ getViewport(): vec4; /** * 销毁 RenderPass * @param options - 有选择销毁内部对象 */ dispose(options?: RenderPassDestroyOptions): void; }