@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
106 lines • 3.56 kB
TypeScript
import { TgdContext } from "../context";
import type { TgdTexture2D, TgdTextureDepth } from "../texture";
import type { TgdPainterFunction } from "../types/painter";
import { TgdPainterGroup } from "./group";
import type { TgdPainter } from "./painter";
export interface TgdPainterFramebufferOptions {
name?: string;
/**
* Do we need a depth buffer?
* Default to `true`.
*/
depthBuffer: boolean;
/**
* Do we need a stencil buffer?
* Default to `true`.
*/
stencilBuffer: boolean;
/**
* Use Multi Sampled Anti Aliasing.
* This gets better visual results, but at a time penalty.
*
* Default to `false`.
*/
antiAliasing: boolean;
/**
* If defined, the framebuffer will automatically match the
* current viewport size multiplied by `viewportMatchingScale`.
*
* for instance, if `viewportMatchingScale === 0.5` and the viewport
* id (640, 480), then the framebuffer will have a size of
* (320, 240).
*
* Default to `1`.
*/
viewportMatchingScale?: number;
/**
* If the size is defined, it takes precedence over `viewportMatchingScale`.
* In this case, the output textures will have this fixed size.
*/
fixedSize?: boolean;
textureColor0?: TgdTexture2D;
textureColor1?: TgdTexture2D;
textureColor2?: TgdTexture2D;
textureColor3?: TgdTexture2D;
/**
* Function to execute before painting.
*/
onEnter?: TgdPainterFunction;
/**
* Function to execute after painting.
*/
onExit?: TgdPainterFunction;
children?: TgdPainter[];
}
export declare class TgdPainterFramebuffer extends TgdPainterGroup {
readonly context: TgdContext;
private readonly options;
readonly textureDepth: TgdTextureDepth | undefined;
readonly samples: number;
private _textureColor0;
private _textureColor1;
private _textureColor2;
private _textureColor3;
private colorRenderbuffersMSAA;
private _depthBufferMSAA;
private _framebufferMSAA;
/**
* The framebuffer becomes dirty as soon as the width or height changes.
*/
private dirty;
private _lastWidth;
private _lastHeight;
private _framebuffer;
private _depthBuffer;
private _stencilBuffer;
private readonly drawBuffers;
private readonly isFixedSize;
private _antiAliasing;
constructor(context: TgdContext, options: Partial<TgdPainterFramebufferOptions>);
get antiAliasing(): boolean;
set antiAliasing(antiAliasing: boolean);
get textureColor0(): TgdTexture2D | undefined;
set textureColor0(textureColor0: TgdTexture2D | undefined);
get textureColor1(): TgdTexture2D | undefined;
set textureColor1(textureColor1: TgdTexture2D | undefined);
get textureColor2(): TgdTexture2D | undefined;
set textureColor2(textureColor2: TgdTexture2D | undefined);
get textureColor3(): TgdTexture2D | undefined;
set textureColor3(textureColor3: TgdTexture2D | undefined);
get textureWidth(): number;
get textureHeight(): number;
get width(): number;
get height(): number;
private updateTextureForColor;
private updateTextureForDepth;
private createDepthBufferMSAA;
private createStencilBuffer;
private createFramebufferMSAA;
private createFramebufferIfNeeded;
private blitFramebuffers;
paint(time: number, delta: number): void;
delete(): void;
private deleteRenderbuffersMSAA;
private createRenderbuffersMSAA;
}
//# sourceMappingURL=framebuffer.d.ts.map