UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

50 lines 1.88 kB
import type { WebglParams } from "../../context/webgl-params"; import type { ArrayNumber4 } from "../../types"; import type { TgdPainterFunction } from "../../types/painter"; import { type WebglBlendOptions, type WebglCullOptions, type WebglDepthOptions, type WebglStencilOptions, webglPresetBlend, webglPresetCull, webglPresetDepth, webglPresetStencil } from "../../utils/state"; import { TgdPainterGroup } from "../group"; import type { TgdPainter } from "../painter"; type Keys<T2, T1> = { [K in keyof T1]: T1[K] extends T2 ? K : never; }[keyof T1] | T2; export interface TgdPainterStateOptions { children: (TgdPainter | TgdPainterFunction)[]; color: boolean | [boolean, boolean, boolean, boolean]; blend: Keys<WebglBlendOptions, typeof webglPresetBlend>; depth: Keys<WebglDepthOptions, typeof webglPresetDepth>; cull: Keys<WebglCullOptions, typeof webglPresetCull>; stencil: Keys<WebglStencilOptions, typeof webglPresetStencil>; viewport: ArrayNumber4; name: string; /** * Function to execute before painting. */ onEnter?: TgdPainterFunction; /** * Function to execute after painting. */ onExit?: TgdPainterFunction; } export declare class TgdPainterState extends TgdPainterGroup { static do(context: { gl: WebGL2RenderingContext; webglParams: WebglParams; }, options: Omit<Partial<TgdPainterStateOptions>, "children" | "onEnter" | "onExit"> & { action: () => void; }): void; static debug(context: { webglParams: WebglParams; }): void; readonly color: { red: boolean; green: boolean; blue: boolean; alpha: boolean; }; constructor(context: { gl: WebGL2RenderingContext; webglParams: WebglParams; }, options?: Partial<TgdPainterStateOptions>); } export {}; //# sourceMappingURL=state.d.ts.map