import { Context } from './context'; import { Initializable } from './initializable'; import { NdcFillingTriangle } from './ndcfillingtriangle'; import { Program } from './program'; import { Shader } from './shader'; import { Texture2D } from './texture2d'; /** * Gaussian Filter implemented using a fragment shader. * Renders the filtered result into COLOR_ATTACHMENT0 of the currently bound framebuffer. * Does not support integer textures. * @todo: revisit this class design w.r.t. post planned catalogue of processing/filtering passes ... */ export declare class GaussFilter extends Initializable { protected static readonly _MAXKERNELSIZEHALF = 32; protected _kernelSize: GLsizei; protected _standardDeviation: GLfloat; protected _redistribute: GLboolean; protected _weights: [number, ...number[]] & { length: 32; } | undefined; protected _uDelta: WebGLUniformLocation; protected _uWeights: WebGLUniformLocation; protected _context: Context; protected _fragmentShader: Shader; protected _program: Program; protected _ndcTriangle: NdcFillingTriangle; protected _ndcTriangleShared: boolean; constructor(context: Context); /** * Recalculates the weights if necessary. * @returns - True if the weights were recalculated, false otherwise. */ protected recalculateWeights(): boolean; /** * Size of the kernel. */ get kernelSize(): GLsizei; /** * Sets the size of the kernel. * The kernel size has to be an odd integer. */ set kernelSize(kernelSize: GLsizei); /** * Standard deviation used to calculate the weights. */ get standardDeviation(): GLfloat; /** * Sets the standard deviation. */ set standardDeviation(standardDeviation: GLfloat); /** * Parameter determining whether the weights outside of the kernel get redistributed on the kernel. */ get redistribute(): GLboolean; /** * Sets the redistribute parameter. * If this is true then the sum of all weights inside the kernel is always 1. */ set redistribute(redistribute: GLboolean); /** * Creates and initializes the gaussian filters resources. * @param ndcTriangle - If specified, assumed to be used as shared geometry. If none is specified, a ndc-filling * triangle will be created internally. */ initialize(ndcTriangle?: NdcFillingTriangle): boolean; /** * Uninitializes the program and screen aligned triangle geometry, if it is not shared. */ uninitialize(): void; /** * Filters the given texture in the given direction using the configured weights. * The weights will be recalculated if necessary. * @param texture - The float texture to filter. * @param direction - The direction to filter the texture in. */ filter(texture: Texture2D, direction: GaussFilter.Direction): void; } export declare namespace GaussFilter { enum Direction { Horizontal = 0, Vertical = 1 } }